creek-jekyll-theme 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/_config.yml +306 -0
- data/_data/README.md +3 -0
- data/_data/navigation/docs.yml +56 -0
- data/_data/navigation/main.yml +12 -0
- data/_data/navigation.yml +68 -0
- data/_data/ui-text.yml +2024 -0
- data/_includes/analytics-providers/custom.html +3 -0
- data/_includes/analytics-providers/google-gtag.html +9 -0
- data/_includes/analytics-providers/google-universal.html +7 -0
- data/_includes/analytics-providers/google.html +14 -0
- data/_includes/analytics.html +14 -0
- data/_includes/archive-single.html +30 -0
- data/_includes/author-profile-custom-links.html +7 -0
- data/_includes/author-profile.html +246 -0
- data/_includes/breadcrumbs.html +40 -0
- data/_includes/browser-upgrade.html +2 -0
- data/_includes/category-list.html +19 -0
- data/_includes/comment.html +22 -0
- data/_includes/comments-providers/custom.html +3 -0
- data/_includes/comments-providers/custom_scripts.html +3 -0
- data/_includes/comments-providers/discourse.html +13 -0
- data/_includes/comments-providers/disqus.html +15 -0
- data/_includes/comments-providers/facebook.html +8 -0
- data/_includes/comments-providers/giscus.html +24 -0
- data/_includes/comments-providers/scripts.html +20 -0
- data/_includes/comments-providers/staticman.html +40 -0
- data/_includes/comments-providers/staticman_v2.html +40 -0
- data/_includes/comments-providers/utterances.html +21 -0
- data/_includes/comments.html +180 -0
- data/_includes/documents-collection.html +15 -0
- data/_includes/feature_row +41 -0
- data/_includes/figure +9 -0
- data/_includes/footer/custom.html +3 -0
- data/_includes/footer.html +21 -0
- data/_includes/gallery +35 -0
- data/_includes/group-by-array +47 -0
- data/_includes/head/custom.html +15 -0
- data/_includes/head.html +25 -0
- data/_includes/masthead.html +35 -0
- data/_includes/nav_list +26 -0
- data/_includes/page__date.html +6 -0
- data/_includes/page__hero.html +55 -0
- data/_includes/page__hero_video.html +2 -0
- data/_includes/page__meta.html +31 -0
- data/_includes/page__taxonomy.html +7 -0
- data/_includes/paginator.html +69 -0
- data/_includes/post_pagination.html +14 -0
- data/_includes/posts-category.html +5 -0
- data/_includes/posts-tag.html +5 -0
- data/_includes/scripts.html +28 -0
- data/_includes/search/algolia-search-scripts.html +62 -0
- data/_includes/search/google-search-scripts.html +30 -0
- data/_includes/search/lunr-search-scripts.html +10 -0
- data/_includes/search/search_form.html +26 -0
- data/_includes/seo.html +158 -0
- data/_includes/sidebar.html +19 -0
- data/_includes/skip-links.html +7 -0
- data/_includes/social-share.html +11 -0
- data/_includes/tag-list.html +19 -0
- data/_includes/toc +7 -0
- data/_includes/toc.html +182 -0
- data/_includes/video +24 -0
- data/_layouts/archive-taxonomy.html +29 -0
- data/_layouts/archive.html +26 -0
- data/_layouts/categories.html +43 -0
- data/_layouts/category.html +10 -0
- data/_layouts/collection.html +10 -0
- data/_layouts/compress.html +10 -0
- data/_layouts/default.html +41 -0
- data/_layouts/home.html +22 -0
- data/_layouts/posts.html +30 -0
- data/_layouts/search.html +42 -0
- data/_layouts/single.html +95 -0
- data/_layouts/splash.html +22 -0
- data/_layouts/tag.html +10 -0
- data/_layouts/tags.html +43 -0
- data/_pages/404.html +26 -0
- data/_sass/minimal-mistakes/_animations.scss +21 -0
- data/_sass/minimal-mistakes/_archive.scss +463 -0
- data/_sass/minimal-mistakes/_base.scss +339 -0
- data/_sass/minimal-mistakes/_buttons.scss +97 -0
- data/_sass/minimal-mistakes/_footer.scss +85 -0
- data/_sass/minimal-mistakes/_forms.scss +359 -0
- data/_sass/minimal-mistakes/_masthead.scss +93 -0
- data/_sass/minimal-mistakes/_mixins.scss +92 -0
- data/_sass/minimal-mistakes/_navigation.scss +573 -0
- data/_sass/minimal-mistakes/_notices.scss +109 -0
- data/_sass/minimal-mistakes/_page.scss +578 -0
- data/_sass/minimal-mistakes/_print.scss +252 -0
- data/_sass/minimal-mistakes/_reset.scss +187 -0
- data/_sass/minimal-mistakes/_search.scss +132 -0
- data/_sass/minimal-mistakes/_sidebar.scss +353 -0
- data/_sass/minimal-mistakes/_syntax.scss +324 -0
- data/_sass/minimal-mistakes/_tables.scss +39 -0
- data/_sass/minimal-mistakes/_utilities.scss +593 -0
- data/_sass/minimal-mistakes/_variables.scss +173 -0
- data/_sass/minimal-mistakes/skins/_air.scss +23 -0
- data/_sass/minimal-mistakes/skins/_aqua.scss +34 -0
- data/_sass/minimal-mistakes/skins/_contrast.scss +52 -0
- data/_sass/minimal-mistakes/skins/_dark.scss +30 -0
- data/_sass/minimal-mistakes/skins/_default.scss +5 -0
- data/_sass/minimal-mistakes/skins/_dirt.scss +33 -0
- data/_sass/minimal-mistakes/skins/_mint.scss +24 -0
- data/_sass/minimal-mistakes/skins/_neon.scss +63 -0
- data/_sass/minimal-mistakes/skins/_plum.scss +70 -0
- data/_sass/minimal-mistakes/skins/_sunrise.scss +49 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_breakpoint.scss +114 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_context.scss +95 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_helpers.scss +151 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_legacy-settings.scss +50 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_no-query.scss +15 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_parsers.scss +215 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_respond-to.scss +82 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/_settings.scss +71 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_double.scss +33 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_query.scss +82 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_resolution.scss +31 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_single.scss +26 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_triple.scss +36 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default-pair.scss +21 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default.scss +22 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_double-string.scss +22 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/single/_default.scss +13 -0
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/triple/_default.scss +18 -0
- data/_sass/minimal-mistakes/vendor/magnific-popup/_magnific-popup.scss +649 -0
- data/_sass/minimal-mistakes/vendor/magnific-popup/_settings.scss +46 -0
- data/_sass/minimal-mistakes/vendor/susy/_su.scss +4 -0
- data/_sass/minimal-mistakes/vendor/susy/_susy-prefix.scss +13 -0
- data/_sass/minimal-mistakes/vendor/susy/_susy.scss +5 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/_svg-grid.scss +5 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_prefix.scss +7 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -0
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_api.scss +318 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_normalize.scss +261 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_parse.scss +163 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_settings.scss +329 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_su-math.scss +441 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_su-validate.scss +213 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_syntax-helpers.scss +191 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_unprefix.scss +56 -0
- data/_sass/minimal-mistakes/vendor/susy/susy/_utilities.scss +167 -0
- data/_sass/minimal-mistakes.scss +40 -0
- data/assets/css/main.scss +9 -0
- data/assets/images/android-chrome-192x192.png +0 -0
- data/assets/images/android-chrome-512x512.png +0 -0
- data/assets/images/apple-touch-icon.png +0 -0
- data/assets/images/browserconfig.xml +9 -0
- data/assets/images/creek-logo.png +0 -0
- data/assets/images/favicon-16x16.png +0 -0
- data/assets/images/favicon-32x32.png +0 -0
- data/assets/images/favicon.ico +0 -0
- data/assets/images/mstile-150x150.png +0 -0
- data/assets/images/safari-pinned-tab.svg +48 -0
- data/assets/images/site-under-construction.png +0 -0
- data/assets/images/site.webmanifest +19 -0
- data/assets/js/_main.js +136 -0
- data/assets/js/lunr/lunr-en.js +73 -0
- data/assets/js/lunr/lunr-gr.js +526 -0
- data/assets/js/lunr/lunr-store.js +84 -0
- data/assets/js/lunr/lunr.js +3475 -0
- data/assets/js/lunr/lunr.min.js +6 -0
- data/assets/js/main.min.js +6 -0
- data/assets/js/plugins/gumshoe.js +484 -0
- data/assets/js/plugins/jquery.ba-throttle-debounce.js +252 -0
- data/assets/js/plugins/jquery.fitvids.js +82 -0
- data/assets/js/plugins/jquery.greedy-navigation.js +127 -0
- data/assets/js/plugins/jquery.magnific-popup.js +1860 -0
- data/assets/js/plugins/smooth-scroll.js +650 -0
- data/assets/js/vendor/jquery/jquery-3.6.0.js +10881 -0
- metadata +233 -0
@@ -0,0 +1,441 @@
|
|
1
|
+
/// Grid Math Engine
|
2
|
+
/// ================
|
3
|
+
/// The `su` functions give you direct access to the math layer,
|
4
|
+
/// without any syntax-sugar like shorthand parsing, and normalization.
|
5
|
+
/// If you prefer named arguments, and stripped-down syntax,
|
6
|
+
/// you can use these functions directly in your code –
|
7
|
+
/// replacing `span`, `gutter`, and `slice`.
|
8
|
+
///
|
9
|
+
/// These functions are also useful
|
10
|
+
/// for building mixins or other extensions to Susy.
|
11
|
+
/// Apply the Susy syntax to new mixins and functions,
|
12
|
+
/// using our "Plugin Helpers",
|
13
|
+
/// or write your own syntax and pass the normalized results along
|
14
|
+
/// to `su` for compilation.
|
15
|
+
///
|
16
|
+
/// @group su-math
|
17
|
+
///
|
18
|
+
/// @see su-span
|
19
|
+
/// @see su-gutter
|
20
|
+
/// @see su-slice
|
21
|
+
/// @ignore _su-sum
|
22
|
+
/// @ignore _su-calc-span
|
23
|
+
/// @ignore _su-calc-sum
|
24
|
+
/// @ignore _su-needs-calc-output
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
// Su Span
|
29
|
+
// -------
|
30
|
+
/// Calculates and returns a CSS-ready span width,
|
31
|
+
/// based on normalized span and context data –
|
32
|
+
/// a low-level version of `susy-span`,
|
33
|
+
/// with all of the logic and none of the syntax sugar.
|
34
|
+
///
|
35
|
+
/// - Grids defined with unitless numbers will return `%` values.
|
36
|
+
/// - Grids defined with comparable units
|
37
|
+
/// will return a value in the units provided.
|
38
|
+
/// - Grids defined with a mix of units,
|
39
|
+
/// or a combination of untiless numbers and unit-lengths,
|
40
|
+
/// will return a `calc()` string.
|
41
|
+
///
|
42
|
+
/// @group su-math
|
43
|
+
/// @see susy-span
|
44
|
+
///
|
45
|
+
/// @param {number | list} $span -
|
46
|
+
/// Number or list of grid columns to span
|
47
|
+
/// @param {list} $columns -
|
48
|
+
/// List of columns available
|
49
|
+
/// @param {number} $gutters -
|
50
|
+
/// Width of a gutter in column-comparable units
|
51
|
+
/// @param {0 | 1 | -1} $spread -
|
52
|
+
/// Number of gutters spanned,
|
53
|
+
/// relative to `span` count
|
54
|
+
/// @param {0 | 1 | -1} $container-spread [$spread] -
|
55
|
+
/// Number of gutters spanned,
|
56
|
+
/// relative to `columns` count
|
57
|
+
/// @param {integer} $location [1] -
|
58
|
+
/// Optional position of sub-span among full set of columns
|
59
|
+
///
|
60
|
+
/// @return {length} -
|
61
|
+
/// Relative or static length of a span on the grid
|
62
|
+
@function su-span(
|
63
|
+
$span,
|
64
|
+
$columns,
|
65
|
+
$gutters,
|
66
|
+
$spread,
|
67
|
+
$container-spread: $spread,
|
68
|
+
$location: 1
|
69
|
+
) {
|
70
|
+
$span: su-valid-span($span);
|
71
|
+
$columns: su-valid-columns($columns);
|
72
|
+
$gutters: su-valid-gutters($gutters);
|
73
|
+
$spread: su-valid-spread($spread);
|
74
|
+
|
75
|
+
@if (type-of($span) == 'number') {
|
76
|
+
@if (not unitless($span)) {
|
77
|
+
@return $span;
|
78
|
+
}
|
79
|
+
|
80
|
+
$location: su-valid-location($span, $location, $columns);
|
81
|
+
$span: su-slice($span, $columns, $location, $validate: false);
|
82
|
+
}
|
83
|
+
|
84
|
+
@if _su-needs-calc-output($span, $columns, $gutters, $spread, not 'validate') {
|
85
|
+
@return _su-calc-span($span, $columns, $gutters, $spread, $container-spread, not 'validate');
|
86
|
+
}
|
87
|
+
|
88
|
+
$span-width: _su-sum($span, $gutters, $spread, $validate: false);
|
89
|
+
|
90
|
+
@if unitless($span-width) {
|
91
|
+
$container-spread: su-valid-spread($container-spread);
|
92
|
+
$container: _su-sum($columns, $gutters, $container-spread, $validate: false);
|
93
|
+
@return percentage($span-width / $container);
|
94
|
+
}
|
95
|
+
|
96
|
+
@return $span-width;
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
// Su Gutter
|
102
|
+
// ---------
|
103
|
+
/// Calculates and returns a CSS-ready gutter width,
|
104
|
+
/// based on normalized grid data –
|
105
|
+
/// a low-level version of `susy-gutter`,
|
106
|
+
/// with all of the logic and none of the syntax sugar.
|
107
|
+
///
|
108
|
+
/// - Grids defined with unitless numbers will return `%` values.
|
109
|
+
/// - Grids defined with comparable units
|
110
|
+
/// will return a value in the units provided.
|
111
|
+
/// - Grids defined with a mix of units,
|
112
|
+
/// or a combination of untiless numbers and unit-lengths,
|
113
|
+
/// will return a `calc()` string.
|
114
|
+
///
|
115
|
+
/// @group su-math
|
116
|
+
/// @see susy-gutter
|
117
|
+
///
|
118
|
+
/// @param {list} $columns -
|
119
|
+
/// List of columns in the grid
|
120
|
+
/// @param {number} $gutters -
|
121
|
+
/// Width of a gutter in column-comparable units
|
122
|
+
/// @param {0 | 1 | -1} $container-spread -
|
123
|
+
/// Number of gutters spanned,
|
124
|
+
/// relative to `columns` count
|
125
|
+
///
|
126
|
+
/// @return {length} -
|
127
|
+
/// Relative or static length of one gutter in a grid
|
128
|
+
@function su-gutter(
|
129
|
+
$columns,
|
130
|
+
$gutters,
|
131
|
+
$container-spread
|
132
|
+
) {
|
133
|
+
@if (type-of($gutters) == 'number') {
|
134
|
+
@if ($gutters == 0) or (not unitless($gutters)) {
|
135
|
+
@return $gutters;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
@if _su-needs-calc-output($gutters, $columns, $gutters, -1, not 'validate') {
|
140
|
+
@return _su-calc-span($gutters, $columns, $gutters, -1, $container-spread, not 'validate');
|
141
|
+
}
|
142
|
+
|
143
|
+
$container: _su-sum($columns, $gutters, $container-spread);
|
144
|
+
@return percentage($gutters / $container);
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
// Su Slice
|
150
|
+
// --------
|
151
|
+
/// Returns a list of columns
|
152
|
+
/// based on a given span/location slice of the grid –
|
153
|
+
/// a low-level version of `susy-slice`,
|
154
|
+
/// with all of the logic and none of the syntax sugar.
|
155
|
+
///
|
156
|
+
/// @group su-math
|
157
|
+
/// @see susy-slice
|
158
|
+
///
|
159
|
+
/// @param {number} $span -
|
160
|
+
/// Number of grid columns to span
|
161
|
+
/// @param {list} $columns -
|
162
|
+
/// List of columns in the grid
|
163
|
+
/// @param {number} $location [1] -
|
164
|
+
/// Starting index of a span in the list of columns
|
165
|
+
/// @param {bool} $validate [true] -
|
166
|
+
/// Check that arguments are valid before proceeding
|
167
|
+
///
|
168
|
+
/// @return {list} -
|
169
|
+
/// Subset list of grid columns, based on span and location
|
170
|
+
@function su-slice(
|
171
|
+
$span,
|
172
|
+
$columns,
|
173
|
+
$location: 1,
|
174
|
+
$validate: true
|
175
|
+
) {
|
176
|
+
@if $validate {
|
177
|
+
$columns: su-valid-columns($columns);
|
178
|
+
$location: su-valid-location($span, $location, $columns);
|
179
|
+
}
|
180
|
+
|
181
|
+
$floor: floor($span);
|
182
|
+
$sub-columns: ();
|
183
|
+
|
184
|
+
@for $i from $location to ($location + $floor) {
|
185
|
+
$sub-columns: append($sub-columns, nth($columns, $i));
|
186
|
+
}
|
187
|
+
|
188
|
+
@if $floor != $span {
|
189
|
+
$remainder: $span - $floor;
|
190
|
+
$column: $location + $floor;
|
191
|
+
$sub-columns: append($sub-columns, nth($columns, $column) * $remainder);
|
192
|
+
}
|
193
|
+
|
194
|
+
@return $sub-columns;
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
// Su Sum
|
200
|
+
// ------
|
201
|
+
/// Get the total sum of column-units in a layout.
|
202
|
+
///
|
203
|
+
/// @group su-math
|
204
|
+
/// @access private
|
205
|
+
///
|
206
|
+
/// @param {list} $columns -
|
207
|
+
/// List of columns in the grid
|
208
|
+
/// @param {number} $gutters -
|
209
|
+
/// Width of a gutter in column-comparable units
|
210
|
+
/// @param {0 | 1 | -1} $spread -
|
211
|
+
/// Number of gutters spanned,
|
212
|
+
/// relative to `columns` count
|
213
|
+
/// @param {bool} $validate [true] -
|
214
|
+
/// Check that arguments are valid before proceeding
|
215
|
+
///
|
216
|
+
/// @return {number} -
|
217
|
+
/// Total sum of column-units in a grid
|
218
|
+
@function _su-sum(
|
219
|
+
$columns,
|
220
|
+
$gutters,
|
221
|
+
$spread,
|
222
|
+
$validate: true
|
223
|
+
) {
|
224
|
+
@if $validate {
|
225
|
+
$columns: su-valid-span($columns);
|
226
|
+
$gutters: su-valid-gutters($gutters);
|
227
|
+
$spread: su-valid-spread($spread);
|
228
|
+
}
|
229
|
+
|
230
|
+
// Calculate column-sum
|
231
|
+
$column-sum: 0;
|
232
|
+
@each $column in $columns {
|
233
|
+
$column-sum: $column-sum + $column;
|
234
|
+
}
|
235
|
+
|
236
|
+
$gutter-sum: (ceil(length($columns)) + $spread) * $gutters;
|
237
|
+
$total: if(($gutter-sum > 0), $column-sum + $gutter-sum, $column-sum);
|
238
|
+
|
239
|
+
@return $total;
|
240
|
+
}
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
// Su Calc
|
245
|
+
// -------
|
246
|
+
/// Return a usable span width as a `calc()` function,
|
247
|
+
/// in order to create mixed-unit grids.
|
248
|
+
///
|
249
|
+
/// @group su-math
|
250
|
+
/// @access private
|
251
|
+
///
|
252
|
+
/// @param {number | list} $span -
|
253
|
+
/// Pre-sliced list of grid columns to span
|
254
|
+
/// @param {list} $columns -
|
255
|
+
/// List of columns available
|
256
|
+
/// @param {number} $gutters -
|
257
|
+
/// Width of a gutter in column-comparable units
|
258
|
+
/// @param {0 | 1 | -1} $spread -
|
259
|
+
/// Number of gutters spanned,
|
260
|
+
/// relative to `span` count
|
261
|
+
/// @param {0 | 1 | -1} $container-spread [$spread] -
|
262
|
+
/// Number of gutters spanned,
|
263
|
+
/// relative to `columns` count
|
264
|
+
/// @param {bool} $validate [true] -
|
265
|
+
/// Check that arguments are valid before proceeding
|
266
|
+
///
|
267
|
+
/// @return {length} -
|
268
|
+
/// Relative or static length of a span on the grid
|
269
|
+
@function _su-calc-span(
|
270
|
+
$span,
|
271
|
+
$columns,
|
272
|
+
$gutters,
|
273
|
+
$spread,
|
274
|
+
$container-spread: $spread,
|
275
|
+
$validate: true
|
276
|
+
) {
|
277
|
+
@if $validate {
|
278
|
+
$span: su-valid-span($span);
|
279
|
+
$columns: su-valid-columns($columns);
|
280
|
+
$gutters: su-valid-gutters($gutters);
|
281
|
+
$spread: su-valid-spread($spread);
|
282
|
+
$container-spread: su-valid-spread($container-spread);
|
283
|
+
}
|
284
|
+
|
285
|
+
// Span and context
|
286
|
+
$span: _su-calc-sum($span, $gutters, $spread, not 'validate');
|
287
|
+
$context: _su-calc-sum($columns, $gutters, $container-spread, not 'validate');
|
288
|
+
|
289
|
+
// Fixed and fluid
|
290
|
+
$fixed-span: map-get($span, 'fixed');
|
291
|
+
$fluid-span: map-get($span, 'fluid');
|
292
|
+
$fixed-context: map-get($context, 'fixed');
|
293
|
+
$fluid-context: map-get($context, 'fluid');
|
294
|
+
|
295
|
+
$calc: '#{$fixed-span}';
|
296
|
+
$fluid-calc: '(100% - #{$fixed-context})';
|
297
|
+
|
298
|
+
// Fluid-values
|
299
|
+
@if (not $fluid-span) {
|
300
|
+
$fluid-calc: null;
|
301
|
+
} @else if ($fluid-span != $fluid-context) {
|
302
|
+
$fluid-span: '* #{$fluid-span}';
|
303
|
+
$fluid-context: if($fluid-context, '/ #{$fluid-context}', '');
|
304
|
+
$fluid-calc: '(#{$fluid-calc $fluid-context $fluid-span})';
|
305
|
+
}
|
306
|
+
|
307
|
+
@if $fluid-calc {
|
308
|
+
$calc: if(($calc != ''), '#{$calc} + ', '');
|
309
|
+
$calc: '#{$calc + $fluid-calc}';
|
310
|
+
}
|
311
|
+
|
312
|
+
@return calc(#{unquote($calc)});
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
// Su Calc-Sum
|
318
|
+
// -----------
|
319
|
+
/// Get the total sum of fixed and fluid column-units
|
320
|
+
/// for creating a mixed-unit layout with `calc()` values.
|
321
|
+
///
|
322
|
+
/// @group su-math
|
323
|
+
/// @access private
|
324
|
+
///
|
325
|
+
/// @param {list} $columns -
|
326
|
+
/// List of columns available
|
327
|
+
/// @param {number} $gutters -
|
328
|
+
/// Width of a gutter in column-comparable units
|
329
|
+
/// @param {0 | 1 | -1} $spread -
|
330
|
+
/// Number of gutters spanned,
|
331
|
+
/// relative to `span` count
|
332
|
+
/// @param {bool} $validate [true] -
|
333
|
+
/// Check that arguments are valid before proceeding
|
334
|
+
///
|
335
|
+
/// @return {map} -
|
336
|
+
/// Map with `fixed` and `fluid` keys
|
337
|
+
/// containing the proper math as strings
|
338
|
+
@function _su-calc-sum(
|
339
|
+
$columns,
|
340
|
+
$gutters,
|
341
|
+
$spread,
|
342
|
+
$validate: true
|
343
|
+
) {
|
344
|
+
@if $validate {
|
345
|
+
$columns: su-valid-span($columns);
|
346
|
+
$gutters: su-valid-gutters($gutters);
|
347
|
+
$spread: su-valid-spread($spread);
|
348
|
+
}
|
349
|
+
|
350
|
+
$fluid: 0;
|
351
|
+
$fixed: ();
|
352
|
+
$calc: null;
|
353
|
+
|
354
|
+
// Gutters
|
355
|
+
$gutters: $gutters * (length($columns) + $spread);
|
356
|
+
|
357
|
+
// Columns
|
358
|
+
@each $col in append($columns, $gutters) {
|
359
|
+
@if unitless($col) {
|
360
|
+
$fluid: $fluid + $col;
|
361
|
+
} @else {
|
362
|
+
$fixed: _su-map-add-units($fixed, $col);
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
// Compile Fixed Units
|
367
|
+
@each $unit, $total in $fixed {
|
368
|
+
@if ($total != (0 * $total)) {
|
369
|
+
$calc: if($calc, '#{$calc} + #{$total}', '#{$total}');
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
// Calc null or string
|
374
|
+
@if $calc {
|
375
|
+
$calc: if(str-index($calc, '+'), '(#{$calc})', '#{$calc}');
|
376
|
+
}
|
377
|
+
|
378
|
+
// Fluid 0 => null
|
379
|
+
$fluid: if(($fluid == 0), null, $fluid);
|
380
|
+
|
381
|
+
|
382
|
+
// Return map
|
383
|
+
$return: (
|
384
|
+
'fixed': $calc,
|
385
|
+
'fluid': $fluid,
|
386
|
+
);
|
387
|
+
|
388
|
+
@return $return;
|
389
|
+
}
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
// Needs Calc
|
394
|
+
// ----------
|
395
|
+
/// Check if `calc()` will be needed in defining a span,
|
396
|
+
/// if the necessary units in a grid are not comparable.
|
397
|
+
///
|
398
|
+
/// @group su-math
|
399
|
+
/// @access private
|
400
|
+
///
|
401
|
+
/// @param {list} $span -
|
402
|
+
/// Slice of columns to span
|
403
|
+
/// @param {list} $columns -
|
404
|
+
/// List of available columns in the grid
|
405
|
+
/// @param {number} $gutters -
|
406
|
+
/// Width of a gutter
|
407
|
+
/// @param {0 | 1 | -1} $spread -
|
408
|
+
/// Number of gutters spanned,
|
409
|
+
/// relative to `span` count
|
410
|
+
/// @param {bool} $validate [true] -
|
411
|
+
/// Check that arguments are valid before proceeding
|
412
|
+
///
|
413
|
+
/// @return {bool} -
|
414
|
+
/// `True` when units do not match, and `calc()` will be required
|
415
|
+
@function _su-needs-calc-output(
|
416
|
+
$span,
|
417
|
+
$columns,
|
418
|
+
$gutters,
|
419
|
+
$spread,
|
420
|
+
$validate: true
|
421
|
+
) {
|
422
|
+
@if $validate {
|
423
|
+
$span: su-valid-span($span);
|
424
|
+
$columns: su-valid-columns($columns);
|
425
|
+
$gutters: su-valid-gutters($gutters);
|
426
|
+
}
|
427
|
+
|
428
|
+
$has-gutter: if((length($span) > 1) or ($spread >= 0), true, false);
|
429
|
+
$check: if($has-gutter, append($span, $gutters), $span);
|
430
|
+
$safe-span: _su-is-comparable($check...);
|
431
|
+
|
432
|
+
@if ($safe-span == 'static') {
|
433
|
+
@return false;
|
434
|
+
} @else if (not $safe-span) {
|
435
|
+
@return true;
|
436
|
+
}
|
437
|
+
|
438
|
+
$safe-fluid: _su-is-comparable($gutters, $columns...);
|
439
|
+
|
440
|
+
@return not $safe-fluid;
|
441
|
+
}
|
@@ -0,0 +1,213 @@
|
|
1
|
+
/// Validation
|
2
|
+
/// ==========
|
3
|
+
/// Each argument to Su has a single canonical syntax.
|
4
|
+
/// These validation functions check to ensure
|
5
|
+
/// that each argument is valid,
|
6
|
+
/// in order to provide useful errors
|
7
|
+
/// before attempting to calculate the results/
|
8
|
+
///
|
9
|
+
/// @group x-validation
|
10
|
+
///
|
11
|
+
/// @see su-valid-columns
|
12
|
+
/// @see su-valid-gutters
|
13
|
+
/// @see su-valid-spread
|
14
|
+
/// @see su-valid-location
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
// Valid Span
|
19
|
+
// ----------
|
20
|
+
/// Check that the `span` argument
|
21
|
+
/// is a number, length, or column-list
|
22
|
+
///
|
23
|
+
/// @group x-validation
|
24
|
+
///
|
25
|
+
/// @param {number | list} $span -
|
26
|
+
/// Number of columns, or length of span
|
27
|
+
///
|
28
|
+
/// @return {number | list} -
|
29
|
+
/// Validated `$span` number, length, or columns list
|
30
|
+
///
|
31
|
+
/// @throw
|
32
|
+
/// when span value is not a number, or valid column list
|
33
|
+
@function su-valid-span(
|
34
|
+
$span
|
35
|
+
) {
|
36
|
+
$type: type-of($span);
|
37
|
+
@if ($type == 'number') {
|
38
|
+
@return $span;
|
39
|
+
} @else if ($type == 'list') and su-valid-columns($span, 'silent-failure') {
|
40
|
+
@return $span;
|
41
|
+
}
|
42
|
+
|
43
|
+
$actual: '[#{type-of($span)}] `#{inspect($span)}`';
|
44
|
+
@return _susy-error(
|
45
|
+
'#{$actual} is not a valid number, length, or column-list for $span.',
|
46
|
+
'su-valid-span');
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
// Valid Columns
|
52
|
+
// -------------
|
53
|
+
/// Check that the `columns` argument is a valid
|
54
|
+
/// list of column-lengths
|
55
|
+
///
|
56
|
+
/// @group x-validation
|
57
|
+
///
|
58
|
+
/// @param {list} $columns -
|
59
|
+
/// List of column-lengths
|
60
|
+
/// @param {bool} $silent-failure [true] -
|
61
|
+
/// Set false to return null on failure
|
62
|
+
///
|
63
|
+
/// @return {list} -
|
64
|
+
/// Validated `$columns` list
|
65
|
+
///
|
66
|
+
/// @throw
|
67
|
+
/// when column value is not a valid list of numbers
|
68
|
+
@function su-valid-columns(
|
69
|
+
$columns,
|
70
|
+
$silent-failure: false
|
71
|
+
) {
|
72
|
+
@if (type-of($columns) == 'list') {
|
73
|
+
$fail: false;
|
74
|
+
|
75
|
+
@each $col in $columns {
|
76
|
+
@if (type-of($col) != 'number') {
|
77
|
+
$fail: true;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
@if not $fail {
|
82
|
+
@return $columns;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// Silent Failure
|
87
|
+
@if $silent-failure {
|
88
|
+
@return null;
|
89
|
+
}
|
90
|
+
|
91
|
+
// Error Message
|
92
|
+
$actual: '[#{type-of($columns)}] `#{inspect($columns)}`';
|
93
|
+
|
94
|
+
@return _susy-error(
|
95
|
+
'#{$actual} is not a valid list of numbers for $columns.',
|
96
|
+
'su-valid-columns');
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
// Valid Gutters
|
102
|
+
// -------------
|
103
|
+
/// Check that the `gutters` argument is a valid number
|
104
|
+
///
|
105
|
+
/// @group x-validation
|
106
|
+
///
|
107
|
+
/// @param {number} $gutters -
|
108
|
+
/// Width of a gutter
|
109
|
+
///
|
110
|
+
/// @return {number} -
|
111
|
+
/// Validated `$gutters` number
|
112
|
+
///
|
113
|
+
/// @throw
|
114
|
+
/// when gutter value is not a number
|
115
|
+
@function su-valid-gutters(
|
116
|
+
$gutters
|
117
|
+
) {
|
118
|
+
$type: type-of($gutters);
|
119
|
+
|
120
|
+
@if ($type == 'number') {
|
121
|
+
@return $gutters;
|
122
|
+
}
|
123
|
+
|
124
|
+
$actual: '[#{$type}] `#{inspect($gutters)}`';
|
125
|
+
@return _susy-error(
|
126
|
+
'#{$actual} is not a number or length for $gutters.',
|
127
|
+
'su-valid-gutters');
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
// Valid Spread
|
133
|
+
// ------------
|
134
|
+
/// Check that the `spread` argument is a valid
|
135
|
+
/// intiger between `-1` and `1`
|
136
|
+
///
|
137
|
+
/// @group x-validation
|
138
|
+
///
|
139
|
+
/// @param {0 | 1 | -1} $spread -
|
140
|
+
/// Number of gutters to include in a span,
|
141
|
+
/// relative to the number columns
|
142
|
+
///
|
143
|
+
/// @return {0 | 1 | -1} -
|
144
|
+
/// Validated `$spread` number
|
145
|
+
///
|
146
|
+
/// @throw
|
147
|
+
/// when spread value is not a valid spread
|
148
|
+
@function su-valid-spread(
|
149
|
+
$spread
|
150
|
+
) {
|
151
|
+
@if index(0 1 -1, $spread) {
|
152
|
+
@return $spread;
|
153
|
+
}
|
154
|
+
|
155
|
+
$actual: '[#{type-of($spread)}] `#{inspect($spread)}`';
|
156
|
+
@return _susy-error(
|
157
|
+
'#{$actual} is not a normalized [0 | 1 | -1] value for `$spread`.',
|
158
|
+
'su-valid-spread');
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
// Valid Location
|
164
|
+
// --------------
|
165
|
+
/// Check that the `location` argument is a valid number,
|
166
|
+
/// within the scope of available columns
|
167
|
+
///
|
168
|
+
/// @group x-validation
|
169
|
+
///
|
170
|
+
/// @param {number} $span -
|
171
|
+
/// Number of grid-columns to be spanned
|
172
|
+
/// @param {integer | string} $location -
|
173
|
+
/// Starting (1-indexed) column-position of that span
|
174
|
+
/// @param {list} $columns -
|
175
|
+
/// List of available columns in the grid
|
176
|
+
///
|
177
|
+
/// @return {integer} -
|
178
|
+
/// Validated `$location` intiger
|
179
|
+
///
|
180
|
+
/// @throw
|
181
|
+
/// when location value is not a valid index,
|
182
|
+
/// given the context and span.
|
183
|
+
@function su-valid-location(
|
184
|
+
$span,
|
185
|
+
$location,
|
186
|
+
$columns
|
187
|
+
) {
|
188
|
+
$count: length($columns);
|
189
|
+
|
190
|
+
@if $location {
|
191
|
+
@if (type-of($location) != 'number') or (not unitless($location)) {
|
192
|
+
$actual: '[#{type-of($location)}] `#{$location}`';
|
193
|
+
@return _susy-error(
|
194
|
+
'#{$actual} is not a unitless number for $location.',
|
195
|
+
'su-valid-location');
|
196
|
+
} @else if (round($location) != $location) {
|
197
|
+
@return _susy-error(
|
198
|
+
'Location (`#{$location}`) must be a 1-indexed intiger position.',
|
199
|
+
'su-valid-location');
|
200
|
+
} @else if ($location > $count) or ($location < 1) {
|
201
|
+
@return _susy-error(
|
202
|
+
'Position `#{$location}` does not exist in grid `#{$columns}`.',
|
203
|
+
'su-valid-location');
|
204
|
+
} @else if ($location + $span - 1 > $count) {
|
205
|
+
$details: 'grid `#{$columns}` for span `#{$span}` at `#{$location}`';
|
206
|
+
@return _susy-error(
|
207
|
+
'There are not enough columns in #{$details}.',
|
208
|
+
'su-valid-location');
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
@return $location;
|
213
|
+
}
|