minimal-mistakes-jekyll 4.6.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE.txt +59 -21
  4. data/README.md +217 -160
  5. data/_data/navigation.yml +11 -11
  6. data/_data/ui-text.yml +931 -888
  7. data/_includes/analytics-providers/custom.html +2 -2
  8. data/_includes/analytics-providers/google-universal.html +9 -9
  9. data/_includes/analytics-providers/google.html +10 -10
  10. data/_includes/analytics.html +11 -11
  11. data/_includes/archive-single.html +37 -37
  12. data/_includes/author-profile-custom-links.html +6 -6
  13. data/_includes/author-profile.html +249 -249
  14. data/_includes/base_path +4 -4
  15. data/_includes/breadcrumbs.html +39 -39
  16. data/_includes/browser-upgrade.html +2 -2
  17. data/_includes/category-list.html +25 -25
  18. data/_includes/comment.html +22 -22
  19. data/_includes/comments-providers/custom.html +2 -2
  20. data/_includes/comments-providers/discourse.html +13 -13
  21. data/_includes/comments-providers/facebook.html +7 -7
  22. data/_includes/comments-providers/google-plus.html +1 -1
  23. data/_includes/comments-providers/scripts.html +17 -15
  24. data/_includes/comments-providers/staticman.html +41 -41
  25. data/_includes/comments-providers/staticman_v2.html +42 -0
  26. data/_includes/comments.html +168 -96
  27. data/_includes/feature_row +49 -49
  28. data/_includes/figure +12 -12
  29. data/_includes/footer.html +25 -25
  30. data/_includes/footer/custom.html +2 -2
  31. data/_includes/gallery +46 -46
  32. data/_includes/group-by-array +46 -46
  33. data/_includes/head.html +42 -42
  34. data/_includes/head/custom.html +4 -4
  35. data/_includes/masthead.html +23 -20
  36. data/_includes/nav_list +46 -46
  37. data/_includes/page__hero_video.html +4 -4
  38. data/_includes/page__taxonomy.html +6 -6
  39. data/_includes/paginator.html +69 -69
  40. data/_includes/post_pagination.html +13 -13
  41. data/_includes/read-time.html +14 -14
  42. data/_includes/scripts.html +15 -15
  43. data/_includes/seo.html +162 -147
  44. data/_includes/sidebar.html +22 -22
  45. data/_includes/social-share.html +13 -13
  46. data/_includes/tag-list.html +25 -25
  47. data/_includes/toc +6 -6
  48. data/_includes/toc.html +75 -0
  49. data/_includes/video +11 -11
  50. data/_layouts/archive-taxonomy.html +14 -14
  51. data/_layouts/archive.html +25 -25
  52. data/_layouts/compress.html +10 -10
  53. data/_layouts/default.html +1 -1
  54. data/_layouts/home.html +11 -11
  55. data/_layouts/single.html +92 -84
  56. data/_layouts/splash.html +21 -21
  57. data/_sass/minimal-mistakes.scss +1 -1
  58. data/_sass/minimal-mistakes/_animations.scss +20 -20
  59. data/_sass/minimal-mistakes/_archive.scss +317 -317
  60. data/_sass/minimal-mistakes/_base.scss +315 -315
  61. data/_sass/minimal-mistakes/_buttons.scss +97 -97
  62. data/_sass/minimal-mistakes/_footer.scss +82 -82
  63. data/_sass/minimal-mistakes/_forms.scss +399 -389
  64. data/_sass/minimal-mistakes/_masthead.scss +82 -82
  65. data/_sass/minimal-mistakes/_mixins.scss +91 -91
  66. data/_sass/minimal-mistakes/_navigation.scss +552 -552
  67. data/_sass/minimal-mistakes/_notices.scss +99 -99
  68. data/_sass/minimal-mistakes/_page.scss +430 -430
  69. data/_sass/minimal-mistakes/_reset.scss +186 -186
  70. data/_sass/minimal-mistakes/_sidebar.scss +262 -262
  71. data/_sass/minimal-mistakes/_syntax.scss +286 -146
  72. data/_sass/minimal-mistakes/_tables.scss +36 -36
  73. data/_sass/minimal-mistakes/_utilities.scss +519 -519
  74. data/_sass/minimal-mistakes/_variables.scss +137 -137
  75. data/_sass/minimal-mistakes/skins/_air.scss +22 -22
  76. data/_sass/minimal-mistakes/skins/_aqua.scss +30 -0
  77. data/_sass/minimal-mistakes/skins/_contrast.scss +33 -33
  78. data/_sass/minimal-mistakes/skins/_dark.scss +23 -23
  79. data/_sass/minimal-mistakes/skins/_default.scss +5 -5
  80. data/_sass/minimal-mistakes/skins/_dirt.scss +14 -14
  81. data/_sass/minimal-mistakes/skins/_mint.scss +22 -22
  82. data/_sass/minimal-mistakes/skins/_neon.scss +35 -0
  83. data/_sass/minimal-mistakes/skins/_plum.scss +42 -0
  84. data/_sass/minimal-mistakes/skins/_sunrise.scss +25 -25
  85. data/_sass/minimal-mistakes/vendor/breakpoint/_breakpoint.scss +114 -114
  86. data/_sass/minimal-mistakes/vendor/breakpoint/_context.scss +94 -94
  87. data/_sass/minimal-mistakes/vendor/breakpoint/_helpers.scss +151 -151
  88. data/_sass/minimal-mistakes/vendor/breakpoint/_legacy-settings.scss +49 -49
  89. data/_sass/minimal-mistakes/vendor/breakpoint/_no-query.scss +15 -15
  90. data/_sass/minimal-mistakes/vendor/breakpoint/_parsers.scss +215 -215
  91. data/_sass/minimal-mistakes/vendor/breakpoint/_respond-to.scss +82 -82
  92. data/_sass/minimal-mistakes/vendor/breakpoint/_settings.scss +70 -70
  93. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_double.scss +33 -33
  94. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_query.scss +82 -82
  95. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_resolution.scss +31 -31
  96. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_single.scss +26 -26
  97. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_triple.scss +36 -36
  98. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
  99. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default.scss +22 -22
  100. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
  101. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
  102. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/single/_default.scss +13 -13
  103. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/triple/_default.scss +18 -18
  104. data/_sass/minimal-mistakes/vendor/font-awesome/_animated.scss +34 -34
  105. data/_sass/minimal-mistakes/vendor/font-awesome/_bordered-pulled.scss +25 -25
  106. data/_sass/minimal-mistakes/vendor/font-awesome/_core.scss +12 -12
  107. data/_sass/minimal-mistakes/vendor/font-awesome/_fixed-width.scss +6 -6
  108. data/_sass/minimal-mistakes/vendor/font-awesome/_font-awesome.scss +18 -18
  109. data/_sass/minimal-mistakes/vendor/font-awesome/_icons.scss +789 -789
  110. data/_sass/minimal-mistakes/vendor/font-awesome/_larger.scss +13 -13
  111. data/_sass/minimal-mistakes/vendor/font-awesome/_list.scss +19 -19
  112. data/_sass/minimal-mistakes/vendor/font-awesome/_mixins.scss +60 -60
  113. data/_sass/minimal-mistakes/vendor/font-awesome/_path.scss +15 -15
  114. data/_sass/minimal-mistakes/vendor/font-awesome/_rotated-flipped.scss +20 -20
  115. data/_sass/minimal-mistakes/vendor/font-awesome/_screen-reader.scss +5 -5
  116. data/_sass/minimal-mistakes/vendor/font-awesome/_stacked.scss +20 -20
  117. data/_sass/minimal-mistakes/vendor/font-awesome/_variables.scss +800 -800
  118. data/_sass/minimal-mistakes/vendor/magnific-popup/_magnific-popup.scss +649 -649
  119. data/_sass/minimal-mistakes/vendor/magnific-popup/_settings.scss +45 -45
  120. data/_sass/minimal-mistakes/vendor/susy/_susy-prefix.scss +13 -13
  121. data/_sass/minimal-mistakes/vendor/susy/_susy.scss +5 -5
  122. data/_sass/minimal-mistakes/vendor/susy/plugins/_svg-grid.scss +5 -5
  123. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_prefix.scss +7 -7
  124. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -114
  125. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -67
  126. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -14
  127. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -18
  128. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -133
  129. data/_sass/minimal-mistakes/vendor/susy/susy/_api.scss +318 -318
  130. data/_sass/minimal-mistakes/vendor/susy/susy/_normalize.scss +261 -261
  131. data/_sass/minimal-mistakes/vendor/susy/susy/_parse.scss +163 -163
  132. data/_sass/minimal-mistakes/vendor/susy/susy/_settings.scss +329 -329
  133. data/_sass/minimal-mistakes/vendor/susy/susy/_su-math.scss +441 -441
  134. data/_sass/minimal-mistakes/vendor/susy/susy/_su-validate.scss +213 -213
  135. data/_sass/minimal-mistakes/vendor/susy/susy/_syntax-helpers.scss +191 -191
  136. data/_sass/minimal-mistakes/vendor/susy/susy/_unprefix.scss +56 -56
  137. data/_sass/minimal-mistakes/vendor/susy/susy/_utilities.scss +167 -167
  138. data/assets/css/main.scss +7 -7
  139. data/assets/fonts/fontawesome-webfont.svg +2671 -2671
  140. data/assets/js/_main.js +72 -72
  141. data/assets/js/main.min.js +1 -1
  142. data/assets/js/plugins/jquery.fitvids.js +81 -81
  143. data/assets/js/plugins/jquery.greedy-navigation.js +77 -77
  144. metadata +8 -3
@@ -1,441 +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
- }
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
+ }