jekyll-theme-basically-basic 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +150 -42
  4. data/_includes/author +30 -30
  5. data/_includes/contact-list.html +27 -27
  6. data/_includes/cv/awards.html +23 -23
  7. data/_includes/cv/basics.html +68 -68
  8. data/_includes/cv/education.html +36 -36
  9. data/_includes/cv/interests.html +19 -19
  10. data/_includes/cv/intro.html +18 -18
  11. data/_includes/cv/languages.html +19 -19
  12. data/_includes/cv/publications.html +29 -29
  13. data/_includes/cv/references.html +23 -23
  14. data/_includes/cv/volunteer.html +46 -46
  15. data/_includes/cv/work.html +46 -46
  16. data/_includes/disqus_comments.html +16 -16
  17. data/_includes/documents-collection.html +19 -0
  18. data/_includes/entry.html +37 -29
  19. data/_includes/footer.html +11 -9
  20. data/_includes/google-analytics.html +8 -8
  21. data/_includes/head.html +35 -35
  22. data/_includes/icon-bitbucket.html +4 -4
  23. data/_includes/icon-codepen.html +4 -4
  24. data/_includes/icon-dribbble.html +4 -4
  25. data/_includes/icon-facebook.html +4 -4
  26. data/_includes/icon-flickr.html +4 -4
  27. data/_includes/icon-github.html +4 -4
  28. data/_includes/icon-gitlab.html +4 -4
  29. data/_includes/icon-googleplus.html +4 -4
  30. data/_includes/icon-instagram.html +4 -4
  31. data/_includes/icon-lastfm.html +4 -4
  32. data/_includes/icon-linkedin.html +4 -4
  33. data/_includes/icon-pinterest.html +4 -4
  34. data/_includes/icon-soundcloud.html +4 -4
  35. data/_includes/icon-stackoverflow.html +4 -4
  36. data/_includes/icon-tumblr.html +4 -4
  37. data/_includes/icon-twitter.html +4 -4
  38. data/_includes/icon-xing.html +4 -4
  39. data/_includes/icon-youtube.html +4 -4
  40. data/_includes/masthead.html +27 -27
  41. data/_includes/navigation.html +25 -25
  42. data/_includes/page-intro.html +42 -42
  43. data/_includes/page-tags.html +14 -0
  44. data/_includes/posts-all.html +2 -2
  45. data/_includes/posts-category.html +3 -0
  46. data/_includes/posts-paginated.html +15 -15
  47. data/_includes/posts-tag.html +3 -0
  48. data/_includes/read-time.html +13 -13
  49. data/_includes/search-form.html +14 -13
  50. data/_includes/search/algolia-search-scripts.html +52 -52
  51. data/_includes/search/lunr-search-scripts.html +1 -1
  52. data/_includes/skip-links.html +8 -8
  53. data/_layouts/about.html +0 -2
  54. data/_layouts/categories.html +48 -0
  55. data/_layouts/category.html +9 -0
  56. data/_layouts/collection.html +9 -0
  57. data/_layouts/cv.html +28 -28
  58. data/_layouts/default.html +2 -1
  59. data/_layouts/home.html +28 -30
  60. data/_layouts/page.html +15 -17
  61. data/_layouts/post.html +18 -20
  62. data/_layouts/posts.html +29 -0
  63. data/_layouts/tag.html +9 -0
  64. data/_layouts/tags.html +48 -0
  65. data/_sass/basically-basic.scss +1 -1
  66. data/_sass/basically-basic/_base.scss +116 -118
  67. data/_sass/basically-basic/_contact-lists.scss +11 -11
  68. data/_sass/basically-basic/_entries.scss +230 -152
  69. data/_sass/basically-basic/_footer.scss +37 -13
  70. data/_sass/basically-basic/_functions.scss +2 -2
  71. data/_sass/basically-basic/_global.scss +116 -42
  72. data/_sass/basically-basic/_icons.scss +43 -43
  73. data/_sass/basically-basic/_intro.scss +3 -1
  74. data/_sass/basically-basic/_layout.scss +188 -188
  75. data/_sass/basically-basic/_mixins.scss +5 -5
  76. data/_sass/basically-basic/_navicons.scss +148 -148
  77. data/_sass/basically-basic/_navigation.scss +66 -66
  78. data/_sass/basically-basic/_print.scss +252 -252
  79. data/_sass/basically-basic/_reset.scss +522 -522
  80. data/_sass/basically-basic/_responsive-embed.scss +70 -70
  81. data/_sass/basically-basic/_search.scss +101 -101
  82. data/_sass/basically-basic/_sidebar.scss +166 -166
  83. data/_sass/basically-basic/_tables.scss +34 -34
  84. data/_sass/basically-basic/_utilities.scss +6 -6
  85. data/_sass/basically-basic/_variables.scss +3 -0
  86. data/_sass/basically-basic/functions/_color.scss +21 -21
  87. data/_sass/basically-basic/functions/_fluid-type.scss +33 -33
  88. data/_sass/basically-basic/mixins/_clearfix.scss +11 -11
  89. data/_sass/basically-basic/mixins/_float.scss +15 -15
  90. data/_sass/basically-basic/mixins/_image.scss +38 -38
  91. data/_sass/basically-basic/mixins/_lists.scss +9 -9
  92. data/_sass/basically-basic/mixins/_text-truncate.scss +10 -10
  93. data/_sass/basically-basic/themes/_default.scss +5 -5
  94. data/_sass/basically-basic/themes/_night.scss +12 -12
  95. data/_sass/basically-basic/themes/_plum.scss +12 -12
  96. data/_sass/basically-basic/themes/_sea.scss +12 -12
  97. data/_sass/basically-basic/utilities/_accessibility.scss +43 -43
  98. data/_sass/basically-basic/utilities/_align.scss +62 -62
  99. data/_sass/basically-basic/utilities/_clearfix.scss +7 -7
  100. data/_sass/basically-basic/utilities/_float.scss +7 -7
  101. data/_sass/basically-basic/utilities/_text.scss +28 -28
  102. data/_sass/basically-basic/utilities/_visibility.scss +32 -32
  103. data/_sass/basically-basic/vendor/breakpoint/_breakpoint.scss +114 -114
  104. data/_sass/basically-basic/vendor/breakpoint/_context.scss +94 -94
  105. data/_sass/basically-basic/vendor/breakpoint/_helpers.scss +151 -151
  106. data/_sass/basically-basic/vendor/breakpoint/_legacy-settings.scss +49 -49
  107. data/_sass/basically-basic/vendor/breakpoint/_no-query.scss +15 -15
  108. data/_sass/basically-basic/vendor/breakpoint/_parsers.scss +215 -215
  109. data/_sass/basically-basic/vendor/breakpoint/_respond-to.scss +82 -82
  110. data/_sass/basically-basic/vendor/breakpoint/_settings.scss +70 -70
  111. data/_sass/basically-basic/vendor/breakpoint/parsers/_double.scss +33 -33
  112. data/_sass/basically-basic/vendor/breakpoint/parsers/_query.scss +82 -82
  113. data/_sass/basically-basic/vendor/breakpoint/parsers/_resolution.scss +31 -31
  114. data/_sass/basically-basic/vendor/breakpoint/parsers/_single.scss +26 -26
  115. data/_sass/basically-basic/vendor/breakpoint/parsers/_triple.scss +36 -36
  116. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
  117. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_default.scss +22 -22
  118. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
  119. data/_sass/basically-basic/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
  120. data/_sass/basically-basic/vendor/breakpoint/parsers/single/_default.scss +13 -13
  121. data/_sass/basically-basic/vendor/breakpoint/parsers/triple/_default.scss +18 -18
  122. data/_sass/basically-basic/vendor/susy/_su.scss +4 -4
  123. data/_sass/basically-basic/vendor/susy/_susy-prefix.scss +13 -13
  124. data/_sass/basically-basic/vendor/susy/_susy.scss +5 -5
  125. data/_sass/basically-basic/vendor/susy/plugins/_svg-grid.scss +5 -5
  126. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_prefix.scss +7 -7
  127. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -114
  128. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -67
  129. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -14
  130. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -18
  131. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -133
  132. data/_sass/basically-basic/vendor/susy/susy/_api.scss +318 -318
  133. data/_sass/basically-basic/vendor/susy/susy/_normalize.scss +261 -261
  134. data/_sass/basically-basic/vendor/susy/susy/_parse.scss +163 -163
  135. data/_sass/basically-basic/vendor/susy/susy/_settings.scss +329 -329
  136. data/_sass/basically-basic/vendor/susy/susy/_su-math.scss +441 -441
  137. data/_sass/basically-basic/vendor/susy/susy/_su-validate.scss +213 -213
  138. data/_sass/basically-basic/vendor/susy/susy/_syntax-helpers.scss +191 -191
  139. data/_sass/basically-basic/vendor/susy/susy/_unprefix.scss +56 -56
  140. data/_sass/basically-basic/vendor/susy/susy/_utilities.scss +167 -167
  141. data/assets/javascripts/lunr/lunr.da.min.js +17 -17
  142. data/assets/javascripts/lunr/lunr.de.min.js +17 -17
  143. data/assets/javascripts/lunr/lunr.du.min.js +17 -17
  144. data/assets/javascripts/lunr/lunr.es.min.js +17 -17
  145. data/assets/javascripts/lunr/lunr.fi.min.js +17 -17
  146. data/assets/javascripts/lunr/lunr.fr.min.js +17 -17
  147. data/assets/javascripts/lunr/lunr.hu.min.js +17 -17
  148. data/assets/javascripts/lunr/lunr.it.min.js +17 -17
  149. data/assets/javascripts/lunr/lunr.jp.min.js +1 -1
  150. data/assets/javascripts/lunr/lunr.min.js +6 -6
  151. data/assets/javascripts/lunr/lunr.no.min.js +17 -17
  152. data/assets/javascripts/lunr/lunr.pt.min.js +17 -17
  153. data/assets/javascripts/lunr/lunr.ro.min.js +17 -17
  154. data/assets/javascripts/lunr/lunr.ru.min.js +17 -17
  155. data/assets/javascripts/lunr/lunr.sv.min.js +17 -17
  156. data/assets/javascripts/lunr/lunr.tr.min.js +17 -17
  157. data/assets/javascripts/main.js +12 -12
  158. data/assets/javascripts/search-data.json +43 -27
  159. data/assets/stylesheets/main.scss +9 -9
  160. metadata +21 -5
@@ -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
+ }