flint-gs 1.12.0 → 2.0.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +71 -207
  3. data/lib/flint.rb +8 -8
  4. data/stylesheets/_flint.scss +3 -2
  5. data/stylesheets/flint/config/_config.scss +37 -68
  6. data/stylesheets/flint/functions/_functions.scss +15 -7
  7. data/stylesheets/flint/functions/helpers/_helpers.scss +115 -117
  8. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +23 -32
  9. data/stylesheets/flint/functions/lib/_calc-width.scss +40 -26
  10. data/stylesheets/flint/functions/lib/_exists.scss +8 -7
  11. data/stylesheets/flint/functions/lib/_fluid-width.scss +8 -7
  12. data/stylesheets/flint/functions/lib/_get-index.scss +12 -10
  13. data/stylesheets/flint/functions/lib/_get-instance-value.scss +10 -16
  14. data/stylesheets/flint/functions/lib/_get-value.scss +9 -13
  15. data/stylesheets/flint/functions/lib/_has-family-instance.scss +21 -20
  16. data/stylesheets/flint/functions/lib/_instance.scss +19 -22
  17. data/stylesheets/flint/functions/lib/_last.scss +7 -6
  18. data/stylesheets/flint/functions/lib/_list-to-string.scss +11 -9
  19. data/stylesheets/flint/functions/lib/_map-fetch.scss +13 -19
  20. data/stylesheets/flint/functions/lib/_next-index.scss +9 -14
  21. data/stylesheets/flint/functions/lib/_purge.scss +9 -8
  22. data/stylesheets/flint/functions/lib/_remove.scss +11 -10
  23. data/stylesheets/flint/functions/lib/_replace-substring.scss +9 -8
  24. data/stylesheets/flint/functions/lib/_replace.scss +11 -10
  25. data/stylesheets/flint/functions/lib/_steal-key.scss +24 -13
  26. data/stylesheets/flint/functions/lib/_steal-values.scss +9 -12
  27. data/stylesheets/flint/functions/lib/_string-to-list.scss +11 -10
  28. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +10 -9
  29. data/stylesheets/flint/functions/lib/_support-syntax.scss +14 -12
  30. data/stylesheets/flint/functions/lib/_types-in-list.scss +9 -8
  31. data/stylesheets/flint/functions/lib/_use-syntax.scss +12 -8
  32. data/stylesheets/flint/globals/_globals.scss +35 -21
  33. data/stylesheets/flint/mixins/_mixins.scss +3 -2
  34. data/stylesheets/flint/mixins/lib/_box-sizing.scss +7 -7
  35. data/stylesheets/flint/mixins/lib/_calculate.scss +112 -583
  36. data/stylesheets/flint/mixins/lib/_clearfix.scss +7 -7
  37. data/stylesheets/flint/mixins/lib/_container.scss +6 -12
  38. data/stylesheets/flint/mixins/lib/_main.scss +271 -202
  39. data/stylesheets/flint/mixins/lib/_new-instance.scss +12 -15
  40. data/stylesheets/flint/mixins/lib/_print-instance.scss +16 -20
  41. metadata +3 -4
  42. data/stylesheets/flint/functions/lib/_calc-margin.scss +0 -57
@@ -1,17 +1,28 @@
1
- // Steal key based on index number
2
- //--------------------------------------------------------------------------------
3
- // @param $index [number] : index of key
4
- // -------------------------------------------------------------------------------
5
- // @return matched key | false
6
-
1
+ /**
2
+ * Steal breakpoint key by index
3
+ *
4
+ * @param {Number} $index - index of key
5
+ *
6
+ * @return {String | False}
7
+ */
7
8
  @function flint-steal-key($index) {
8
- @if flint-is-number($index) {
9
- @for $n from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
10
- @each $key in nth(map-get($flint, "config"), $index) {
11
- @return $key;
12
- }
9
+ $length: length(map-keys(flint-get-value("breakpoints")));
10
+
11
+ @if not flint-is-number($index) {
12
+ @if not $flint__development-mode {
13
+ @error "Passed $index (#{$index}) is not a number. Function takes index number of breakpoint key.";
14
+ } @else {
15
+ @return false;
16
+ }
17
+ }
18
+
19
+ @if $index > $length {
20
+ @if not $flint__development-mode {
21
+ @error "Passed $index (#{$index}) is greater than the length of the config map.";
22
+ } @else {
23
+ @return false;
13
24
  }
14
- } @else {
15
- @return false;
16
25
  }
26
+
27
+ @return if($index != 0, nth(map-keys(flint-get-value("breakpoints")), $index), false);
17
28
  }
@@ -1,14 +1,11 @@
1
- // Steal value based on index number
2
- // -------------------------------------------------------------------------------
3
- // @param $index [number] : index of breakpoint key in config
4
- // @param $value [number] : value
5
- // -------------------------------------------------------------------------------
6
- // @return [number]
7
-
1
+ /**
2
+ * Steal breakpoint value by index
3
+ *
4
+ * @param {Number} $index - index of key
5
+ * @param {String} $value - value to get from breakpoint
6
+ *
7
+ * @return {String | False}
8
+ */
8
9
  @function flint-steal-values($index, $value) {
9
- @for $n from 1 through (length(flint-map-fetch($flint, config)) - 1) {
10
- @each $key in nth(map-get($flint, config), $index) {
11
- @return flint-get-value($key, $value);
12
- }
13
- }
10
+ @return if(flint-is-number($index), flint-get-value("breakpoints", flint-steal-key($index), $value), false);
14
11
  }
@@ -1,11 +1,12 @@
1
- // Turns string into a flat list
2
- // -------------------------------------------------------------------------------
3
- // @param $string [string] : string
4
- // @param $find [string] : item to find which separates substrings (default is single space [" "])
5
- // @param $ignore [string] : removes remaining string beyond item (default is comma [","])
6
- // -------------------------------------------------------------------------------
7
- // @return [list] | error
8
-
1
+ /**
2
+ * Turns string into a flat list
3
+ *
4
+ * @param {String} $string
5
+ * @param {String} $find (" ") - item to find which separates substrings
6
+ * @param {String} $ignore (",") - removes remaining string beyond item
7
+ *
8
+ * @return {List | False}
9
+ */
9
10
  @function flint-string-to-list($string, $find: " ", $ignore: ",") {
10
11
  @if flint-is-string($string) {
11
12
 
@@ -83,8 +84,8 @@
83
84
 
84
85
  @return $string-list;
85
86
  }
86
- } @else {
87
- @return "You did not input a valid string: #{$string}";
88
87
  }
88
+ } @else {
89
+ @return false;
89
90
  }
90
91
  }
@@ -1,14 +1,15 @@
1
- // Support BEM syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $selectors [string] : string of selectors to parse
4
- // -------------------------------------------------------------------------------
5
- // @return [list] : parsed list of selectors according to syntax
6
-
1
+ /**
2
+ * Parser to support BEM syntax
3
+ *
4
+ * @param {List} $selectors - string of selectors to parse
5
+ *
6
+ * @return {List} - parsed list of selectors according to syntax
7
+ */
7
8
  @function flint-support-syntax-bem($selectors) {
8
9
  // Clean up selector, remove double underscores for spaces
9
- // add psudeo character to differentiate selectors
10
- $selectors: flint-replace-substring($selectors, "__", "/");
11
- // Parse string to list
10
+ // add pseudo character to differentiate selectors
11
+ $selectors: flint-replace-substring(inspect($selectors), "__", "/");
12
+ // Parse string back to list without pseudo character
12
13
  $selectors: flint-string-to-list($selectors, "/");
13
14
  // Define top-most parent of selector
14
15
  $parent: nth($selectors, 1);
@@ -1,10 +1,11 @@
1
- // Support syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $syntax [string] : alias of syntax to support
4
- // @param $selectors [string] : string of selectors to parse
5
- // -------------------------------------------------------------------------------
6
- // @return [list] : list of parsed selectors according to syntax
7
-
1
+ /**
2
+ * Support syntax
3
+ *
4
+ * @param {String} $syntax - alias of syntax to support
5
+ * @param {List} $selectors - string of selectors to parse
6
+ *
7
+ * @return {List} - list of parsed selectors according to syntax
8
+ */
8
9
  @function flint-support-syntax($syntax, $selectors) {
9
10
  $syntax: to-lower-case($syntax);
10
11
 
@@ -19,10 +20,11 @@
19
20
  @return call("flint-support-syntax-#{$syntax}", $selectors);
20
21
 
21
22
  } @else {
22
-
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 `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
- @return null;
26
-
23
+ @if not $flint__development-mode {
24
+ // Throw error if the syntax does not exist and a function to call cannot be found
25
+ @error "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.";
26
+ } @else {
27
+ @return false;
28
+ }
27
29
  }
28
30
  }
@@ -1,11 +1,12 @@
1
- // Checks type of each item in list
2
- // -------------------------------------------------------------------------------
3
- // @param $list [list] : list of items
4
- // @param $assert-types [string | list] : single or list of types to assert
5
- // @param $assert-length [number] : assert length of list
6
- // -------------------------------------------------------------------------------
7
- // @return [bool]
8
-
1
+ /**
2
+ * Checks type of each item in list
3
+ *
4
+ * @param {List} $list - list of items
5
+ * @param {String | List} $assert-types (null) - single or list of types to assert
6
+ * @param {Number} $assert-length (null) - assert length of list
7
+ *
8
+ * @return {Bool}
9
+ */
9
10
  @function flint-types-in-list($list, $assert-types: null, $assert-length: null) {
10
11
  @if flint-is-list($list) {
11
12
 
@@ -1,14 +1,18 @@
1
- // Use global syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $selectors [string] : string of selectors to transform
4
- // -------------------------------------------------------------------------------
5
- // @return [list] : list of transformed selectors according to syntax
6
-
1
+ /**
2
+ * Use global syntax
3
+ *
4
+ * @param {List} $selectors - string of selectors to parse
5
+ *
6
+ * @return {List} - parsed list of selectors
7
+ */
7
8
  @function flint-use-syntax($selectors) {
8
9
  @if $flint__support-syntax {
9
10
  @return flint-support-syntax($flint__support-syntax, $selectors);
10
11
  } @else {
11
- @warn "Support syntax is set to #{$flint__support-syntax}. Aborting mission.";
12
- @return false;
12
+ @if not $flint__development-mode {
13
+ @error "Support syntax is set to #{$flint__support-syntax}. Aborting mission.";
14
+ } @else {
15
+ @return false;
16
+ }
13
17
  }
14
18
  }
@@ -1,38 +1,52 @@
1
- // Set global variable to check if foundation has been applied globally
2
- // ----
3
- $flint__foundation: "nonexistant" !global;
4
-
5
- // Gather all keys, breakpoints and column counts
6
- // ----
1
+ /*
2
+ * Use development mode to silence fatal errors
3
+ */
4
+ $flint__development-mode: false !global;
5
+
6
+ /*
7
+ * Set global variable to check if foundation has been applied globally
8
+ */
9
+ $flint__foundation: "non-existent" !global;
10
+
11
+ /*
12
+ * Gather all keys, breakpoints and column counts
13
+ */
7
14
  $flint__all__keys: flint-get-all-keys() !global;
8
15
  $flint__all__breakpoints: flint-get-all-breakpoints() !global;
9
16
  $flint__all__columns: flint-get-all-columns() !global;
10
17
 
11
- // Keep track of all instances of mixin
12
- // ----
18
+ /*
19
+ * Keep track of all instances of mixin
20
+ */
13
21
  $flint__instance-count: 0 !global;
14
22
  $flint__instances: () !global;
15
23
 
16
- // Font size for em calculation
17
- // ----
24
+ /*
25
+ * Font size for em calculation
26
+ */
18
27
  $flint__base-font-size: 16px !global;
19
28
 
20
- // Global syntax support
21
- // ----
22
- $flint__support-syntax: if(flint-exists($flint, "support-syntax"), flint-get-value("settings", "support-syntax"), false) !global;
29
+ /*
30
+ * Global syntax support
31
+ */
32
+ $flint__support-syntax: flint-get-value("settings", "support-syntax") !global;
23
33
 
24
- // Use Ruby functions?
25
- // ----
34
+ /*
35
+ * Detect if Ruby functions are available
36
+ */
26
37
  $flint__use-ruby-functions: if(flint-use-ruby-functions() == true, true, false) !global;
27
38
 
28
- // Cached selector instance lists
29
- // ----
39
+ /*
40
+ * Cached selector instance lists
41
+ */
30
42
  $flint__cached-instances: () !global;
31
43
 
32
- // Cached calculated values
33
- // ----
44
+ /*
45
+ * Cached calculated values
46
+ */
34
47
  $flint__cached-values: () !global;
35
48
 
36
- // Chached calculation results
37
- // ----
49
+ /*
50
+ * hached calculation results
51
+ */
38
52
  $flint__cache-results: () !global;
@@ -1,5 +1,6 @@
1
- // Mixins
2
- // ----
1
+ /*
2
+ * Mixins
3
+ */
3
4
  @import "lib/clearfix";
4
5
  @import "lib/box-sizing";
5
6
  @import "lib/container";
@@ -1,10 +1,10 @@
1
- // Box sizing
2
- // -------------------------------------------------------------------------------
3
- // @param $type [string] : border-box type, defaults to "border-box"
4
- // -------------------------------------------------------------------------------
5
- // @uses : local box-sizing mixin if available
6
- // -------------------------------------------------------------------------------
7
-
1
+ /**
2
+ * Box sizing
3
+ *
4
+ * @param {String} $type ("border-box") - border-box type
5
+ *
6
+ * @requires local box-sizing mixin if available
7
+ */
8
8
  @mixin flint-box-sizing($type: "border-box") {
9
9
  @if mixin-exists("box-sizing") {
10
10
  @include box-sizing($type);
@@ -1,62 +1,72 @@
1
- // Outputs calculated styles
2
- // -------------------------------------------------------------------------------
3
- // @param $width [number] : width
4
- // @param $margin-right [number] : right margin
5
- // @param $margin-left [number] : left margin
6
- // -------------------------------------------------------------------------------
7
- // @output outputs styles
8
-
1
+ /**
2
+ * Outputs calculated styles
3
+ *
4
+ * @param {Number} $width
5
+ * @param {Number} $margin-right
6
+ * @param {Number} $margin-left
7
+ */
9
8
  @mixin flint-output($width, $margin-right, $margin-left) {
10
- width: $width;
11
- margin-right: $margin-right;
12
- margin-left: $margin-left;
9
+
10
+ @if not flint-is-map($width) {
11
+ @if not $flint__development-mode {
12
+ @error "Passed $width (#{$width}) was not a map; a map containing a target / context combination is required."
13
+ }
14
+ }
15
+
16
+ @if flint-get-value("settings", "grid") == "fluid" {
17
+ width: flint-fluid-width(map-get($width, "target"), map-get($width, "context"));
18
+ margin-right: flint-fluid-width($margin-right, map-get($width, "context"));
19
+ margin-left: flint-fluid-width($margin-left, map-get($width, "context"));
20
+ } @else {
21
+ width: map-get($width, "target");
22
+ margin-right: $margin-right;
23
+ margin-left: $margin-left;
24
+ }
25
+
13
26
  @content;
14
27
  }
15
28
 
16
- // Calculate widths, save all variables to instance
17
- // -------------------------------------------------------------------------------
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 [string] : gutter modifier
22
- // @param $calc-shift [number] : shift modifier
23
- // @param $i [number | null] : index if variable length is > 1
24
- // -------------------------------------------------------------------------------
25
- // @output calculated styles
26
-
27
- @mixin flint-calculate($key, $span, $context, $gutter, $shift, $i: null) {
29
+ /**
30
+ * Calculate widths, save all variables to instance
31
+ *
32
+ * @param {String} $calc-key - breakpoint key
33
+ * @param {Number} $calc-span - span value
34
+ * @param {Number} $calc-context - context value
35
+ * @param {String} $calc-gutter - gutter modifier
36
+ * @param {Number | Null} $i - index if variable length is > 1
37
+ */
38
+ @mixin flint-calculate($key, $span, $context, $gutter, $i: null) {
28
39
 
29
40
  // Define local vars
30
41
  $calc-key: $key;
31
42
  $calc-span: $span;
32
43
  $calc-context: $context;
33
44
  $calc-gutter: $gutter;
34
- $calc-shift: $shift;
35
45
 
36
46
  // Define default values
37
- $output-width: 0;
38
- $output-margin-right: 0;
39
- $output-margin-left: 0;
47
+ $output-width-map: null;
48
+ $output-margin-right: null;
49
+ $output-margin-left: null;
40
50
 
41
- // Keep track of errors
51
+ // Track errors
42
52
  $errors: false;
43
53
 
44
54
  // Default value for cache search result
45
55
  $cached: false;
46
56
 
47
- // Check lengths, if invalid throw error
48
- // ----
57
+ /*
58
+ * Check lengths, if invalid throw error
59
+ */
49
60
  @if flint-types-in-list($calc-gutter, "string") and length($calc-gutter) != length($flint__all__keys) {
50
- @warn "Invalid argument length of #{length($calc-gutter)} for gutter. If you're using a shorthand, please provide an argument for each breakpoint in your config (#{length($flint__all__keys)}). Your argument was: #{$calc-gutter}";
51
- $errors: true;
52
- } @else if flint-types-in-list($calc-shift, "number") and length($calc-shift) != length($flint__all__keys) {
53
- @warn "Invalid argument length of #{length($calc-shift)} for shift. If you're using a shorthand, please provide an argument for each breakpoint in your config (#{length($flint__all__keys)}). Your argument was: #{$calc-shift}";
54
- $errors: true;
61
+ @if not $flint__development-mode {
62
+ @error "Invalid argument length of #{length($calc-gutter)} for gutter. If you're using a shorthand, please provide an argument for each breakpoint in your config (#{length($flint__all__keys)}). Your argument was: #{$calc-gutter}";
63
+ }
55
64
  }
56
65
 
57
- // Check if any arguments are lists if called from loop
58
- // ----
59
- @if $i and not $errors {
66
+ /*
67
+ * Check if any arguments are lists if called from loop
68
+ */
69
+ @if $i {
60
70
 
61
71
  @if flint-types-in-list($calc-key, "number") {
62
72
  $calc-key: nth($calc-key, $i);
@@ -70,30 +80,30 @@
70
80
  @if flint-types-in-list($calc-gutter, "string") {
71
81
  $calc-gutter: nth($calc-gutter, $i);
72
82
  }
73
- @if flint-types-in-list($calc-shift, "number") {
74
- $calc-shift: nth($calc-shift, $i);
75
- }
76
83
 
77
84
  }
78
85
 
79
- // Check for cached results
80
- // ----
81
- @if $calc-context != "auto" and $calc-span != 0 and not $errors {
82
- @if map-has-key($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}") {
86
+ /*
87
+ * Check for cached results
88
+ */
89
+ @if $calc-context != "auto" and $calc-span != 0 {
90
+ @if map-has-key($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}") {
91
+ $result: map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}");
83
92
 
84
93
  // Get results
85
- $output-width: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 1);
86
- $output-margin-right: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 2);
87
- $output-margin-left: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 3);
94
+ $output-width-map: nth($result, 1);
95
+ $output-margin-right: nth($result, 2);
96
+ $output-margin-left: nth($result, 3);
88
97
 
89
98
  // Declare successful search
90
99
  $cached: true;
91
100
  }
92
101
  }
93
102
 
94
- // Hide if span is zero
95
- // ----
96
- @if $calc-span == 0 and not $errors {
103
+ /*
104
+ * Hide if span is zero
105
+ */
106
+ @if $calc-span == 0 {
97
107
 
98
108
  // First check if it's the default, so we don't hide the element on all breakpoints
99
109
  @if $calc-key == flint-get-value("settings", "default") {
@@ -102,25 +112,29 @@
102
112
  }
103
113
  // If we're hiding the default, but span is a list, define floats for other queries
104
114
  @if flint-is-list($span) {
105
- float: unquote(flint-get-value("settings", "float-style"));
115
+ float: unquote(flint-get-value("settings", "float-direction"));
106
116
  }
107
117
  } @else {
108
118
  display: none;
109
119
  }
110
120
 
111
- @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $output-width, $output-margin-right, $output-margin-left);
112
- @include flint-debug-instance($calc-key);
121
+ @if flint-get-value("settings", "instance-maps") {
122
+ @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $output-width, $output-margin-right, $output-margin-left);
123
+ @include flint-debug-instance($calc-key);
124
+ }
113
125
 
114
126
  } @else {
115
127
 
116
- // Define floats if key is default, or this is a single instance call
117
- // ----
128
+ /*
129
+ * Define floats if key is default, or this is a single instance call
130
+ */
118
131
  @if flint-is-default($calc-key) and $gutter != "center" or $i == null and $gutter != "center" {
119
- float: unquote(flint-get-value("settings", "float-style"));
132
+ float: unquote(flint-get-value("settings", "float-direction"));
120
133
  }
121
134
 
122
- // Disable floats if gutter is set to center
123
- // ----
135
+ /*
136
+ * Disable floats if gutter is set to center
137
+ */
124
138
  $recursive-center: false;
125
139
 
126
140
  @if $gutter == "center" {
@@ -140,565 +154,80 @@
140
154
  float: none;
141
155
  }
142
156
 
143
- // Only run through if cache search was unsuccessful
144
- // ----
145
- @if not $cached and not $errors {
146
-
147
- // Shift, no context
148
- // ----
149
- @if $calc-shift != null and $calc-context == null {
150
-
151
- @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
152
-
153
- // Save to variables for instance creation
154
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
155
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
156
- $output-margin-left: ( if( $calc-shift > 0,
157
- (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
158
- (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
159
- ));
160
-
161
- } @else if $calc-gutter == "inside" {
162
-
163
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*4);
164
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
165
- $output-margin-left: ( if( $calc-shift > 0,
166
- (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
167
- (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
168
- ));
169
-
170
- } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
171
-
172
- $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
173
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
174
- $output-margin-left: ( if( $calc-shift > 0,
175
- flint-calc-width($calc-key, $calc-shift),
176
- flint-calc-width($calc-key, $calc-shift)
177
- ));
178
-
179
- } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" {
180
-
181
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span)));
182
- $output-margin-right: 0;
183
- $output-margin-left: ( if( $calc-shift > 0,
184
- (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
185
- (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
186
- ));
187
-
188
- } @else if $calc-gutter == "center" {
189
-
190
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
191
- $output-margin-right: auto;
192
- $output-margin-left: auto;
193
-
194
- } @else if $calc-gutter == "row" or $calc-gutter == "none" {
195
-
196
- $output-width: (flint-calc-width($calc-key, $calc-span));
197
- $output-margin-right: 0;
198
- $output-margin-left: ( if( $calc-shift > 0,
199
- flint-calc-width($calc-key, $calc-shift),
200
- flint-calc-width($calc-key, $calc-shift)
201
- ));
202
-
203
- } @else {
204
- @warn "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
205
- $errors: true;
206
- }
207
-
208
- // Shift, context
209
- // ----
210
- } @else if $calc-context != null {
211
-
212
- // Check if parent instance flint-exists
213
- $flint-exists: flint-has-family-instance($calc-key);
214
-
215
- @if $calc-shift != null {
216
-
217
- @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
218
-
219
- // Check if context is set to auto
220
- @if $calc-context == "auto" {
221
-
222
- // Does parent exist?
223
- @if $flint-exists != false {
224
- @if flint-get-value("settings", "grid") == "fluid" {
225
-
226
- // Get parent span value
227
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
228
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
229
- $output-margin-left: ( if( $calc-shift > 0,
230
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
231
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
232
- ));
233
-
234
- } @else if flint-get-value("settings", "grid") == "fixed" {
235
-
236
- // Get parent width instead of parent span for fixed grids
237
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
238
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
239
- $output-margin-left: ( if( $calc-shift > 0,
240
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
241
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
242
- ));
243
-
244
- }
245
- } @else {
246
- // Else warn that context should not be set to `auto`
247
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
248
- // Throw error
249
- $errors: true;
250
- }
251
-
252
- // Output styles normally if not set to auto
253
- } @else {
254
-
255
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
256
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
257
- $output-margin-left: ( if( $calc-shift > 0,
258
- (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
259
- (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
260
- ));
261
-
262
- }
263
-
264
- } @else if $calc-gutter == "inside" {
265
-
266
- @if $calc-context == "auto" {
267
- @if $flint-exists != false {
268
- @if flint-get-value("settings", "grid") == "fluid" {
269
-
270
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*4);
271
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
272
- $output-margin-left: ( if( $calc-shift > 0,
273
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
274
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
275
- ));
276
-
277
- } @else if flint-get-value("settings", "grid") == "fixed" {
278
-
279
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*4);
280
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
281
- $output-margin-left: ( if( $calc-shift > 0,
282
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
283
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
284
- ));
285
-
286
- }
287
- } @else {
288
- // Else warn that context should not be set to `auto`
289
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
290
- $errors: true;
291
- }
292
- // Output styles normally if not set to auto
293
- } @else {
294
-
295
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
296
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
297
- $output-margin-left: ( if( $calc-shift > 0,
298
- (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
299
- (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
300
- ));
301
-
302
- }
303
-
304
- } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
305
-
306
- @if $calc-context == "auto" {
307
- @if $flint-exists != false {
308
- @if flint-get-value("settings", "grid") == "fluid" {
309
-
310
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")));
311
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
312
- $output-margin-left: ( if( $calc-shift > 0,
313
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")),
314
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))
315
- ));
316
-
317
- } @else if flint-get-value("settings", "grid") == "fixed" {
318
-
319
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))));
320
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
321
- $output-margin-left: ( if( $calc-shift > 0,
322
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")),
323
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))
324
- ));
325
-
326
- }
327
- } @else {
328
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
329
- $errors: true;
330
- }
331
- } @else {
332
-
333
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
334
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
335
- $output-margin-left: ( if( $calc-shift > 0,
336
- flint-calc-width($calc-key, $calc-shift, $calc-context),
337
- flint-calc-width($calc-key, $calc-shift, $calc-context)
338
- ));
339
-
340
- }
341
-
342
- } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" {
343
-
344
- @if $calc-context == "auto" {
345
- @if $flint-exists != false {
346
- @if flint-get-value("settings", "grid") == "fluid" {
347
-
348
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))));
349
- $output-margin-right: 0;
350
- $output-margin-left: ( if( $calc-shift > 0,
351
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
352
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
353
- ));
354
-
355
- } @else if flint-get-value("settings", "grid") == "fixed" {
356
-
357
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))));
358
- $output-margin-right: 0;
359
- $output-margin-left: ( if( $calc-shift > 0,
360
- (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))),
361
- (flint-calc-margin($calc-key, -$calc-span, flint-get-instance-value($calc-key, "span"))) + (flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")))
362
- ));
363
-
364
- }
365
- } @else {
366
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
367
- $errors: true;
368
- }
369
- } @else {
370
-
371
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context)));
372
- $output-margin-right: 0;
373
- $output-margin-left: ( if( $calc-shift > 0,
374
- (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
375
- (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
376
- ));
377
-
378
- }
379
-
380
- } @else if $calc-gutter == "center" {
381
-
382
- @if $calc-context == "auto" {
383
-
384
- @if $flint-exists != false {
385
- @if flint-get-value("settings", "grid") == "fluid" {
386
-
387
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
388
- $output-margin-right: auto;
389
- $output-margin-left: auto;
390
-
391
- } @else if flint-get-value("settings", "grid") == "fixed" {
392
-
393
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
394
- $output-margin-right: auto;
395
- $output-margin-left: auto;
396
-
397
- }
398
- } @else {
399
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
400
- $errors: true;
401
- }
402
- } @else {
403
-
404
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
405
- $output-margin-right: auto;
406
- $output-margin-left: auto;
407
-
408
- }
409
- } @else if $calc-gutter == "row" or $calc-gutter == "none" {
410
-
411
- @if $calc-context == "auto" {
412
- @if $flint-exists != false {
413
- @if flint-get-value("settings", "grid") == "fluid" {
414
-
415
- $output-width: (flint-calc-width($calc-key, $calc-span, lint-get-instance-value($calc-key, "span")));
416
- $output-margin-right: 0;
417
- $output-margin-left: ( if( $calc-shift > 0,
418
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")),
419
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))
420
- ));
421
-
422
- } @else if flint-get-value("settings", "grid") == "fixed" {
423
-
424
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span);
425
- $output-margin-right: 0;
426
- $output-margin-left: ( if( $calc-shift > 0,
427
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span")),
428
- flint-calc-width($calc-key, $calc-shift, flint-get-instance-value($calc-key, "span"))
429
- ));
430
-
431
- }
432
- } @else {
433
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
434
- $errors: true;
435
- }
436
- } @else {
437
-
438
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context));
439
- $output-margin-right: 0;
440
- $output-margin-left: ( if( $calc-shift > 0,
441
- flint-calc-width($calc-key, $calc-shift, $calc-context),
442
- flint-calc-width($calc-key, $calc-shift, $calc-context)
443
- ));
444
- }
445
- } @else {
446
- @warn "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
447
- $errors: true;
448
- }
449
-
450
- // Context, no shift
451
- // ----
452
- } @else {
453
-
454
- @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
455
- @if $calc-context == "auto" {
456
- @if $flint-exists != false {
457
- @if flint-get-value("settings", "grid") == "fluid" {
458
-
459
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
460
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
461
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
462
-
463
- } @else if flint-get-value("settings", "grid") == "fixed" {
464
-
465
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
466
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
467
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
468
-
469
- }
470
- } @else {
471
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
472
- $errors: true;
473
- }
474
- } @else {
475
-
476
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
477
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
478
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
479
-
480
- }
481
-
482
- } @else if $calc-gutter == "inside" {
483
-
484
- @if $calc-context == "auto" {
485
- @if $flint-exists != false {
486
- @if flint-get-value("settings", "grid") == "fluid" {
487
-
488
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*4);
489
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
490
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
157
+ /*
158
+ * Only run through if cache search was unsuccessful
159
+ */
160
+ @if not $cached {
491
161
 
492
- } @else if flint-get-value("settings", "grid") == "fixed" {
162
+ $output-gutter: flint-get-gutter();
493
163
 
494
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*4);
495
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
496
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
164
+ @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
497
165
 
498
- }
166
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
167
+ $output-margin-right: $output-gutter;
168
+ $output-margin-left: $output-gutter;
499
169
 
500
- } @else {
501
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
502
- $errors: true;
503
- }
504
- } @else {
170
+ } @else if $calc-gutter == "inside" {
505
171
 
506
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
507
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
508
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
172
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 4));
173
+ $output-margin-right: $output-gutter;
174
+ $output-margin-left: $output-gutter;
509
175
 
510
- }
176
+ } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
511
177
 
512
- } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
178
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
179
+ $output-margin-right: $output-gutter;
180
+ $output-margin-left: 0;
513
181
 
514
- @if $calc-context == "auto" {
515
- @if $flint-exists != false {
516
- @if flint-get-value("settings", "grid") == "fluid" {
182
+ } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" {
517
183
 
518
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")));
519
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
520
- $output-margin-left: 0;
184
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
185
+ $output-margin-right: 0;
186
+ $output-margin-left: $output-gutter;
521
187
 
522
- } @else if flint-get-value("settings", "grid") == "fixed" {
188
+ } @else if $calc-gutter == "center" {
523
189
 
524
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))));
525
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
526
- $output-margin-left: 0;
190
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
191
+ $output-margin-right: auto;
192
+ $output-margin-left: auto;
527
193
 
528
- }
529
- } @else {
530
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
531
- $errors: true;
532
- }
533
- } @else {
194
+ } @else if $calc-gutter == "row" or $calc-gutter == "none" {
534
195
 
535
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
536
- $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
537
- $output-margin-left: 0;
196
+ $output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null));
197
+ $output-margin-right: 0;
198
+ $output-margin-left: 0;
538
199
 
539
- }
540
-
541
- } @else if $calc-gutter == "omega" or $calc-gutter =="no-right" or $calc-gutter == "flint-last" {
542
-
543
- @if $calc-context == "auto" {
544
- @if $flint-exists != false {
545
- @if flint-get-value("settings", "grid") == "fluid" {
546
-
547
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - (flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")));
548
- $output-margin-right: 0;
549
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
550
-
551
- } @else if flint-get-value("settings", "grid") == "fixed" {
552
-
553
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))));
554
- $output-margin-right: 0;
555
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
556
-
557
- }
558
- } @else {
559
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
560
- $errors: true;
561
- }
562
- } @else {
563
-
564
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
565
- $output-margin-right: 0;
566
- $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
567
-
568
- }
569
-
570
- } @else if $calc-gutter == "center" {
571
-
572
- @if $calc-context == "auto" {
573
- @if $flint-exists != false {
574
- @if flint-get-value("settings", "grid") == "fluid" {
575
-
576
- $output-width: (flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"))) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
577
- $output-margin-right: auto;
578
- $output-margin-left: auto;
579
-
580
- } @else if flint-get-value("settings", "grid") == "fixed" {
581
-
582
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-get-instance-value($calc-key, "span")))*2);
583
- $output-margin-right: auto;
584
- $output-margin-left: auto;
585
-
586
- }
587
- } @else {
588
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
589
- $errors: true;
590
- }
591
- } @else {
592
-
593
- $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
594
- $output-margin-right: auto;
595
- $output-margin-left: auto;
596
-
597
- }
598
-
599
- } @else if $calc-gutter == "row" or $calc-gutter == "none" {
600
-
601
- @if $calc-context == "auto" {
602
- @if $flint-exists != false {
603
- @if flint-get-value("settings", "grid") == "fluid" {
604
-
605
- $output-width: flint-calc-width($calc-key, $calc-span, flint-get-instance-value($calc-key, "span"));
606
- $output-margin-right: 0;
607
- $output-margin-left: 0;
608
-
609
- } @else if flint-get-value("settings", "grid") == "fixed" {
610
-
611
- $output-width: (flint-get-instance-value($calc-key, "output", "width") / flint-get-instance-value($calc-key, "span") * $calc-span);
612
- $output-margin-right: 0;
613
- $output-margin-left: 0;
614
-
615
- }
616
- } @else {
617
- @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string() + '::' + $calc-key}`";
618
- $errors: true;
619
- }
620
- } @else {
621
-
622
- $output-width: flint-calc-width($calc-key, $calc-span, $calc-context);
623
- $output-margin-right: 0;
624
- $output-margin-left: 0;
625
-
626
- }
627
- } @else {
628
- @warn "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
629
- $errors: true;
630
- }
631
- }
632
-
633
- // No context
634
- // ----
635
200
  } @else {
636
-
637
- @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
638
-
639
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
640
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
641
- $output-margin-left: flint-calc-margin($calc-key, $calc-span);
642
-
643
- } @else if $calc-gutter == "inside" {
644
-
645
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*4);
646
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
647
- $output-margin-left: flint-calc-margin($calc-key, $calc-span);
648
-
649
- } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
650
-
651
- $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
652
- $output-margin-right: flint-calc-margin($calc-key, $calc-span);
653
- $output-margin-left: 0;
654
-
655
- } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" {
656
-
657
- $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
658
- $output-margin-right: 0;
659
- $output-margin-left: flint-calc-margin($calc-key, $calc-span);
660
-
661
- } @else if $calc-gutter == "center" {
662
-
663
- $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
664
- $output-margin-right: auto;
665
- $output-margin-left: auto;
666
-
667
- } @else if $calc-gutter == "row" or $calc-gutter == "none" {
668
-
669
- $output-width: flint-calc-width($calc-key, $calc-span);
670
- $output-margin-right: 0;
671
- $output-margin-left: 0;
672
-
201
+ @if not $flint__development-mode {
202
+ @error "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
673
203
  } @else {
674
- @warn "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
675
204
  $errors: true;
676
205
  }
677
206
  }
678
207
  }
679
208
 
680
- // Make sure there are no errors
681
- // ----
682
209
  @if not $errors {
683
210
 
684
211
  // Cache result
685
212
  @if $calc-context != "auto" and $calc-span != 0 and not $cached {
686
213
  $flint__cache-results: map-merge($flint__cache-results, (
687
- "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}": ($output-width, $output-margin-right, $output-margin-left)
214
+ "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}": ($output-width-map, $output-margin-right, $output-margin-left)
688
215
  )) !global;
689
216
  }
690
217
 
691
218
  // Output styles
692
- @include flint-output($output-width, $output-margin-right, $output-margin-left) {
219
+ @include flint-output($output-width-map, $output-margin-right, $output-margin-left) {
693
220
  @content;
694
221
  }
695
222
 
696
- // Create new instance
697
- @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $output-width, $output-margin-right, $output-margin-left);
223
+ @if flint-get-value("settings", "instance-maps") {
698
224
 
699
- // If debug mode, print instance
700
- @include flint-debug-instance($calc-key);
225
+ // Create new instance
226
+ @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, map-get($output-width-map, "target"), $output-margin-right, $output-margin-left);
701
227
 
228
+ // If debug mode, print instance
229
+ @include flint-debug-instance($calc-key);
230
+ }
702
231
  }
703
232
  }
704
233
  }