flint-gs 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +99 -98
- data/lib/flint-gs.rb +8 -0
- data/lib/flint.rb +22 -16
- data/lib/flint/functions.rb +99 -99
- data/lib/flint/version.rb +3 -3
- data/stylesheets/_flint.scss +7 -7
- data/stylesheets/flint/config/_config.scss +56 -56
- data/stylesheets/flint/functions/_functions.scss +48 -48
- data/stylesheets/flint/functions/helpers/_helpers.scss +229 -229
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +47 -47
- data/stylesheets/flint/functions/lib/_calc-width.scss +70 -70
- data/stylesheets/flint/functions/lib/_fluid-width.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-index.scss +21 -21
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +84 -84
- data/stylesheets/flint/functions/lib/_html-encode.scss +14 -14
- data/stylesheets/flint/functions/lib/_instance.scss +48 -48
- data/stylesheets/flint/functions/lib/_last.scss +14 -14
- data/stylesheets/flint/functions/lib/_list-to-str.scss +38 -38
- data/stylesheets/flint/functions/lib/_map-fetch.scss +31 -31
- data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
- data/stylesheets/flint/functions/lib/_purge.scss +24 -24
- data/stylesheets/flint/functions/lib/_remove.scss +18 -18
- data/stylesheets/flint/functions/lib/_replace.scss +30 -30
- data/stylesheets/flint/functions/lib/_steal-key.scss +32 -32
- data/stylesheets/flint/functions/lib/_steal-values.scss +15 -15
- data/stylesheets/flint/functions/lib/_str-replace.scss +39 -39
- data/stylesheets/flint/functions/lib/_str-to-list.scss +89 -89
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +37 -37
- data/stylesheets/flint/functions/lib/_support-syntax.scss +31 -31
- data/stylesheets/flint/functions/lib/_types-in-list.scss +76 -76
- data/stylesheets/flint/functions/lib/_use-syntax.scss +22 -22
- data/stylesheets/flint/globals/_globals.scss +122 -122
- data/stylesheets/flint/mixins/_mixins.scss +11 -11
- data/stylesheets/flint/mixins/lib/_box-sizing.scss +18 -18
- data/stylesheets/flint/mixins/lib/_calculate.scss +241 -241
- data/stylesheets/flint/mixins/lib/_clearfix.scss +29 -29
- data/stylesheets/flint/mixins/lib/_container.scss +45 -45
- data/stylesheets/flint/mixins/lib/_grid-overlay.scss +73 -73
- data/stylesheets/flint/mixins/lib/_main.scss +1057 -1057
- data/stylesheets/flint/mixins/lib/_new-instance.scss +28 -28
- data/stylesheets/flint/mixins/lib/_print-instance.scss +44 -44
- data/tests/config.rb +22 -34
- data/tests/input/functions/_functions.scss +47 -47
- data/tests/input/functions/helpers/_helpers.scss +437 -437
- data/tests/input/functions/lib/_calc-breakpoint.scss +62 -62
- data/tests/input/functions/lib/_calc-width.scss +195 -195
- data/tests/input/functions/lib/_fluid-width.scss +32 -32
- data/tests/input/functions/lib/_get-index.scss +31 -31
- data/tests/input/functions/lib/_get-instance-value.scss +72 -72
- data/tests/input/functions/lib/_get-value.scss +28 -28
- data/tests/input/functions/lib/_has-family-instance.scss +35 -35
- data/tests/input/functions/lib/_instance.scss +187 -187
- data/tests/input/functions/lib/_last.scss +18 -18
- data/tests/input/functions/lib/_list-to-str.scss +28 -28
- data/tests/input/functions/lib/_map-fetch.scss +34 -34
- data/tests/input/functions/lib/_next-index.scss +24 -24
- data/tests/input/functions/lib/_purge.scss +14 -14
- data/tests/input/functions/lib/_remove.scss +14 -14
- data/tests/input/functions/lib/_replace.scss +14 -14
- data/tests/input/functions/lib/_steal-key.scss +19 -19
- data/tests/input/functions/lib/_steal-values.scss +16 -16
- data/tests/input/functions/lib/_str-replace.scss +14 -14
- data/tests/input/functions/lib/_str-to-list.scss +28 -28
- data/tests/input/functions/lib/_support-syntax-bem.scss +14 -14
- data/tests/input/functions/lib/_support-syntax.scss +21 -21
- data/tests/input/functions/lib/_types-in-list.scss +50 -50
- data/tests/input/functions/lib/_use-syntax.scss +14 -14
- data/tests/input/output.scss +250 -250
- data/tests/output/output.css +3499 -3499
- data/tests/tests.html +110 -110
- metadata +12 -212
- data/tests/bootcamp/CHANGELOG.md +0 -70
- data/tests/bootcamp/CONTRIBUTING.md +0 -72
- data/tests/bootcamp/Gruntfile.coffee +0 -34
- data/tests/bootcamp/LICENSE.md +0 -7
- data/tests/bootcamp/README.md +0 -52
- data/tests/bootcamp/bower.json +0 -15
- data/tests/bootcamp/dist/_bootcamp.scss +0 -46
- data/tests/bootcamp/dist/bootcamp.coffee +0 -101
- data/tests/bootcamp/dist/core/functions/_actual.scss +0 -3
- data/tests/bootcamp/dist/core/functions/_error.scss +0 -29
- data/tests/bootcamp/dist/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/dist/core/functions/_should.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_to.scss +0 -5
- data/tests/bootcamp/dist/core/mixins/_describe.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_it.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_runner.scss +0 -28
- data/tests/bootcamp/dist/core/mixins/_should.scss +0 -46
- data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +0 -9
- data/tests/bootcamp/dist/core/mixins/_xit.scss +0 -9
- data/tests/bootcamp/dist/core/variables/_helpers.scss +0 -5
- data/tests/bootcamp/dist/core/variables/_settings.scss +0 -2
- data/tests/bootcamp/dist/core/variables/_should.scss +0 -6
- data/tests/bootcamp/dist/core/variables/_trackers.scss +0 -6
- data/tests/bootcamp/dist/lib/_sassyjson.scss +0 -1075
- data/tests/bootcamp/dist/matchers/_be.scss +0 -3
- data/tests/bootcamp/dist/matchers/_equal.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +0 -47
- data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +0 -3
- data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-null.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +0 -3
- data/tests/bootcamp/dist/utils/_contain.scss +0 -15
- data/tests/bootcamp/dist/utils/_equal.scss +0 -23
- data/tests/bootcamp/dist/utils/_list-join.scss +0 -35
- data/tests/bootcamp/dist/utils/_power.scss +0 -15
- data/tests/bootcamp/package.json +0 -63
- data/tests/bootcamp/tasks/bootcamp.coffee +0 -83
- data/tests/bootcamp/test/core/functions/_actual.scss +0 -10
- data/tests/bootcamp/test/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/test/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/test/core/functions/_should.scss +0 -10
- data/tests/bootcamp/test/core/functions/_to.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_describe.scss +0 -11
- data/tests/bootcamp/test/core/mixins/_it.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_should.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_xdescribe.scss +0 -28
- data/tests/bootcamp/test/core/mixins/_xit.scss +0 -12
- data/tests/bootcamp/test/matchers/_be.scss +0 -90
- data/tests/bootcamp/test/matchers/_equal.scss +0 -33
- data/tests/bootcamp/test/matchers/lists/_be-empty.scss +0 -12
- data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_contain.scss +0 -39
- data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +0 -51
- data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +0 -151
- data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +0 -31
- data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +0 -24
- data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +0 -16
- data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +0 -16
- data/tests/bootcamp/test/matchers/types/_be-falsy.scss +0 -14
- data/tests/bootcamp/test/matchers/types/_be-null.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_be-truthy.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_have-type-of.scss +0 -17
- data/tests/bootcamp/test/specs.scss +0 -45
- data/tests/bootcamp/test/utils/_contain.scss +0 -41
- data/tests/bootcamp/test/utils/_equal.scss +0 -79
- data/tests/bootcamp/test/utils/_list-join.scss +0 -39
- data/tests/bootcamp/test/utils/_power.scss +0 -13
- data/tests/sass-prof.log +0 -0
@@ -1,18 +1,18 @@
|
|
1
|
-
///
|
2
|
-
/// Box sizing
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $type ["border-box"] - border-box type
|
7
|
-
///
|
8
|
-
/// @requires {Mixin} box-sizing - local mixin if available
|
9
|
-
///
|
10
|
-
/// @group Internal Mixins
|
11
|
-
///
|
12
|
-
@mixin flint-box-sizing($type: "border-box") {
|
13
|
-
@if mixin-exists("box-sizing") {
|
14
|
-
@include box-sizing($type);
|
15
|
-
} @else {
|
16
|
-
box-sizing: #{$type};
|
17
|
-
}
|
18
|
-
}
|
1
|
+
///
|
2
|
+
/// Box sizing
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $type ["border-box"] - border-box type
|
7
|
+
///
|
8
|
+
/// @requires {Mixin} box-sizing - local mixin if available
|
9
|
+
///
|
10
|
+
/// @group Internal Mixins
|
11
|
+
///
|
12
|
+
@mixin flint-box-sizing($type: "border-box") {
|
13
|
+
@if mixin-exists("box-sizing") {
|
14
|
+
@include box-sizing($type);
|
15
|
+
} @else {
|
16
|
+
box-sizing: #{$type};
|
17
|
+
}
|
18
|
+
}
|
@@ -1,241 +1,241 @@
|
|
1
|
-
////
|
2
|
-
/// @group Internal Mixins
|
3
|
-
////
|
4
|
-
|
5
|
-
///
|
6
|
-
/// Outputs calculated styles
|
7
|
-
///
|
8
|
-
/// @access private
|
9
|
-
///
|
10
|
-
/// @param {Map} $width - map of target / context values
|
11
|
-
/// @param {Number} $margin-right - right margin value
|
12
|
-
/// @param {Number} $margin-left - left margin value
|
13
|
-
///
|
14
|
-
@mixin flint-output($width, $margin-right, $margin-left) {
|
15
|
-
|
16
|
-
@if not flint-is-map($width) {
|
17
|
-
@if not $flint-development-mode {
|
18
|
-
@error "Passed $width (#{$width}) was not a map; a map containing a target / context combination is required."
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
@if flint-get-value("settings", "grid") == "fluid" {
|
23
|
-
width: flint-fluid-width(map-get($width, "target"), map-get($width, "context"));
|
24
|
-
margin-right: if(flint-is-number($margin-right) and $margin-right != 0, flint-fluid-width($margin-right, map-get($width, "context")), $margin-right);
|
25
|
-
margin-left: if(flint-is-number($margin-left) and $margin-left != 0, flint-fluid-width($margin-left, map-get($width, "context")), $margin-left);
|
26
|
-
} @else {
|
27
|
-
width: map-get($width, "target");
|
28
|
-
margin-right: $margin-right;
|
29
|
-
margin-left: $margin-left;
|
30
|
-
}
|
31
|
-
|
32
|
-
@content;
|
33
|
-
}
|
34
|
-
|
35
|
-
///
|
36
|
-
/// Calculate widths, save all variables to instance
|
37
|
-
///
|
38
|
-
/// @access private
|
39
|
-
///
|
40
|
-
/// @param {String} $calc-key - breakpoint key
|
41
|
-
/// @param {Number} $calc-span - span value
|
42
|
-
/// @param {Number} $calc-context - context value
|
43
|
-
/// @param {String} $calc-gutter - gutter modifier
|
44
|
-
/// @param {Number|Null} $i - index if variable length is > 1
|
45
|
-
///
|
46
|
-
@mixin flint-calculate($key, $span, $context, $gutter, $i: null) {
|
47
|
-
|
48
|
-
// Define local vars
|
49
|
-
$calc-key: $key;
|
50
|
-
$calc-span: $span;
|
51
|
-
$calc-context: $context;
|
52
|
-
$calc-gutter: $gutter;
|
53
|
-
|
54
|
-
// Define default values
|
55
|
-
$output-width-map: null;
|
56
|
-
$output-margin-right: null;
|
57
|
-
$output-margin-left: null;
|
58
|
-
|
59
|
-
// Track errors
|
60
|
-
$errors: false;
|
61
|
-
|
62
|
-
// Default value for cache search result
|
63
|
-
$cached: false;
|
64
|
-
|
65
|
-
//
|
66
|
-
// Check lengths, if invalid throw error
|
67
|
-
//
|
68
|
-
@if flint-types-in-list($calc-gutter, "string") and length($calc-gutter) != length($flint-all-keys) {
|
69
|
-
@if not $flint-development-mode {
|
70
|
-
@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}";
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
//
|
75
|
-
// Check if any arguments are lists if called from loop
|
76
|
-
//
|
77
|
-
@if $i {
|
78
|
-
|
79
|
-
@if flint-types-in-list($calc-key, "number") {
|
80
|
-
$calc-key: nth($calc-key, $i);
|
81
|
-
}
|
82
|
-
@if flint-types-in-list($calc-span, "number") {
|
83
|
-
$calc-span: nth($calc-span, $i);
|
84
|
-
}
|
85
|
-
@if flint-types-in-list($calc-context, "number") {
|
86
|
-
$calc-context: nth($calc-context, $i);
|
87
|
-
}
|
88
|
-
@if flint-types-in-list($calc-gutter, "string") {
|
89
|
-
$calc-gutter: nth($calc-gutter, $i);
|
90
|
-
}
|
91
|
-
|
92
|
-
}
|
93
|
-
|
94
|
-
//
|
95
|
-
// Check for cached results
|
96
|
-
//
|
97
|
-
@if $calc-context != "auto" and $calc-span != 0 {
|
98
|
-
@if map-has-key($flint-cached-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}") {
|
99
|
-
$result: map-get($flint-cached-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}");
|
100
|
-
|
101
|
-
// Get results
|
102
|
-
$output-width-map: nth($result, 1);
|
103
|
-
$output-margin-right: nth($result, 2);
|
104
|
-
$output-margin-left: nth($result, 3);
|
105
|
-
|
106
|
-
// Declare successful search
|
107
|
-
$cached: true;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
//
|
112
|
-
// Hide if span is zero
|
113
|
-
//
|
114
|
-
@if $calc-span == 0 {
|
115
|
-
|
116
|
-
// First check if it's the default, so we don't hide the element on all breakpoints
|
117
|
-
@if $calc-key == flint-get-value("settings", "default") {
|
118
|
-
@include _($calc-key) {
|
119
|
-
display: none;
|
120
|
-
}
|
121
|
-
// If we're hiding the default, but span is a list, define floats for other queries
|
122
|
-
@if flint-is-list($span) {
|
123
|
-
float: unquote(flint-get-value("settings", "float-direction"));
|
124
|
-
}
|
125
|
-
} @else {
|
126
|
-
display: none;
|
127
|
-
}
|
128
|
-
|
129
|
-
@if flint-get-value("settings", "instance-maps") {
|
130
|
-
@include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $output-width-map, $output-margin-right, $output-margin-left);
|
131
|
-
@include flint-debug-instance($calc-key);
|
132
|
-
}
|
133
|
-
|
134
|
-
} @else {
|
135
|
-
|
136
|
-
//
|
137
|
-
// Define floats if key is default, or this is a single instance call
|
138
|
-
//
|
139
|
-
@if flint-is-default($calc-key) and $gutter != "center" or $i == null and $gutter != "center" {
|
140
|
-
float: unquote(flint-get-value("settings", "float-direction"));
|
141
|
-
}
|
142
|
-
|
143
|
-
//
|
144
|
-
// Disable floats if gutter is set to center
|
145
|
-
//
|
146
|
-
$recursive-center: false;
|
147
|
-
|
148
|
-
@if $gutter == "center" {
|
149
|
-
$recursive-center: true;
|
150
|
-
}
|
151
|
-
|
152
|
-
// Check if default and gutter is recursive
|
153
|
-
@if flint-is-default($calc-key) and $recursive-center {
|
154
|
-
float: none;
|
155
|
-
// Check if default and gutter is not recurisve, wrap in query to not affect others
|
156
|
-
} @else if flint-is-default($calc-key) and $calc-gutter == "center" and not $recursive-center {
|
157
|
-
@include _($calc-key) {
|
158
|
-
float: none;
|
159
|
-
}
|
160
|
-
// Not default, check if gutter was set to center but not recursive
|
161
|
-
} @else if $calc-gutter == "center" and not $recursive-center or $i == null and $recursive-center {
|
162
|
-
float: none;
|
163
|
-
}
|
164
|
-
|
165
|
-
//
|
166
|
-
// Only run through if cache search was unsuccessful
|
167
|
-
//
|
168
|
-
@if not $cached {
|
169
|
-
|
170
|
-
$output-gutter: flint-get-gutter();
|
171
|
-
|
172
|
-
@if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
|
173
|
-
|
174
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
|
175
|
-
$output-margin-right: $output-gutter;
|
176
|
-
$output-margin-left: $output-gutter;
|
177
|
-
|
178
|
-
} @else if $calc-gutter == "inside" {
|
179
|
-
|
180
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 4));
|
181
|
-
$output-margin-right: $output-gutter;
|
182
|
-
$output-margin-left: $output-gutter;
|
183
|
-
|
184
|
-
} @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
|
185
|
-
|
186
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
|
187
|
-
$output-margin-right: $output-gutter;
|
188
|
-
$output-margin-left: 0;
|
189
|
-
|
190
|
-
} @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "last" {
|
191
|
-
|
192
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
|
193
|
-
$output-margin-right: 0;
|
194
|
-
$output-margin-left: $output-gutter;
|
195
|
-
|
196
|
-
} @else if $calc-gutter == "center" {
|
197
|
-
|
198
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
|
199
|
-
$output-margin-right: auto;
|
200
|
-
$output-margin-left: auto;
|
201
|
-
|
202
|
-
} @else if $calc-gutter == "row" or $calc-gutter == "none" {
|
203
|
-
|
204
|
-
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null));
|
205
|
-
$output-margin-right: 0;
|
206
|
-
$output-margin-left: 0;
|
207
|
-
|
208
|
-
} @else {
|
209
|
-
@if not $flint-development-mode {
|
210
|
-
@error "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
|
211
|
-
} @else {
|
212
|
-
$errors: true;
|
213
|
-
}
|
214
|
-
}
|
215
|
-
}
|
216
|
-
|
217
|
-
@if not $errors {
|
218
|
-
|
219
|
-
// Cache result
|
220
|
-
@if $calc-context != "auto" and $calc-span != 0 and not $cached {
|
221
|
-
$flint-cached-results: map-merge($flint-cached-results, (
|
222
|
-
"#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}": ($output-width-map, $output-margin-right, $output-margin-left)
|
223
|
-
)) !global;
|
224
|
-
}
|
225
|
-
|
226
|
-
// Output styles
|
227
|
-
@include flint-output($output-width-map, $output-margin-right, $output-margin-left) {
|
228
|
-
@content;
|
229
|
-
}
|
230
|
-
|
231
|
-
@if flint-get-value("settings", "instance-maps") {
|
232
|
-
|
233
|
-
// Create new instance
|
234
|
-
@include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, map-get($output-width-map, "target"), $output-margin-right, $output-margin-left);
|
235
|
-
|
236
|
-
// If debug mode, print instance
|
237
|
-
@include flint-debug-instance($calc-key);
|
238
|
-
}
|
239
|
-
}
|
240
|
-
}
|
241
|
-
}
|
1
|
+
////
|
2
|
+
/// @group Internal Mixins
|
3
|
+
////
|
4
|
+
|
5
|
+
///
|
6
|
+
/// Outputs calculated styles
|
7
|
+
///
|
8
|
+
/// @access private
|
9
|
+
///
|
10
|
+
/// @param {Map} $width - map of target / context values
|
11
|
+
/// @param {Number} $margin-right - right margin value
|
12
|
+
/// @param {Number} $margin-left - left margin value
|
13
|
+
///
|
14
|
+
@mixin flint-output($width, $margin-right, $margin-left) {
|
15
|
+
|
16
|
+
@if not flint-is-map($width) {
|
17
|
+
@if not $flint-development-mode {
|
18
|
+
@error "Passed $width (#{$width}) was not a map; a map containing a target / context combination is required."
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
@if flint-get-value("settings", "grid") == "fluid" {
|
23
|
+
width: flint-fluid-width(map-get($width, "target"), map-get($width, "context"));
|
24
|
+
margin-right: if(flint-is-number($margin-right) and $margin-right != 0, flint-fluid-width($margin-right, map-get($width, "context")), $margin-right);
|
25
|
+
margin-left: if(flint-is-number($margin-left) and $margin-left != 0, flint-fluid-width($margin-left, map-get($width, "context")), $margin-left);
|
26
|
+
} @else {
|
27
|
+
width: map-get($width, "target");
|
28
|
+
margin-right: $margin-right;
|
29
|
+
margin-left: $margin-left;
|
30
|
+
}
|
31
|
+
|
32
|
+
@content;
|
33
|
+
}
|
34
|
+
|
35
|
+
///
|
36
|
+
/// Calculate widths, save all variables to instance
|
37
|
+
///
|
38
|
+
/// @access private
|
39
|
+
///
|
40
|
+
/// @param {String} $calc-key - breakpoint key
|
41
|
+
/// @param {Number} $calc-span - span value
|
42
|
+
/// @param {Number} $calc-context - context value
|
43
|
+
/// @param {String} $calc-gutter - gutter modifier
|
44
|
+
/// @param {Number|Null} $i - index if variable length is > 1
|
45
|
+
///
|
46
|
+
@mixin flint-calculate($key, $span, $context, $gutter, $i: null) {
|
47
|
+
|
48
|
+
// Define local vars
|
49
|
+
$calc-key: $key;
|
50
|
+
$calc-span: $span;
|
51
|
+
$calc-context: $context;
|
52
|
+
$calc-gutter: $gutter;
|
53
|
+
|
54
|
+
// Define default values
|
55
|
+
$output-width-map: null;
|
56
|
+
$output-margin-right: null;
|
57
|
+
$output-margin-left: null;
|
58
|
+
|
59
|
+
// Track errors
|
60
|
+
$errors: false;
|
61
|
+
|
62
|
+
// Default value for cache search result
|
63
|
+
$cached: false;
|
64
|
+
|
65
|
+
//
|
66
|
+
// Check lengths, if invalid throw error
|
67
|
+
//
|
68
|
+
@if flint-types-in-list($calc-gutter, "string") and length($calc-gutter) != length($flint-all-keys) {
|
69
|
+
@if not $flint-development-mode {
|
70
|
+
@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}";
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
//
|
75
|
+
// Check if any arguments are lists if called from loop
|
76
|
+
//
|
77
|
+
@if $i {
|
78
|
+
|
79
|
+
@if flint-types-in-list($calc-key, "number") {
|
80
|
+
$calc-key: nth($calc-key, $i);
|
81
|
+
}
|
82
|
+
@if flint-types-in-list($calc-span, "number") {
|
83
|
+
$calc-span: nth($calc-span, $i);
|
84
|
+
}
|
85
|
+
@if flint-types-in-list($calc-context, "number") {
|
86
|
+
$calc-context: nth($calc-context, $i);
|
87
|
+
}
|
88
|
+
@if flint-types-in-list($calc-gutter, "string") {
|
89
|
+
$calc-gutter: nth($calc-gutter, $i);
|
90
|
+
}
|
91
|
+
|
92
|
+
}
|
93
|
+
|
94
|
+
//
|
95
|
+
// Check for cached results
|
96
|
+
//
|
97
|
+
@if $calc-context != "auto" and $calc-span != 0 {
|
98
|
+
@if map-has-key($flint-cached-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}") {
|
99
|
+
$result: map-get($flint-cached-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}");
|
100
|
+
|
101
|
+
// Get results
|
102
|
+
$output-width-map: nth($result, 1);
|
103
|
+
$output-margin-right: nth($result, 2);
|
104
|
+
$output-margin-left: nth($result, 3);
|
105
|
+
|
106
|
+
// Declare successful search
|
107
|
+
$cached: true;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
//
|
112
|
+
// Hide if span is zero
|
113
|
+
//
|
114
|
+
@if $calc-span == 0 {
|
115
|
+
|
116
|
+
// First check if it's the default, so we don't hide the element on all breakpoints
|
117
|
+
@if $calc-key == flint-get-value("settings", "default") {
|
118
|
+
@include _($calc-key) {
|
119
|
+
display: none;
|
120
|
+
}
|
121
|
+
// If we're hiding the default, but span is a list, define floats for other queries
|
122
|
+
@if flint-is-list($span) {
|
123
|
+
float: unquote(flint-get-value("settings", "float-direction"));
|
124
|
+
}
|
125
|
+
} @else {
|
126
|
+
display: none;
|
127
|
+
}
|
128
|
+
|
129
|
+
@if flint-get-value("settings", "instance-maps") {
|
130
|
+
@include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $output-width-map, $output-margin-right, $output-margin-left);
|
131
|
+
@include flint-debug-instance($calc-key);
|
132
|
+
}
|
133
|
+
|
134
|
+
} @else {
|
135
|
+
|
136
|
+
//
|
137
|
+
// Define floats if key is default, or this is a single instance call
|
138
|
+
//
|
139
|
+
@if flint-is-default($calc-key) and $gutter != "center" or $i == null and $gutter != "center" {
|
140
|
+
float: unquote(flint-get-value("settings", "float-direction"));
|
141
|
+
}
|
142
|
+
|
143
|
+
//
|
144
|
+
// Disable floats if gutter is set to center
|
145
|
+
//
|
146
|
+
$recursive-center: false;
|
147
|
+
|
148
|
+
@if $gutter == "center" {
|
149
|
+
$recursive-center: true;
|
150
|
+
}
|
151
|
+
|
152
|
+
// Check if default and gutter is recursive
|
153
|
+
@if flint-is-default($calc-key) and $recursive-center {
|
154
|
+
float: none;
|
155
|
+
// Check if default and gutter is not recurisve, wrap in query to not affect others
|
156
|
+
} @else if flint-is-default($calc-key) and $calc-gutter == "center" and not $recursive-center {
|
157
|
+
@include _($calc-key) {
|
158
|
+
float: none;
|
159
|
+
}
|
160
|
+
// Not default, check if gutter was set to center but not recursive
|
161
|
+
} @else if $calc-gutter == "center" and not $recursive-center or $i == null and $recursive-center {
|
162
|
+
float: none;
|
163
|
+
}
|
164
|
+
|
165
|
+
//
|
166
|
+
// Only run through if cache search was unsuccessful
|
167
|
+
//
|
168
|
+
@if not $cached {
|
169
|
+
|
170
|
+
$output-gutter: flint-get-gutter();
|
171
|
+
|
172
|
+
@if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" {
|
173
|
+
|
174
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
|
175
|
+
$output-margin-right: $output-gutter;
|
176
|
+
$output-margin-left: $output-gutter;
|
177
|
+
|
178
|
+
} @else if $calc-gutter == "inside" {
|
179
|
+
|
180
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 4));
|
181
|
+
$output-margin-right: $output-gutter;
|
182
|
+
$output-margin-left: $output-gutter;
|
183
|
+
|
184
|
+
} @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" {
|
185
|
+
|
186
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
|
187
|
+
$output-margin-right: $output-gutter;
|
188
|
+
$output-margin-left: 0;
|
189
|
+
|
190
|
+
} @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "last" {
|
191
|
+
|
192
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), $output-gutter);
|
193
|
+
$output-margin-right: 0;
|
194
|
+
$output-margin-left: $output-gutter;
|
195
|
+
|
196
|
+
} @else if $calc-gutter == "center" {
|
197
|
+
|
198
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null), ($output-gutter * 2));
|
199
|
+
$output-margin-right: auto;
|
200
|
+
$output-margin-left: auto;
|
201
|
+
|
202
|
+
} @else if $calc-gutter == "row" or $calc-gutter == "none" {
|
203
|
+
|
204
|
+
$output-width-map: flint-calc-width($calc-key, $calc-span, if($calc-context, $calc-context, null));
|
205
|
+
$output-margin-right: 0;
|
206
|
+
$output-margin-left: 0;
|
207
|
+
|
208
|
+
} @else {
|
209
|
+
@if not $flint-development-mode {
|
210
|
+
@error "Invalid gutter argument: #{$calc-gutter}. Please provide a valid argument.";
|
211
|
+
} @else {
|
212
|
+
$errors: true;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
@if not $errors {
|
218
|
+
|
219
|
+
// Cache result
|
220
|
+
@if $calc-context != "auto" and $calc-span != 0 and not $cached {
|
221
|
+
$flint-cached-results: map-merge($flint-cached-results, (
|
222
|
+
"#{$calc-key, $calc-span, $calc-context, $calc-gutter, $i}": ($output-width-map, $output-margin-right, $output-margin-left)
|
223
|
+
)) !global;
|
224
|
+
}
|
225
|
+
|
226
|
+
// Output styles
|
227
|
+
@include flint-output($output-width-map, $output-margin-right, $output-margin-left) {
|
228
|
+
@content;
|
229
|
+
}
|
230
|
+
|
231
|
+
@if flint-get-value("settings", "instance-maps") {
|
232
|
+
|
233
|
+
// Create new instance
|
234
|
+
@include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, map-get($output-width-map, "target"), $output-margin-right, $output-margin-left);
|
235
|
+
|
236
|
+
// If debug mode, print instance
|
237
|
+
@include flint-debug-instance($calc-key);
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|