susy 2.2.14 → 3.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/{docs/changelog.rst → CHANGELOG.md} +0 -34
  3. data/README.md +135 -10
  4. data/VERSION +1 -1
  5. data/sass/_prefix.scss +10 -0
  6. data/sass/_susy.scss +4 -3
  7. data/sass/susy/_api.scss +134 -0
  8. data/sass/susy/_grids.scss +192 -0
  9. data/sass/susy/_parser.scss +284 -0
  10. data/sass/susy/_settings.scss +120 -0
  11. data/sass/susy/_unprefix.scss +53 -0
  12. data/sass/susy/_validation.scss +132 -0
  13. metadata +26 -75
  14. data/sass/_su.scss +0 -4
  15. data/sass/_susyone.scss +0 -4
  16. data/sass/susy/_su.scss +0 -7
  17. data/sass/susy/language/_susy.scss +0 -24
  18. data/sass/susy/language/_susyone.scss +0 -13
  19. data/sass/susy/language/susy/_background.scss +0 -385
  20. data/sass/susy/language/susy/_bleed.scss +0 -200
  21. data/sass/susy/language/susy/_box-sizing.scss +0 -47
  22. data/sass/susy/language/susy/_breakpoint-plugin.scss +0 -185
  23. data/sass/susy/language/susy/_container.scss +0 -81
  24. data/sass/susy/language/susy/_context.scss +0 -36
  25. data/sass/susy/language/susy/_gallery.scss +0 -94
  26. data/sass/susy/language/susy/_grids.scss +0 -64
  27. data/sass/susy/language/susy/_gutters.scss +0 -154
  28. data/sass/susy/language/susy/_isolate.scss +0 -77
  29. data/sass/susy/language/susy/_margins.scss +0 -94
  30. data/sass/susy/language/susy/_padding.scss +0 -74
  31. data/sass/susy/language/susy/_rows.scss +0 -138
  32. data/sass/susy/language/susy/_settings.scss +0 -216
  33. data/sass/susy/language/susy/_span.scss +0 -163
  34. data/sass/susy/language/susy/_validation.scss +0 -16
  35. data/sass/susy/language/susyone/_background.scss +0 -18
  36. data/sass/susy/language/susyone/_functions.scss +0 -377
  37. data/sass/susy/language/susyone/_grid.scss +0 -312
  38. data/sass/susy/language/susyone/_isolation.scss +0 -51
  39. data/sass/susy/language/susyone/_margin.scss +0 -93
  40. data/sass/susy/language/susyone/_media.scss +0 -105
  41. data/sass/susy/language/susyone/_padding.scss +0 -92
  42. data/sass/susy/language/susyone/_settings.scss +0 -60
  43. data/sass/susy/output/_float.scss +0 -9
  44. data/sass/susy/output/_shared.scss +0 -15
  45. data/sass/susy/output/_support.scss +0 -9
  46. data/sass/susy/output/float/_container.scss +0 -16
  47. data/sass/susy/output/float/_end.scss +0 -40
  48. data/sass/susy/output/float/_isolate.scss +0 -22
  49. data/sass/susy/output/float/_span.scss +0 -35
  50. data/sass/susy/output/shared/_background.scss +0 -26
  51. data/sass/susy/output/shared/_container.scss +0 -21
  52. data/sass/susy/output/shared/_direction.scss +0 -42
  53. data/sass/susy/output/shared/_inspect.scss +0 -25
  54. data/sass/susy/output/shared/_margins.scss +0 -23
  55. data/sass/susy/output/shared/_output.scss +0 -14
  56. data/sass/susy/output/shared/_padding.scss +0 -23
  57. data/sass/susy/output/support/_background.scss +0 -58
  58. data/sass/susy/output/support/_box-sizing.scss +0 -19
  59. data/sass/susy/output/support/_clearfix.scss +0 -18
  60. data/sass/susy/output/support/_prefix.scss +0 -19
  61. data/sass/susy/output/support/_rem.scss +0 -22
  62. data/sass/susy/output/support/_support.scss +0 -95
  63. data/sass/susy/su/_grid.scss +0 -103
  64. data/sass/susy/su/_settings.scss +0 -73
  65. data/sass/susy/su/_utilities.scss +0 -111
  66. data/sass/susy/su/_validation.scss +0 -57
  67. data/templates/project/_grids.scss +0 -9
  68. data/templates/project/manifest.rb +0 -15
  69. data/templates/project/style.scss +0 -4
@@ -0,0 +1,284 @@
1
+ // Parser
2
+ // ======
3
+ // - susy-parse [function]
4
+ // - susy-normalize [function]
5
+ // - susy-normalize-columns [function]
6
+ // - susy-normalize-span [function]
7
+ // - susy-normalize-spread [function]
8
+ // - susy-normalize-location [function]
9
+
10
+
11
+ // Parse
12
+ // -----
13
+ /// Parse shorthand span expression
14
+ ///
15
+ /// @access private
16
+ ///
17
+ /// @param {List} $shorthand -
18
+ /// Shorthand expression to define the width of the span —
19
+ /// containing a unitless column-span;
20
+ /// 'of $n' for available grid columns [optional];
21
+ /// 'at $n', 'first', or 'last' for location on asymmetrical grids;
22
+ /// and 'narrow', 'wide', or 'wider' for
23
+ /// optionally spreading over adjacent gutters
24
+ /// with either the `span` or `columns` value
25
+ ///
26
+ /// @return {Map} -
27
+ /// Map of span settings
28
+ /// (`span`, `location`, `columns`, `spread`, `container-spread`)
29
+ /// parsed from shorthand input
30
+ @function susy-parse(
31
+ $shorthand
32
+ ) {
33
+ $span-error: 'Not able to determine column-span from `#{$shorthand}`';
34
+ $parse-error: 'Unknown span property:';
35
+ $options: (
36
+ 'first': 'location',
37
+ 'last': 'location',
38
+ 'alpha': 'location',
39
+ 'omega': 'location',
40
+ 'narrow': 'spread',
41
+ 'wide': 'spread',
42
+ 'wider': 'spread',
43
+ );
44
+
45
+ $return: ();
46
+ $span: null;
47
+ $columns: null;
48
+
49
+ $of: false;
50
+ $next: false;
51
+
52
+ @for $i from 1 through length($shorthand) {
53
+ $item: nth($shorthand, $i);
54
+ $type: type-of($item);
55
+
56
+ @if $next {
57
+ @if ($next == 'column-width') {
58
+ @if ($type == 'number') and (not unitless($item)) {
59
+ @if $columns {
60
+ $columns: join($columns, ('x' $item));
61
+ } @else {
62
+ $span: join($span, ('x' $item));
63
+ }
64
+ } @else {
65
+ @error '`#{item}` is not a valid column-width';
66
+ }
67
+ } @else {
68
+ $return: map-merge($return, ($next: $item));
69
+ }
70
+
71
+ $next: false;
72
+ } @else {
73
+ @if ($type == 'string') {
74
+ @if map-has-key($options, $item) {
75
+ $setting: map-get($options, $item);
76
+
77
+ @if ($setting == 'spread') and $of {
78
+ $return: map-merge($return, ('container-spread': $item));
79
+ } @else {
80
+ $return: map-merge($return, ($setting: $item));
81
+ }
82
+ } @else if $item == 'all' {
83
+ $span: 'all';
84
+ } @else if not $span {
85
+ @error $span-error;
86
+ } @else if ($item == 'at') {
87
+ $next: 'location';
88
+ } @else if ($item == 'x') {
89
+ $next: 'column-width';
90
+ } @else if ($item == 'of') {
91
+ $of: true;
92
+ } @else {
93
+ @error '#{$parse-error} `#{$item}`';
94
+ }
95
+ } @else if ($type == 'number') or ($type == 'list') {
96
+ @if not $span {
97
+ $span: $item;
98
+ } @else if $of {
99
+ $columns: $item;
100
+ } @else {
101
+ @error '#{$parse-error} `#{$item}`';
102
+ }
103
+ } @else {
104
+ @error '#{$parse-error} `#{$item}`';
105
+ }
106
+ }
107
+ }
108
+
109
+ @if $span {
110
+ $return: map-merge($return, ('span': $span));
111
+ } @else {
112
+ @error $span-error;
113
+ }
114
+
115
+ @if $columns {
116
+ $return: map-merge($return, ('columns': $columns));
117
+ }
118
+
119
+ @return $return;
120
+ }
121
+
122
+
123
+ // Susy Normalize
124
+ // --------------
125
+ /// Normalize the values in a configuration map
126
+ ///
127
+ /// @access private
128
+ ///
129
+ /// @param {Map} $config -
130
+ /// Map of Susy configuration settings to normalize
131
+ ///
132
+ /// @return {Map} -
133
+ /// Map of Susy configuration settings, with all values normalized
134
+ @function susy-normalize(
135
+ $config
136
+ ) {
137
+ @each $setting in ('columns', 'spread', 'container-spread') {
138
+ $value: map-get($config, $setting);
139
+
140
+ @if $value {
141
+ $function: if(($setting == 'container-spread'), 'spread', $setting);
142
+ $value: call('susy-normalize-#{$function}', $value);
143
+ }
144
+
145
+ $config: map-merge($config, ($setting: $value));
146
+ }
147
+
148
+ $span: map-get($config, 'span');
149
+ $location: map-get($config, 'location');
150
+ $columns: map-get($config, 'columns');
151
+
152
+ @if $span {
153
+ $span: susy-normalize-span($span, $columns);
154
+ $config: map-merge($config, ('span': $span));
155
+ }
156
+
157
+ @if $location {
158
+ $location: susy-normalize-location($span, $location, $columns);
159
+ $config: map-merge($config, ('location': $location));
160
+ }
161
+
162
+ @return $config;
163
+ }
164
+
165
+
166
+ // Normalize Columns
167
+ // -----------------
168
+ /// Normalize `columns` shorthand for Su
169
+ ///
170
+ /// @access private
171
+ ///
172
+ /// @param {Number | List} $columns -
173
+ /// Columns value to normalize
174
+ ///
175
+ /// @return {List} -
176
+ /// List value for `$columns`
177
+ @function susy-normalize-columns(
178
+ $columns
179
+ ) {
180
+ $return: ();
181
+
182
+ @if (type-of($columns) == 'number') and unitless($columns) {
183
+ @for $i from 1 through $columns {
184
+ $return: append($return, 1);
185
+ }
186
+
187
+ @return $return;
188
+ } @else if index($columns, 'x') and length($columns) == 3 {
189
+ $width: nth($columns, -1);
190
+
191
+ @for $i from 1 through nth($columns, 1) {
192
+ $return: append($return, $width);
193
+ }
194
+
195
+ @return $return;
196
+ }
197
+
198
+ @return $columns;
199
+ }
200
+
201
+
202
+ // Normalize Span
203
+ // --------------
204
+ /// Normalize `span` shorthand for Su
205
+ ///
206
+ /// @access private
207
+ ///
208
+ /// @param {Number | List | 'all'} $span -
209
+ /// Span value to normalize
210
+ /// @param {List} $columns -
211
+ /// Normalized list of columns in the grid
212
+ ///
213
+ /// @return {Number | List} -
214
+ /// Number or list value for `$span`
215
+ @function susy-normalize-span(
216
+ $span,
217
+ $columns: susy-get('columns')
218
+ ) {
219
+ @if (type-of($span) == 'number') {
220
+ @return $span;
221
+ } @else if $span == 'all' {
222
+ @return length($columns);
223
+ }
224
+
225
+ @return susy-normalize-columns($span);
226
+ }
227
+
228
+
229
+ // Normalize Spread
230
+ // ----------------
231
+ /// Normalize `spread` shorthand for Su
232
+ ///
233
+ /// @access private
234
+ ///
235
+ /// @param {0 | 1 | -1 | 'narrow' | 'wide' | 'wider'} $spread -
236
+ /// Spread across adjacent gutters, relative to a column-count —
237
+ /// either `narrow` (-1), `wide` (0), or `wider` (1)
238
+ ///
239
+ /// @return {Number} -
240
+ /// Numeric value for `$spread`
241
+ @function susy-normalize-spread(
242
+ $spread
243
+ ) {
244
+ $normal-spread: (
245
+ 'narrow': -1,
246
+ 'wide': 0,
247
+ 'wider': 1,
248
+ );
249
+
250
+ @return map-get($normal-spread, $spread) or $spread;
251
+ }
252
+
253
+
254
+ // Normalize Location
255
+ // ------------------
256
+ /// Normalize `location` shorthand for Su
257
+ ///
258
+ /// @access private
259
+ ///
260
+ /// @param {Number} $span -
261
+ /// Number of grid-columns to be spanned
262
+ /// @param {Integer | 'first' | 'last'} $location -
263
+ /// Starting (1-indexed) column position of a span,
264
+ /// or a named location keyword
265
+ /// @param {List} $columns -
266
+ /// Normalized list of columns in the grid
267
+ ///
268
+ /// @return {Integer} -
269
+ /// Numeric value for `$location`
270
+ @function susy-normalize-location(
271
+ $span,
272
+ $location,
273
+ $columns
274
+ ) {
275
+ $count: length($columns);
276
+ $normal-locations: (
277
+ 'first': 1,
278
+ 'alpha': 1,
279
+ 'last': $count - $span + 1,
280
+ 'omega': $count - $span + 1,
281
+ );
282
+
283
+ @return map-get($normal-locations, $location) or $location;
284
+ }
@@ -0,0 +1,120 @@
1
+ // Settings
2
+ // ========
3
+ // - susy [variable]
4
+ // - susy-defaults [variable]
5
+ // - susy-settings [function]
6
+ // - susy-get [function]
7
+
8
+
9
+ // Susy
10
+ // ----
11
+ /// Custom user configuration map for Susy
12
+ ///
13
+ /// @group a-config
14
+ ///
15
+ /// @type Map
16
+ ///
17
+ /// @see $susy-defaults
18
+ ///
19
+ /// @prop {Number | List} columns [4] -
20
+ /// Description of the columns in a grid,
21
+ /// their number, realtive sizes (if asymmetrical),
22
+ /// and optional static widths
23
+ /// @prop {Number} gutters [0.25] -
24
+ /// Ratio of a gutter to a column,
25
+ /// or static width of a single gutter
26
+ /// @prop {String} spread ['narrow'] -
27
+ /// Spread of an element across adjacent gutters:
28
+ /// either `narrow` (none), `wide` (one), or `wider` (two)
29
+ /// @prop {String} container-spread ['narrow'] -
30
+ /// Spread of a container around adjacent gutters:
31
+ /// either `narrow` (none), `wide` (one), or `wider` (two)
32
+ ///
33
+ /// @example scss - All available options (to their default value)
34
+ /// $susy: (
35
+ /// 'columns': 4,
36
+ /// 'gutters': 0.25,
37
+ /// 'spread': 'narrow',
38
+ /// 'container-spread': 'narrow',
39
+ /// );
40
+ $susy: () !default;
41
+
42
+
43
+ // Susy Defaults
44
+ // -------------
45
+ /// Configuration map of Susy factory defaults
46
+ ///
47
+ /// @access private
48
+ ///
49
+ /// @type Map
50
+ ///
51
+ /// @prop {Number | List} columns [4] -
52
+ /// Description of the columns in a grid,
53
+ /// their number, realtive sizes (if asymmetrical),
54
+ /// and optional static widths
55
+ /// @prop {Number} gutters [0.25] -
56
+ /// Ratio of a gutter to a column,
57
+ /// or static width of a single gutter
58
+ /// @prop {String} spread ['narrow'] -
59
+ /// Spread of an element across adjacent gutters:
60
+ /// either `narrow` (none), `wide` (one), or `wider` (two)
61
+ /// @prop {String} container-spread ['narrow'] -
62
+ /// Spread of a container around adjacent gutters:
63
+ /// either `narrow` (none), `wide` (one), or `wider` (two)
64
+ $susy-defaults: (
65
+ 'columns': 4,
66
+ 'gutters': 0.25,
67
+ 'spread': 'narrow',
68
+ 'container-spread': 'narrow',
69
+ );
70
+
71
+
72
+
73
+ // Susy Settings
74
+ // -------------
75
+ /// Return a combined map of Susy settings
76
+ ///
77
+ /// @group a-config
78
+ ///
79
+ /// @param {Map | Arglist} $overrides... -
80
+ /// Optional map override of global configuration settings
81
+ ///
82
+ /// @return {Map} -
83
+ /// Combined map of Susy configuration settings, in order of specificity:
84
+ /// `$overrides...`, `$susy`, then `$susy-defaults`
85
+ @function susy-settings(
86
+ $overrides...
87
+ ) {
88
+ $settings: map-merge($susy-defaults, $susy);
89
+
90
+ @each $config in $overrides {
91
+ $settings: map-merge($settings, $config);
92
+ }
93
+
94
+ @return $settings;
95
+ }
96
+
97
+
98
+ // Susy Get
99
+ // --------
100
+ /// Return the current value of any Susy setting
101
+ ///
102
+ /// @group a-config
103
+ ///
104
+ /// @param {String} $key -
105
+ /// Setting to retrieve from the configuration
106
+ ///
107
+ /// @return {*} -
108
+ /// Value mapped to `$key` in the configuration maps, in order of specificity:
109
+ /// `$susy`, then `$susy-defaults`
110
+ @function susy-get(
111
+ $key
112
+ ) {
113
+ $settings: susy-settings();
114
+
115
+ @if not map-has-key($settings, $key) {
116
+ @error 'There is no Susy setting called `#{$key}`';
117
+ }
118
+
119
+ @return map-get($settings, $key);
120
+ }
@@ -0,0 +1,53 @@
1
+ // Unprefix Susy
2
+ // =============
3
+
4
+
5
+ // Span
6
+ // ----
7
+ /// Un-prefixed alias for `susy-span`
8
+ ///
9
+ /// @group unprefix
10
+ /// @alias susy-span
11
+ ///
12
+ /// @param {List} $span
13
+ /// @param {Map} $config [()]
14
+ @function span(
15
+ $span,
16
+ $config: ()
17
+ ) {
18
+ @return susy-span($span, $config);
19
+ }
20
+
21
+
22
+ // Gutter
23
+ // ------
24
+ /// Un-prefixed alias for `susy-gutter`
25
+ ///
26
+ /// @group unprefix
27
+ /// @alias susy-gutter
28
+ ///
29
+ /// @param {Integer | List} $nested [null] -
30
+ /// @param {Map} $config [()]
31
+ @function gutter(
32
+ $nested: null,
33
+ $config: ()
34
+ ) {
35
+ @return susy-gutter($nested, $config);
36
+ }
37
+
38
+
39
+ // Slice
40
+ // -----
41
+ /// Un-prefixed alias for `susy-slice`
42
+ ///
43
+ /// @group unprefix
44
+ /// @alias susy-slice
45
+ ///
46
+ /// @param {List} $span
47
+ /// @param {Map} $config [()]
48
+ @function slice(
49
+ $span,
50
+ $config: ()
51
+ ) {
52
+ @return susy-slice($span, $config);
53
+ }