piecss 0.2.0.0 → 0.3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/piecss.rb +16 -5
  3. data/sass/piecss/_settings.scss +6 -3
  4. data/sass/piecss/_utilities.scss +3 -0
  5. data/sass/piecss/behavior/_anchor.scss +1 -1
  6. data/sass/piecss/settings/_base.scss +5 -25
  7. data/sass/piecss/settings/_breakpoint.scss +112 -18
  8. data/sass/piecss/settings/_button.scss +2 -2
  9. data/sass/piecss/settings/_colour.scss +152 -0
  10. data/sass/piecss/settings/_constants.scss +0 -143
  11. data/sass/piecss/settings/_font.scss +0 -21
  12. data/sass/piecss/settings/_form.scss +7 -9
  13. data/sass/piecss/settings/{_grid.scss → _layout.scss} +43 -44
  14. data/sass/piecss/settings/_list.scss +1 -1
  15. data/sass/piecss/settings/_miscellaneous.scss +5 -0
  16. data/sass/piecss/settings/_rhythm.scss +0 -0
  17. data/sass/piecss/settings/_typography.scss +13 -0
  18. data/sass/piecss/settings/fonts/_example.scss +36 -36
  19. data/sass/piecss/settings/fonts/_monospace.scss +33 -33
  20. data/sass/piecss/settings/fonts/_sans-serif.scss +33 -33
  21. data/sass/piecss/settings/fonts/_serif.scss +33 -33
  22. data/sass/piecss/settings/fonts/_verdana.scss +34 -34
  23. data/sass/piecss/utilities/_breakpoint.scss +5 -5
  24. data/sass/piecss/utilities/_cache.scss +8 -4
  25. data/sass/piecss/utilities/_colour.scss +37 -0
  26. data/sass/piecss/utilities/_element.scss +85 -88
  27. data/sass/piecss/utilities/_image.scss +20 -22
  28. data/sass/piecss/utilities/_layout.scss +382 -213
  29. data/sass/piecss/utilities/_list.scss +2 -0
  30. data/sass/piecss/utilities/_miscellaneous.scss +161 -99
  31. data/sass/piecss/utilities/_rhythm.scss +27 -59
  32. data/sass/piecss/utilities/_side.scss +155 -154
  33. data/sass/piecss/utilities/_string.scss +68 -0
  34. data/sass/piecss/utilities/_svg.scss +47 -0
  35. data/sass/piecss/utilities/_typography.scss +96 -107
  36. data/sass/piecss/utilities/_unit.scss +85 -50
  37. data/templates/project/_sets/_button.scss +1 -1
  38. data/templates/project/_sets/_form.scss +1 -1
  39. data/templates/project/_sets.scss +1 -1
  40. data/templates/project/_settings.scss +1 -1
  41. metadata +13 -40
  42. data/sass/piecss/settings/fonts/_asap.scss +0 -44
  43. data/sass/piecss/settings/fonts/_bree-serif.scss +0 -23
  44. data/sass/piecss/settings/fonts/_lato.scss +0 -32
  45. data/sass/piecss/settings/fonts/_pt-sans.scss +0 -40
  46. data/sass/piecss/settings/fonts/_raleway.scss +0 -31
  47. data/sass/piecss/settings/fonts/_righteous.scss +0 -23
  48. data/sass/piecss/settings/fonts/_roboto-slab.scss +0 -37
  49. data/sass/piecss/settings/fonts/_roboto.scss +0 -35
  50. data/sass/piecss/settings/fonts/_sofia-pro.scss +0 -40
  51. data/sass/piecss/settings/fonts/_varela-round.scss +0 -24
  52. data/sass/piecss/settings/fonts/icon-fonts/_fontawesome.scss +0 -33
  53. data/sass/piecss/settings/fonts/icon-fonts/_foundation-accessability.scss +0 -75
  54. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_bootstrap.scss +0 -84
  55. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_core.scss +0 -129
  56. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_extras.scss +0 -93
  57. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_icons.scss +0 -381
  58. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_mixins.scss +0 -48
  59. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_path.scss +0 -14
  60. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_variables.scss +0 -734
  61. data/sass/piecss/settings/fonts/icon-fonts/foundation-accessability/_settings.scss +0 -28
@@ -26,20 +26,20 @@
26
26
 
27
27
  @function value-map($values, $keys: $keys-side) {
28
28
 
29
- // Make sure we have all sides, except when a map is used as an argument
30
- @if type-of($values)==map {
31
- @return $values;
32
- }
33
- $values: -sides($values);
34
-
35
- $-list: zip($keys, $values);
29
+ // Make sure we have all sides, except when a map is used as an argument
30
+ @if type-of($values) == map {
31
+ @return $values;
32
+ }
33
+ $values: -sides($values);
36
34
 
37
- $map: ();
38
- @each $pair in $-list {
39
- $map: map-merge($map, (nth($pair, 1): nth($pair, 2)));
40
- }
35
+ $-list: zip($keys, $values);
41
36
 
42
- @return $map;
37
+ $map: ();
38
+ @each $pair in $-list {
39
+ $map: map-merge($map, (nth($pair, 1): nth($pair, 2)));
40
+ }
41
+
42
+ @return $map;
43
43
  }
44
44
 
45
45
  ///
@@ -55,20 +55,20 @@
55
55
 
56
56
  @function is-value-map($values, $keys: $keys-side) {
57
57
 
58
- // Start by assuming $values is not a map
59
- $is-map: false;
58
+ // Start by assuming $values is not a map
59
+ $is-map: false;
60
60
 
61
- // Simple test for a match to $keys, passes if there is a single match
62
- @if type-of($values)==map {
61
+ // Simple test for a match to $keys, passes if there is a single match
62
+ @if type-of($values) == map {
63
63
 
64
- @each $key in $keys {
65
- @if map-has-key($values, $key)==true {
66
- $is-map: true;
67
- }
68
- }
64
+ @each $key in $keys {
65
+ @if map-has-key($values, $key) == true {
66
+ $is-map: true;
67
+ }
69
68
  }
69
+ }
70
70
 
71
- @return $is-map;
71
+ @return $is-map;
72
72
  }
73
73
 
74
74
  ///
@@ -86,17 +86,17 @@
86
86
 
87
87
  @function value-map-to-unit($map, $unit: $unit) {
88
88
 
89
- @if not(type-of($map)==map) {
90
- @warn 'Argument $map needs to be a map.';
91
- @return $map;
92
- }
89
+ @if not(type-of($map) == map) {
90
+ @warn "Argument $map needs to be a map.";
91
+ @return $map;
92
+ }
93
93
 
94
- // Convert to units
95
- @each $key, $value in $map {
96
- $map: map-merge($map, ($key: to-unit($value, $unit)));
97
- }
94
+ // Convert to units
95
+ @each $key, $value in $map {
96
+ $map: map-merge($map, ($key: to-unit($value, $unit)));
97
+ }
98
98
 
99
- @return $map;
99
+ @return $map;
100
100
  }
101
101
 
102
102
  ///
@@ -113,24 +113,27 @@
113
113
  ///
114
114
  @function -sides($values) {
115
115
 
116
- @if type-of($values)==map {
117
- @warn 'Argument $values needs to be a list or a single value.';
118
- @return $values;
119
- }
120
-
121
- // Check for the number of values and convert to a value map
122
- $length: length($values);
123
- @if $length==1 {
124
- $values: $values $values $values $values;
125
- } @elseif $length==2 {
126
- $values: nth($values, 1) nth($values, 2) nth($values, 1) nth($values, 2);
127
- } @elseif $length==3 {
128
- $values: nth($values, 1) nth($values, 2) nth($values, 3) nth($values, 2);
129
- } @elseif $length==4 {
130
- $values: nth($values, 1) nth($values, 2) nth($values, 3) nth($values, 4);
131
- }
132
-
116
+ @if type-of($values) == map {
117
+ @warn "Argument $values needs to be a list or a single value.";
133
118
  @return $values;
119
+ }
120
+
121
+ // Check for the number of values and convert to a value map
122
+ $length: length($values);
123
+ @if $length == 1 {
124
+ $values: $values $values $values $values;
125
+ }
126
+ @elseif $length == 2 {
127
+ $values: nth($values, 1) nth($values, 2) nth($values, 1) nth($values, 2);
128
+ }
129
+ @elseif $length == 3 {
130
+ $values: nth($values, 1) nth($values, 2) nth($values, 3) nth($values, 2);
131
+ }
132
+ @elseif $length == 4 {
133
+ $values: nth($values, 1) nth($values, 2) nth($values, 3) nth($values, 4);
134
+ }
135
+
136
+ @return $values;
134
137
  }
135
138
 
136
139
 
@@ -139,125 +142,123 @@
139
142
 
140
143
  ///
141
144
  /// Mixin padding for any or all sides, in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
142
- ///
145
+ ///
143
146
  /// @since 0.1
144
- ///
147
+ ///
145
148
  /// @param {Map} $sides - A spacing map in px (top:0,right:0,bottom:0,left:0)
146
149
  ///
147
150
 
148
151
  @mixin padding($values) {
149
-
150
- @include -unit-sides($values, padding);
152
+ @include -unit-sides($values, padding);
151
153
  }
152
154
 
153
155
  ///
154
156
  /// Mixin top padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
155
- ///
157
+ ///
156
158
  /// @since 0.1
157
- ///
159
+ ///
158
160
  /// @param {Number} $value - A value in px
159
161
  ///
160
162
 
161
163
  @mixin padding-top($value) {
162
- @include -unit-sides((top: $value), padding);
164
+ @include -unit-sides((top: $value), padding);
163
165
  }
164
166
 
165
167
  ///
166
168
  /// Mixin right padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
167
- ///
169
+ ///
168
170
  /// @since 0.1
169
- ///
171
+ ///
170
172
  /// @param {Number} $value - A value in px
171
173
  ///
172
174
 
173
175
  @mixin padding-right($value) {
174
- @include -unit-sides((right: $value), padding);
176
+ @include -unit-sides((right: $value), padding);
175
177
  }
176
178
 
177
179
  ///
178
180
  /// Mixin bottom padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
179
- ///
181
+ ///
180
182
  /// @since 0.1
181
- ///
183
+ ///
182
184
  /// @param {Number} $value - A value in px
183
185
  ///
184
186
 
185
187
  @mixin padding-bottom($value) {
186
- @include -unit-sides((bottom: $value), padding);
188
+ @include -unit-sides((bottom: $value), padding);
187
189
  }
188
190
 
189
191
  ///
190
192
  /// Mixin left padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
191
- ///
193
+ ///
192
194
  /// @since 0.1
193
- ///
195
+ ///
194
196
  /// @param {Number} $value - A value in px
195
197
  ///
196
198
 
197
199
  @mixin padding-left($value) {
198
- @include -unit-sides((left: $value), padding);
200
+ @include -unit-sides((left: $value), padding);
199
201
  }
200
202
 
201
203
 
202
204
  ///
203
205
  /// Mixin margin for any or all sides, in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
204
- ///
206
+ ///
205
207
  /// @since 0.1
206
- ///
208
+ ///
207
209
  /// @param {Map} $sides - A spacing map in px (top:0,right:0,bottom:0,left:0)
208
210
  ///
209
211
 
210
212
  @mixin margin($values) {
211
-
212
- @include -unit-sides($values, margin);
213
+ @include -unit-sides($values, margin);
213
214
  }
214
215
 
215
216
  ///
216
217
  /// Mixin top margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
217
- ///
218
+ ///
218
219
  /// @since 0.1
219
- ///
220
+ ///
220
221
  /// @param {Number} $value - A value in px
221
222
  ///
222
223
 
223
224
  @mixin margin-top($value) {
224
- @include -unit-sides((top: $value), margin);
225
+ @include -unit-sides((top: $value), margin);
225
226
  }
226
227
 
227
228
  ///
228
229
  /// Mixin right margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
229
- ///
230
+ ///
230
231
  /// @since 0.1
231
- ///
232
+ ///
232
233
  /// @param {Number} $value - A value in px
233
234
  ///
234
235
 
235
236
  @mixin margin-right($value) {
236
- @include -unit-sides((right: $value), margin);
237
+ @include -unit-sides((right: $value), margin);
237
238
  }
238
239
 
239
240
  ///
240
241
  /// Mixin bottom margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
241
- ///
242
+ ///
242
243
  /// @since 0.1
243
- ///
244
+ ///
244
245
  /// @param {Number} $value - A value in px
245
246
  ///
246
247
 
247
248
  @mixin margin-bottom($value) {
248
- @include -unit-sides((bottom: $value), margin);
249
+ @include -unit-sides((bottom: $value), margin);
249
250
  }
250
251
 
251
252
  ///
252
253
  /// Mixin right margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
253
- ///
254
+ ///
254
255
  /// @since 0.1
255
- ///
256
+ ///
256
257
  /// @param {Number} $value - A value in px
257
258
  ///
258
259
 
259
260
  @mixin margin-left($value) {
260
- @include -unit-sides((left: $value), margin);
261
+ @include -unit-sides((left: $value), margin);
261
262
  }
262
263
 
263
264
 
@@ -275,94 +276,94 @@
275
276
 
276
277
  @mixin -unit-sides($values, $property: padding, $unit: $unit) {
277
278
 
278
- // This mixin needs a value-map to work, so convert argument if it is not a value-map;
279
- @if not(is-value-map($values, $keys-side)) {
280
- $values: value-map(-sides($values), $keys-side);
281
- }
282
-
283
- // now, Convert to units
284
- $unit-values: ();
285
- @each $key, $value in $values {
286
- $unit-values: map-merge($unit-values, ($key: to-unit($value, $unit)));
287
- }
288
-
289
- // Now, render the property and include rem fallback if needed
290
- @if unit($unit)==rem {
291
- @include -sides($values, $property);
292
- }
293
- @include -sides($unit-values, $property);
279
+ // This mixin needs a value-map to work, so convert argument if it is not a value-map;
280
+ @if not(is-value-map($values, $keys-side)) {
281
+ $values: value-map(-sides($values), $keys-side);
282
+ }
283
+
284
+ // now, Convert to units
285
+ $unit-values: ();
286
+ @each $key, $value in $values {
287
+ $unit-values: map-merge($unit-values, ($key: to-unit($value, $unit)));
288
+ }
289
+
290
+ // Now, render the property and include rem fallback if needed
291
+ @if unit($unit) == rem {
292
+ @include -sides($values, $property);
293
+ }
294
+ @include -sides($unit-values, $property);
294
295
  }
295
296
 
296
297
 
297
298
  ///
298
299
  /// Mixin the value for any or all sides for padding or margin. The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used.
299
- ///
300
+ ///
300
301
  /// @access private
301
- ///
302
+ ///
302
303
  /// @since 0.1
303
304
  ///
304
305
  /// @throws 'Argument $map needs to be a value map of four side (top, right, bottom, left) values. Mixin -sides aborted.';
305
- ///
306
+ ///
306
307
  /// @param {Map} $sides - A spacing map in final values (top:0,right:0,bottom:0,left:0)
307
308
  /// @param {String} $property - The property to apply the values to (padding, margin)
308
309
  ///
309
310
 
310
311
  @mixin -sides($values, $property: padding) {
311
312
 
312
- @if not(is-value-map($values, $keys-side)) {
313
- @warn 'Argument $map needs to be a value map of four side (top, right, bottom, left) values. Mixin -sides aborted.';
314
- } @else {
315
-
316
- // Initialize some variables
317
- $top: null;
318
- $right: null;
319
- $bottom: null;
320
- $left: null;
321
-
322
- @if map-has-key($values, top) {
323
- $top: map-get($values, top);
324
- }
325
-
326
- @if map-has-key($values, right) {
327
- $right: map-get($values, right);
328
- }
329
-
330
- @if map-has-key($values, bottom) {
331
- $bottom: map-get($values, bottom);
332
- }
333
-
334
- @if map-has-key($values, left) {
335
- $left: map-get($values, left);
336
- }
337
-
338
- @if length($values)==4 {
339
-
340
- @if ($top==$bottom and $right==$left and $top==$right) {
341
- #{$property}: #{$top};
342
- }
343
- @elseif ($top==$bottom and $right==$left) {
344
- #{$property}: #{$top} #{$right};
345
- }
346
- @else {
347
- #{$property}: #{$top} #{$right} #{$bottom} #{$left};
348
- }
349
-
350
- }
351
- @else {
352
-
353
- @if $top {
354
- #{$property}-top: #{$top};
355
- }
356
- @if $right {
357
- #{$property}-right: #{$right};
358
- }
359
- @if $bottom {
360
- #{$property}-bottom: #{$bottom};
361
- }
362
- @if $left {
363
- #{$property}-left: #{$left};
364
- }
365
-
366
- }
313
+ @if not(is-value-map($values, $keys-side)) {
314
+ @warn "Argument $map needs to be a value map of four side (top, right, bottom, left) values. Mixin -sides aborted.";
315
+ }
316
+ @else {
317
+
318
+ // Initialize some variables
319
+ $top: null;
320
+ $right: null;
321
+ $bottom: null;
322
+ $left: null;
323
+
324
+ @if map-has-key($values, top) {
325
+ $top: map-get($values, top);
326
+ }
327
+
328
+ @if map-has-key($values, right) {
329
+ $right: map-get($values, right);
330
+ }
331
+
332
+ @if map-has-key($values, bottom) {
333
+ $bottom: map-get($values, bottom);
334
+ }
335
+
336
+ @if map-has-key($values, left) {
337
+ $left: map-get($values, left);
338
+ }
339
+
340
+ @if length($values) == 4 {
341
+
342
+ @if ($top == $bottom and $right == $left and $top == $right) {
343
+ #{$property}: #{$top};
344
+ }
345
+ @elseif ($top == $bottom and $right == $left) {
346
+ #{$property}: #{$top} #{$right};
347
+ }
348
+ @else {
349
+ #{$property}: #{$top} #{$right} #{$bottom} #{$left};
350
+ }
351
+
352
+ }
353
+ @else {
354
+
355
+ @if $top {
356
+ #{$property}-top: #{$top};
357
+ }
358
+ @if $right {
359
+ #{$property}-right: #{$right};
360
+ }
361
+ @if $bottom {
362
+ #{$property}-bottom: #{$bottom};
363
+ }
364
+ @if $left {
365
+ #{$property}-left: #{$left};
366
+ }
367
367
  }
368
+ }
368
369
  }
@@ -0,0 +1,68 @@
1
+ // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
+
3
+
4
+ // Content
5
+ //
6
+ // 1. Functions
7
+ // str-replace
8
+ // implode
9
+
10
+ // 1. FUNCTIONS
11
+
12
+
13
+ ///
14
+ /// Function to replace characters in a string.
15
+ ///
16
+ /// @example
17
+ /// @include str-replace('Hello World', 'Hello', 'Yo');
18
+ ///
19
+ /// @since 1.0
20
+ ///
21
+ /// @param {String} $string - The whole string
22
+ /// @param {String} $search - The string that needs to be replaced
23
+ /// @param {String} $replace - The replacement
24
+ ///
25
+
26
+ @function str-replace($string, $search, $replace: "") {
27
+
28
+ $index: str-index($string, $search);
29
+
30
+ @if $index {
31
+ @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
32
+ }
33
+
34
+ @return $string;
35
+ }
36
+
37
+ ///
38
+ /// Function to replace characters in a string.
39
+ /// http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/#miscellaneous
40
+ ///
41
+ /// @example
42
+ /// $list: a, b, c d e, f, g, h;
43
+ /// $new-list: implode($list); // abcdefgh
44
+ /// $new-list: implode($list, '-'); // a-b-c-d-e-f-g-h
45
+ ///
46
+ /// @since 1.0
47
+ ///
48
+ /// @param {List} $list - The list to implode
49
+ /// @param {String} $separator (, ) - A separator to join the list items
50
+ /// @param {Bool} $is-nested (false) - Set to true is the list is contains other lists
51
+ ///
52
+
53
+ @function implode($list, $separator: ', ', $is-nested: false) {
54
+ $string: null;
55
+
56
+ @for $i from 1 through length($list) {
57
+ $e: nth($list, $i);
58
+
59
+ @if type-of($e) == list {
60
+ $string: $string#{to-string($e, $is-nested, true)};
61
+ }
62
+ @else {
63
+ $string: if($i != length($list) or $is-nested, $string#{$e}#{$separator}, $string#{$e});
64
+ }
65
+ }
66
+
67
+ @return $string;
68
+ }
@@ -0,0 +1,47 @@
1
+ // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
+
3
+
4
+ // Content
5
+ //
6
+ // 1. Functions
7
+ // svg-url
8
+
9
+
10
+ // 1. FUNCTIONS
11
+
12
+
13
+ ///
14
+ /// Function to create an optimized svg url
15
+ ///
16
+ /// @example
17
+ /// @include svg-url('<svg xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M0 0h10v10H0z"/></svg>');
18
+ ///
19
+ /// @since 1.0
20
+ ///
21
+ /// @param {String} $svg - The single-line svg xml
22
+ ///
23
+
24
+
25
+ @function svg-url($svg) {
26
+ //
27
+ // Chunk up string in order to avoid
28
+ // "SystemStackError: stack level too deep"
29
+ //
30
+ $encoded: "";
31
+ $slice: 2000;
32
+ $index: 0;
33
+ $loops: ceil(str-length($svg) / $slice);
34
+
35
+ @for $i from 1 through $loops {
36
+ $chunk: str-slice($svg, $index, $index + $slice - 1);
37
+ $chunk: str-replace($chunk, "\"", "'");
38
+ $chunk: str-replace($chunk, "<", "%3C");
39
+ $chunk: str-replace($chunk, ">", "%3E");
40
+ $chunk: str-replace($chunk, "&", "%26");
41
+ $chunk: str-replace($chunk, "#", "%23");
42
+ $encoded: #{$encoded}#{$chunk};
43
+ $index: $index + $slice;
44
+ }
45
+
46
+ @return url("data:image/svg+xml;charset=utf8, #{$encoded}");
47
+ }