piecss 0.3.0.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,7 @@
1
1
  // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
2
 
3
3
 
4
- // Rhythm settings
5
-
6
- // Vertical measurements like line-height and %-top and %-bottom are factors of rhythm
7
-
8
- ///
9
- /// This measure is used to calculare vertical measurements like line-height and top and bottom paddings and margins. It defaults to the $line-height but some prefer to set it to a smaller value, like 1/2 or 1/3 times the $line-height.
10
- ///
11
- /// @since 0.1
12
- ///
13
- /// @type {Number}
14
- ///
15
-
16
- $rhythm: 8px !default;
17
-
18
- ///
19
- /// If true,reveals the document's vertical rhythm. Also see: [mixin $debug-rhythm](./#mixin-debug-rhythm).
20
- ///
21
- /// @since 0.1
22
- ///
23
- /// @type {Bool}
24
- ///
25
-
26
- $debug-rhythm: false !default;
4
+ // Layout settings
27
5
 
28
6
  ///
29
7
  /// If true,reveals the document's horizontal rhythm. Also see: [mixin $debug-layout](./#mixin-debug-layout).
@@ -53,9 +31,7 @@ $single-direction-elements: (p, pre, table, hr, article) !default;
53
31
  /// @type {Number}
54
32
  ///
55
33
 
56
- // scss-lint:disable SpaceAroundOperator
57
34
  $column-width-default: 1/1 !default;
58
- // scss-lint:enable SpaceAroundOperator
59
35
 
60
36
  ///
61
37
  /// If set to true, the [column() mixin](./#mixin-column) will mixin a reset of all column widths to 100% at the smallest [breakpoint](./#variable-small_handheld). If you are developing mobile-first, leave this setting to false.
@@ -88,7 +64,7 @@ $column-float: false !default; // If you prefer floated columns instead of inlin
88
64
  // /// @type {Number}
89
65
  // ///
90
66
 
91
- // $gutter-width: 2*$rhythm !default;
67
+ $gutter-width: $default-line-height !default;
92
68
 
93
69
  ///
94
70
  /// The final unit of output in which gutter widths are rendered
@@ -173,27 +149,27 @@ $columns: 4 !default;
173
149
  ///
174
150
 
175
151
  $layouts: (
176
- debug-color: $orange,
152
+ debug-color: $deeppink, // #ff1493
177
153
  columns: 4,
178
154
  rhythm: $rhythm, // 8px
179
155
  gutter-width: rhythm(3), // 24px
180
156
  pages: (),
181
157
  $gt-small-handheld: (
182
- debug-color: $orange,
158
+ debug-color: $orange, // #ffa500
183
159
  columns: 4,
184
160
  rhythm: $rhythm,
185
161
  gutter-width: rhythm(3),
186
162
  pages: ()
187
163
  ),
188
164
  $gt-medium-handheld: (
189
- debug-color: $cyan,
165
+ debug-color: $cyan, // #0ff
190
166
  columns: 8,
191
167
  rhythm: $rhythm,
192
168
  gutter-width: rhythm(3),
193
169
  pages: ()
194
170
  ),
195
171
  $gt-small-desktop: (
196
- debug-color: $becca,
172
+ debug-color: $becca, // #639
197
173
  columns: 12,
198
174
  rhythm: $rhythm,
199
175
  gutter-width: rhythm(3),
@@ -0,0 +1,26 @@
1
+ // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
+
3
+
4
+ // Rhythm settings
5
+
6
+ // Vertical measurements like line-height and %-top and %-bottom are factors of rhythm
7
+
8
+ ///
9
+ /// This measure is used to calculare vertical measurements like line-height and top and bottom paddings and margins. It defaults to 8px which is 1/3 times the $default-line-height.
10
+ ///
11
+ /// @since 0.1
12
+ ///
13
+ /// @type {Number}
14
+ ///
15
+
16
+ $rhythm: 8px !default;
17
+
18
+ ///
19
+ /// If true,reveals the document's vertical rhythm. Also see: [mixin $debug-rhythm](./#mixin-debug-rhythm).
20
+ ///
21
+ /// @since 0.1
22
+ ///
23
+ /// @type {Bool}
24
+ ///
25
+
26
+ $debug-rhythm: false !default;
@@ -1,13 +0,0 @@
1
- // $font-family: $default-font;
2
- // $font-variant: normal;
3
- // $font-style: normal;
4
- // $font-weight: 300;
5
- //
6
- // $type-default: $default-font-regular;
7
- // $type-heading: $default-font-bold;
8
- // $type-anchor: $default-font-regular;
9
- // $type-button: $default-font-regular;
10
- // $type-label: $default-font-regular;
11
- //
12
- // $default-font: $type-default;
13
- $default-font-size: 16px !default;
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
  // Content:
5
- // 1. Functions
5
+ // 1. Mixins
6
6
  // breakpoint
7
7
 
8
8
 
9
- // 1. FUNCTIONS
9
+ // 1. Mixins
10
10
 
11
11
  ///
12
12
  /// Expects a valid breakpoint expression like (min-width: 30em)
@@ -22,6 +22,7 @@
22
22
  /// @param {String} $breakpoints - A valid breakpoint
23
23
  /// @param {Map} $media - The media to which this breakpoint applies
24
24
  ///
25
+
25
26
  @mixin breakpoint($breakpoints, $media: "only screen") {
26
27
 
27
28
  $breakpoints: unquote($breakpoints);
@@ -33,7 +34,7 @@
33
34
  $query: append($query, $breakpoint, comma);
34
35
  }
35
36
  }
36
- @else {
37
+ @else {
37
38
  $query: append($query, $breakpoints, comma);
38
39
  }
39
40
 
@@ -7,6 +7,13 @@
7
7
  // percentage
8
8
  // fraction-to-text
9
9
  // gutters
10
+ // get-layout
11
+ // get-layout-property
12
+ // get-layout-columns
13
+ // get-layout-gutter-width
14
+ // get-layout-rhythm
15
+ // get-layout-debug-color
16
+
10
17
  // 2. Mixins
11
18
  // 2a. Columns
12
19
  // column
@@ -37,11 +44,9 @@
37
44
  /// @return {Number} - The resulting percentage value
38
45
  ///
39
46
 
40
- // scss-lint:disable SpaceAroundOperator
41
47
  @function fraction-to-percentage($fraction: 1/3) {
42
48
  @return percentage($fraction);
43
49
  }
44
- // scss-lint:enable SpaceAroundOperator
45
50
 
46
51
 
47
52
  ///
@@ -63,11 +68,7 @@
63
68
  /// @return {String}
64
69
  ///
65
70
 
66
- // scss-lint:disable SpaceAroundOperator
67
71
  @function fraction-to-text($fraction) {
68
- @if type-of($fraction) == string {
69
- @warn 'The function fraction-to-text only accepts unquoted fractions (1/2 and not \"1/2\")';
70
- }
71
72
 
72
73
  @if $fraction == 1/1 { @return "full"; }
73
74
  @if $fraction == 1/2 { @return "half"; }
@@ -153,7 +154,6 @@
153
154
 
154
155
  @return "full";
155
156
  }
156
- // scss-lint:enable SpaceAroundOperator
157
157
 
158
158
  ///
159
159
  /// Return a value based on the gutter-width. The gutter width is set as a property of the layouts map.
@@ -164,7 +164,6 @@
164
164
  /// @return {Number} - The resulting value in px
165
165
  ///
166
166
 
167
- // scss-lint:disable SpaceAroundOperator
168
167
  @function gutter($args...) {
169
168
 
170
169
  $_fraction: 1/2;
@@ -182,58 +181,143 @@
182
181
  }
183
182
  }
184
183
 
185
- $gutter-width: get-layout-gutter-width($layouts);
186
-
184
+ // Retrieve the gutter-width from the settings, but check if one is set in layouts and take that in stead
185
+ $_gutter-width: $gutter-width;
187
186
  @if $_breakpoint {
188
- $gutter-width: get-layout-gutter-width(get-layout($_breakpoint));
187
+ $_gutter-width: if(get-layout-gutter-width(get-layout($_breakpoint)), get-layout-gutter-width(get-layout($_breakpoint)), $_gutter-width);
189
188
  }
190
189
 
190
+
191
191
  @return $_fraction * $gutter-width;
192
192
  }
193
- // scss-lint:enable SpaceAroundOperator
194
-
195
193
 
196
194
  ///
197
195
  /// Get layout settings from a layout map
198
196
  ///
199
197
  ///
200
198
  /// @param {String} $breakpoints - A valid breakpoint
201
- /// @param {Map} $page - An optional page layout
199
+ /// @param {Map} $layouts ($layouts) - A layout map
202
200
  ///
203
201
  /// @return {Map} - A breakpoint global layout, or a breakpoint nested page layout from [$layouts map](./#variable-layouts)
204
202
  ///
205
203
 
206
- @function get-layout($breakpoint: null, $page: null) {
204
+ @function get-layout($breakpoint, $layouts: $layouts) {
205
+
206
+ @if not( map-has-key($layouts, $breakpoint) ) {
207
+ @error "Unknown breakpoint: #{$breakpoint}";
208
+ }
207
209
 
208
- $layout: map-get($layouts, $breakpoint);
210
+ @return map-get($layouts, $breakpoint);
211
+ }
209
212
 
210
- @if $page {
211
- $layout: map-get($layout, $page);
213
+ ///
214
+ /// Retrieves a property setting for a specific breakpoint
215
+ ///
216
+ /// @since 1.0
217
+ ///
218
+ /// @example
219
+ /// $columns: get-layout-property($columns);
220
+ ///
221
+ /// @param {String} $property - The layout-map property to retrieve
222
+ /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
223
+ /// @param {Map} $layouts ($layouts) - A layout map
224
+ ///
225
+ /// @return {*}
226
+ ///
227
+
228
+ @function get-layout-property($property, $breakpoint: false, $layouts: $layouts) {
229
+
230
+ $_value: null;
231
+
232
+ // Retrieve the layout – default values are not nested in a breakpoint
233
+ $_layout: $layouts;
234
+
235
+ @if $breakpoint and map-has-key($layouts, $breakpoint) {
236
+ $_layout: get-layout($breakpoint);
237
+ }
238
+
239
+ @if map-has-key($_layout, $property) {
240
+ $_value: map-get($_layout, $property);
241
+ }
242
+ @else {
243
+ @error "Unknown layout property: #{$property}";
212
244
  }
213
245
 
214
- @return $layout;
246
+ @return $_value;
215
247
  }
216
248
 
249
+ ///
250
+ /// Retrieves the column setting for a specific breakpoint
251
+ ///
252
+ /// @since 1.0
253
+ ///
254
+ /// @example
255
+ /// $columns: get-layout-columns();
256
+ ///
257
+ /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
258
+ /// @param {Map} $layouts ($layouts) - A layout map
259
+ ///
260
+ /// @since 1.0
261
+ ///
262
+
263
+ @function get-layout-columns($breakpoint: false, $layouts: $layouts) {
264
+ @return get-layout-property("columns", $breakpoint);
265
+ }
217
266
 
218
267
  ///
219
- /// Get layout settings from a layout map
268
+ /// Retrieves the gutter-width setting for a specific breakpoint
220
269
  ///
270
+ /// @since 1.0
221
271
  ///
222
- /// @param {String} $breakpoints - A valid breakpoint
223
- /// @param {Map} $page - An optional page layout
272
+ /// @example
273
+ /// $gutter-width: get-layout-gutter-width();
224
274
  ///
225
- /// @return {Map} - A breakpoint global layout, or a breakpoint nested page layout from [$layouts map](./#variable-layouts)
275
+ /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
276
+ /// @param {Map} $layouts ($layouts) - A layout map
277
+ ///
278
+ /// @since 1.0
226
279
  ///
227
280
 
228
- @function get($key, $breakpoint) {
281
+ @function get-layout-gutter-width($breakpoint: false, $layouts: $layouts) {
282
+ @return get-layout-property("gutter-width", $breakpoint);
283
+ }
229
284
 
230
- @if not( map-has-key($layout, $breakpoint) ) {
231
- @error "Unknown breakpoint: #{$breakpoint}";
232
- }
233
285
 
234
- $config: map-get($layout, $breakpoint);
286
+ ///
287
+ /// Retrieves the rhythm settings for a specific breakpoint
288
+ ///
289
+ /// @since 1.0
290
+ ///
291
+ /// @example
292
+ /// $rhythm: get-layout-rhythm();
293
+ ///
294
+ /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
295
+ /// @param {Map} $layouts ($layouts) - A layout map
296
+ ///
297
+ /// @since 1.0
298
+ ///
235
299
 
236
- @return map-get($config, "columns");
300
+ @function get-layout-rhythm($breakpoint: false, $layouts: $layouts) {
301
+ @return get-layout-property("rhythm", $breakpoint);
302
+ }
303
+
304
+
305
+ ///
306
+ /// Retrieves the debug colour settings for a specific breakpoint
307
+ ///
308
+ /// @since 1.0
309
+ ///
310
+ /// @example
311
+ /// $debug-color: get-layout-debug-color();
312
+ ///
313
+ /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
314
+ /// @param {Map} $layouts ($layouts) - A layout map
315
+ ///
316
+ /// @since 1.0
317
+ ///
318
+
319
+ @function get-layout-debug-color($breakpoint: false, $layouts: $layouts) {
320
+ @return get-layout-property("debug-color", $breakpoint);
237
321
  }
238
322
 
239
323
 
@@ -252,7 +336,6 @@
252
336
  /// @param {Number | Bool} $apply-margin (false) - A fraction, e.g. 1/2, or false
253
337
  ///
254
338
 
255
- // scss-lint:disable SpaceAroundOperator
256
339
  @mixin column($fraction: 1/1, $apply-padding: 1/2, $apply-margin: false) {
257
340
 
258
341
  @include column-behavior();
@@ -266,7 +349,6 @@
266
349
  @include gutters($apply-margin, true);
267
350
  }
268
351
  }
269
- // scss-lint:enable SpaceAroundOperator
270
352
 
271
353
 
272
354
  ///
@@ -303,7 +385,6 @@
303
385
  /// @param {Number} $fraction (1/1) - A fraction, e.g. 1/2
304
386
  ///
305
387
 
306
- // scss-lint:disable SpaceAroundOperator
307
388
  @mixin column-width($fraction: $column-width-default) {
308
389
 
309
390
  width: percentage($fraction);
@@ -313,7 +394,6 @@
313
394
  margin-right: 0;
314
395
  }
315
396
  }
316
- // scss-lint:enable SpaceAroundOperator
317
397
 
318
398
 
319
399
  ///
@@ -325,7 +405,6 @@
325
405
  /// @param {Bool} $use-margin (false) - If true, will render gutters outside the column using margins
326
406
  ///
327
407
 
328
- // scss-lint:disable SpaceAroundOperator
329
408
  @mixin gutters($fraction: 1/2, $use-margin: false) {
330
409
 
331
410
  $both: length($fraction);
@@ -355,7 +434,6 @@
355
434
  }
356
435
  }
357
436
  }
358
- // scss-lint:enable SpaceAroundOperator
359
437
 
360
438
 
361
439
  ///
@@ -406,11 +484,9 @@
406
484
  /// @param {Number} $fraction (1/2) - A fraction, e.g. 1/2
407
485
  ///
408
486
 
409
- // scss-lint:disable SpaceAroundOperator
410
487
  @mixin bleed($fraction: -1/2) {
411
488
  @include gutters($fraction, true);
412
489
  }
413
- // scss-lint:enable SpaceAroundOperator
414
490
 
415
491
 
416
492
  ///
@@ -421,33 +497,27 @@
421
497
  /// @param {Number} $fraction (1/2) - A fraction, e.g. 1/2
422
498
  ///
423
499
 
424
- // scss-lint:disable SpaceAroundOperator
425
500
  @mixin move($fraction) {
426
501
  left: percentage($fraction);
427
502
  }
428
- // scss-lint:enable SpaceAroundOperator
429
503
 
430
504
 
431
505
  ///
432
506
  /// @alias move
433
507
  ///
434
508
 
435
- // scss-lint:disable SpaceAroundOperator
436
509
  @mixin push($fraction) {
437
510
  @include move($fraction);
438
511
  }
439
- // scss-lint:enable SpaceAroundOperator
440
512
 
441
513
 
442
514
  ///
443
515
  /// @alias move
444
516
  ///
445
517
 
446
- // scss-lint:disable SpaceAroundOperator
447
518
  @mixin pull($fraction) {
448
519
  @include move(-1 * $fraction);
449
520
  }
450
- // scss-lint:enable SpaceAroundOperator
451
521
 
452
522
 
453
523
  ///
@@ -476,7 +546,7 @@
476
546
 
477
547
  @mixin debug-layout($columns: $columns, $color: $black, $gutter-width: $gutter-width) {
478
548
  background-size: percentage(1 / $columns) 100%;
479
- // scss-lint:disable SpaceAfterPropertyColon TrailingWhitespace
549
+ // scss-lint:disable TrailingWhitespace SpaceAfterPropertyColon
480
550
  background-image:
481
551
  linear-gradient(to right,
482
552
  rgba($color, .1) 0,
@@ -496,97 +566,5 @@
496
566
  transparent 1px,
497
567
  transparent percentage($columns / $columns)
498
568
  );
499
- // scss-lint:enable SpaceAfterPropertyColon TrailingWhitespace
500
- }
501
-
502
-
503
-
504
- ///
505
- /// Retrieves the layout settings for a specific breakpoint
506
- ///
507
- /// @since 1.0
508
- ///
509
-
510
- @function get-layout($breakpoint) {
511
- @return map-get($layouts, $breakpoint);
512
- }
513
-
514
-
515
- ///
516
- /// Retrieves the column setting for a specific breakpoint
517
- ///
518
- /// @since 1.0
519
- ///
520
-
521
- @function get-layout-columns($breakpoint: false) {
522
- @return get-layout-property("columns", $breakpoint);
523
- }
524
-
525
-
526
- ///
527
- /// Retrieves the gutter-width setting for a specific breakpoint
528
- ///
529
- /// @since 1.0
530
- ///
531
-
532
- @function get-layout-gutter-width($breakpoint: false) {
533
- @return get-layout-property("gutter-width", $breakpoint);
534
- }
535
-
536
-
537
- ///
538
- /// Retrieves the rhythm settings for a specific breakpoint
539
- ///
540
- /// @since 1.0
541
- ///
542
-
543
- @function get-layout-rhythm($breakpoint: false) {
544
- @return get-layout-property("rhythm", $breakpoint);
545
- }
546
-
547
-
548
- ///
549
- /// Retrieves the debug colour settings for a specific breakpoint
550
- ///
551
- /// @since 1.0
552
- ///
553
-
554
- @function get-layout-debug-color($breakpoint: false) {
555
- @return get-layout-property("debug-color", $breakpoint);
556
- }
557
-
558
-
559
- ///
560
- /// Retrieves a property setting for a specific breakpoint
561
- ///
562
- /// @since 1.0
563
- ///
564
- /// @example
565
- /// $columns: get-layout-property($columns);
566
- ///
567
- /// @param {String} $property - The layout-map property to retrieve
568
- /// @param {String | Bool} $breakpoint (false) - A valid breakpoint string, or false to retrieve the default value
569
- ///
570
- /// @return {*}
571
- ///
572
-
573
- @function get-layout-property($property, $breakpoint: false, $layouts: $layouts) {
574
-
575
- $_value: null;
576
-
577
- // Retrieve the layout – default values are not nested in a breakpoint
578
- $_layout: $layouts;
579
-
580
- @if $breakpoint and map-has-key($layouts, $breakpoint) {
581
- $_layout: map-get($layouts, $breakpoint);
582
- }
583
-
584
- @if map-has-key($_layout, $property) {
585
- $_value: map-get($_layout, $property);
586
- }
587
- @else {
588
- @error "Unknown layout property: #{$property}";
589
- }
590
-
591
- @return $_value;
569
+ // scss-lint:enable TrailingWhitespace SpaceAfterPropertyColon
592
570
  }
@@ -19,10 +19,8 @@
19
19
  /// @param {String} $type
20
20
  ///
21
21
 
22
- // scss-lint:disable Indentation
23
22
  @mixin list-style-type($type) {
24
- %list--#{$type} {
25
- list-style-type: $type;
26
- }
23
+ %list--#{$type} {
24
+ list-style-type: $type;
25
+ }
27
26
  }
28
- // scss-lint:enable Indentation
@@ -183,7 +183,7 @@
183
183
  /// @since 0.1
184
184
  ///
185
185
  /// @example
186
- /// @include inline-block(baseline);
186
+ /// @include inline-block(baseline);
187
187
  ///
188
188
  /// @param {String} $vertical-alignment (baseline) - Set $inline-block-alignment to none or false to disable the output of a vertical-align property in the inline-block mixin. Or set it to a legal value for vertical-align to change the default.
189
189
  ///
@@ -273,8 +273,6 @@
273
273
  /// @param {String} $selector (&) - The selector to append the pseudo-element to
274
274
  /// @param {List | String} $placement (before) - The pseudo-element(s)
275
275
  ///
276
- /// @return {Bool}
277
- ///
278
276
 
279
277
  @mixin pseudo-element($placements: "before", $selectors: "&") {
280
278
 
@@ -64,7 +64,7 @@
64
64
  /// @param {Number} $context (16px) - The font-size context
65
65
  ///
66
66
 
67
- @mixin rhythm($units, $property, $context: $font-size) {
67
+ @mixin rhythm($units, $property, $context: $default-font-size) {
68
68
  // @if strip-unit($units)==0 {
69
69
  // #{$property}: 0;
70
70
  // }
@@ -83,7 +83,6 @@
83
83
  /// @param {Number} $rhythm - The rhythm height
84
84
  ///
85
85
 
86
- // scss-lint:disable ImportantRule DuplicateProperty
87
86
  @mixin debug-rhythm($rhythm: $rhythm) {
88
87
  $to: transparent;
89
88
  $from: rgba($lightcyan, .5);
@@ -92,13 +91,14 @@
92
91
  background-size: (2 * $rhythm) (2 * $rhythm);
93
92
 
94
93
  * {
94
+ // scss-lint:disable ImportantRule DuplicateProperty
95
95
  background-image: none !important;
96
96
  background-color: transparent !important;
97
97
  outline: rgba($fuchsia, .1) dotted 1px;
98
98
  outline: $lightgray dotted 1px;
99
+ // scss-lint:enable ImportantRule DuplicateProperty
99
100
  @include old-ie {
100
101
  outline: lighten($fuchsia, .1) dotted 1px \9;
101
102
  }
102
103
  }
103
104
  }
104
- // scss-lint:enable ImportantRule DuplicateProperty
@@ -80,11 +80,12 @@
80
80
  ///
81
81
  /// @param {List} $values - The value to test, can be a single number or a list
82
82
  /// @param {Number} $unit ($unit) - A list of keys to match
83
+ /// @param {Number} $context ($default-font-size) - The context of the targeted element, for calculations to em
83
84
  ///
84
85
  /// @return {Map}
85
86
  ///
86
87
 
87
- @function value-map-to-unit($map, $unit: $unit) {
88
+ @function value-map-to-unit($map, $unit: $unit, $context: $default-font-size) {
88
89
 
89
90
  @if not(type-of($map) == map) {
90
91
  @warn "Argument $map needs to be a map.";
@@ -93,7 +94,7 @@
93
94
 
94
95
  // Convert to units
95
96
  @each $key, $value in $map {
96
- $map: map-merge($map, ($key: to-unit($value, $unit)));
97
+ $map: map-merge($map, ($key: to-unit($value, $unit, $context)));
97
98
  }
98
99
 
99
100
  @return $map;