flint-gs 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -21
- data/README.md +906 -906
- data/lib/flint.rb +67 -77
- data/stylesheets/_flint.scss +6 -6
- data/stylesheets/flint/config/_config.scss +83 -83
- data/stylesheets/flint/functions/_functions.scss +40 -41
- data/stylesheets/flint/functions/helpers/_helpers.scss +181 -181
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +33 -33
- data/stylesheets/flint/functions/lib/_calc-margin.scss +57 -57
- data/stylesheets/flint/functions/lib/_calc-width.scss +50 -50
- data/stylesheets/flint/functions/lib/_exists.scss +22 -22
- data/stylesheets/flint/functions/lib/_fluid-width.scss +10 -10
- data/stylesheets/flint/functions/lib/_get-index.scss +13 -13
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +17 -17
- data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -74
- data/stylesheets/flint/functions/lib/_instance.scss +46 -46
- data/stylesheets/flint/functions/lib/_last.scss +9 -9
- data/stylesheets/flint/functions/lib/_list-to-string.scss +25 -25
- data/stylesheets/flint/functions/lib/_map-fetch.scss +30 -30
- data/stylesheets/flint/functions/lib/_next-index.scss +15 -15
- data/stylesheets/flint/functions/lib/_purge.scss +19 -19
- data/stylesheets/flint/functions/lib/_remove.scss +13 -13
- data/stylesheets/flint/functions/lib/_replace-substring.scss +34 -34
- data/stylesheets/flint/functions/lib/_replace.scss +25 -25
- data/stylesheets/flint/functions/lib/_steal-key.scss +13 -13
- data/stylesheets/flint/functions/lib/_steal-values.scss +14 -14
- data/stylesheets/flint/functions/lib/_string-to-list.scss +90 -90
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +31 -31
- data/stylesheets/flint/functions/lib/_support-syntax.scss +28 -28
- data/stylesheets/flint/functions/lib/_types-in-list.scss +119 -119
- data/stylesheets/flint/functions/lib/_use-syntax.scss +14 -14
- data/stylesheets/flint/globals/_globals.scss +38 -38
- data/stylesheets/flint/mixins/_mixins.scss +7 -7
- data/stylesheets/flint/mixins/lib/_calculate.scss +571 -571
- data/stylesheets/flint/mixins/lib/_clearfix.scss +19 -19
- data/stylesheets/flint/mixins/lib/_main.scss +935 -935
- data/stylesheets/flint/mixins/lib/_new-instance.scss +27 -27
- data/stylesheets/flint/mixins/lib/_print-instance.scss +42 -42
- metadata +16 -23
- data/stylesheets/flint/functions/lib/_string-to-number.scss +0 -77
@@ -1,181 +1,181 @@
|
|
1
|
-
// Returns truthiness of a value
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $value [literal] : value
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @return [bool]
|
6
|
-
|
7
|
-
@function flint-is-true($value) {
|
8
|
-
@return if($value == null, false, $value and $value != null and $value != "" and $value != ());
|
9
|
-
}
|
10
|
-
|
11
|
-
// Checks if item is map
|
12
|
-
//--------------------------------------------------------------------------------
|
13
|
-
// @param $n [map] : value
|
14
|
-
// -------------------------------------------------------------------------------
|
15
|
-
// @return [bool]
|
16
|
-
|
17
|
-
@function flint-is-map($n) {
|
18
|
-
@return type-of($n) == "map";
|
19
|
-
}
|
20
|
-
|
21
|
-
// Checks if item is list
|
22
|
-
//--------------------------------------------------------------------------------
|
23
|
-
// @param $n [list] : value
|
24
|
-
// -------------------------------------------------------------------------------
|
25
|
-
// @return [bool]
|
26
|
-
|
27
|
-
@function flint-is-list($n) {
|
28
|
-
@return type-of($n) == "list";
|
29
|
-
}
|
30
|
-
|
31
|
-
// Checks if item is number
|
32
|
-
//--------------------------------------------------------------------------------
|
33
|
-
// @param $n [number] : value
|
34
|
-
// -------------------------------------------------------------------------------
|
35
|
-
// @return [bool]
|
36
|
-
|
37
|
-
@function flint-is-number($n) {
|
38
|
-
@return type-of($n) == "number";
|
39
|
-
}
|
40
|
-
|
41
|
-
// Checks if item is string
|
42
|
-
//--------------------------------------------------------------------------------
|
43
|
-
// @param $n [string] : value
|
44
|
-
// -------------------------------------------------------------------------------
|
45
|
-
// @return [bool]
|
46
|
-
|
47
|
-
@function flint-is-string($n) {
|
48
|
-
@return type-of($n) == "string";
|
49
|
-
}
|
50
|
-
|
51
|
-
// Checks if item is not string
|
52
|
-
//--------------------------------------------------------------------------------
|
53
|
-
// @param $n [string] : value
|
54
|
-
// -------------------------------------------------------------------------------
|
55
|
-
// @return [bool]
|
56
|
-
|
57
|
-
@function flint-is-not-string($n) {
|
58
|
-
@return type-of($n) != "string";
|
59
|
-
}
|
60
|
-
|
61
|
-
// Gets list of each breakpoint's key
|
62
|
-
// -------------------------------------------------------------------------------
|
63
|
-
// @return [list]
|
64
|
-
|
65
|
-
@function flint-get-all-keys() {
|
66
|
-
$all-keys: ();
|
67
|
-
|
68
|
-
@for $i from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
|
69
|
-
$key: flint-steal-key($i);
|
70
|
-
$all-keys: append($all-keys, $key, "comma");
|
71
|
-
}
|
72
|
-
|
73
|
-
@return $all-keys;
|
74
|
-
}
|
75
|
-
|
76
|
-
// Gets list of all breakpoints
|
77
|
-
// -------------------------------------------------------------------------------
|
78
|
-
// @return [list]
|
79
|
-
|
80
|
-
@function flint-get-all-breakpoints() {
|
81
|
-
$all-breakpoints: ();
|
82
|
-
|
83
|
-
@each $map, $keys in map-get($flint, "config") {
|
84
|
-
@each $key, $value in $keys {
|
85
|
-
@if $key == "breakpoint" {
|
86
|
-
$all-breakpoints: append($all-breakpoints, $value, "comma");
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
@return $all-breakpoints;
|
92
|
-
}
|
93
|
-
|
94
|
-
// Checks if passed $key is the highest breakpoint
|
95
|
-
// -------------------------------------------------------------------------------
|
96
|
-
// @param $key [string] : alias of breakpoint
|
97
|
-
// -------------------------------------------------------------------------------
|
98
|
-
// @return [bool]
|
99
|
-
|
100
|
-
@function flint-is-highest-breakpoint($key) {
|
101
|
-
@if flint-get-value($key, "breakpoint") == max(flint-get-all-breakpoints()...) {
|
102
|
-
@return true;
|
103
|
-
} @else {
|
104
|
-
@return false;
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
|
-
// Checks if passed $key is the lowest breakpoint
|
109
|
-
// -------------------------------------------------------------------------------
|
110
|
-
// @param $key [string] : alias of breakpoint
|
111
|
-
// -------------------------------------------------------------------------------
|
112
|
-
// @return [bool]
|
113
|
-
|
114
|
-
@function flint-is-lowest-breakpoint($key) {
|
115
|
-
@if flint-get-value($key, "breakpoint") == min(flint-get-all-breakpoints()...) {
|
116
|
-
@return true;
|
117
|
-
} @else {
|
118
|
-
@return false;
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
// Checks if $key is grid default
|
123
|
-
// -------------------------------------------------------------------------------
|
124
|
-
// @param $key [string] : alias of breakpoint
|
125
|
-
// -------------------------------------------------------------------------------
|
126
|
-
// @return [bool]
|
127
|
-
|
128
|
-
@function flint-is-default($key) {
|
129
|
-
@if $key == flint-get-value("settings", "default") {
|
130
|
-
@return true;
|
131
|
-
} @else {
|
132
|
-
@return false;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
// Gets all breakpoint column values
|
137
|
-
// -------------------------------------------------------------------------------
|
138
|
-
// @return [list]
|
139
|
-
|
140
|
-
@function flint-get-all-columns() {
|
141
|
-
$all-columns: ();
|
142
|
-
|
143
|
-
@each $map, $keys in map-get($flint, "config") {
|
144
|
-
@each $key, $value in $keys {
|
145
|
-
@if $key == "columns" {
|
146
|
-
$all-columns: append($all-columns, $value, "comma");
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
@return $all-columns;
|
152
|
-
}
|
153
|
-
|
154
|
-
// Returns the unit used in config
|
155
|
-
// -------------------------------------------------------------------------------
|
156
|
-
// @return [literal]
|
157
|
-
|
158
|
-
@function flint-get-config-unit() {
|
159
|
-
@return unit(flint-get-value("settings", "gutter"));
|
160
|
-
}
|
161
|
-
|
162
|
-
// Convert pixel value to em
|
163
|
-
// -------------------------------------------------------------------------------
|
164
|
-
// @param $target [number] : pixel value
|
165
|
-
// @param $context [number] : context to divide by
|
166
|
-
// -------------------------------------------------------------------------------
|
167
|
-
// @return : em value of $target relative to $context
|
168
|
-
// -------------------------------------------------------------------------------
|
169
|
-
|
170
|
-
@function flint-to-em($target, $context: $flint__base-font-size) {
|
171
|
-
@return ($target / $context) * 1em;
|
172
|
-
}
|
173
|
-
|
174
|
-
// Use Ruby functions in place of Sass functions where possible
|
175
|
-
// to speed up performance, especially with string functions
|
176
|
-
// -------------------------------------------------------------------------------
|
177
|
-
// @return [bool]
|
178
|
-
|
179
|
-
@function flint-use-ruby-functions() {
|
180
|
-
@return flint_use_ruby() == true;
|
181
|
-
}
|
1
|
+
// Returns truthiness of a value
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $value [literal] : value
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [bool]
|
6
|
+
|
7
|
+
@function flint-is-true($value) {
|
8
|
+
@return if($value == null, false, $value and $value != null and $value != "" and $value != ());
|
9
|
+
}
|
10
|
+
|
11
|
+
// Checks if item is map
|
12
|
+
//--------------------------------------------------------------------------------
|
13
|
+
// @param $n [map] : value
|
14
|
+
// -------------------------------------------------------------------------------
|
15
|
+
// @return [bool]
|
16
|
+
|
17
|
+
@function flint-is-map($n) {
|
18
|
+
@return type-of($n) == "map";
|
19
|
+
}
|
20
|
+
|
21
|
+
// Checks if item is list
|
22
|
+
//--------------------------------------------------------------------------------
|
23
|
+
// @param $n [list] : value
|
24
|
+
// -------------------------------------------------------------------------------
|
25
|
+
// @return [bool]
|
26
|
+
|
27
|
+
@function flint-is-list($n) {
|
28
|
+
@return type-of($n) == "list";
|
29
|
+
}
|
30
|
+
|
31
|
+
// Checks if item is number
|
32
|
+
//--------------------------------------------------------------------------------
|
33
|
+
// @param $n [number] : value
|
34
|
+
// -------------------------------------------------------------------------------
|
35
|
+
// @return [bool]
|
36
|
+
|
37
|
+
@function flint-is-number($n) {
|
38
|
+
@return type-of($n) == "number";
|
39
|
+
}
|
40
|
+
|
41
|
+
// Checks if item is string
|
42
|
+
//--------------------------------------------------------------------------------
|
43
|
+
// @param $n [string] : value
|
44
|
+
// -------------------------------------------------------------------------------
|
45
|
+
// @return [bool]
|
46
|
+
|
47
|
+
@function flint-is-string($n) {
|
48
|
+
@return type-of($n) == "string";
|
49
|
+
}
|
50
|
+
|
51
|
+
// Checks if item is not string
|
52
|
+
//--------------------------------------------------------------------------------
|
53
|
+
// @param $n [string] : value
|
54
|
+
// -------------------------------------------------------------------------------
|
55
|
+
// @return [bool]
|
56
|
+
|
57
|
+
@function flint-is-not-string($n) {
|
58
|
+
@return type-of($n) != "string";
|
59
|
+
}
|
60
|
+
|
61
|
+
// Gets list of each breakpoint's key
|
62
|
+
// -------------------------------------------------------------------------------
|
63
|
+
// @return [list]
|
64
|
+
|
65
|
+
@function flint-get-all-keys() {
|
66
|
+
$all-keys: ();
|
67
|
+
|
68
|
+
@for $i from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
|
69
|
+
$key: flint-steal-key($i);
|
70
|
+
$all-keys: append($all-keys, $key, "comma");
|
71
|
+
}
|
72
|
+
|
73
|
+
@return $all-keys;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Gets list of all breakpoints
|
77
|
+
// -------------------------------------------------------------------------------
|
78
|
+
// @return [list]
|
79
|
+
|
80
|
+
@function flint-get-all-breakpoints() {
|
81
|
+
$all-breakpoints: ();
|
82
|
+
|
83
|
+
@each $map, $keys in map-get($flint, "config") {
|
84
|
+
@each $key, $value in $keys {
|
85
|
+
@if $key == "breakpoint" {
|
86
|
+
$all-breakpoints: append($all-breakpoints, $value, "comma");
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
@return $all-breakpoints;
|
92
|
+
}
|
93
|
+
|
94
|
+
// Checks if passed $key is the highest breakpoint
|
95
|
+
// -------------------------------------------------------------------------------
|
96
|
+
// @param $key [string] : alias of breakpoint
|
97
|
+
// -------------------------------------------------------------------------------
|
98
|
+
// @return [bool]
|
99
|
+
|
100
|
+
@function flint-is-highest-breakpoint($key) {
|
101
|
+
@if flint-get-value($key, "breakpoint") == max(flint-get-all-breakpoints()...) {
|
102
|
+
@return true;
|
103
|
+
} @else {
|
104
|
+
@return false;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
// Checks if passed $key is the lowest breakpoint
|
109
|
+
// -------------------------------------------------------------------------------
|
110
|
+
// @param $key [string] : alias of breakpoint
|
111
|
+
// -------------------------------------------------------------------------------
|
112
|
+
// @return [bool]
|
113
|
+
|
114
|
+
@function flint-is-lowest-breakpoint($key) {
|
115
|
+
@if flint-get-value($key, "breakpoint") == min(flint-get-all-breakpoints()...) {
|
116
|
+
@return true;
|
117
|
+
} @else {
|
118
|
+
@return false;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// Checks if $key is grid default
|
123
|
+
// -------------------------------------------------------------------------------
|
124
|
+
// @param $key [string] : alias of breakpoint
|
125
|
+
// -------------------------------------------------------------------------------
|
126
|
+
// @return [bool]
|
127
|
+
|
128
|
+
@function flint-is-default($key) {
|
129
|
+
@if $key == flint-get-value("settings", "default") {
|
130
|
+
@return true;
|
131
|
+
} @else {
|
132
|
+
@return false;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
// Gets all breakpoint column values
|
137
|
+
// -------------------------------------------------------------------------------
|
138
|
+
// @return [list]
|
139
|
+
|
140
|
+
@function flint-get-all-columns() {
|
141
|
+
$all-columns: ();
|
142
|
+
|
143
|
+
@each $map, $keys in map-get($flint, "config") {
|
144
|
+
@each $key, $value in $keys {
|
145
|
+
@if $key == "columns" {
|
146
|
+
$all-columns: append($all-columns, $value, "comma");
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
@return $all-columns;
|
152
|
+
}
|
153
|
+
|
154
|
+
// Returns the unit used in config
|
155
|
+
// -------------------------------------------------------------------------------
|
156
|
+
// @return [literal]
|
157
|
+
|
158
|
+
@function flint-get-config-unit() {
|
159
|
+
@return unit(flint-get-value("settings", "gutter"));
|
160
|
+
}
|
161
|
+
|
162
|
+
// Convert pixel value to em
|
163
|
+
// -------------------------------------------------------------------------------
|
164
|
+
// @param $target [number] : pixel value
|
165
|
+
// @param $context [number] : context to divide by
|
166
|
+
// -------------------------------------------------------------------------------
|
167
|
+
// @return : em value of $target relative to $context
|
168
|
+
// -------------------------------------------------------------------------------
|
169
|
+
|
170
|
+
@function flint-to-em($target, $context: $flint__base-font-size) {
|
171
|
+
@return ($target / $context) * 1em;
|
172
|
+
}
|
173
|
+
|
174
|
+
// Use Ruby functions in place of Sass functions where possible
|
175
|
+
// to speed up performance, especially with string functions
|
176
|
+
// -------------------------------------------------------------------------------
|
177
|
+
// @return [bool]
|
178
|
+
|
179
|
+
@function flint-use-ruby-functions() {
|
180
|
+
@return flint_use_ruby() == true;
|
181
|
+
}
|
@@ -1,33 +1,33 @@
|
|
1
|
-
// Calculate from-to breakpoints
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $n [string] : how to calculate breakpoint
|
4
|
-
// @param $key [string] : key of breakpoint
|
5
|
-
// @param $i [number] : index of current breakpoint
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value
|
8
|
-
|
9
|
-
@function flint-calc-breakpoint($n, $key, $i) {
|
10
|
-
@if $n == "alias" {
|
11
|
-
@if flint-get-value("settings", "grid") == "fixed" {
|
12
|
-
@if flint-is-lowest-breakpoint($key) {
|
13
|
-
@return 0;
|
14
|
-
} @else {
|
15
|
-
@return flint-get-value($key, "breakpoint");
|
16
|
-
}
|
17
|
-
} @else if flint-get-value("settings", "grid") == "fluid" {
|
18
|
-
@return flint-get-value($key, "breakpoint");
|
19
|
-
}
|
20
|
-
} @else if $n == "next" {
|
21
|
-
@if flint-is-lowest-breakpoint($key) {
|
22
|
-
@return 0;
|
23
|
-
} @else {
|
24
|
-
@return flint-get-value(flint-steal-key(($i + 1)), "breakpoint");
|
25
|
-
}
|
26
|
-
} @else if $n == "prev" {
|
27
|
-
@if flint-is-highest-breakpoint($key) {
|
28
|
-
@return flint-get-value($key, "breakpoint");
|
29
|
-
} @else {
|
30
|
-
@return flint-get-value(flint-steal-key(($i - 1)), "breakpoint");
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
1
|
+
// Calculate from-to breakpoints
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $n [string] : how to calculate breakpoint
|
4
|
+
// @param $key [string] : key of breakpoint
|
5
|
+
// @param $i [number] : index of current breakpoint
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value
|
8
|
+
|
9
|
+
@function flint-calc-breakpoint($n, $key, $i) {
|
10
|
+
@if $n == "alias" {
|
11
|
+
@if flint-get-value("settings", "grid") == "fixed" {
|
12
|
+
@if flint-is-lowest-breakpoint($key) {
|
13
|
+
@return 0;
|
14
|
+
} @else {
|
15
|
+
@return flint-get-value($key, "breakpoint");
|
16
|
+
}
|
17
|
+
} @else if flint-get-value("settings", "grid") == "fluid" {
|
18
|
+
@return flint-get-value($key, "breakpoint");
|
19
|
+
}
|
20
|
+
} @else if $n == "next" {
|
21
|
+
@if flint-is-lowest-breakpoint($key) {
|
22
|
+
@return 0;
|
23
|
+
} @else {
|
24
|
+
@return flint-get-value(flint-steal-key(($i + 1)), "breakpoint");
|
25
|
+
}
|
26
|
+
} @else if $n == "prev" {
|
27
|
+
@if flint-is-highest-breakpoint($key) {
|
28
|
+
@return flint-get-value($key, "breakpoint");
|
29
|
+
} @else {
|
30
|
+
@return flint-get-value(flint-steal-key(($i - 1)), "breakpoint");
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -1,57 +1,57 @@
|
|
1
|
-
// Calculate margin
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : key for lookup
|
4
|
-
// @param $span [number] : span value of element
|
5
|
-
// @param $context [number] : context value of element
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value | false
|
8
|
-
|
9
|
-
@function flint-calc-margin($key, $span, $context: null) {
|
10
|
-
$result: false;
|
11
|
-
|
12
|
-
// Check to see if value has been cached
|
13
|
-
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::margin") and $context != "auto" {
|
14
|
-
@return map-get($flint__cached-values, "#{$key, $span, $context}::margin");
|
15
|
-
}
|
16
|
-
|
17
|
-
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
-
|
19
|
-
@if $key == "container" or $span == "container" {
|
20
|
-
|
21
|
-
$result: 0;
|
22
|
-
|
23
|
-
} @else if $context == null {
|
24
|
-
|
25
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter"), flint-get-value($key, "breakpoint"));
|
26
|
-
|
27
|
-
} @else if $context <= flint-get-value($key, "columns") {
|
28
|
-
|
29
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter"), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
30
|
-
|
31
|
-
} @else {
|
32
|
-
|
33
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter") / flint-get-value($key, "columns") * $context, ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
} @if flint-get-value("settings", "grid") == "fixed" {
|
38
|
-
|
39
|
-
@if $key == "container" or $span == "container" {
|
40
|
-
|
41
|
-
$result: 0;
|
42
|
-
|
43
|
-
} @else {
|
44
|
-
|
45
|
-
$result: flint-get-value("settings", "gutter");
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
// Save result to cache
|
51
|
-
@if $context != "auto" {
|
52
|
-
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::margin": $result));
|
53
|
-
}
|
54
|
-
|
55
|
-
// Return result
|
56
|
-
@return $result;
|
57
|
-
}
|
1
|
+
// Calculate margin
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : key for lookup
|
4
|
+
// @param $span [number] : span value of element
|
5
|
+
// @param $context [number] : context value of element
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value | false
|
8
|
+
|
9
|
+
@function flint-calc-margin($key, $span, $context: null) {
|
10
|
+
$result: false;
|
11
|
+
|
12
|
+
// Check to see if value has been cached
|
13
|
+
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::margin") and $context != "auto" {
|
14
|
+
@return map-get($flint__cached-values, "#{$key, $span, $context}::margin");
|
15
|
+
}
|
16
|
+
|
17
|
+
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
+
|
19
|
+
@if $key == "container" or $span == "container" {
|
20
|
+
|
21
|
+
$result: 0;
|
22
|
+
|
23
|
+
} @else if $context == null {
|
24
|
+
|
25
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter"), flint-get-value($key, "breakpoint"));
|
26
|
+
|
27
|
+
} @else if $context <= flint-get-value($key, "columns") {
|
28
|
+
|
29
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter"), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
30
|
+
|
31
|
+
} @else {
|
32
|
+
|
33
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter") / flint-get-value($key, "columns") * $context, ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
} @if flint-get-value("settings", "grid") == "fixed" {
|
38
|
+
|
39
|
+
@if $key == "container" or $span == "container" {
|
40
|
+
|
41
|
+
$result: 0;
|
42
|
+
|
43
|
+
} @else {
|
44
|
+
|
45
|
+
$result: flint-get-value("settings", "gutter");
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
// Save result to cache
|
51
|
+
@if $context != "auto" {
|
52
|
+
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::margin": $result));
|
53
|
+
}
|
54
|
+
|
55
|
+
// Return result
|
56
|
+
@return $result;
|
57
|
+
}
|
@@ -1,50 +1,50 @@
|
|
1
|
-
// Calculate width
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : key for lookup
|
4
|
-
// @param $span [number] : span value of element
|
5
|
-
// @param $context [number] : context value of element
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value | false
|
8
|
-
|
9
|
-
@function flint-calc-width($key, $span, $context: null) {
|
10
|
-
$result: false;
|
11
|
-
|
12
|
-
// Check to see if value has been cached
|
13
|
-
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::width") and $context != "auto" {
|
14
|
-
@return map-get($flint__cached-values, "#{$key, $span, $context}::width");
|
15
|
-
}
|
16
|
-
|
17
|
-
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
-
@if $key == "container" or $span == "container" {
|
19
|
-
|
20
|
-
$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));
|
21
|
-
|
22
|
-
} @else if $context == null {
|
23
|
-
|
24
|
-
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));
|
25
|
-
|
26
|
-
} @else {
|
27
|
-
|
28
|
-
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
29
|
-
|
30
|
-
}
|
31
|
-
} @if flint-get-value("settings", "grid") == "fixed" {
|
32
|
-
@if $key == "container" or $span == "container" {
|
33
|
-
|
34
|
-
$result: flint-get-value($key, "breakpoint");
|
35
|
-
|
36
|
-
} @else {
|
37
|
-
|
38
|
-
$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;
|
39
|
-
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
// Save result to cache
|
44
|
-
@if $context != "auto" {
|
45
|
-
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
|
46
|
-
}
|
47
|
-
|
48
|
-
// Return result
|
49
|
-
@return $result;
|
50
|
-
}
|
1
|
+
// Calculate width
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : key for lookup
|
4
|
+
// @param $span [number] : span value of element
|
5
|
+
// @param $context [number] : context value of element
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value | false
|
8
|
+
|
9
|
+
@function flint-calc-width($key, $span, $context: null) {
|
10
|
+
$result: false;
|
11
|
+
|
12
|
+
// Check to see if value has been cached
|
13
|
+
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::width") and $context != "auto" {
|
14
|
+
@return map-get($flint__cached-values, "#{$key, $span, $context}::width");
|
15
|
+
}
|
16
|
+
|
17
|
+
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
+
@if $key == "container" or $span == "container" {
|
19
|
+
|
20
|
+
$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));
|
21
|
+
|
22
|
+
} @else if $context == null {
|
23
|
+
|
24
|
+
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));
|
25
|
+
|
26
|
+
} @else {
|
27
|
+
|
28
|
+
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
29
|
+
|
30
|
+
}
|
31
|
+
} @if flint-get-value("settings", "grid") == "fixed" {
|
32
|
+
@if $key == "container" or $span == "container" {
|
33
|
+
|
34
|
+
$result: flint-get-value($key, "breakpoint");
|
35
|
+
|
36
|
+
} @else {
|
37
|
+
|
38
|
+
$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;
|
39
|
+
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
// Save result to cache
|
44
|
+
@if $context != "auto" {
|
45
|
+
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
|
46
|
+
}
|
47
|
+
|
48
|
+
// Return result
|
49
|
+
@return $result;
|
50
|
+
}
|