flint-gs 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +99 -98
  4. data/lib/flint-gs.rb +8 -0
  5. data/lib/flint.rb +22 -16
  6. data/lib/flint/functions.rb +99 -99
  7. data/lib/flint/version.rb +3 -3
  8. data/stylesheets/_flint.scss +7 -7
  9. data/stylesheets/flint/config/_config.scss +56 -56
  10. data/stylesheets/flint/functions/_functions.scss +48 -48
  11. data/stylesheets/flint/functions/helpers/_helpers.scss +229 -229
  12. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +47 -47
  13. data/stylesheets/flint/functions/lib/_calc-width.scss +70 -70
  14. data/stylesheets/flint/functions/lib/_fluid-width.scss +15 -15
  15. data/stylesheets/flint/functions/lib/_get-index.scss +21 -21
  16. data/stylesheets/flint/functions/lib/_get-instance-value.scss +15 -15
  17. data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
  18. data/stylesheets/flint/functions/lib/_has-family-instance.scss +84 -84
  19. data/stylesheets/flint/functions/lib/_html-encode.scss +14 -14
  20. data/stylesheets/flint/functions/lib/_instance.scss +48 -48
  21. data/stylesheets/flint/functions/lib/_last.scss +14 -14
  22. data/stylesheets/flint/functions/lib/_list-to-str.scss +38 -38
  23. data/stylesheets/flint/functions/lib/_map-fetch.scss +31 -31
  24. data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
  25. data/stylesheets/flint/functions/lib/_purge.scss +24 -24
  26. data/stylesheets/flint/functions/lib/_remove.scss +18 -18
  27. data/stylesheets/flint/functions/lib/_replace.scss +30 -30
  28. data/stylesheets/flint/functions/lib/_steal-key.scss +32 -32
  29. data/stylesheets/flint/functions/lib/_steal-values.scss +15 -15
  30. data/stylesheets/flint/functions/lib/_str-replace.scss +39 -39
  31. data/stylesheets/flint/functions/lib/_str-to-list.scss +89 -89
  32. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +37 -37
  33. data/stylesheets/flint/functions/lib/_support-syntax.scss +31 -31
  34. data/stylesheets/flint/functions/lib/_types-in-list.scss +76 -76
  35. data/stylesheets/flint/functions/lib/_use-syntax.scss +22 -22
  36. data/stylesheets/flint/globals/_globals.scss +122 -122
  37. data/stylesheets/flint/mixins/_mixins.scss +11 -11
  38. data/stylesheets/flint/mixins/lib/_box-sizing.scss +18 -18
  39. data/stylesheets/flint/mixins/lib/_calculate.scss +241 -241
  40. data/stylesheets/flint/mixins/lib/_clearfix.scss +29 -29
  41. data/stylesheets/flint/mixins/lib/_container.scss +45 -45
  42. data/stylesheets/flint/mixins/lib/_grid-overlay.scss +73 -73
  43. data/stylesheets/flint/mixins/lib/_main.scss +1057 -1057
  44. data/stylesheets/flint/mixins/lib/_new-instance.scss +28 -28
  45. data/stylesheets/flint/mixins/lib/_print-instance.scss +44 -44
  46. data/tests/config.rb +22 -34
  47. data/tests/input/functions/_functions.scss +47 -47
  48. data/tests/input/functions/helpers/_helpers.scss +437 -437
  49. data/tests/input/functions/lib/_calc-breakpoint.scss +62 -62
  50. data/tests/input/functions/lib/_calc-width.scss +195 -195
  51. data/tests/input/functions/lib/_fluid-width.scss +32 -32
  52. data/tests/input/functions/lib/_get-index.scss +31 -31
  53. data/tests/input/functions/lib/_get-instance-value.scss +72 -72
  54. data/tests/input/functions/lib/_get-value.scss +28 -28
  55. data/tests/input/functions/lib/_has-family-instance.scss +35 -35
  56. data/tests/input/functions/lib/_instance.scss +187 -187
  57. data/tests/input/functions/lib/_last.scss +18 -18
  58. data/tests/input/functions/lib/_list-to-str.scss +28 -28
  59. data/tests/input/functions/lib/_map-fetch.scss +34 -34
  60. data/tests/input/functions/lib/_next-index.scss +24 -24
  61. data/tests/input/functions/lib/_purge.scss +14 -14
  62. data/tests/input/functions/lib/_remove.scss +14 -14
  63. data/tests/input/functions/lib/_replace.scss +14 -14
  64. data/tests/input/functions/lib/_steal-key.scss +19 -19
  65. data/tests/input/functions/lib/_steal-values.scss +16 -16
  66. data/tests/input/functions/lib/_str-replace.scss +14 -14
  67. data/tests/input/functions/lib/_str-to-list.scss +28 -28
  68. data/tests/input/functions/lib/_support-syntax-bem.scss +14 -14
  69. data/tests/input/functions/lib/_support-syntax.scss +21 -21
  70. data/tests/input/functions/lib/_types-in-list.scss +50 -50
  71. data/tests/input/functions/lib/_use-syntax.scss +14 -14
  72. data/tests/input/output.scss +250 -250
  73. data/tests/output/output.css +3499 -3499
  74. data/tests/tests.html +110 -110
  75. metadata +12 -212
  76. data/tests/bootcamp/CHANGELOG.md +0 -70
  77. data/tests/bootcamp/CONTRIBUTING.md +0 -72
  78. data/tests/bootcamp/Gruntfile.coffee +0 -34
  79. data/tests/bootcamp/LICENSE.md +0 -7
  80. data/tests/bootcamp/README.md +0 -52
  81. data/tests/bootcamp/bower.json +0 -15
  82. data/tests/bootcamp/dist/_bootcamp.scss +0 -46
  83. data/tests/bootcamp/dist/bootcamp.coffee +0 -101
  84. data/tests/bootcamp/dist/core/functions/_actual.scss +0 -3
  85. data/tests/bootcamp/dist/core/functions/_error.scss +0 -29
  86. data/tests/bootcamp/dist/core/functions/_expect.scss +0 -6
  87. data/tests/bootcamp/dist/core/functions/_not-to.scss +0 -5
  88. data/tests/bootcamp/dist/core/functions/_should.scss +0 -6
  89. data/tests/bootcamp/dist/core/functions/_to.scss +0 -5
  90. data/tests/bootcamp/dist/core/mixins/_describe.scss +0 -31
  91. data/tests/bootcamp/dist/core/mixins/_it.scss +0 -31
  92. data/tests/bootcamp/dist/core/mixins/_runner.scss +0 -28
  93. data/tests/bootcamp/dist/core/mixins/_should.scss +0 -46
  94. data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +0 -9
  95. data/tests/bootcamp/dist/core/mixins/_xit.scss +0 -9
  96. data/tests/bootcamp/dist/core/variables/_helpers.scss +0 -5
  97. data/tests/bootcamp/dist/core/variables/_settings.scss +0 -2
  98. data/tests/bootcamp/dist/core/variables/_should.scss +0 -6
  99. data/tests/bootcamp/dist/core/variables/_trackers.scss +0 -6
  100. data/tests/bootcamp/dist/lib/_sassyjson.scss +0 -1075
  101. data/tests/bootcamp/dist/matchers/_be.scss +0 -3
  102. data/tests/bootcamp/dist/matchers/_equal.scss +0 -3
  103. data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +0 -3
  104. data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +0 -3
  105. data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +0 -3
  106. data/tests/bootcamp/dist/matchers/lists/_contain.scss +0 -3
  107. data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +0 -3
  108. data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +0 -47
  109. data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +0 -3
  110. data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +0 -12
  111. data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +0 -12
  112. data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +0 -12
  113. data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +0 -3
  114. data/tests/bootcamp/dist/matchers/types/_be-null.scss +0 -3
  115. data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +0 -3
  116. data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +0 -3
  117. data/tests/bootcamp/dist/utils/_contain.scss +0 -15
  118. data/tests/bootcamp/dist/utils/_equal.scss +0 -23
  119. data/tests/bootcamp/dist/utils/_list-join.scss +0 -35
  120. data/tests/bootcamp/dist/utils/_power.scss +0 -15
  121. data/tests/bootcamp/package.json +0 -63
  122. data/tests/bootcamp/tasks/bootcamp.coffee +0 -83
  123. data/tests/bootcamp/test/core/functions/_actual.scss +0 -10
  124. data/tests/bootcamp/test/core/functions/_expect.scss +0 -6
  125. data/tests/bootcamp/test/core/functions/_not-to.scss +0 -5
  126. data/tests/bootcamp/test/core/functions/_should.scss +0 -10
  127. data/tests/bootcamp/test/core/functions/_to.scss +0 -5
  128. data/tests/bootcamp/test/core/mixins/_describe.scss +0 -11
  129. data/tests/bootcamp/test/core/mixins/_it.scss +0 -5
  130. data/tests/bootcamp/test/core/mixins/_should.scss +0 -5
  131. data/tests/bootcamp/test/core/mixins/_xdescribe.scss +0 -28
  132. data/tests/bootcamp/test/core/mixins/_xit.scss +0 -12
  133. data/tests/bootcamp/test/matchers/_be.scss +0 -90
  134. data/tests/bootcamp/test/matchers/_equal.scss +0 -33
  135. data/tests/bootcamp/test/matchers/lists/_be-empty.scss +0 -12
  136. data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +0 -29
  137. data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +0 -29
  138. data/tests/bootcamp/test/matchers/lists/_contain.scss +0 -39
  139. data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +0 -51
  140. data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +0 -151
  141. data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +0 -31
  142. data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +0 -24
  143. data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +0 -16
  144. data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +0 -16
  145. data/tests/bootcamp/test/matchers/types/_be-falsy.scss +0 -14
  146. data/tests/bootcamp/test/matchers/types/_be-null.scss +0 -13
  147. data/tests/bootcamp/test/matchers/types/_be-truthy.scss +0 -13
  148. data/tests/bootcamp/test/matchers/types/_have-type-of.scss +0 -17
  149. data/tests/bootcamp/test/specs.scss +0 -45
  150. data/tests/bootcamp/test/utils/_contain.scss +0 -41
  151. data/tests/bootcamp/test/utils/_equal.scss +0 -79
  152. data/tests/bootcamp/test/utils/_list-join.scss +0 -39
  153. data/tests/bootcamp/test/utils/_power.scss +0 -13
  154. data/tests/sass-prof.log +0 -0
@@ -1,29 +1,29 @@
1
- ///
2
- /// Micro flint-clearfix
3
- ///
4
- /// @access private
5
- ///
6
- /// @link http://nicolasgallagher.com/micro-clearfix-hack/
7
- ///
8
- /// @requires {Mixin} clearfix - local mixin if available
9
- ///
10
- /// @group Internal Mixins
11
- ///
12
- @mixin flint-clearfix {
13
- @if mixin-exists("clearfix") {
14
- @include clearfix;
15
- } @else {
16
- zoom: 1;
17
-
18
- &:before, &:after {
19
- content: "\0020";
20
- display: block;
21
- height: 0;
22
- overflow: hidden;
23
- }
24
-
25
- &:after {
26
- clear: both;
27
- }
28
- }
29
- }
1
+ ///
2
+ /// Micro flint-clearfix
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @link http://nicolasgallagher.com/micro-clearfix-hack/
7
+ ///
8
+ /// @requires {Mixin} clearfix - local mixin if available
9
+ ///
10
+ /// @group Internal Mixins
11
+ ///
12
+ @mixin flint-clearfix {
13
+ @if mixin-exists("clearfix") {
14
+ @include clearfix;
15
+ } @else {
16
+ zoom: 1;
17
+
18
+ &:before, &:after {
19
+ content: "\0020";
20
+ display: block;
21
+ height: 0;
22
+ overflow: hidden;
23
+ }
24
+
25
+ &:after {
26
+ clear: both;
27
+ }
28
+ }
29
+ }
@@ -1,45 +1,45 @@
1
- ///
2
- /// Container
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {String} $key [null] - alias of individual breakpoint
7
- /// @param {Number} $i [null] - index number if called from loop
8
- ///
9
- /// @group Internal Mixins
10
- ///
11
- @mixin flint-container($key: null, $i: null) {
12
-
13
- // Check if inside of loop, and if so only output for default
14
- @if $i == null or flint-is-default(flint-steal-key($i)) {
15
- float: none;
16
-
17
- @if $key {
18
- width: flint-calc-width($key, "container");
19
- }
20
-
21
- @if flint-get-value("settings", "max-width") {
22
- @if flint-is-number(flint-get-value("settings", "max-width")) {
23
- max-width: flint-get-value("settings", "max-width");
24
- } @else {
25
- max-width: max(flint-get-all-breakpoints()...);
26
- }
27
- }
28
-
29
- @if flint-get-value("settings", "center-container") {
30
- margin-right: auto;
31
- margin-left: auto;
32
- } @else {
33
- margin-right: 0;
34
- margin-left: 0;
35
- }
36
-
37
- // Inside of loop, so only output width
38
- } @else {
39
- @if $key {
40
- width: flint-calc-width($key, "container");
41
- }
42
- }
43
-
44
- @content;
45
- }
1
+ ///
2
+ /// Container
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {String} $key [null] - alias of individual breakpoint
7
+ /// @param {Number} $i [null] - index number if called from loop
8
+ ///
9
+ /// @group Internal Mixins
10
+ ///
11
+ @mixin flint-container($key: null, $i: null) {
12
+
13
+ // Check if inside of loop, and if so only output for default
14
+ @if $i == null or flint-is-default(flint-steal-key($i)) {
15
+ float: none;
16
+
17
+ @if $key {
18
+ width: flint-calc-width($key, "container");
19
+ }
20
+
21
+ @if flint-get-value("settings", "max-width") {
22
+ @if flint-is-number(flint-get-value("settings", "max-width")) {
23
+ max-width: flint-get-value("settings", "max-width");
24
+ } @else {
25
+ max-width: max(flint-get-all-breakpoints()...);
26
+ }
27
+ }
28
+
29
+ @if flint-get-value("settings", "center-container") {
30
+ margin-right: auto;
31
+ margin-left: auto;
32
+ } @else {
33
+ margin-right: 0;
34
+ margin-left: 0;
35
+ }
36
+
37
+ // Inside of loop, so only output width
38
+ } @else {
39
+ @if $key {
40
+ width: flint-calc-width($key, "container");
41
+ }
42
+ }
43
+
44
+ @content;
45
+ }
@@ -1,73 +1,73 @@
1
- ///
2
- /// Create encoded SVG grid overlay
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {String} $key - breakpoint alias
7
- /// @param {Number} $breakpoint - breakpoint value
8
- /// @param {Number} $columns - breakpoint column count
9
- /// @param {Number} $gutter - gutter value
10
- ///
11
- /// @group Internal Mixins
12
- ///
13
- @mixin flint-svg-grid($key, $breakpoint, $columns, $gutter) {
14
- $svg: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>";
15
- $svg: $svg + "<defs>";
16
- $svg: $svg + "<linearGradient id='gr' x1='0%' y1='0%' x2='100%' y2='0%'>";
17
- $svg: $svg + "<stop offset='0%' style='stop-color: #{$flint-overlay-color};' />";
18
- $svg: $svg + "<stop offset='100%' style='stop-color: #{lighten($flint-overlay-color, 10%)};' />";
19
- $svg: $svg + "</linearGradient>";
20
- $svg: $svg + "</defs>";
21
-
22
- @for $i from 1 through $columns {
23
- $x: flint-fluid-width(((($breakpoint / $columns) * ($i - 1)) + $gutter), $breakpoint);
24
- $span: flint-fluid-width(((($breakpoint) / $columns)) - ($gutter * 2), $breakpoint);
25
- $svg: $svg + "<rect x='#{$x}' fill='url(#gr)' width='#{$span}' height='100%'/>";
26
- }
27
-
28
- $svg: $svg + "</svg>";
29
-
30
- @include _($key) {
31
- max-width: $breakpoint;
32
- background: {
33
- image: url("data:image/svg+xml," + flint-html-encode($svg));
34
- size: 100% 100%;
35
- position: 0 0;
36
- }
37
- }
38
- }
39
-
40
- ///
41
- /// Apply SVG grid overlay
42
- ///
43
- /// @access private
44
- ///
45
- /// @group Internal Mixins
46
- ///
47
- @mixin flint-overlay-grid {
48
- @at-root html {
49
- position: relative;
50
-
51
- &:after {
52
- transform: translateX(-50%);
53
- content: " ";
54
- position: absolute;
55
- display: block;
56
- top: 0;
57
- left: 50%;
58
- bottom: 0;
59
- right: 0;
60
- width: 100%;
61
- height: 100%;
62
- opacity: 0.25;
63
- z-index: 9999;
64
- pointer: {
65
- events: none;
66
- }
67
-
68
- @each $key, $settings in flint-get-value("breakpoints") {
69
- @include flint-svg-grid($key, map-get($settings, "breakpoint"), map-get($settings, "columns"), flint-get-gutter());
70
- }
71
- }
72
- }
73
- }
1
+ ///
2
+ /// Create encoded SVG grid overlay
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {String} $key - breakpoint alias
7
+ /// @param {Number} $breakpoint - breakpoint value
8
+ /// @param {Number} $columns - breakpoint column count
9
+ /// @param {Number} $gutter - gutter value
10
+ ///
11
+ /// @group Internal Mixins
12
+ ///
13
+ @mixin flint-svg-grid($key, $breakpoint, $columns, $gutter) {
14
+ $svg: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>";
15
+ $svg: $svg + "<defs>";
16
+ $svg: $svg + "<linearGradient id='gr' x1='0%' y1='0%' x2='100%' y2='0%'>";
17
+ $svg: $svg + "<stop offset='0%' style='stop-color: #{$flint-overlay-color};' />";
18
+ $svg: $svg + "<stop offset='100%' style='stop-color: #{lighten($flint-overlay-color, 10%)};' />";
19
+ $svg: $svg + "</linearGradient>";
20
+ $svg: $svg + "</defs>";
21
+
22
+ @for $i from 1 through $columns {
23
+ $x: flint-fluid-width(((($breakpoint / $columns) * ($i - 1)) + $gutter), $breakpoint);
24
+ $span: flint-fluid-width(((($breakpoint) / $columns)) - ($gutter * 2), $breakpoint);
25
+ $svg: $svg + "<rect x='#{$x}' fill='url(#gr)' width='#{$span}' height='100%'/>";
26
+ }
27
+
28
+ $svg: $svg + "</svg>";
29
+
30
+ @include _($key) {
31
+ max-width: $breakpoint;
32
+ background: {
33
+ image: url("data:image/svg+xml," + flint-html-encode($svg));
34
+ size: 100% 100%;
35
+ position: 0 0;
36
+ }
37
+ }
38
+ }
39
+
40
+ ///
41
+ /// Apply SVG grid overlay
42
+ ///
43
+ /// @access private
44
+ ///
45
+ /// @group Internal Mixins
46
+ ///
47
+ @mixin flint-overlay-grid {
48
+ @at-root html {
49
+ position: relative;
50
+
51
+ &:after {
52
+ transform: translateX(-50%);
53
+ content: " ";
54
+ position: absolute;
55
+ display: block;
56
+ top: 0;
57
+ left: 50%;
58
+ bottom: 0;
59
+ right: 0;
60
+ width: 100%;
61
+ height: 100%;
62
+ opacity: 0.25;
63
+ z-index: 9999;
64
+ pointer: {
65
+ events: none;
66
+ }
67
+
68
+ @each $key, $settings in flint-get-value("breakpoints") {
69
+ @include flint-svg-grid($key, map-get($settings, "breakpoint"), map-get($settings, "columns"), flint-get-gutter());
70
+ }
71
+ }
72
+ }
73
+ }
@@ -1,1057 +1,1057 @@
1
- ///
2
- /// # Main API
3
- ///
4
- /// ----
5
- ///
6
- /// ## Shorthand
7
- ///
8
- /// ### Recursive span
9
- /// Use this if you want identical column spans across all breakpoints. This is of course
10
- /// relative to each of your breakpoint's column count, so if your lowest breakpoint has
11
- /// a column count of `4`, then anything above that would likely cause layout issues
12
- /// for that breakpoint.
13
- ///
14
- /// ```scss
15
- /// div {
16
- /// @include _(2);
17
- /// }
18
- /// ```
19
- ///
20
- /// ### Recursive Span With Identical Context
21
- /// Use this if your nested context is identical across all breakpoints. The `$context` should
22
- /// be the span value of the element's parent, or `auto`.
23
- ///
24
- /// ```scss
25
- /// div {
26
- /// @include _(4, 2);
27
- /// }
28
- /// ```
29
- ///
30
- /// ### Recursive Span With Differing Context
31
- /// Use this if your nested context is not identical across all breakpoints. The `$context`
32
- /// should be the span value of the element's parent, or `auto`.
33
- ///
34
- /// ```scss
35
- /// div {
36
- /// @include _(4, 8 8 4 4);
37
- /// }
38
- /// ```
39
- ///
40
- /// ### Variable Span
41
- /// Use this if your content needs different spans across each breakpoint. The order of
42
- /// operations is the order that your breakpoints are listed in your config (DESC).
43
- ///
44
- /// ```scss
45
- /// div {
46
- /// @include _(8 8 4 4);
47
- /// }
48
- /// ```
49
- ///
50
- /// ### Variable Span With Identical Context
51
- /// Use this if your nested context is identical across all breakpoints. The `$context`
52
- /// should be the span value of the element's parent, or `auto`.
53
- ///
54
- /// ```scss
55
- /// div {
56
- /// @include _(4 4 2 2, 4);
57
- /// }
58
- /// ```
59
- ///
60
- /// ### Variable Span With Differing Context
61
- /// Use this if your nested context is not identical across all breakpoints. The `$context`
62
- /// should be the span value of the element's parent, or `auto`.
63
- ///
64
- /// ```scss
65
- /// div {
66
- /// @include _(8 8 4 4, 8 8 4 4);
67
- /// }
68
- /// ```
69
- ///
70
- /// ----
71
- ///
72
- /// ## Longhand
73
- ///
74
- /// ### Span
75
- /// Use if you want to define each span by breakpoint `$alias`.
76
- ///
77
- /// ```scss
78
- /// div {
79
- /// @include _(desktop, 2);
80
- /// }
81
- /// ```
82
- ///
83
- /// ### Span With Context
84
- /// Use if you want to define each span by breakpoint `$alias`. The `$context` should be the span
85
- /// value of the element's parent, or `auto`.
86
- ///
87
- /// ```scss
88
- /// div {
89
- /// @include _(desktop, 4, 2);
90
- /// }
91
- /// ```
92
- ///
93
- /// ----
94
- ///
95
- /// ## Automatic Context
96
- ///
97
- /// You can use `$context: auto`, and Flint will calculate based on the closest parent element's
98
- /// width instead of the current breakpoint. When using `auto`, Flint falls back from the topmost
99
- /// selector until one is found that has an instance, and it will calculate its span based on that
100
- /// instance's width for the current breakpoint. Think of the `auto` option as a self-correcting grid.
101
- ///
102
- /// When utilizing the `$context` argument, be sure to note the differences in the way the calculations
103
- /// happen depending on if you use a numerical value or `auto`. When using a numerical value, the span
104
- /// is calculated against the current breakpoint's value (example: `80em`), then it's divided by its column
105
- /// count (example: `16`), and then finally, it's multiplied by the passed `$context` value. When using
106
- /// `auto`, the span is _always_ calculated against the closest parent element's width instead
107
- /// of the current breakpoint's width.
108
- ///
109
- /// The difference in output varies, but your gutters will be more accurate across the board if you
110
- /// consistently use the `auto` option. This option allows you to infinitely nest elements on both fixed
111
- /// and fluid grids without dealing with the inconsistencies that can be caused by nesting elements that
112
- /// all use a gutter value of their own. Because the parent element's actual width is always used, the
113
- /// gutters never become out of sync.
114
- ///
115
- /// ```scss
116
- /// .parent {
117
- /// @include _(4);
118
- /// .child {
119
- /// @include _(3, 4);
120
- /// }
121
- /// }
122
- ///
123
- /// // Auto will work
124
- /// .parent {
125
- /// @include _(4);
126
- /// .child {
127
- /// @include _(3, auto);
128
- /// }
129
- /// }
130
- ///
131
- /// // Will also work
132
- /// .parent {
133
- /// @include _(4);
134
- /// }
135
- /// .parent .child {
136
- /// @include _(3, auto);
137
- /// }
138
- ///
139
- /// // Will not work, as the child has no relation to
140
- /// // the parent within the stylesheet
141
- /// .parent {
142
- /// @include _(6);
143
- /// }
144
- /// .child {
145
- /// @include _(3, auto);
146
- /// }
147
- /// ```
148
- ///
149
- /// If you attempt to use this feature with a methodology like BEM, where selectors aren't neccassarily
150
- /// lists, but instead single strings, you'll notice that Flint can't find return a valid parent for the
151
- /// element. This is the reason for the `support-syntax` functionality. With it, Flint is able to parse
152
- /// selectors that are a single string, as opposed to a list, and successfully search for the passed
153
- /// selector's parent.
154
- ///
155
- /// ----
156
- ///
157
- /// ## Modifiers
158
- ///
159
- /// ### Alpha
160
- /// Remove the left `$gutter` from the span. Other aliases for `alpha` include: `no-left` and `first`.
161
- ///
162
- /// ```scss
163
- /// div {
164
- /// @include _(12 8 6 4, $gutter: alpha);
165
- /// }
166
- /// ```
167
- ///
168
- /// ### Omega
169
- /// Remove the right `$gutter` from the span. Other aliases for `omega` include: `no-right` and `last`.
170
- ///
171
- /// ```scss
172
- /// div {
173
- /// @include _(2, $gutter: omega);
174
- /// }
175
- /// ````
176
- ///
177
- /// ### Row
178
- /// Remove both of the `$gutter` values from the span. Other aliases for `row` include: `none`.
179
- ///
180
- /// ```scss
181
- /// div {
182
- /// @include _(4, $gutter: row);
183
- /// }
184
- /// ```
185
- ///
186
- /// ### Center
187
- /// Center the current span within it's container element. Outputs auto left and right margins.
188
- /// This modifier will also remove any float properties on the element.
189
- ///
190
- /// ```scss
191
- /// div {
192
- /// @include _(4, $gutter: center);
193
- /// }
194
- /// ```
195
- ///
196
- /// ### Inside
197
- /// Sets both `$gutter` values on the inside of the element. Instead of deducting `$gutter*2` out
198
- /// of the final width, it will deduct `$gutter*4`. Useful for nesting elements inside of other
199
- /// elements without using `$context: auto`.
200
- ///
201
- /// ```scss
202
- /// div {
203
- /// @include _(16 12 8 4, $gutter: inside);
204
- /// }
205
- /// ```
206
- ///
207
- /// ### Default
208
- /// Argument to use the default left/right `$gutter` values. Useful for when you want to use a
209
- /// variable `$gutter` argument. Other aliases for `default` include: `normal` and `regular`.
210
- ///
211
- /// ```scss
212
- /// div {
213
- /// @include _(4, $gutter: default);
214
- /// }
215
- /// ```
216
- ///
217
- /// ### Variable Modifiers
218
- /// Instead of passing in a recursive `$gutter` value, you may specify a value for each breakpoint exactly
219
- /// like you would a `$span` argument.
220
- ///
221
- /// ```scss
222
- /// div {
223
- /// @include _(10 8 6 4, $gutter: alpha omega omega default);
224
- /// }
225
- /// ```
226
- ///
227
- /// ----
228
- ///
229
- /// ## Queries
230
- ///
231
- /// ### By Alias
232
- /// Use this type of query to wrap the `@content` in a single query for the specified breakpoint.
233
- ///
234
- /// ```scss
235
- /// div {
236
- /// @include _(desktop) {
237
- /// property: value;
238
- /// }
239
- /// }
240
- /// ```
241
- ///
242
- /// ### From, To
243
- /// Use this type of query to wrap the `@content` in a single query between 2 breakpoints. Make
244
- /// sure to pass in the breakpoints from lowest to highest.
245
- ///
246
- /// ```scss
247
- /// div {
248
- /// @include _(from tablet to laptop) {
249
- /// property: value;
250
- /// }
251
- /// }
252
- /// ```
253
- ///
254
- /// ### Greater Than
255
- /// Use this type of query to wrap the `@content` in a single query for anything above
256
- /// the passed breakpoint.
257
- ///
258
- /// ```scss
259
- /// div {
260
- /// @include _(greater than laptop) {
261
- /// property: value;
262
- /// }
263
- /// @include _(5em greater than tablet) {
264
- /// property: value;
265
- /// }
266
- /// @include _(greater than 55em) {
267
- /// property: value;
268
- /// }
269
- /// }
270
- /// ```
271
- ///
272
- /// ### Less Than
273
- /// Use this type of query to wrap the `@content` in a single query for anything below
274
- /// the passed breakpoint.
275
- ///
276
- /// ```scss
277
- /// div {
278
- /// @include _(less than laptop) {
279
- /// property: value;
280
- /// }
281
- /// @include _(5em less than tablet) {
282
- /// property: value;
283
- /// }
284
- /// @include _(less than 8em) {
285
- /// property: value;
286
- /// }
287
- /// }
288
- /// ```
289
- ///
290
- /// ### For
291
- /// Use this type of query to wrap the `@content` in a single comma delimited query
292
- /// for each passed `$alias`.
293
- ///
294
- /// ```scss
295
- /// div {
296
- /// @include _(for mobile tablet desktop) {
297
- /// property: value;
298
- /// }
299
- /// }
300
- /// ```
301
- ///
302
- /// ----
303
- ///
304
- /// ## Miscellaneous
305
- ///
306
- /// ### Clearfix
307
- /// Given that Flint is float based, you might find yourself needing to use a clearfix. Flint comes
308
- /// packaged with a micro-clearfix function. _Flint will attempt to use a local mixin named
309
- /// `clearfix`. If one is not found, it will use it's own._
310
- ///
311
- /// ```scss
312
- /// div {
313
- /// @include _(clear);
314
- /// }
315
- /// ```
316
- ///
317
- /// ### Foundation
318
- /// A foundation instance will output a global box-sizing: border-box declaration. If you selected
319
- /// `"border-box-sizing": true`, then it is advised to create a global foundation instance. If you
320
- /// don't, Flint will automatically apply a foundation instance with your first span declaration.
321
- /// This should be placed at the root of your stylesheet. _Flint will attempt to use a local
322
- /// mixin named `box-sizing`. If one is not found, it will use it's own._
323
- ///
324
- /// ```scss
325
- /// @include _(foundation);
326
- /// ```
327
- ///
328
- /// ### Container
329
- /// Containers act as a containing row for each individual breakpoint. It uses the `"max-width"`
330
- /// setting, if set. They do not float, so if you have `"center-container"` set, then it
331
- /// will also center your element using auto left and right margins. You may combine
332
- /// container and clear declarations, with arguments separated by a comma.
333
- ///
334
- /// ```scss
335
- /// div {
336
- /// @include _(container);
337
- /// }
338
- /// ```
339
- ///
340
- /// ----
341
- ///
342
- /// @access public
343
- ///
344
- /// @param {String|Number|List} $key [null] - key of breakpoint, or shorthand span
345
- /// @param {String|Number|List} $span [null] - value of span for column, or shorthand context
346
- /// @param {String|Number} $context [null] - context value of span, or null for shorthand
347
- /// @param {String|List} $gutter [null] - alias for gutter modifier
348
- ///
349
- /// @throws - Error if list lengths do not match number of breakpoints (when using variable shorthands).
350
- ///
351
- /// ----
352
- ///
353
- /// @example scss - Recursive shorthand with no context
354
- /// _(2)
355
- ///
356
- /// @example scss - Recursive shorthand with identical context
357
- /// _(2, 4)
358
- ///
359
- /// @example scss - Recursive shorthand with differing context
360
- /// _(1, 2 4 6 8)
361
- /// _(1, auto)
362
- ///
363
- /// @example scss - Variable shorthand with no context
364
- /// _(1 2 3 4)
365
- ///
366
- /// @example scss - Variable shorthand with identical context
367
- /// _(1 2 3 4, 4)
368
- /// _(1 2 3 4, auto)
369
- ///
370
- /// @example scss - Variable shorthand with differing context
371
- /// _(4 3 2 1, 8 6 4 2)
372
- /// _(4 3 2 1, auto)
373
- ///
374
- /// @example scss - Call by alias with no context
375
- /// _(desktop, 2)
376
- ///
377
- /// @example scss - Call by alias with context
378
- /// _(desktop, 2, 4)
379
- /// _(desktop, 2, auto)
380
- ///
381
- /// @example scss - Call $key breakpoint by alias
382
- /// _(desktop) { ... }
383
- ///
384
- /// @example scss - From $key breakpoint to infinity
385
- /// _(from laptop to infinity) { ... }
386
- ///
387
- /// @example scss - From $key-x breakpoint to $key-y breakpoint
388
- /// _(from tablet to laptop) { ... }
389
- ///
390
- /// @example scss - From $num-x to $num-y
391
- /// _(from 20em to laptop) { ... }
392
- ///
393
- /// @example scss - Greater than $key breakpoint
394
- /// _(greater than tablet) { ... }
395
- ///
396
- /// @example scss - Greater than number
397
- /// _(greater than 15em) { ... }
398
- ///
399
- /// @example scss - Number greater than $key breakpoint
400
- /// _(5em greater than mobile) { ... }
401
- ///
402
- /// @example scss - Less than $key breakpoint
403
- /// _(less than laptop) { ... }
404
- ///
405
- /// @example scss - Less than number
406
- /// _(less than 35em) { ... }
407
- ///
408
- /// @example scss - Number less than $key breakpoint
409
- /// _(10em less than laptop) { ... }
410
- ///
411
- /// @example scss - For $key-x $key-y $key-z...
412
- /// _(for mobile tablet desktop) { ... }
413
- ///
414
- /// @example scss - Clear
415
- /// _(clear)
416
- ///
417
- /// @example scss - Foundation
418
- /// _(foundation)
419
- ///
420
- /// @example scss - Container
421
- /// _(container)
422
- ///
423
- /// ----
424
- ///
425
- /// @author Ezekiel Gabrielse
426
- /// @link http://flint.gs
427
- ///
428
- /// @group Public API
429
- ///
430
- @mixin _(
431
- $key: null,
432
- $span: null,
433
- $context: null,
434
- $gutter: null
435
- ) {
436
-
437
- //
438
- // Get unit to modify queries with
439
- //
440
- $unit: null;
441
-
442
- @if flint-get-config-unit() == "rem" {
443
- $unit: flint-to-rem(1px);
444
- } @else if flint-get-config-unit() == "em" {
445
- $unit: flint-to-em(1px);
446
- } @else {
447
- $unit: 1;
448
- }
449
-
450
- //
451
- // Clearfix
452
- //
453
- @if $key == "clear" or $span == "clear" or $context == "clear" {
454
-
455
- //
456
- // Check if key exists as breakpoint, and if so wrap
457
- // in query to not affect other breakpoints
458
- //
459
- @if map-has-key(map-get($flint, "breakpoints"), $key) {
460
-
461
- @if flint-get-value("settings", "grid") == "fluid" {
462
- @if flint-is-highest-breakpoint($key) {
463
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
464
- @include flint-clearfix;
465
- @content;
466
- }
467
- } @else {
468
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
469
- @include flint-clearfix;
470
- @content;
471
- }
472
- }
473
- } @else if flint-get-value("settings", "grid") == "fixed" {
474
- @if flint-is-highest-breakpoint($key) {
475
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
476
- @include flint-clearfix;
477
- @content;
478
- }
479
- } @else {
480
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
481
- @include flint-clearfix;
482
- @content;
483
- }
484
- }
485
- }
486
-
487
- } @else {
488
-
489
- @include flint-clearfix;
490
- @content;
491
-
492
- }
493
- }
494
-
495
- //
496
- // Apply grid overlay if debug mode is enabled
497
- //
498
- @if not $flint-overlay and flint-get-value("settings", "debug-mode") {
499
- $flint-overlay: true !global;
500
- @include flint-overlay-grid;
501
- }
502
-
503
- //
504
- // Foundation
505
- //
506
- @if $key == "foundation" {
507
-
508
- // Apply global border-box-sizing if set to true
509
- @if flint-get-value("settings", "border-box-sizing") {
510
- $flint-foundation: true !global;
511
- }
512
-
513
- // Foundation is now globally existant
514
- @if $flint-foundation {
515
- @at-root *, *:before, *:after {
516
- @include flint-box-sizing;
517
- @content;
518
- }
519
- }
520
-
521
- //
522
- // Container
523
- //
524
- } @else if $key == "container" or $span == "container" or $context == "container" {
525
-
526
- // Apply individually if foundation is not set globally, but is set to true in config
527
- @if flint-get-value("settings", "border-box-sizing") and not $flint-foundation {
528
- @include _("foundation");
529
- }
530
-
531
- // Output container for each breakpoint if fixed grid
532
- @if $key == "container" and flint-get-value("settings", "grid") == "fixed" {
533
-
534
- @for $i from 1 through length($flint-all-keys) {
535
-
536
- // Set up variables
537
- $calc-key: flint-steal-key($i);
538
-
539
- // Key is default, no media queries
540
- @if flint-is-default($calc-key) {
541
-
542
- @include flint-container($calc-key, $i) {
543
- @content;
544
- }
545
-
546
- // Not default, wrap in media queries
547
- } @else {
548
-
549
- // Highest breakpoint? No max-width
550
- @if flint-is-highest-breakpoint($calc-key) {
551
-
552
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
553
- @include flint-container($calc-key, $i) {
554
- @content;
555
- }
556
- }
557
-
558
- } @else {
559
-
560
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, $i) - $unit) ) {
561
- @include flint-container($calc-key, $i) {
562
- @content;
563
- }
564
- }
565
-
566
- }
567
- }
568
- }
569
-
570
- // Output container for specific breakpoint if exists
571
- } @else if map-has-key(map-get($flint, "breakpoints"), $key) and flint-get-value("settings", "grid") == "fixed" {
572
-
573
- @if flint-is-highest-breakpoint($key) {
574
-
575
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
576
- @include flint-container($key) {
577
- @content;
578
- }
579
- }
580
-
581
- } @else {
582
-
583
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
584
- @include flint-container($key) {
585
- @content;
586
- }
587
- }
588
-
589
- }
590
- } @else if map-has-key(map-get($flint, "breakpoints"), $key) and flint-get-value("settings", "grid") == "fluid" {
591
- @if flint-is-highest-breakpoint($key) {
592
-
593
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
594
- @include flint-container {
595
- @content;
596
- }
597
- }
598
-
599
- } @else {
600
-
601
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
602
- @include flint-container {
603
- @content;
604
- }
605
- }
606
-
607
- }
608
- } @else {
609
- @include flint-container {
610
- @content;
611
- }
612
- }
613
-
614
- //
615
- // Create a new instance, add to global instance map
616
- //
617
- } @else {
618
-
619
- // Apply individually if foundation is not set globally, but is set to true in config
620
- @if flint-get-value("settings", "border-box-sizing") and not $flint-foundation {
621
- @include _("foundation");
622
- }
623
-
624
- //
625
- // Recursive shorthand with no context
626
- //
627
- @if flint-is-number($key) and length($key) == 1 and $span == null
628
-
629
- //
630
- // Recursive shorthand with identical context
631
- //
632
- or flint-is-number($key) and length($key) == 1 and flint-is-number($span) and length($span) == 1
633
- or flint-is-number($key) and length($key) == 1 and $span == "auto"
634
-
635
- //
636
- // Recursive shorthand with differing context
637
- //
638
- or flint-is-number($key) and length($key) == 1 and flint-types-in-list($span, "number")
639
- or flint-is-number($key) and length($key) == 1 and $span == "auto"
640
-
641
- //
642
- // Variable shorthand with no context
643
- //
644
- or flint-types-in-list($key, "number") and $span == null
645
-
646
- //
647
- // Variable shorthand with identical context
648
- //
649
- or flint-types-in-list($key, "number") and flint-is-number($span) and length($span) == 1
650
- or flint-types-in-list($key, "number") and $span == "auto"
651
-
652
- //
653
- // Variable shorthand with differing context
654
- //
655
- or flint-types-in-list($key, "number") and flint-types-in-list($span, "number")
656
- or flint-types-in-list($key, "number") and $span == "auto" {
657
-
658
- // Emit erroring for invalid argument lengths
659
- @if flint-types-in-list($key, "number") and length($key) != length($flint-all-keys) {
660
- @if not $flint-development-mode {
661
- @error "Invalid argument length of #{length($key)} for span. Please provide an argument for each breakpoint in your config (#{length($flint-all-keys)}). Your argument was: #{$key}";
662
- }
663
- } @else if flint-types-in-list($span, "number") and length($span) != length($flint-all-keys) {
664
- @if not $flint-development-mode {
665
- @error "Invalid argument length of #{length($span)} for context. Please provide an argument for each breakpoint in your config (#{length($flint-all-keys)}). Your argument was: #{$span}";
666
- }
667
- } @else {
668
-
669
- @for $i from 1 through length($flint-all-keys) {
670
-
671
- $calc-key: flint-steal-key($i);
672
- $calc-span: $key;
673
- $calc-context: $span;
674
- $calc-gutter: $gutter;
675
-
676
- @if flint-is-default($calc-key) {
677
-
678
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
679
- @content;
680
- }
681
-
682
- } @else {
683
-
684
- @if flint-get-value("settings", "grid") == "fluid" {
685
-
686
- @if flint-is-highest-breakpoint($calc-key) {
687
-
688
- @media ( min-width: (flint-calc-breakpoint("next", $calc-key, $i) + $unit) ) {
689
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
690
- @content;
691
- }
692
- }
693
-
694
- } @else {
695
-
696
- @media ( min-width: (flint-calc-breakpoint("next", $calc-key, $i) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
697
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
698
- @content;
699
- }
700
- }
701
-
702
- }
703
-
704
- } @else if flint-get-value("settings", "grid") == "fixed" {
705
-
706
- @if flint-is-highest-breakpoint($calc-key) {
707
-
708
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
709
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
710
- @content;
711
- }
712
- }
713
-
714
- } @else {
715
-
716
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, $i) - $unit) ) {
717
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
718
- @content;
719
- }
720
- }
721
-
722
- }
723
-
724
- } @else {
725
- @if not $flint-development-mode {
726
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
727
- }
728
- }
729
- }
730
- }
731
- }
732
-
733
- //
734
- // Call by alias with no context
735
- //
736
- } @else if flint-is-string($key) and flint-is-number($span) and $context == null
737
-
738
- //
739
- // Call by alias with context
740
- //
741
- or flint-is-string($key) and flint-is-number($span) and flint-is-number($context)
742
- or flint-is-string($key) and flint-is-number($span) and $context == "auto" {
743
-
744
- // Throw error for invalid argument lengths
745
- @if not map-has-key(map-get($flint, "breakpoints"), $key) {
746
- @if not $flint-development-mode {
747
- @error "Invalid argument: #{$key}. Breakpoint does not exist. Please provide a valid argument.";
748
- }
749
- } @else {
750
-
751
- $calc-key: $key;
752
- $calc-span: $span;
753
- $calc-context: $context;
754
- $calc-gutter: $gutter;
755
-
756
- @if flint-is-default($calc-key) {
757
-
758
- @include flint-calculate ($calc-key, $calc-span, $calc-context, $calc-gutter) {
759
- @content;
760
- }
761
-
762
- } @else {
763
-
764
- @if flint-get-value("settings", "grid") == "fluid" {
765
-
766
- @if flint-is-highest-breakpoint($calc-key) {
767
-
768
- @media ( min-width: (flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + $unit) ) {
769
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
770
- @content;
771
- }
772
- }
773
-
774
- } @else {
775
-
776
- @media ( min-width: (flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) {
777
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
778
- @content;
779
- }
780
- }
781
-
782
- }
783
-
784
- } @else if flint-get-value("settings", "grid") == "fixed" {
785
-
786
- @if flint-is-highest-breakpoint($calc-key) {
787
-
788
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) {
789
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
790
- @content;
791
- }
792
- }
793
-
794
- } @else {
795
-
796
- @media ( min-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, flint-get-index($calc-key)) - $unit) ) {
797
- @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
798
- @content;
799
- }
800
- }
801
-
802
- }
803
-
804
- } @else {
805
- @if not $flint-development-mode {
806
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
807
- }
808
- }
809
- }
810
- }
811
-
812
- //
813
- // Wrap content in media query
814
- //
815
- } @else if map-has-key(map-get($flint, "breakpoints"), $key) and $span == null and $context == null
816
- or flint-is-list($key) and $span == null and $context == null {
817
-
818
- //
819
- // Call $key breakpoint by alias
820
- //
821
- @if length($key) == 1 {
822
-
823
- @if flint-get-value("settings", "grid") == "fluid" {
824
- @if flint-is-highest-breakpoint($key) {
825
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
826
- @content;
827
- }
828
- } @else {
829
- @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
830
- @content;
831
- }
832
- }
833
- } @else if flint-get-value("settings", "grid") == "fixed" {
834
- @if flint-is-highest-breakpoint($key) {
835
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
836
- @content;
837
- }
838
- } @else {
839
- @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
840
- @content;
841
- }
842
- }
843
- } @else {
844
- @if not $flint-development-mode {
845
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
846
- }
847
- }
848
-
849
- //
850
- // From $key breakpoint to infinity
851
- //
852
- } @else if flint-types-in-list($key, "string", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" and nth($key, 4) == "infinity" {
853
-
854
- @if flint-get-value("settings", "grid") == "fluid" {
855
- @media ( min-width: (flint-calc-breakpoint("next", nth($key, 2), flint-get-index(nth($key, 2))) + if(flint-is-lowest-breakpoint(nth($key, 2)), 0, $unit)) ) {
856
- @content;
857
- }
858
- } @else if flint-get-value("settings", "grid") == "fixed" {
859
- @media ( min-width: flint-calc-breakpoint("alias", nth($key, 2), flint-get-index(nth($key, 2))) ) {
860
- @content;
861
- }
862
- } @else {
863
- @if not $flint-development-mode {
864
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
865
- }
866
- }
867
-
868
- //
869
- // From $key-x breakpoint to $key-y breakpoint
870
- //
871
- } @else if flint-types-in-list($key, "string", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" {
872
-
873
- @if flint-get-value("settings", "grid") == "fluid" {
874
- @media ( min-width: (flint-calc-breakpoint("next", nth($key, 2), flint-get-index(nth($key, 2))) + if(flint-is-lowest-breakpoint(nth($key, 2)), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) ) {
875
- @content;
876
- }
877
- } @else if flint-get-value("settings", "grid") == "fixed" {
878
- @media ( min-width: flint-calc-breakpoint("alias", nth($key, 2), flint-get-index(nth($key, 2))) ) and ( max-width: (flint-calc-breakpoint("prev", nth($key, 4), flint-get-index(nth($key, 4))) - if(flint-is-highest-breakpoint(nth($key, 4)), 0, $unit)) ) {
879
- @content;
880
- }
881
- } @else {
882
- @if not $flint-development-mode {
883
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
884
- }
885
- }
886
-
887
- //
888
- // From $num-x to $num-y
889
- //
890
- } @else if flint-types-in-list($key, "string" "number" "string" "number", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" {
891
- // Make sure passed units match units used in config
892
- @if flint-get-config-unit() == unit(nth($key, 2)) and flint-get-config-unit() == unit(nth($key, 4)) {
893
- @media ( min-width: nth($key, 2) ) and ( max-width: nth($key, 4) ) {
894
- @content;
895
- }
896
- // Throw error
897
- } @else {
898
- @if not $flint-development-mode {
899
- @error "Passed units [#{unit(nth($key, 2))}, #{unit(nth($key, 4))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
900
- }
901
- }
902
-
903
- //
904
- // Greater than $key breakpoint
905
- //
906
- } @else if flint-types-in-list($key, "string", 3) and nth($key, 1) == "greater" and nth($key, 2) == "than" {
907
-
908
- @if flint-get-value("settings", "grid") == "fluid" {
909
- @media ( min-width: (flint-calc-breakpoint("alias", nth($key, 3), flint-get-index(nth($key, 3))) + $unit) ) {
910
- @content;
911
- }
912
- } @else if flint-get-value("settings", "grid") == "fixed" {
913
- @media ( min-width: flint-calc-breakpoint("prev", nth($key, 3), flint-get-index(nth($key, 3))) ) {
914
- @content;
915
- }
916
- } @else {
917
- @if not $flint-development-mode {
918
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
919
- }
920
- }
921
-
922
- //
923
- // Greater than number
924
- //
925
- } @else if flint-types-in-list($key, "string" "string" "number", 3) and nth($key, 1) == "greater" and nth($key, 2) == "than" {
926
-
927
- @if flint-get-config-unit() == unit(nth($key, 3)) {
928
- @media ( min-width: nth($key, 3) + $unit ) {
929
- @content;
930
- }
931
- } @else {
932
- @if not $flint-development-mode {
933
- @error "Passed units [#{unit(nth($key, 3))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
934
- }
935
- }
936
-
937
- //
938
- // Number greater than $key breakpoint
939
- //
940
- } @else if flint-types-in-list($key, "number" "string" "string" "string", 4) and nth($key, 2) == "greater" and nth($key, 3) == "than" {
941
-
942
- @if flint-get-config-unit() == unit(nth($key, 1)) {
943
- @media ( min-width: (flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) + nth($key, 1)) ) {
944
- @content;
945
- }
946
- } @else {
947
- @if not $flint-development-mode {
948
- @error "Passed units [#{unit(nth($key, 1))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
949
- }
950
- }
951
-
952
- //
953
- // Less than $key breakpoint
954
- //
955
- } @else if flint-types-in-list($key, "string", 3) and nth($key, 1) == "less" and nth($key, 2) == "than" {
956
-
957
- @if flint-get-value("settings", "grid") == "fluid" {
958
- @media ( max-width: flint-calc-breakpoint("next", nth($key, 3), flint-get-index(nth($key, 3))) ) {
959
- @content;
960
- }
961
- } @else if flint-get-value("settings", "grid") == "fixed" {
962
- @media ( max-width: (flint-calc-breakpoint("alias", nth($key, 3), flint-get-index(nth($key, 3))) - $unit) ) {
963
- @content;
964
- }
965
- } @else {
966
- @if not $flint-development-mode {
967
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
968
- }
969
- }
970
-
971
- //
972
- // Less than number
973
- //
974
- } @else if flint-types-in-list($key, "string" "string" "number", 3) and nth($key, 1) == "less" and nth($key, 2) == "than" {
975
-
976
- @if flint-get-config-unit() == unit(nth($key, 3)) {
977
- @media ( max-width: nth($key, 3) - $unit ) {
978
- @content;
979
- }
980
- } @else {
981
- @if not $flint-development-mode {
982
- @error "Passed units [#{unit(nth($key, 3))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
983
- }
984
- }
985
-
986
- //
987
- // Number less than $key breakpoint
988
- //
989
- } @else if flint-types-in-list($key, "number" "string" "string" "string", 4) and nth($key, 2) == "less" and nth($key, 3) == "than" {
990
-
991
- @if flint-get-config-unit() == unit(nth($key, 1)) {
992
- @media ( max-width: (flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) - nth($key, 1)) ) {
993
- @content;
994
- }
995
- } @else {
996
- @if not $flint-development-mode {
997
- @error "Passed units [#{unit(nth($key, 1))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
998
- }
999
- }
1000
-
1001
- //
1002
- // For $key-x $key-y $key-z
1003
- //
1004
- } @else if flint-types-in-list($key, "string") and nth($key, 1) == "for" {
1005
- // Define empty query list
1006
- $query: ();
1007
-
1008
- //
1009
- // Build out comma delimited query list for each breakpoint
1010
- //
1011
- @for $i from 1 through length($key) {
1012
- $calc-key: nth($key, $i);
1013
-
1014
- @if map-has-key(map-get($flint, "breakpoints"), $calc-key) {
1015
- @if flint-get-value("settings", "grid") == "fluid" {
1016
- @if flint-is-highest-breakpoint($calc-key) {
1017
- $query: append($query, unquote('( min-width: #{(flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + $unit)} )'), "comma");
1018
- } @else {
1019
- $query: append($query, unquote('( min-width: #{(flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit))} ) and ( max-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} )'), "comma");
1020
- }
1021
- } @else if flint-get-value("settings", "grid") == "fixed" {
1022
- @if flint-is-highest-breakpoint($calc-key) {
1023
- $query: append($query, unquote('( min-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} )'), "comma");
1024
- } @else {
1025
- $query: append($query, unquote('( min-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} ) and ( max-width: #{(flint-calc-breakpoint("prev", $calc-key, flint-get-index($calc-key)) - $unit)} )'), "comma");
1026
- }
1027
- } @else {
1028
- @if not $flint-development-mode {
1029
- @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
1030
- }
1031
- }
1032
- } @else {
1033
- @if not $calc-key == "for" {
1034
- @if not $flint-development-mode {
1035
- @error "Invalid argument: #{$calc-key}. Breakpoint does not exist. Please provide a valid argument.";
1036
- }
1037
- }
1038
- }
1039
- }
1040
-
1041
- @media #{$query} {
1042
- @content;
1043
- }
1044
- }
1045
-
1046
- //
1047
- // Invalid argument
1048
- //
1049
- } @else {
1050
- @if $key != "clear" {
1051
- @if not $flint-development-mode {
1052
- @error "Invalid argument(s). Please double check and provide a valid argument. If you're calling by alias, please provide a single span argument for your breakpoint. See documentation for additional details.";
1053
- }
1054
- }
1055
- }
1056
- }
1057
- }
1
+ ///
2
+ /// # Main API
3
+ ///
4
+ /// ----
5
+ ///
6
+ /// ## Shorthand
7
+ ///
8
+ /// ### Recursive span
9
+ /// Use this if you want identical column spans across all breakpoints. This is of course
10
+ /// relative to each of your breakpoint's column count, so if your lowest breakpoint has
11
+ /// a column count of `4`, then anything above that would likely cause layout issues
12
+ /// for that breakpoint.
13
+ ///
14
+ /// ```scss
15
+ /// div {
16
+ /// @include _(2);
17
+ /// }
18
+ /// ```
19
+ ///
20
+ /// ### Recursive Span With Identical Context
21
+ /// Use this if your nested context is identical across all breakpoints. The `$context` should
22
+ /// be the span value of the element's parent, or `auto`.
23
+ ///
24
+ /// ```scss
25
+ /// div {
26
+ /// @include _(4, 2);
27
+ /// }
28
+ /// ```
29
+ ///
30
+ /// ### Recursive Span With Differing Context
31
+ /// Use this if your nested context is not identical across all breakpoints. The `$context`
32
+ /// should be the span value of the element's parent, or `auto`.
33
+ ///
34
+ /// ```scss
35
+ /// div {
36
+ /// @include _(4, 8 8 4 4);
37
+ /// }
38
+ /// ```
39
+ ///
40
+ /// ### Variable Span
41
+ /// Use this if your content needs different spans across each breakpoint. The order of
42
+ /// operations is the order that your breakpoints are listed in your config (DESC).
43
+ ///
44
+ /// ```scss
45
+ /// div {
46
+ /// @include _(8 8 4 4);
47
+ /// }
48
+ /// ```
49
+ ///
50
+ /// ### Variable Span With Identical Context
51
+ /// Use this if your nested context is identical across all breakpoints. The `$context`
52
+ /// should be the span value of the element's parent, or `auto`.
53
+ ///
54
+ /// ```scss
55
+ /// div {
56
+ /// @include _(4 4 2 2, 4);
57
+ /// }
58
+ /// ```
59
+ ///
60
+ /// ### Variable Span With Differing Context
61
+ /// Use this if your nested context is not identical across all breakpoints. The `$context`
62
+ /// should be the span value of the element's parent, or `auto`.
63
+ ///
64
+ /// ```scss
65
+ /// div {
66
+ /// @include _(8 8 4 4, 8 8 4 4);
67
+ /// }
68
+ /// ```
69
+ ///
70
+ /// ----
71
+ ///
72
+ /// ## Longhand
73
+ ///
74
+ /// ### Span
75
+ /// Use if you want to define each span by breakpoint `$alias`.
76
+ ///
77
+ /// ```scss
78
+ /// div {
79
+ /// @include _(desktop, 2);
80
+ /// }
81
+ /// ```
82
+ ///
83
+ /// ### Span With Context
84
+ /// Use if you want to define each span by breakpoint `$alias`. The `$context` should be the span
85
+ /// value of the element's parent, or `auto`.
86
+ ///
87
+ /// ```scss
88
+ /// div {
89
+ /// @include _(desktop, 4, 2);
90
+ /// }
91
+ /// ```
92
+ ///
93
+ /// ----
94
+ ///
95
+ /// ## Automatic Context
96
+ ///
97
+ /// You can use `$context: auto`, and Flint will calculate based on the closest parent element's
98
+ /// width instead of the current breakpoint. When using `auto`, Flint falls back from the topmost
99
+ /// selector until one is found that has an instance, and it will calculate its span based on that
100
+ /// instance's width for the current breakpoint. Think of the `auto` option as a self-correcting grid.
101
+ ///
102
+ /// When utilizing the `$context` argument, be sure to note the differences in the way the calculations
103
+ /// happen depending on if you use a numerical value or `auto`. When using a numerical value, the span
104
+ /// is calculated against the current breakpoint's value (example: `80em`), then it's divided by its column
105
+ /// count (example: `16`), and then finally, it's multiplied by the passed `$context` value. When using
106
+ /// `auto`, the span is _always_ calculated against the closest parent element's width instead
107
+ /// of the current breakpoint's width.
108
+ ///
109
+ /// The difference in output varies, but your gutters will be more accurate across the board if you
110
+ /// consistently use the `auto` option. This option allows you to infinitely nest elements on both fixed
111
+ /// and fluid grids without dealing with the inconsistencies that can be caused by nesting elements that
112
+ /// all use a gutter value of their own. Because the parent element's actual width is always used, the
113
+ /// gutters never become out of sync.
114
+ ///
115
+ /// ```scss
116
+ /// .parent {
117
+ /// @include _(4);
118
+ /// .child {
119
+ /// @include _(3, 4);
120
+ /// }
121
+ /// }
122
+ ///
123
+ /// // Auto will work
124
+ /// .parent {
125
+ /// @include _(4);
126
+ /// .child {
127
+ /// @include _(3, auto);
128
+ /// }
129
+ /// }
130
+ ///
131
+ /// // Will also work
132
+ /// .parent {
133
+ /// @include _(4);
134
+ /// }
135
+ /// .parent .child {
136
+ /// @include _(3, auto);
137
+ /// }
138
+ ///
139
+ /// // Will not work, as the child has no relation to
140
+ /// // the parent within the stylesheet
141
+ /// .parent {
142
+ /// @include _(6);
143
+ /// }
144
+ /// .child {
145
+ /// @include _(3, auto);
146
+ /// }
147
+ /// ```
148
+ ///
149
+ /// If you attempt to use this feature with a methodology like BEM, where selectors aren't neccassarily
150
+ /// lists, but instead single strings, you'll notice that Flint can't find return a valid parent for the
151
+ /// element. This is the reason for the `support-syntax` functionality. With it, Flint is able to parse
152
+ /// selectors that are a single string, as opposed to a list, and successfully search for the passed
153
+ /// selector's parent.
154
+ ///
155
+ /// ----
156
+ ///
157
+ /// ## Modifiers
158
+ ///
159
+ /// ### Alpha
160
+ /// Remove the left `$gutter` from the span. Other aliases for `alpha` include: `no-left` and `first`.
161
+ ///
162
+ /// ```scss
163
+ /// div {
164
+ /// @include _(12 8 6 4, $gutter: alpha);
165
+ /// }
166
+ /// ```
167
+ ///
168
+ /// ### Omega
169
+ /// Remove the right `$gutter` from the span. Other aliases for `omega` include: `no-right` and `last`.
170
+ ///
171
+ /// ```scss
172
+ /// div {
173
+ /// @include _(2, $gutter: omega);
174
+ /// }
175
+ /// ````
176
+ ///
177
+ /// ### Row
178
+ /// Remove both of the `$gutter` values from the span. Other aliases for `row` include: `none`.
179
+ ///
180
+ /// ```scss
181
+ /// div {
182
+ /// @include _(4, $gutter: row);
183
+ /// }
184
+ /// ```
185
+ ///
186
+ /// ### Center
187
+ /// Center the current span within it's container element. Outputs auto left and right margins.
188
+ /// This modifier will also remove any float properties on the element.
189
+ ///
190
+ /// ```scss
191
+ /// div {
192
+ /// @include _(4, $gutter: center);
193
+ /// }
194
+ /// ```
195
+ ///
196
+ /// ### Inside
197
+ /// Sets both `$gutter` values on the inside of the element. Instead of deducting `$gutter*2` out
198
+ /// of the final width, it will deduct `$gutter*4`. Useful for nesting elements inside of other
199
+ /// elements without using `$context: auto`.
200
+ ///
201
+ /// ```scss
202
+ /// div {
203
+ /// @include _(16 12 8 4, $gutter: inside);
204
+ /// }
205
+ /// ```
206
+ ///
207
+ /// ### Default
208
+ /// Argument to use the default left/right `$gutter` values. Useful for when you want to use a
209
+ /// variable `$gutter` argument. Other aliases for `default` include: `normal` and `regular`.
210
+ ///
211
+ /// ```scss
212
+ /// div {
213
+ /// @include _(4, $gutter: default);
214
+ /// }
215
+ /// ```
216
+ ///
217
+ /// ### Variable Modifiers
218
+ /// Instead of passing in a recursive `$gutter` value, you may specify a value for each breakpoint exactly
219
+ /// like you would a `$span` argument.
220
+ ///
221
+ /// ```scss
222
+ /// div {
223
+ /// @include _(10 8 6 4, $gutter: alpha omega omega default);
224
+ /// }
225
+ /// ```
226
+ ///
227
+ /// ----
228
+ ///
229
+ /// ## Queries
230
+ ///
231
+ /// ### By Alias
232
+ /// Use this type of query to wrap the `@content` in a single query for the specified breakpoint.
233
+ ///
234
+ /// ```scss
235
+ /// div {
236
+ /// @include _(desktop) {
237
+ /// property: value;
238
+ /// }
239
+ /// }
240
+ /// ```
241
+ ///
242
+ /// ### From, To
243
+ /// Use this type of query to wrap the `@content` in a single query between 2 breakpoints. Make
244
+ /// sure to pass in the breakpoints from lowest to highest.
245
+ ///
246
+ /// ```scss
247
+ /// div {
248
+ /// @include _(from tablet to laptop) {
249
+ /// property: value;
250
+ /// }
251
+ /// }
252
+ /// ```
253
+ ///
254
+ /// ### Greater Than
255
+ /// Use this type of query to wrap the `@content` in a single query for anything above
256
+ /// the passed breakpoint.
257
+ ///
258
+ /// ```scss
259
+ /// div {
260
+ /// @include _(greater than laptop) {
261
+ /// property: value;
262
+ /// }
263
+ /// @include _(5em greater than tablet) {
264
+ /// property: value;
265
+ /// }
266
+ /// @include _(greater than 55em) {
267
+ /// property: value;
268
+ /// }
269
+ /// }
270
+ /// ```
271
+ ///
272
+ /// ### Less Than
273
+ /// Use this type of query to wrap the `@content` in a single query for anything below
274
+ /// the passed breakpoint.
275
+ ///
276
+ /// ```scss
277
+ /// div {
278
+ /// @include _(less than laptop) {
279
+ /// property: value;
280
+ /// }
281
+ /// @include _(5em less than tablet) {
282
+ /// property: value;
283
+ /// }
284
+ /// @include _(less than 8em) {
285
+ /// property: value;
286
+ /// }
287
+ /// }
288
+ /// ```
289
+ ///
290
+ /// ### For
291
+ /// Use this type of query to wrap the `@content` in a single comma delimited query
292
+ /// for each passed `$alias`.
293
+ ///
294
+ /// ```scss
295
+ /// div {
296
+ /// @include _(for mobile tablet desktop) {
297
+ /// property: value;
298
+ /// }
299
+ /// }
300
+ /// ```
301
+ ///
302
+ /// ----
303
+ ///
304
+ /// ## Miscellaneous
305
+ ///
306
+ /// ### Clearfix
307
+ /// Given that Flint is float based, you might find yourself needing to use a clearfix. Flint comes
308
+ /// packaged with a micro-clearfix function. _Flint will attempt to use a local mixin named
309
+ /// `clearfix`. If one is not found, it will use it's own._
310
+ ///
311
+ /// ```scss
312
+ /// div {
313
+ /// @include _(clear);
314
+ /// }
315
+ /// ```
316
+ ///
317
+ /// ### Foundation
318
+ /// A foundation instance will output a global box-sizing: border-box declaration. If you selected
319
+ /// `"border-box-sizing": true`, then it is advised to create a global foundation instance. If you
320
+ /// don't, Flint will automatically apply a foundation instance with your first span declaration.
321
+ /// This should be placed at the root of your stylesheet. _Flint will attempt to use a local
322
+ /// mixin named `box-sizing`. If one is not found, it will use it's own._
323
+ ///
324
+ /// ```scss
325
+ /// @include _(foundation);
326
+ /// ```
327
+ ///
328
+ /// ### Container
329
+ /// Containers act as a containing row for each individual breakpoint. It uses the `"max-width"`
330
+ /// setting, if set. They do not float, so if you have `"center-container"` set, then it
331
+ /// will also center your element using auto left and right margins. You may combine
332
+ /// container and clear declarations, with arguments separated by a comma.
333
+ ///
334
+ /// ```scss
335
+ /// div {
336
+ /// @include _(container);
337
+ /// }
338
+ /// ```
339
+ ///
340
+ /// ----
341
+ ///
342
+ /// @access public
343
+ ///
344
+ /// @param {String|Number|List} $key [null] - key of breakpoint, or shorthand span
345
+ /// @param {String|Number|List} $span [null] - value of span for column, or shorthand context
346
+ /// @param {String|Number} $context [null] - context value of span, or null for shorthand
347
+ /// @param {String|List} $gutter [null] - alias for gutter modifier
348
+ ///
349
+ /// @throws - Error if list lengths do not match number of breakpoints (when using variable shorthands).
350
+ ///
351
+ /// ----
352
+ ///
353
+ /// @example scss - Recursive shorthand with no context
354
+ /// _(2)
355
+ ///
356
+ /// @example scss - Recursive shorthand with identical context
357
+ /// _(2, 4)
358
+ ///
359
+ /// @example scss - Recursive shorthand with differing context
360
+ /// _(1, 2 4 6 8)
361
+ /// _(1, auto)
362
+ ///
363
+ /// @example scss - Variable shorthand with no context
364
+ /// _(1 2 3 4)
365
+ ///
366
+ /// @example scss - Variable shorthand with identical context
367
+ /// _(1 2 3 4, 4)
368
+ /// _(1 2 3 4, auto)
369
+ ///
370
+ /// @example scss - Variable shorthand with differing context
371
+ /// _(4 3 2 1, 8 6 4 2)
372
+ /// _(4 3 2 1, auto)
373
+ ///
374
+ /// @example scss - Call by alias with no context
375
+ /// _(desktop, 2)
376
+ ///
377
+ /// @example scss - Call by alias with context
378
+ /// _(desktop, 2, 4)
379
+ /// _(desktop, 2, auto)
380
+ ///
381
+ /// @example scss - Call $key breakpoint by alias
382
+ /// _(desktop) { ... }
383
+ ///
384
+ /// @example scss - From $key breakpoint to infinity
385
+ /// _(from laptop to infinity) { ... }
386
+ ///
387
+ /// @example scss - From $key-x breakpoint to $key-y breakpoint
388
+ /// _(from tablet to laptop) { ... }
389
+ ///
390
+ /// @example scss - From $num-x to $num-y
391
+ /// _(from 20em to laptop) { ... }
392
+ ///
393
+ /// @example scss - Greater than $key breakpoint
394
+ /// _(greater than tablet) { ... }
395
+ ///
396
+ /// @example scss - Greater than number
397
+ /// _(greater than 15em) { ... }
398
+ ///
399
+ /// @example scss - Number greater than $key breakpoint
400
+ /// _(5em greater than mobile) { ... }
401
+ ///
402
+ /// @example scss - Less than $key breakpoint
403
+ /// _(less than laptop) { ... }
404
+ ///
405
+ /// @example scss - Less than number
406
+ /// _(less than 35em) { ... }
407
+ ///
408
+ /// @example scss - Number less than $key breakpoint
409
+ /// _(10em less than laptop) { ... }
410
+ ///
411
+ /// @example scss - For $key-x $key-y $key-z...
412
+ /// _(for mobile tablet desktop) { ... }
413
+ ///
414
+ /// @example scss - Clear
415
+ /// _(clear)
416
+ ///
417
+ /// @example scss - Foundation
418
+ /// _(foundation)
419
+ ///
420
+ /// @example scss - Container
421
+ /// _(container)
422
+ ///
423
+ /// ----
424
+ ///
425
+ /// @author Ezekiel Gabrielse
426
+ /// @link http://flint.gs
427
+ ///
428
+ /// @group Public API
429
+ ///
430
+ @mixin _(
431
+ $key: null,
432
+ $span: null,
433
+ $context: null,
434
+ $gutter: null
435
+ ) {
436
+
437
+ //
438
+ // Get unit to modify queries with
439
+ //
440
+ $unit: null;
441
+
442
+ @if flint-get-config-unit() == "rem" {
443
+ $unit: flint-to-rem(1px);
444
+ } @else if flint-get-config-unit() == "em" {
445
+ $unit: flint-to-em(1px);
446
+ } @else {
447
+ $unit: 1;
448
+ }
449
+
450
+ //
451
+ // Clearfix
452
+ //
453
+ @if $key == "clear" or $span == "clear" or $context == "clear" {
454
+
455
+ //
456
+ // Check if key exists as breakpoint, and if so wrap
457
+ // in query to not affect other breakpoints
458
+ //
459
+ @if map-has-key(map-get($flint, "breakpoints"), $key) {
460
+
461
+ @if flint-get-value("settings", "grid") == "fluid" {
462
+ @if flint-is-highest-breakpoint($key) {
463
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
464
+ @include flint-clearfix;
465
+ @content;
466
+ }
467
+ } @else {
468
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
469
+ @include flint-clearfix;
470
+ @content;
471
+ }
472
+ }
473
+ } @else if flint-get-value("settings", "grid") == "fixed" {
474
+ @if flint-is-highest-breakpoint($key) {
475
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
476
+ @include flint-clearfix;
477
+ @content;
478
+ }
479
+ } @else {
480
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
481
+ @include flint-clearfix;
482
+ @content;
483
+ }
484
+ }
485
+ }
486
+
487
+ } @else {
488
+
489
+ @include flint-clearfix;
490
+ @content;
491
+
492
+ }
493
+ }
494
+
495
+ //
496
+ // Apply grid overlay if debug mode is enabled
497
+ //
498
+ @if not $flint-overlay and flint-get-value("settings", "debug-mode") {
499
+ $flint-overlay: true !global;
500
+ @include flint-overlay-grid;
501
+ }
502
+
503
+ //
504
+ // Foundation
505
+ //
506
+ @if $key == "foundation" {
507
+
508
+ // Apply global border-box-sizing if set to true
509
+ @if flint-get-value("settings", "border-box-sizing") {
510
+ $flint-foundation: true !global;
511
+ }
512
+
513
+ // Foundation is now globally existant
514
+ @if $flint-foundation {
515
+ @at-root *, *:before, *:after {
516
+ @include flint-box-sizing;
517
+ @content;
518
+ }
519
+ }
520
+
521
+ //
522
+ // Container
523
+ //
524
+ } @else if $key == "container" or $span == "container" or $context == "container" {
525
+
526
+ // Apply individually if foundation is not set globally, but is set to true in config
527
+ @if flint-get-value("settings", "border-box-sizing") and not $flint-foundation {
528
+ @include _("foundation");
529
+ }
530
+
531
+ // Output container for each breakpoint if fixed grid
532
+ @if $key == "container" and flint-get-value("settings", "grid") == "fixed" {
533
+
534
+ @for $i from 1 through length($flint-all-keys) {
535
+
536
+ // Set up variables
537
+ $calc-key: flint-steal-key($i);
538
+
539
+ // Key is default, no media queries
540
+ @if flint-is-default($calc-key) {
541
+
542
+ @include flint-container($calc-key, $i) {
543
+ @content;
544
+ }
545
+
546
+ // Not default, wrap in media queries
547
+ } @else {
548
+
549
+ // Highest breakpoint? No max-width
550
+ @if flint-is-highest-breakpoint($calc-key) {
551
+
552
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
553
+ @include flint-container($calc-key, $i) {
554
+ @content;
555
+ }
556
+ }
557
+
558
+ } @else {
559
+
560
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, $i) - $unit) ) {
561
+ @include flint-container($calc-key, $i) {
562
+ @content;
563
+ }
564
+ }
565
+
566
+ }
567
+ }
568
+ }
569
+
570
+ // Output container for specific breakpoint if exists
571
+ } @else if map-has-key(map-get($flint, "breakpoints"), $key) and flint-get-value("settings", "grid") == "fixed" {
572
+
573
+ @if flint-is-highest-breakpoint($key) {
574
+
575
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
576
+ @include flint-container($key) {
577
+ @content;
578
+ }
579
+ }
580
+
581
+ } @else {
582
+
583
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
584
+ @include flint-container($key) {
585
+ @content;
586
+ }
587
+ }
588
+
589
+ }
590
+ } @else if map-has-key(map-get($flint, "breakpoints"), $key) and flint-get-value("settings", "grid") == "fluid" {
591
+ @if flint-is-highest-breakpoint($key) {
592
+
593
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
594
+ @include flint-container {
595
+ @content;
596
+ }
597
+ }
598
+
599
+ } @else {
600
+
601
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
602
+ @include flint-container {
603
+ @content;
604
+ }
605
+ }
606
+
607
+ }
608
+ } @else {
609
+ @include flint-container {
610
+ @content;
611
+ }
612
+ }
613
+
614
+ //
615
+ // Create a new instance, add to global instance map
616
+ //
617
+ } @else {
618
+
619
+ // Apply individually if foundation is not set globally, but is set to true in config
620
+ @if flint-get-value("settings", "border-box-sizing") and not $flint-foundation {
621
+ @include _("foundation");
622
+ }
623
+
624
+ //
625
+ // Recursive shorthand with no context
626
+ //
627
+ @if flint-is-number($key) and length($key) == 1 and $span == null
628
+
629
+ //
630
+ // Recursive shorthand with identical context
631
+ //
632
+ or flint-is-number($key) and length($key) == 1 and flint-is-number($span) and length($span) == 1
633
+ or flint-is-number($key) and length($key) == 1 and $span == "auto"
634
+
635
+ //
636
+ // Recursive shorthand with differing context
637
+ //
638
+ or flint-is-number($key) and length($key) == 1 and flint-types-in-list($span, "number")
639
+ or flint-is-number($key) and length($key) == 1 and $span == "auto"
640
+
641
+ //
642
+ // Variable shorthand with no context
643
+ //
644
+ or flint-types-in-list($key, "number") and $span == null
645
+
646
+ //
647
+ // Variable shorthand with identical context
648
+ //
649
+ or flint-types-in-list($key, "number") and flint-is-number($span) and length($span) == 1
650
+ or flint-types-in-list($key, "number") and $span == "auto"
651
+
652
+ //
653
+ // Variable shorthand with differing context
654
+ //
655
+ or flint-types-in-list($key, "number") and flint-types-in-list($span, "number")
656
+ or flint-types-in-list($key, "number") and $span == "auto" {
657
+
658
+ // Emit erroring for invalid argument lengths
659
+ @if flint-types-in-list($key, "number") and length($key) != length($flint-all-keys) {
660
+ @if not $flint-development-mode {
661
+ @error "Invalid argument length of #{length($key)} for span. Please provide an argument for each breakpoint in your config (#{length($flint-all-keys)}). Your argument was: #{$key}";
662
+ }
663
+ } @else if flint-types-in-list($span, "number") and length($span) != length($flint-all-keys) {
664
+ @if not $flint-development-mode {
665
+ @error "Invalid argument length of #{length($span)} for context. Please provide an argument for each breakpoint in your config (#{length($flint-all-keys)}). Your argument was: #{$span}";
666
+ }
667
+ } @else {
668
+
669
+ @for $i from 1 through length($flint-all-keys) {
670
+
671
+ $calc-key: flint-steal-key($i);
672
+ $calc-span: $key;
673
+ $calc-context: $span;
674
+ $calc-gutter: $gutter;
675
+
676
+ @if flint-is-default($calc-key) {
677
+
678
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
679
+ @content;
680
+ }
681
+
682
+ } @else {
683
+
684
+ @if flint-get-value("settings", "grid") == "fluid" {
685
+
686
+ @if flint-is-highest-breakpoint($calc-key) {
687
+
688
+ @media ( min-width: (flint-calc-breakpoint("next", $calc-key, $i) + $unit) ) {
689
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
690
+ @content;
691
+ }
692
+ }
693
+
694
+ } @else {
695
+
696
+ @media ( min-width: (flint-calc-breakpoint("next", $calc-key, $i) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
697
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
698
+ @content;
699
+ }
700
+ }
701
+
702
+ }
703
+
704
+ } @else if flint-get-value("settings", "grid") == "fixed" {
705
+
706
+ @if flint-is-highest-breakpoint($calc-key) {
707
+
708
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) {
709
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
710
+ @content;
711
+ }
712
+ }
713
+
714
+ } @else {
715
+
716
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, $i) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, $i) - $unit) ) {
717
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $i) {
718
+ @content;
719
+ }
720
+ }
721
+
722
+ }
723
+
724
+ } @else {
725
+ @if not $flint-development-mode {
726
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
727
+ }
728
+ }
729
+ }
730
+ }
731
+ }
732
+
733
+ //
734
+ // Call by alias with no context
735
+ //
736
+ } @else if flint-is-string($key) and flint-is-number($span) and $context == null
737
+
738
+ //
739
+ // Call by alias with context
740
+ //
741
+ or flint-is-string($key) and flint-is-number($span) and flint-is-number($context)
742
+ or flint-is-string($key) and flint-is-number($span) and $context == "auto" {
743
+
744
+ // Throw error for invalid argument lengths
745
+ @if not map-has-key(map-get($flint, "breakpoints"), $key) {
746
+ @if not $flint-development-mode {
747
+ @error "Invalid argument: #{$key}. Breakpoint does not exist. Please provide a valid argument.";
748
+ }
749
+ } @else {
750
+
751
+ $calc-key: $key;
752
+ $calc-span: $span;
753
+ $calc-context: $context;
754
+ $calc-gutter: $gutter;
755
+
756
+ @if flint-is-default($calc-key) {
757
+
758
+ @include flint-calculate ($calc-key, $calc-span, $calc-context, $calc-gutter) {
759
+ @content;
760
+ }
761
+
762
+ } @else {
763
+
764
+ @if flint-get-value("settings", "grid") == "fluid" {
765
+
766
+ @if flint-is-highest-breakpoint($calc-key) {
767
+
768
+ @media ( min-width: (flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + $unit) ) {
769
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
770
+ @content;
771
+ }
772
+ }
773
+
774
+ } @else {
775
+
776
+ @media ( min-width: (flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) {
777
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
778
+ @content;
779
+ }
780
+ }
781
+
782
+ }
783
+
784
+ } @else if flint-get-value("settings", "grid") == "fixed" {
785
+
786
+ @if flint-is-highest-breakpoint($calc-key) {
787
+
788
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) {
789
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
790
+ @content;
791
+ }
792
+ }
793
+
794
+ } @else {
795
+
796
+ @media ( min-width: flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key)) ) and ( max-width: (flint-calc-breakpoint("prev", $calc-key, flint-get-index($calc-key)) - $unit) ) {
797
+ @include flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter) {
798
+ @content;
799
+ }
800
+ }
801
+
802
+ }
803
+
804
+ } @else {
805
+ @if not $flint-development-mode {
806
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
807
+ }
808
+ }
809
+ }
810
+ }
811
+
812
+ //
813
+ // Wrap content in media query
814
+ //
815
+ } @else if map-has-key(map-get($flint, "breakpoints"), $key) and $span == null and $context == null
816
+ or flint-is-list($key) and $span == null and $context == null {
817
+
818
+ //
819
+ // Call $key breakpoint by alias
820
+ //
821
+ @if length($key) == 1 {
822
+
823
+ @if flint-get-value("settings", "grid") == "fluid" {
824
+ @if flint-is-highest-breakpoint($key) {
825
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + $unit) ) {
826
+ @content;
827
+ }
828
+ } @else {
829
+ @media ( min-width: (flint-calc-breakpoint("next", $key, flint-get-index($key)) + if(flint-is-lowest-breakpoint($key), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
830
+ @content;
831
+ }
832
+ }
833
+ } @else if flint-get-value("settings", "grid") == "fixed" {
834
+ @if flint-is-highest-breakpoint($key) {
835
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) {
836
+ @content;
837
+ }
838
+ } @else {
839
+ @media ( min-width: flint-calc-breakpoint("alias", $key, flint-get-index($key)) ) and ( max-width: (flint-calc-breakpoint("prev", $key, flint-get-index($key)) - $unit) ) {
840
+ @content;
841
+ }
842
+ }
843
+ } @else {
844
+ @if not $flint-development-mode {
845
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
846
+ }
847
+ }
848
+
849
+ //
850
+ // From $key breakpoint to infinity
851
+ //
852
+ } @else if flint-types-in-list($key, "string", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" and nth($key, 4) == "infinity" {
853
+
854
+ @if flint-get-value("settings", "grid") == "fluid" {
855
+ @media ( min-width: (flint-calc-breakpoint("next", nth($key, 2), flint-get-index(nth($key, 2))) + if(flint-is-lowest-breakpoint(nth($key, 2)), 0, $unit)) ) {
856
+ @content;
857
+ }
858
+ } @else if flint-get-value("settings", "grid") == "fixed" {
859
+ @media ( min-width: flint-calc-breakpoint("alias", nth($key, 2), flint-get-index(nth($key, 2))) ) {
860
+ @content;
861
+ }
862
+ } @else {
863
+ @if not $flint-development-mode {
864
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
865
+ }
866
+ }
867
+
868
+ //
869
+ // From $key-x breakpoint to $key-y breakpoint
870
+ //
871
+ } @else if flint-types-in-list($key, "string", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" {
872
+
873
+ @if flint-get-value("settings", "grid") == "fluid" {
874
+ @media ( min-width: (flint-calc-breakpoint("next", nth($key, 2), flint-get-index(nth($key, 2))) + if(flint-is-lowest-breakpoint(nth($key, 2)), 0, $unit)) ) and ( max-width: flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) ) {
875
+ @content;
876
+ }
877
+ } @else if flint-get-value("settings", "grid") == "fixed" {
878
+ @media ( min-width: flint-calc-breakpoint("alias", nth($key, 2), flint-get-index(nth($key, 2))) ) and ( max-width: (flint-calc-breakpoint("prev", nth($key, 4), flint-get-index(nth($key, 4))) - if(flint-is-highest-breakpoint(nth($key, 4)), 0, $unit)) ) {
879
+ @content;
880
+ }
881
+ } @else {
882
+ @if not $flint-development-mode {
883
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
884
+ }
885
+ }
886
+
887
+ //
888
+ // From $num-x to $num-y
889
+ //
890
+ } @else if flint-types-in-list($key, "string" "number" "string" "number", 4) and nth($key, 1) == "from" and nth($key, 3) == "to" {
891
+ // Make sure passed units match units used in config
892
+ @if flint-get-config-unit() == unit(nth($key, 2)) and flint-get-config-unit() == unit(nth($key, 4)) {
893
+ @media ( min-width: nth($key, 2) ) and ( max-width: nth($key, 4) ) {
894
+ @content;
895
+ }
896
+ // Throw error
897
+ } @else {
898
+ @if not $flint-development-mode {
899
+ @error "Passed units [#{unit(nth($key, 2))}, #{unit(nth($key, 4))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
900
+ }
901
+ }
902
+
903
+ //
904
+ // Greater than $key breakpoint
905
+ //
906
+ } @else if flint-types-in-list($key, "string", 3) and nth($key, 1) == "greater" and nth($key, 2) == "than" {
907
+
908
+ @if flint-get-value("settings", "grid") == "fluid" {
909
+ @media ( min-width: (flint-calc-breakpoint("alias", nth($key, 3), flint-get-index(nth($key, 3))) + $unit) ) {
910
+ @content;
911
+ }
912
+ } @else if flint-get-value("settings", "grid") == "fixed" {
913
+ @media ( min-width: flint-calc-breakpoint("prev", nth($key, 3), flint-get-index(nth($key, 3))) ) {
914
+ @content;
915
+ }
916
+ } @else {
917
+ @if not $flint-development-mode {
918
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
919
+ }
920
+ }
921
+
922
+ //
923
+ // Greater than number
924
+ //
925
+ } @else if flint-types-in-list($key, "string" "string" "number", 3) and nth($key, 1) == "greater" and nth($key, 2) == "than" {
926
+
927
+ @if flint-get-config-unit() == unit(nth($key, 3)) {
928
+ @media ( min-width: nth($key, 3) + $unit ) {
929
+ @content;
930
+ }
931
+ } @else {
932
+ @if not $flint-development-mode {
933
+ @error "Passed units [#{unit(nth($key, 3))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
934
+ }
935
+ }
936
+
937
+ //
938
+ // Number greater than $key breakpoint
939
+ //
940
+ } @else if flint-types-in-list($key, "number" "string" "string" "string", 4) and nth($key, 2) == "greater" and nth($key, 3) == "than" {
941
+
942
+ @if flint-get-config-unit() == unit(nth($key, 1)) {
943
+ @media ( min-width: (flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) + nth($key, 1)) ) {
944
+ @content;
945
+ }
946
+ } @else {
947
+ @if not $flint-development-mode {
948
+ @error "Passed units [#{unit(nth($key, 1))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
949
+ }
950
+ }
951
+
952
+ //
953
+ // Less than $key breakpoint
954
+ //
955
+ } @else if flint-types-in-list($key, "string", 3) and nth($key, 1) == "less" and nth($key, 2) == "than" {
956
+
957
+ @if flint-get-value("settings", "grid") == "fluid" {
958
+ @media ( max-width: flint-calc-breakpoint("next", nth($key, 3), flint-get-index(nth($key, 3))) ) {
959
+ @content;
960
+ }
961
+ } @else if flint-get-value("settings", "grid") == "fixed" {
962
+ @media ( max-width: (flint-calc-breakpoint("alias", nth($key, 3), flint-get-index(nth($key, 3))) - $unit) ) {
963
+ @content;
964
+ }
965
+ } @else {
966
+ @if not $flint-development-mode {
967
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
968
+ }
969
+ }
970
+
971
+ //
972
+ // Less than number
973
+ //
974
+ } @else if flint-types-in-list($key, "string" "string" "number", 3) and nth($key, 1) == "less" and nth($key, 2) == "than" {
975
+
976
+ @if flint-get-config-unit() == unit(nth($key, 3)) {
977
+ @media ( max-width: nth($key, 3) - $unit ) {
978
+ @content;
979
+ }
980
+ } @else {
981
+ @if not $flint-development-mode {
982
+ @error "Passed units [#{unit(nth($key, 3))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
983
+ }
984
+ }
985
+
986
+ //
987
+ // Number less than $key breakpoint
988
+ //
989
+ } @else if flint-types-in-list($key, "number" "string" "string" "string", 4) and nth($key, 2) == "less" and nth($key, 3) == "than" {
990
+
991
+ @if flint-get-config-unit() == unit(nth($key, 1)) {
992
+ @media ( max-width: (flint-calc-breakpoint("alias", nth($key, 4), flint-get-index(nth($key, 4))) - nth($key, 1)) ) {
993
+ @content;
994
+ }
995
+ } @else {
996
+ @if not $flint-development-mode {
997
+ @error "Passed units [#{unit(nth($key, 1))}] do not match the unit used in your config map: #{flint-get-config-unit()}";
998
+ }
999
+ }
1000
+
1001
+ //
1002
+ // For $key-x $key-y $key-z
1003
+ //
1004
+ } @else if flint-types-in-list($key, "string") and nth($key, 1) == "for" {
1005
+ // Define empty query list
1006
+ $query: ();
1007
+
1008
+ //
1009
+ // Build out comma delimited query list for each breakpoint
1010
+ //
1011
+ @for $i from 1 through length($key) {
1012
+ $calc-key: nth($key, $i);
1013
+
1014
+ @if map-has-key(map-get($flint, "breakpoints"), $calc-key) {
1015
+ @if flint-get-value("settings", "grid") == "fluid" {
1016
+ @if flint-is-highest-breakpoint($calc-key) {
1017
+ $query: append($query, unquote('( min-width: #{(flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + $unit)} )'), "comma");
1018
+ } @else {
1019
+ $query: append($query, unquote('( min-width: #{(flint-calc-breakpoint("next", $calc-key, flint-get-index($calc-key)) + if(flint-is-lowest-breakpoint($calc-key), 0, $unit))} ) and ( max-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} )'), "comma");
1020
+ }
1021
+ } @else if flint-get-value("settings", "grid") == "fixed" {
1022
+ @if flint-is-highest-breakpoint($calc-key) {
1023
+ $query: append($query, unquote('( min-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} )'), "comma");
1024
+ } @else {
1025
+ $query: append($query, unquote('( min-width: #{flint-calc-breakpoint("alias", $calc-key, flint-get-index($calc-key))} ) and ( max-width: #{(flint-calc-breakpoint("prev", $calc-key, flint-get-index($calc-key)) - $unit)} )'), "comma");
1026
+ }
1027
+ } @else {
1028
+ @if not $flint-development-mode {
1029
+ @error "Invalid gutter settings in config map: #{flint-get-value('settings', 'grid')}. Valid arguments: fluid, fixed";
1030
+ }
1031
+ }
1032
+ } @else {
1033
+ @if not $calc-key == "for" {
1034
+ @if not $flint-development-mode {
1035
+ @error "Invalid argument: #{$calc-key}. Breakpoint does not exist. Please provide a valid argument.";
1036
+ }
1037
+ }
1038
+ }
1039
+ }
1040
+
1041
+ @media #{$query} {
1042
+ @content;
1043
+ }
1044
+ }
1045
+
1046
+ //
1047
+ // Invalid argument
1048
+ //
1049
+ } @else {
1050
+ @if $key != "clear" {
1051
+ @if not $flint-development-mode {
1052
+ @error "Invalid argument(s). Please double check and provide a valid argument. If you're calling by alias, please provide a single span argument for your breakpoint. See documentation for additional details.";
1053
+ }
1054
+ }
1055
+ }
1056
+ }
1057
+ }