dendron-jekyll 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +68 -0
  4. data/Rakefile +1 -0
  5. data/_includes/active.html +8 -0
  6. data/_includes/archive-single.html +33 -0
  7. data/_includes/crumbs.html +15 -0
  8. data/_includes/css/custom.scss.liquid +1 -0
  9. data/_includes/css/just-the-docs.scss.liquid +7 -0
  10. data/_includes/documents-collection.html +25 -0
  11. data/_includes/figure +9 -0
  12. data/_includes/head.html +40 -0
  13. data/_includes/head_custom.html +0 -0
  14. data/_includes/js/custom.js +0 -0
  15. data/_includes/nav.html +37 -0
  16. data/_includes/sidebar.html +19 -0
  17. data/_includes/title.html +5 -0
  18. data/_includes/toc +7 -0
  19. data/_includes/toc-mm.html +96 -0
  20. data/_includes/toc.html +16 -0
  21. data/_includes/vendor/anchor_headings.html +100 -0
  22. data/_layouts/about.html +5 -0
  23. data/_layouts/archive.html +30 -0
  24. data/_layouts/default.html +160 -0
  25. data/_layouts/home.html +5 -0
  26. data/_layouts/page.html +5 -0
  27. data/_layouts/post.html +5 -0
  28. data/_layouts/single.html +97 -0
  29. data/_layouts/table_wrappers.html +7 -0
  30. data/_layouts/vendor/compress.html +10 -0
  31. data/_sass/base.scss +108 -0
  32. data/_sass/buttons.scss +118 -0
  33. data/_sass/code.scss +261 -0
  34. data/_sass/color_schemes/dark.scss +17 -0
  35. data/_sass/color_schemes/light.scss +0 -0
  36. data/_sass/content.scss +196 -0
  37. data/_sass/custom/custom.scss +0 -0
  38. data/_sass/labels.scss +37 -0
  39. data/_sass/layout.scss +205 -0
  40. data/_sass/minimal-mistakes/_animations.scss +21 -0
  41. data/_sass/minimal-mistakes/_archive.scss +455 -0
  42. data/_sass/minimal-mistakes/_base.scss +357 -0
  43. data/_sass/minimal-mistakes/_buttons.scss +97 -0
  44. data/_sass/minimal-mistakes/_footer.scss +86 -0
  45. data/_sass/minimal-mistakes/_forms.scss +393 -0
  46. data/_sass/minimal-mistakes/_masthead.scss +93 -0
  47. data/_sass/minimal-mistakes/_mixins.scss +92 -0
  48. data/_sass/minimal-mistakes/_navigation.scss +566 -0
  49. data/_sass/minimal-mistakes/_notices.scss +105 -0
  50. data/_sass/minimal-mistakes/_page.scss +553 -0
  51. data/_sass/minimal-mistakes/_print.scss +252 -0
  52. data/_sass/minimal-mistakes/_reset.scss +187 -0
  53. data/_sass/minimal-mistakes/_search.scss +132 -0
  54. data/_sass/minimal-mistakes/_sidebar.scss +347 -0
  55. data/_sass/minimal-mistakes/_syntax.scss +324 -0
  56. data/_sass/minimal-mistakes/_tables.scss +39 -0
  57. data/_sass/minimal-mistakes/_utilities.scss +593 -0
  58. data/_sass/minimal-mistakes/_variables.scss +169 -0
  59. data/_sass/minimal-mistakes/skins/_air.scss +23 -0
  60. data/_sass/minimal-mistakes/skins/_aqua.scss +30 -0
  61. data/_sass/minimal-mistakes/skins/_contrast.scss +51 -0
  62. data/_sass/minimal-mistakes/skins/_dark.scss +28 -0
  63. data/_sass/minimal-mistakes/skins/_default.scss +5 -0
  64. data/_sass/minimal-mistakes/skins/_dirt.scss +33 -0
  65. data/_sass/minimal-mistakes/skins/_mint.scss +23 -0
  66. data/_sass/minimal-mistakes/skins/_neon.scss +57 -0
  67. data/_sass/minimal-mistakes/skins/_plum.scss +64 -0
  68. data/_sass/minimal-mistakes/skins/_sunrise.scss +44 -0
  69. data/_sass/minimal-mistakes/vendor/breakpoint/_breakpoint.scss +114 -0
  70. data/_sass/minimal-mistakes/vendor/breakpoint/_context.scss +95 -0
  71. data/_sass/minimal-mistakes/vendor/breakpoint/_helpers.scss +151 -0
  72. data/_sass/minimal-mistakes/vendor/breakpoint/_legacy-settings.scss +50 -0
  73. data/_sass/minimal-mistakes/vendor/breakpoint/_no-query.scss +15 -0
  74. data/_sass/minimal-mistakes/vendor/breakpoint/_parsers.scss +215 -0
  75. data/_sass/minimal-mistakes/vendor/breakpoint/_respond-to.scss +82 -0
  76. data/_sass/minimal-mistakes/vendor/breakpoint/_settings.scss +71 -0
  77. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_double.scss +33 -0
  78. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_query.scss +82 -0
  79. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_resolution.scss +31 -0
  80. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_single.scss +26 -0
  81. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_triple.scss +36 -0
  82. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default-pair.scss +21 -0
  83. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default.scss +22 -0
  84. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_double-string.scss +22 -0
  85. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -0
  86. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/single/_default.scss +13 -0
  87. data/_sass/minimal-mistakes/vendor/breakpoint/parsers/triple/_default.scss +18 -0
  88. data/_sass/minimal-mistakes/vendor/magnific-popup/_magnific-popup.scss +649 -0
  89. data/_sass/minimal-mistakes/vendor/magnific-popup/_settings.scss +46 -0
  90. data/_sass/minimal-mistakes/vendor/susy/_su.scss +4 -0
  91. data/_sass/minimal-mistakes/vendor/susy/_susy-prefix.scss +13 -0
  92. data/_sass/minimal-mistakes/vendor/susy/_susy.scss +5 -0
  93. data/_sass/minimal-mistakes/vendor/susy/plugins/_svg-grid.scss +5 -0
  94. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_prefix.scss +7 -0
  95. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -0
  96. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -0
  97. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -0
  98. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -0
  99. data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -0
  100. data/_sass/minimal-mistakes/vendor/susy/susy/_api.scss +318 -0
  101. data/_sass/minimal-mistakes/vendor/susy/susy/_normalize.scss +261 -0
  102. data/_sass/minimal-mistakes/vendor/susy/susy/_parse.scss +163 -0
  103. data/_sass/minimal-mistakes/vendor/susy/susy/_settings.scss +329 -0
  104. data/_sass/minimal-mistakes/vendor/susy/susy/_su-math.scss +441 -0
  105. data/_sass/minimal-mistakes/vendor/susy/susy/_su-validate.scss +213 -0
  106. data/_sass/minimal-mistakes/vendor/susy/susy/_syntax-helpers.scss +191 -0
  107. data/_sass/minimal-mistakes/vendor/susy/susy/_unprefix.scss +56 -0
  108. data/_sass/minimal-mistakes/vendor/susy/susy/_utilities.scss +167 -0
  109. data/_sass/modules.scss +25 -0
  110. data/_sass/navigation.scss +196 -0
  111. data/_sass/print.scss +40 -0
  112. data/_sass/search.scss +323 -0
  113. data/_sass/support/_functions.scss +9 -0
  114. data/_sass/support/_variables.scss +135 -0
  115. data/_sass/support/mixins/_buttons.scss +27 -0
  116. data/_sass/support/mixins/_layout.scss +34 -0
  117. data/_sass/support/mixins/_typography.scss +86 -0
  118. data/_sass/support/mixins/mixins.scss +3 -0
  119. data/_sass/support/support.scss +3 -0
  120. data/_sass/tables.scss +58 -0
  121. data/_sass/typography.scss +60 -0
  122. data/_sass/utilities/_colors.scss +239 -0
  123. data/_sass/utilities/_layout.scss +95 -0
  124. data/_sass/utilities/_lists.scss +17 -0
  125. data/_sass/utilities/_spacing.scss +165 -0
  126. data/_sass/utilities/_typography.scss +91 -0
  127. data/_sass/utilities/utilities.scss +5 -0
  128. data/_sass/vendor/normalize.scss/README.md +78 -0
  129. data/_sass/vendor/normalize.scss/normalize.scss +427 -0
  130. data/_sass/vendor/normalize.scss/package.json +70 -0
  131. data/assets/css/just-the-docs-dark.scss +3 -0
  132. data/assets/css/just-the-docs-default.scss +8 -0
  133. data/assets/css/just-the-docs-light.scss +3 -0
  134. data/assets/images/just-the-docs.png +0 -0
  135. data/assets/images/search.svg +1 -0
  136. data/assets/js/just-the-docs.js +473 -0
  137. data/assets/js/vendor/lunr.min.js +6 -0
  138. data/assets/js/zzzz-search-data.json +60 -0
  139. data/bin/just-the-docs +16 -0
  140. data/lib/tasks/search.rake +74 -0
  141. metadata +245 -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
+ }