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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/LICENSE.txt +59 -21
- data/README.md +217 -160
- data/_data/navigation.yml +11 -11
- data/_data/ui-text.yml +931 -888
- data/_includes/analytics-providers/custom.html +2 -2
- data/_includes/analytics-providers/google-universal.html +9 -9
- data/_includes/analytics-providers/google.html +10 -10
- data/_includes/analytics.html +11 -11
- data/_includes/archive-single.html +37 -37
- data/_includes/author-profile-custom-links.html +6 -6
- data/_includes/author-profile.html +249 -249
- data/_includes/base_path +4 -4
- data/_includes/breadcrumbs.html +39 -39
- data/_includes/browser-upgrade.html +2 -2
- data/_includes/category-list.html +25 -25
- data/_includes/comment.html +22 -22
- data/_includes/comments-providers/custom.html +2 -2
- data/_includes/comments-providers/discourse.html +13 -13
- data/_includes/comments-providers/facebook.html +7 -7
- data/_includes/comments-providers/google-plus.html +1 -1
- data/_includes/comments-providers/scripts.html +17 -15
- data/_includes/comments-providers/staticman.html +41 -41
- data/_includes/comments-providers/staticman_v2.html +42 -0
- data/_includes/comments.html +168 -96
- data/_includes/feature_row +49 -49
- data/_includes/figure +12 -12
- data/_includes/footer.html +25 -25
- data/_includes/footer/custom.html +2 -2
- data/_includes/gallery +46 -46
- data/_includes/group-by-array +46 -46
- data/_includes/head.html +42 -42
- data/_includes/head/custom.html +4 -4
- data/_includes/masthead.html +23 -20
- data/_includes/nav_list +46 -46
- data/_includes/page__hero_video.html +4 -4
- data/_includes/page__taxonomy.html +6 -6
- data/_includes/paginator.html +69 -69
- data/_includes/post_pagination.html +13 -13
- data/_includes/read-time.html +14 -14
- data/_includes/scripts.html +15 -15
- data/_includes/seo.html +162 -147
- data/_includes/sidebar.html +22 -22
- data/_includes/social-share.html +13 -13
- data/_includes/tag-list.html +25 -25
- data/_includes/toc +6 -6
- data/_includes/toc.html +75 -0
- data/_includes/video +11 -11
- data/_layouts/archive-taxonomy.html +14 -14
- data/_layouts/archive.html +25 -25
- data/_layouts/compress.html +10 -10
- data/_layouts/default.html +1 -1
- data/_layouts/home.html +11 -11
- data/_layouts/single.html +92 -84
- data/_layouts/splash.html +21 -21
- data/_sass/minimal-mistakes.scss +1 -1
- data/_sass/minimal-mistakes/_animations.scss +20 -20
- data/_sass/minimal-mistakes/_archive.scss +317 -317
- data/_sass/minimal-mistakes/_base.scss +315 -315
- data/_sass/minimal-mistakes/_buttons.scss +97 -97
- data/_sass/minimal-mistakes/_footer.scss +82 -82
- data/_sass/minimal-mistakes/_forms.scss +399 -389
- data/_sass/minimal-mistakes/_masthead.scss +82 -82
- data/_sass/minimal-mistakes/_mixins.scss +91 -91
- data/_sass/minimal-mistakes/_navigation.scss +552 -552
- data/_sass/minimal-mistakes/_notices.scss +99 -99
- data/_sass/minimal-mistakes/_page.scss +430 -430
- data/_sass/minimal-mistakes/_reset.scss +186 -186
- data/_sass/minimal-mistakes/_sidebar.scss +262 -262
- data/_sass/minimal-mistakes/_syntax.scss +286 -146
- data/_sass/minimal-mistakes/_tables.scss +36 -36
- data/_sass/minimal-mistakes/_utilities.scss +519 -519
- data/_sass/minimal-mistakes/_variables.scss +137 -137
- data/_sass/minimal-mistakes/skins/_air.scss +22 -22
- data/_sass/minimal-mistakes/skins/_aqua.scss +30 -0
- data/_sass/minimal-mistakes/skins/_contrast.scss +33 -33
- data/_sass/minimal-mistakes/skins/_dark.scss +23 -23
- data/_sass/minimal-mistakes/skins/_default.scss +5 -5
- data/_sass/minimal-mistakes/skins/_dirt.scss +14 -14
- data/_sass/minimal-mistakes/skins/_mint.scss +22 -22
- data/_sass/minimal-mistakes/skins/_neon.scss +35 -0
- data/_sass/minimal-mistakes/skins/_plum.scss +42 -0
- data/_sass/minimal-mistakes/skins/_sunrise.scss +25 -25
- data/_sass/minimal-mistakes/vendor/breakpoint/_breakpoint.scss +114 -114
- data/_sass/minimal-mistakes/vendor/breakpoint/_context.scss +94 -94
- data/_sass/minimal-mistakes/vendor/breakpoint/_helpers.scss +151 -151
- data/_sass/minimal-mistakes/vendor/breakpoint/_legacy-settings.scss +49 -49
- data/_sass/minimal-mistakes/vendor/breakpoint/_no-query.scss +15 -15
- data/_sass/minimal-mistakes/vendor/breakpoint/_parsers.scss +215 -215
- data/_sass/minimal-mistakes/vendor/breakpoint/_respond-to.scss +82 -82
- data/_sass/minimal-mistakes/vendor/breakpoint/_settings.scss +70 -70
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_double.scss +33 -33
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_query.scss +82 -82
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_resolution.scss +31 -31
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_single.scss +26 -26
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/_triple.scss +36 -36
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_default.scss +22 -22
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/single/_default.scss +13 -13
- data/_sass/minimal-mistakes/vendor/breakpoint/parsers/triple/_default.scss +18 -18
- data/_sass/minimal-mistakes/vendor/font-awesome/_animated.scss +34 -34
- data/_sass/minimal-mistakes/vendor/font-awesome/_bordered-pulled.scss +25 -25
- data/_sass/minimal-mistakes/vendor/font-awesome/_core.scss +12 -12
- data/_sass/minimal-mistakes/vendor/font-awesome/_fixed-width.scss +6 -6
- data/_sass/minimal-mistakes/vendor/font-awesome/_font-awesome.scss +18 -18
- data/_sass/minimal-mistakes/vendor/font-awesome/_icons.scss +789 -789
- data/_sass/minimal-mistakes/vendor/font-awesome/_larger.scss +13 -13
- data/_sass/minimal-mistakes/vendor/font-awesome/_list.scss +19 -19
- data/_sass/minimal-mistakes/vendor/font-awesome/_mixins.scss +60 -60
- data/_sass/minimal-mistakes/vendor/font-awesome/_path.scss +15 -15
- data/_sass/minimal-mistakes/vendor/font-awesome/_rotated-flipped.scss +20 -20
- data/_sass/minimal-mistakes/vendor/font-awesome/_screen-reader.scss +5 -5
- data/_sass/minimal-mistakes/vendor/font-awesome/_stacked.scss +20 -20
- data/_sass/minimal-mistakes/vendor/font-awesome/_variables.scss +800 -800
- data/_sass/minimal-mistakes/vendor/magnific-popup/_magnific-popup.scss +649 -649
- data/_sass/minimal-mistakes/vendor/magnific-popup/_settings.scss +45 -45
- data/_sass/minimal-mistakes/vendor/susy/_susy-prefix.scss +13 -13
- data/_sass/minimal-mistakes/vendor/susy/_susy.scss +5 -5
- data/_sass/minimal-mistakes/vendor/susy/plugins/_svg-grid.scss +5 -5
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_prefix.scss +7 -7
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -114
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -67
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -14
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -18
- data/_sass/minimal-mistakes/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -133
- data/_sass/minimal-mistakes/vendor/susy/susy/_api.scss +318 -318
- data/_sass/minimal-mistakes/vendor/susy/susy/_normalize.scss +261 -261
- data/_sass/minimal-mistakes/vendor/susy/susy/_parse.scss +163 -163
- data/_sass/minimal-mistakes/vendor/susy/susy/_settings.scss +329 -329
- data/_sass/minimal-mistakes/vendor/susy/susy/_su-math.scss +441 -441
- data/_sass/minimal-mistakes/vendor/susy/susy/_su-validate.scss +213 -213
- data/_sass/minimal-mistakes/vendor/susy/susy/_syntax-helpers.scss +191 -191
- data/_sass/minimal-mistakes/vendor/susy/susy/_unprefix.scss +56 -56
- data/_sass/minimal-mistakes/vendor/susy/susy/_utilities.scss +167 -167
- data/assets/css/main.scss +7 -7
- data/assets/fonts/fontawesome-webfont.svg +2671 -2671
- data/assets/js/_main.js +72 -72
- data/assets/js/main.min.js +1 -1
- data/assets/js/plugins/jquery.fitvids.js +81 -81
- data/assets/js/plugins/jquery.greedy-navigation.js +77 -77
- metadata +8 -3
@@ -1,213 +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
|
-
}
|
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
|
+
}
|
@@ -1,191 +1,191 @@
|
|
1
|
-
/// Syntax Utilities for Extending Susy
|
2
|
-
/// ===================================
|
3
|
-
/// There are many steps involved
|
4
|
-
/// when translating between the Susy syntax layer,
|
5
|
-
/// and the Su core math.
|
6
|
-
/// That entire process can be condensed with these two functions.
|
7
|
-
/// For anyone that wants to access the full power of Susy,
|
8
|
-
/// and build their own plugins, functions, or mixins –
|
9
|
-
/// this is the primary API for compiling user input,
|
10
|
-
/// and accessing the core math.
|
11
|
-
///
|
12
|
-
/// This is the same technique we use internally,
|
13
|
-
/// to keep our API layer simple and light-weight.
|
14
|
-
/// Every function accepts two arguments,
|
15
|
-
/// a "shorthand" description of the span or context,
|
16
|
-
/// and an optional settings-map to override global defaults.
|
17
|
-
///
|
18
|
-
/// - Use `susy-compile()` to parse, merge, and normalize
|
19
|
-
/// all the user settings into a single map.
|
20
|
-
/// - Then use `su-call()` to call one of the core math functions,
|
21
|
-
/// with whatever data is needed for that function.
|
22
|
-
///
|
23
|
-
/// @group plugin-utils
|
24
|
-
/// @see susy-compile
|
25
|
-
/// @see su-call
|
26
|
-
///
|
27
|
-
/// @example scss - Susy API `gutter` function
|
28
|
-
/// @function susy-gutter(
|
29
|
-
/// $context: susy-get('columns'),
|
30
|
-
/// $config: ()
|
31
|
-
/// ) {
|
32
|
-
/// // compile and normalize all user arguments and global settings
|
33
|
-
/// $context: susy-compile($context, $config, 'context-only');
|
34
|
-
/// // call `su-gutter` with the appropriate data
|
35
|
-
/// @return su-call('su-gutter', $context);
|
36
|
-
/// }
|
37
|
-
///
|
38
|
-
/// @example scss - Sample `span` mixin for floated grids
|
39
|
-
/// @mixin span(
|
40
|
-
/// $span,
|
41
|
-
/// $config: ()
|
42
|
-
/// ) {
|
43
|
-
/// $context: susy-compile($span, $config);
|
44
|
-
/// width: su-call('su-span', $context);
|
45
|
-
///
|
46
|
-
/// @if index($span, 'last') {
|
47
|
-
/// float: right;
|
48
|
-
/// } @else {
|
49
|
-
/// float: left;
|
50
|
-
/// margin-right: su-call('su-gutter', $context);
|
51
|
-
/// }
|
52
|
-
/// }
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
// Compile
|
57
|
-
// -------
|
58
|
-
/// Susy's syntax layer has various moving parts,
|
59
|
-
/// with syntax-parsing for the grid/span shorthand,
|
60
|
-
/// and normalization for each of the resulting values.
|
61
|
-
/// The compile function rolls this all together
|
62
|
-
/// in a single call –
|
63
|
-
/// for quick access from our internal API functions,
|
64
|
-
/// or any additional functions and mixins you add to your project.
|
65
|
-
/// Pass user input and configuration maps to the compiler,
|
66
|
-
/// and it will hand back a map of values ready for Su.
|
67
|
-
/// Combine this with the `su-call` function
|
68
|
-
/// to quickly parse, normalize, and process grid calculations.
|
69
|
-
///
|
70
|
-
/// @group plugin-utils
|
71
|
-
/// @see su-call
|
72
|
-
///
|
73
|
-
/// @param {list | map} $shorthand -
|
74
|
-
/// Shorthand expression to define the width of the span,
|
75
|
-
/// optionally containing:
|
76
|
-
/// - a count, length, or column-list span;
|
77
|
-
/// - `at $n`, `first`, or `last` location on asymmetrical grids;
|
78
|
-
/// - `narrow`, `wide`, or `wider` for optionally spreading
|
79
|
-
/// across adjacent gutters;
|
80
|
-
/// - `of $n <spread>` for available grid columns
|
81
|
-
/// and spread of the container
|
82
|
-
/// (span counts like `of 6` are only valid
|
83
|
-
/// in the context of symmetrical grids);
|
84
|
-
/// - and `set-gutters $n` to override global gutter settings
|
85
|
-
/// @param {map} $config [null] -
|
86
|
-
/// Optional map of Susy grid configuration settings
|
87
|
-
/// @param {bool} $context-only [false] -
|
88
|
-
/// Allow the parser to ignore span and span-spread values,
|
89
|
-
/// only parsing context and container-spread
|
90
|
-
///
|
91
|
-
/// @return {map} -
|
92
|
-
/// Parsed and normalized map of settings,
|
93
|
-
/// based on global and local configuration,
|
94
|
-
/// alongwith shorthad adjustments.
|
95
|
-
///
|
96
|
-
/// @example scss -
|
97
|
-
/// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
|
98
|
-
/// $grid-data: susy-compile($user-input, $susy);
|
99
|
-
///
|
100
|
-
/// @each $key, $value in $grid-data {
|
101
|
-
/// /* #{$key}: #{$value}, */
|
102
|
-
/// }
|
103
|
-
@function susy-compile(
|
104
|
-
$short,
|
105
|
-
$config: null,
|
106
|
-
$context-only: false
|
107
|
-
) {
|
108
|
-
// Get and normalize config
|
109
|
-
$config: if($config, susy-settings($config), susy-settings());
|
110
|
-
$normal-config: susy-normalize($config);
|
111
|
-
|
112
|
-
// Parse and normalize shorthand
|
113
|
-
@if (type-of($short) != 'map') and (length($short) > 0) {
|
114
|
-
$short: susy-parse($short, $context-only);
|
115
|
-
}
|
116
|
-
|
117
|
-
$normal-short: susy-normalize($short, $normal-config);
|
118
|
-
|
119
|
-
// Merge and return
|
120
|
-
@return map-merge($normal-config, $normal-short);
|
121
|
-
}
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
// Call
|
126
|
-
// ----
|
127
|
-
/// The Susy parsing and normalization process
|
128
|
-
/// results in a map of configuration settings,
|
129
|
-
/// much like the global `$susy` settings map.
|
130
|
-
/// In order to pass that information along to Su math functions,
|
131
|
-
/// the proper values have to be picked out,
|
132
|
-
/// and converted to arguments.
|
133
|
-
///
|
134
|
-
/// The `su-call` function streamlines that process,
|
135
|
-
/// weeding out the unnecessary data,
|
136
|
-
/// and passing the rest along to Su in the proper format.
|
137
|
-
/// Combine this with `susy-compile` to quickly parse,
|
138
|
-
/// normalize, and process grid calculations.
|
139
|
-
///
|
140
|
-
/// @group plugin-utils
|
141
|
-
///
|
142
|
-
/// @require su-span
|
143
|
-
/// @require su-gutter
|
144
|
-
/// @require su-slice
|
145
|
-
/// @see susy-compile
|
146
|
-
///
|
147
|
-
/// @param {'su-span' | 'su-gutter' | 'su-slice'} $name -
|
148
|
-
/// Name of the Su math function to call.
|
149
|
-
/// @param {map} $config -
|
150
|
-
/// Parsed and normalized map of Susy configuration settings
|
151
|
-
/// to use for math-function arguments.
|
152
|
-
///
|
153
|
-
/// @return {*} -
|
154
|
-
/// Results of the function being called.
|
155
|
-
///
|
156
|
-
/// @example scss -
|
157
|
-
/// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
|
158
|
-
/// $grid-data: susy-compile($user-input, $susy);
|
159
|
-
///
|
160
|
-
/// .su-span {
|
161
|
-
/// width: su-call('su-span', $grid-data);
|
162
|
-
/// }
|
163
|
-
@function su-call(
|
164
|
-
$name,
|
165
|
-
$config
|
166
|
-
) {
|
167
|
-
$grid-function-args: (
|
168
|
-
'su-span': ('span', 'columns', 'gutters', 'spread', 'container-spread', 'location'),
|
169
|
-
'su-gutter': ('columns', 'gutters', 'container-spread'),
|
170
|
-
'su-slice': ('span', 'columns', 'location'),
|
171
|
-
);
|
172
|
-
|
173
|
-
$args: map-get($grid-function-args, $name);
|
174
|
-
|
175
|
-
@if not $args {
|
176
|
-
$options: 'Try one of these: #{map-keys($grid-function-args)}';
|
177
|
-
@return _susy-error(
|
178
|
-
'#{$name} is not a public Su function. #{$options}',
|
179
|
-
'su-call');
|
180
|
-
}
|
181
|
-
|
182
|
-
$call: if(function-exists('get-function'), get-function($name), $name);
|
183
|
-
$output: ();
|
184
|
-
|
185
|
-
@each $arg in $args {
|
186
|
-
$value: map-get($config, $arg);
|
187
|
-
$output: if($value, map-merge($output, ($arg: $value)), $output);
|
188
|
-
}
|
189
|
-
|
190
|
-
@return call($call, $output...);
|
191
|
-
}
|
1
|
+
/// Syntax Utilities for Extending Susy
|
2
|
+
/// ===================================
|
3
|
+
/// There are many steps involved
|
4
|
+
/// when translating between the Susy syntax layer,
|
5
|
+
/// and the Su core math.
|
6
|
+
/// That entire process can be condensed with these two functions.
|
7
|
+
/// For anyone that wants to access the full power of Susy,
|
8
|
+
/// and build their own plugins, functions, or mixins –
|
9
|
+
/// this is the primary API for compiling user input,
|
10
|
+
/// and accessing the core math.
|
11
|
+
///
|
12
|
+
/// This is the same technique we use internally,
|
13
|
+
/// to keep our API layer simple and light-weight.
|
14
|
+
/// Every function accepts two arguments,
|
15
|
+
/// a "shorthand" description of the span or context,
|
16
|
+
/// and an optional settings-map to override global defaults.
|
17
|
+
///
|
18
|
+
/// - Use `susy-compile()` to parse, merge, and normalize
|
19
|
+
/// all the user settings into a single map.
|
20
|
+
/// - Then use `su-call()` to call one of the core math functions,
|
21
|
+
/// with whatever data is needed for that function.
|
22
|
+
///
|
23
|
+
/// @group plugin-utils
|
24
|
+
/// @see susy-compile
|
25
|
+
/// @see su-call
|
26
|
+
///
|
27
|
+
/// @example scss - Susy API `gutter` function
|
28
|
+
/// @function susy-gutter(
|
29
|
+
/// $context: susy-get('columns'),
|
30
|
+
/// $config: ()
|
31
|
+
/// ) {
|
32
|
+
/// // compile and normalize all user arguments and global settings
|
33
|
+
/// $context: susy-compile($context, $config, 'context-only');
|
34
|
+
/// // call `su-gutter` with the appropriate data
|
35
|
+
/// @return su-call('su-gutter', $context);
|
36
|
+
/// }
|
37
|
+
///
|
38
|
+
/// @example scss - Sample `span` mixin for floated grids
|
39
|
+
/// @mixin span(
|
40
|
+
/// $span,
|
41
|
+
/// $config: ()
|
42
|
+
/// ) {
|
43
|
+
/// $context: susy-compile($span, $config);
|
44
|
+
/// width: su-call('su-span', $context);
|
45
|
+
///
|
46
|
+
/// @if index($span, 'last') {
|
47
|
+
/// float: right;
|
48
|
+
/// } @else {
|
49
|
+
/// float: left;
|
50
|
+
/// margin-right: su-call('su-gutter', $context);
|
51
|
+
/// }
|
52
|
+
/// }
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
// Compile
|
57
|
+
// -------
|
58
|
+
/// Susy's syntax layer has various moving parts,
|
59
|
+
/// with syntax-parsing for the grid/span shorthand,
|
60
|
+
/// and normalization for each of the resulting values.
|
61
|
+
/// The compile function rolls this all together
|
62
|
+
/// in a single call –
|
63
|
+
/// for quick access from our internal API functions,
|
64
|
+
/// or any additional functions and mixins you add to your project.
|
65
|
+
/// Pass user input and configuration maps to the compiler,
|
66
|
+
/// and it will hand back a map of values ready for Su.
|
67
|
+
/// Combine this with the `su-call` function
|
68
|
+
/// to quickly parse, normalize, and process grid calculations.
|
69
|
+
///
|
70
|
+
/// @group plugin-utils
|
71
|
+
/// @see su-call
|
72
|
+
///
|
73
|
+
/// @param {list | map} $shorthand -
|
74
|
+
/// Shorthand expression to define the width of the span,
|
75
|
+
/// optionally containing:
|
76
|
+
/// - a count, length, or column-list span;
|
77
|
+
/// - `at $n`, `first`, or `last` location on asymmetrical grids;
|
78
|
+
/// - `narrow`, `wide`, or `wider` for optionally spreading
|
79
|
+
/// across adjacent gutters;
|
80
|
+
/// - `of $n <spread>` for available grid columns
|
81
|
+
/// and spread of the container
|
82
|
+
/// (span counts like `of 6` are only valid
|
83
|
+
/// in the context of symmetrical grids);
|
84
|
+
/// - and `set-gutters $n` to override global gutter settings
|
85
|
+
/// @param {map} $config [null] -
|
86
|
+
/// Optional map of Susy grid configuration settings
|
87
|
+
/// @param {bool} $context-only [false] -
|
88
|
+
/// Allow the parser to ignore span and span-spread values,
|
89
|
+
/// only parsing context and container-spread
|
90
|
+
///
|
91
|
+
/// @return {map} -
|
92
|
+
/// Parsed and normalized map of settings,
|
93
|
+
/// based on global and local configuration,
|
94
|
+
/// alongwith shorthad adjustments.
|
95
|
+
///
|
96
|
+
/// @example scss -
|
97
|
+
/// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
|
98
|
+
/// $grid-data: susy-compile($user-input, $susy);
|
99
|
+
///
|
100
|
+
/// @each $key, $value in $grid-data {
|
101
|
+
/// /* #{$key}: #{$value}, */
|
102
|
+
/// }
|
103
|
+
@function susy-compile(
|
104
|
+
$short,
|
105
|
+
$config: null,
|
106
|
+
$context-only: false
|
107
|
+
) {
|
108
|
+
// Get and normalize config
|
109
|
+
$config: if($config, susy-settings($config), susy-settings());
|
110
|
+
$normal-config: susy-normalize($config);
|
111
|
+
|
112
|
+
// Parse and normalize shorthand
|
113
|
+
@if (type-of($short) != 'map') and (length($short) > 0) {
|
114
|
+
$short: susy-parse($short, $context-only);
|
115
|
+
}
|
116
|
+
|
117
|
+
$normal-short: susy-normalize($short, $normal-config);
|
118
|
+
|
119
|
+
// Merge and return
|
120
|
+
@return map-merge($normal-config, $normal-short);
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
// Call
|
126
|
+
// ----
|
127
|
+
/// The Susy parsing and normalization process
|
128
|
+
/// results in a map of configuration settings,
|
129
|
+
/// much like the global `$susy` settings map.
|
130
|
+
/// In order to pass that information along to Su math functions,
|
131
|
+
/// the proper values have to be picked out,
|
132
|
+
/// and converted to arguments.
|
133
|
+
///
|
134
|
+
/// The `su-call` function streamlines that process,
|
135
|
+
/// weeding out the unnecessary data,
|
136
|
+
/// and passing the rest along to Su in the proper format.
|
137
|
+
/// Combine this with `susy-compile` to quickly parse,
|
138
|
+
/// normalize, and process grid calculations.
|
139
|
+
///
|
140
|
+
/// @group plugin-utils
|
141
|
+
///
|
142
|
+
/// @require su-span
|
143
|
+
/// @require su-gutter
|
144
|
+
/// @require su-slice
|
145
|
+
/// @see susy-compile
|
146
|
+
///
|
147
|
+
/// @param {'su-span' | 'su-gutter' | 'su-slice'} $name -
|
148
|
+
/// Name of the Su math function to call.
|
149
|
+
/// @param {map} $config -
|
150
|
+
/// Parsed and normalized map of Susy configuration settings
|
151
|
+
/// to use for math-function arguments.
|
152
|
+
///
|
153
|
+
/// @return {*} -
|
154
|
+
/// Results of the function being called.
|
155
|
+
///
|
156
|
+
/// @example scss -
|
157
|
+
/// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
|
158
|
+
/// $grid-data: susy-compile($user-input, $susy);
|
159
|
+
///
|
160
|
+
/// .su-span {
|
161
|
+
/// width: su-call('su-span', $grid-data);
|
162
|
+
/// }
|
163
|
+
@function su-call(
|
164
|
+
$name,
|
165
|
+
$config
|
166
|
+
) {
|
167
|
+
$grid-function-args: (
|
168
|
+
'su-span': ('span', 'columns', 'gutters', 'spread', 'container-spread', 'location'),
|
169
|
+
'su-gutter': ('columns', 'gutters', 'container-spread'),
|
170
|
+
'su-slice': ('span', 'columns', 'location'),
|
171
|
+
);
|
172
|
+
|
173
|
+
$args: map-get($grid-function-args, $name);
|
174
|
+
|
175
|
+
@if not $args {
|
176
|
+
$options: 'Try one of these: #{map-keys($grid-function-args)}';
|
177
|
+
@return _susy-error(
|
178
|
+
'#{$name} is not a public Su function. #{$options}',
|
179
|
+
'su-call');
|
180
|
+
}
|
181
|
+
|
182
|
+
$call: if(function-exists('get-function'), get-function($name), $name);
|
183
|
+
$output: ();
|
184
|
+
|
185
|
+
@each $arg in $args {
|
186
|
+
$value: map-get($config, $arg);
|
187
|
+
$output: if($value, map-merge($output, ($arg: $value)), $output);
|
188
|
+
}
|
189
|
+
|
190
|
+
@return call($call, $output...);
|
191
|
+
}
|