piecss 0.1.6 → 0.1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1e0a3828cd09d8b40eefb4cddad8be412b53d2a
4
- data.tar.gz: cbbf4c52754dfcfe3bd92a2287630a2e15ee9653
3
+ metadata.gz: 1344c40bbaf258d5fcc0b991fbe2bd3307b300d6
4
+ data.tar.gz: cf60c8b0b54458900350507792eb64c996bd7368
5
5
  SHA512:
6
- metadata.gz: fec98fd4f102c60dc970e599a780a4b8c1830612c2d615a662bad78f4920f19daaaa17cf15a11090ed3fb29434fc357e5a623f6b6382c3bcbc31ec895f12d1de
7
- data.tar.gz: dc9bed508685aacf894354bcb54e124724275ed2c28fd2d6c899a380dd90a75e1ece729a9e575aa473af2245061fb0151d748e1919dc5df36e1d5dc950bc73a5
6
+ metadata.gz: d7696c62cfbe406c4e19b4833779807ca5fde6e301769fc73d7bcb730c06367d683134dad0e04f68a79524535574dea789803a14523e0c47df3608e1f2985797
7
+ data.tar.gz: ef2a1e52dfe99c0f0316a18e874b6269794fd4ce95225a5e3651fb514727cf3e6158faa565cf8974f7467934cf5a8d41acad7c2dab2d315f368121a9f503cfd2
@@ -32,7 +32,7 @@ html {
32
32
  $font-family: extract-type-family($default-font);
33
33
 
34
34
  $font-size: to-unit($default-font-size, 1%, $base-font-size);
35
- $line-height: to-unit($default-line-height, 1%, $base-font-size);
35
+ $line-height: line-height($default-line-height, $base-font-size, $line-height-unit);
36
36
 
37
37
  font: #{$font-style} #{$font-variant} #{$font-weight} #{$font-size}/#{$line-height} #{$font-family};
38
38
 
@@ -18,37 +18,4 @@ Debug helpers
18
18
  body {
19
19
  @extend %debug;
20
20
  }
21
- }
22
-
23
- %rhythm-padding {
24
- @include vrhythm(1, padding-top);
25
- @include vrhythm(1, padding-bottom);
26
- &--top {
27
- @include vrhythm(1, padding-top);
28
- }
29
- &--bottom {
30
- @include vrhythm(1, padding-bottom);
31
- }
32
- }
33
-
34
- %rhythm-margin {
35
- @include vrhythm(0, margin-top);
36
- @include vrhythm(1, margin-bottom);
37
- &--top {
38
- @include vrhythm(1, margin-top);
39
- }
40
- &--bottom {
41
- @include vrhythm(1, margin-bottom);
42
- }
43
- }
44
-
45
- $single-direction-selector: '';
46
- @if length($single-direction-elements) > 0 and $single-direction-elements != '' {
47
- @each $element in $single-direction-elements {
48
- // This leaves the last element with a comma, but the compiler will strip that out anyway so leave for now and revisit later
49
- $single-direction-selector: $single-direction-selector + $element + ',' !global;
50
- }
51
- #{$single-direction-selector} {
52
- @extend %rhythm-margin;
53
- }
54
21
  }
@@ -3,6 +3,12 @@
3
3
 
4
4
  $browser-default-font-size: 16px;
5
5
 
6
+ $keys-side: top right bottom left;
7
+ $keys-padding: $keys-side;
8
+ $keys-margin: $keys-side;
9
+ $keys-border: width style color;
10
+ $keys-corner: top-left top-right right-bottom left-bottom;
11
+
6
12
 
7
13
  $aliceblue: #f0f8ff;
8
14
  $antiquewhite: #faebd7;
@@ -233,7 +233,7 @@ $form-elements: ();
233
233
  * @type {Number}
234
234
  */
235
235
 
236
- $field-padding-top: vrhythm(.25) !default;
236
+ $field-padding-top: rhythm(.25) !default;
237
237
 
238
238
  /**
239
239
  * Field right-padding.
@@ -253,7 +253,7 @@ $field-padding-right: .5em !default;
253
253
  * @type {Number}
254
254
  */
255
255
 
256
- $field-padding-bottom: vrhythm(.25) !default;
256
+ $field-padding-bottom: rhythm(.25) !default;
257
257
 
258
258
  /**
259
259
  * Field left-padding.
@@ -353,7 +353,7 @@ $field-width: 100% !default;
353
353
  * @type {Number}
354
354
  */
355
355
 
356
- $field-height: $default-line-height + 2*$field-border-width + $field-padding-top + $field-padding-bottom !default;
356
+ $field-height: $default-line-height + 2 * $field-border-width + $field-padding-top + $field-padding-bottom !default;
357
357
 
358
358
  /**
359
359
  * Field line-height, relevant for text-area.
@@ -619,7 +619,7 @@ $textarea-height: auto !default;
619
619
  * @type {Number | String}
620
620
  */
621
621
 
622
- $textarea-height-medium: vrhythm(5) - 2*$field-border-width !default;
622
+ $textarea-height-medium: rhythm(5) - 2*$field-border-width !default;
623
623
 
624
624
  /**
625
625
  * Alternate height of textarea element, large.
@@ -629,7 +629,7 @@ $textarea-height-medium: vrhythm(5) - 2*$field-border-width !default;
629
629
  * @type {Number | String}
630
630
  */
631
631
 
632
- $textarea-height-large: vrhythm(10) - 2*$field-border-width !default;
632
+ $textarea-height-large: rhythm(10) - 2*$field-border-width !default;
633
633
 
634
634
  $form-elements: add-properties(
635
635
  (
@@ -63,6 +63,10 @@
63
63
 
64
64
  @function fraction-to-text($fraction)
65
65
  {
66
+ @if type-of($fraction)==string {
67
+ @warn "The function fraction-to-text only accepts unquoted fractions (1/2 and not \"1/2\")";
68
+ }
69
+
66
70
  @if $fraction == 1/1 { @return "full"; }
67
71
  @if $fraction == 1/2 { @return "half"; }
68
72
  @if $fraction == 1/3 { @return "third"; }
@@ -145,7 +149,7 @@
145
149
  @if $fraction == 13/16 { @return "thirteen-sixteenth"; }
146
150
  @if $fraction == 15/16 { @return "sixteen-sixteenth"; }
147
151
 
148
- @return false;
152
+ @return "full";
149
153
  }
150
154
 
151
155
 
@@ -244,18 +248,18 @@
244
248
 
245
249
  @if ($use-margin) {
246
250
  @if $left != false {
247
- margin-left: hrhythm($left);
251
+ margin-left: rhythm($left);
248
252
  }
249
253
  @if $right != false {
250
- margin-right: hrhythm($right);
254
+ margin-right: rhythm($right);
251
255
  }
252
256
  }
253
257
  @else {
254
258
  @if $left != false {
255
- padding-left: hrhythm($left);
259
+ padding-left: rhythm($left);
256
260
  }
257
261
  @if $right != false {
258
- padding-right: hrhythm($right);
262
+ padding-right: rhythm($right);
259
263
  }
260
264
  }
261
265
  }
@@ -37,7 +37,7 @@
37
37
  * Converts a list of property values to a property map. Use to convert 'old-style' associative arrays to SASS's new Map type.
38
38
  *
39
39
  * @example
40
- * @include list-to-map(color #FFF, text-align left)
40
+ * list-to-map((color #FFF, text-align left))
41
41
  * // Output:
42
42
  * (color: #FFF, text-align: left)
43
43
  *
@@ -63,26 +63,42 @@
63
63
 
64
64
 
65
65
  /**
66
- * Conditional mixin of property
66
+ * Mixin for border properties
67
67
  *
68
68
  * @since 0.1
69
- * @deprecated
70
69
  *
71
- * @param {String} $property - A CSS property
72
- * @param {Bool | *} $value - A value for the property, or false if the property should not be rendered.
70
+ * @param {String | Map | List | Numner} $values - The border (or outline) properties
71
+ * @param {Bool} $outline - If true, will render the values as outline properties
73
72
  */
74
73
 
75
- @mixin property($property, $value)
74
+ @mixin border($values, $outline: false)
76
75
  {
77
- @if to-bool($value) {
78
- #{$property}: $value;
76
+ // This mixin needs a value-map to work, so convert argument if it is not a value-map;
77
+ @if not(is-value-map($values, $keys-border)) {
78
+ $values: value-map($values, $keys-border);
79
+ }
80
+
81
+ $property: if($outline, outline, border);
82
+
83
+ // Rem fallback
84
+ $width: map-get($values, width);
85
+ @if type-of($width)==number and unit($width)==rem {
86
+ #{$property}-width: to-px($width);
87
+ }
88
+
89
+ @if map-has-key($values, width) and map-has-key($values, style) and map-has-key($values, color) {
90
+ #{$property}: map-get($values, width) map-get($values, style) map-get($values, color);
91
+ }
92
+ @else {
93
+ @each $key, $value in $values {
94
+ #{$property}-#{$key}: $value;
95
+ }
79
96
  }
97
+
80
98
  }
81
99
 
82
100
  /**
83
- *
84
101
  * @alias border
85
- * Mixin for outline properties.
86
102
  */
87
103
 
88
104
  @mixin outline($attributes)
@@ -90,54 +106,40 @@
90
106
  @include border($attributes, true);
91
107
  }
92
108
 
109
+
93
110
  /**
94
- * Mixin for border properties
111
+ * Provides a cross-browser method to implement opacity. This replaces [Compass's](http://compass-style.org/reference/compass/css3/opacity/) mixin by the same name with a more accessible implementation.
95
112
  *
96
113
  * @since 0.1
97
114
  *
98
- * @todo Provide examples
99
- *
100
- * @param {String | Map | List | Numner} $values - The border (or outline) properties
101
- * @param {Bool} $outline - If true, will render the values as outline properties
115
+ * @param {Number} $opacity - A number between 0 and 1, where 0 is transparent and 1 is opaque.
102
116
  */
103
117
 
104
- @mixin border($values, $outline: false)
105
- {
106
- $property: if($outline, outline, border);
107
-
108
- @if type-of($values)=="list" {
109
- $map: ();
110
- @each $value in $values {
111
- @if type-of($value)==number {
112
- $map: append($map, width, space);
113
- }
114
- @else if type-of($value)==color {
115
- $map: append($map, color, space);
116
- }
117
- @elseif type-of($value)==string {
118
- $map: append($map, style, space);
119
- }
120
- }
121
- @include border( list-to-map( zip($map, $values) ), $outline);
122
- }
123
- @elseif type-of($values)=="string" {
124
- #{$property}: $values;
118
+ @mixin opacity($opacity) {
119
+ @include old-ie() {
120
+ filter: unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{round($opacity * 100)})");
125
121
  }
126
- @elseif type-of($values)=="map" {
122
+ opacity: $opacity;
123
+ }
127
124
 
128
- @if map-has-key($values, width) and map-has-key($values, style) and map-has-key($values, color) {
129
- #{$property}: map-get($values, width) map-get($values, style) map-get($values, color);
130
- }
131
- @else {
132
- $keys: map-keys($values);
133
- @each $key in $keys {
134
- #{$property}-#{$key}: map-get($values, $key);
135
- }
136
- }
125
+
126
+ /**
127
+ * Conditional mixin of property
128
+ *
129
+ * @since 0.1
130
+ * @deprecated
131
+ *
132
+ * @param {String} $property - A CSS property
133
+ * @param {Bool | *} $value - A value for the property, or false if the property should not be rendered.
134
+ */
135
+
136
+ @mixin property($property, $value)
137
+ {
138
+ @if to-bool($value) {
139
+ $property: $value;
137
140
  }
138
141
  }
139
142
 
140
-
141
143
  /**
142
144
  * Support for old-mozilla, cuse it to separate old-ie declarations from your other declarations with either a separate stylesheet or added specificity (Modernizr).
143
145
  *
@@ -200,20 +202,6 @@
200
202
  vertical-align: #{$vertical-alignment};
201
203
  }
202
204
  }
203
- /**
204
- * Provides a cross-browser method to implement opacity. This replaces [Compass's](http://compass-style.org/reference/compass/css3/opacity/) mixin by the same name with a more accessible implementation.
205
- *
206
- * @since 0.1
207
- *
208
- * @param {Number} $opacity - A number between 0 and 1, where 0 is transparent and 1 is opaque.
209
- */
210
-
211
- @mixin opacity($opacity) {
212
- @include old-ie() {
213
- filter: unquote("progid:DXImageTransform.Microsoft.Alpha(Opacity=#{round($opacity * 100)})");
214
- }
215
- opacity: $opacity;
216
- }
217
205
 
218
206
  /**
219
207
  * Accepts a string which a valid appearance
@@ -3,12 +3,8 @@
3
3
 
4
4
  // Content:
5
5
  // 1. Functions
6
- // 1a. Vertical Rhythm:
7
- // vrhythm
8
- // vrhythm-units
9
- // 1b. Horizontal Rhythm
10
- // hrhythm
11
- // vrhythm-units
6
+ // -rhythm-units
7
+ // rhythm
12
8
  // 2. Mixins
13
9
  // 2a. Vertical Rhythm:
14
10
  // vrhythm
@@ -24,127 +20,92 @@
24
20
  * Calculates a value based on the [$rhythm](./#variable-rhythm).
25
21
  *
26
22
  * @since 0.1
23
+ * @access private
27
24
  *
28
- * @param {Int | Fraction} $span (1) - The number of rhythm-units (whole or fraction) to span
25
+ * @param {Int | Fraction} $units (1) - The number of -rhythm-units (whole or fraction) to span
29
26
  *
30
27
  * @return {Number} - The calculated span in px
31
28
  */
32
29
 
33
- @function vrhythm($span: 1)
30
+ @function -rhythm-units($units: 1)
34
31
  {
35
- @return $rhythm * $span;
32
+ @return abs($rhythm * $units);
36
33
  }
37
34
 
38
35
 
39
36
  /**
40
- * Find the optimal rhythm units for a given font-size.
41
- * If the specified span is too small for the font-size, find the next best one
37
+ * Find the optimal rhythm units for a given size in px.
38
+ * If the specified span is too small for the size, find the next best one
42
39
  * based on a specified increment.
43
40
  *
44
41
  * @since 0.1
45
42
  *
46
- * @param {Number} $font-size (16px) - The font-size in px
47
- * @param {Number} (1) $span - The number of rhythm units to span, 1 equals 1 $rhythm
48
- * @param {Number} (1) $increment - The increment in rhythm-units
43
+ * @param {Number} $units - The number of rhythm units to span (whole or fraction), 1 equals 1 $rhythm
44
+ * @param {Number} $size-px - The size in px
45
+ * @param {Number} $increment - The increment in rhythm-units (whole or fraction)
49
46
  *
50
47
  * @return {Number} - The calculated span in px
51
48
  */
52
49
 
53
- @function vrhythm-units($font-size: $default-font-size, $span: 1, $increment: 1)
50
+ @function rhythm($args...)
54
51
  {
55
- $line-height: $span * $rhythm;
56
-
57
- @if $font-size >= $line-height {
58
- // call line-height again, but increase span with increment
59
- @return vrhythm-units($font-size, $span + $increment, $increment);
52
+ $units: false;
53
+ $size-px: false;
54
+ $increment: false;
55
+
56
+ @each $var in $args {
57
+ @if unitless($var) and not($units) {
58
+ $units: $var;
59
+ } @elseif unitless($var) and not($increment) {
60
+ $increment: $var;
61
+ } @elseif not(unitless($var)) and unit($var)==px {
62
+ $size-px: $var;
63
+ }
60
64
  }
61
65
 
62
- @return $span;
63
- }
64
-
65
-
66
- /**
67
- * Calculates a value based on the [$gutter-width](./#variable-gutter-width) as declared in the Layout settings
68
- *
69
- * @example
70
- * padding: hrhythm(.5);
71
- * padding: to-unit( hrhythm(.5) );
72
- * // Output:
73
- * padding: 8px;
74
- * padding: .5em;
75
- *
76
- * @since 0.1
77
- *
78
- * @param {Number} $fraction (1/2) - A fraction, e.g. 1/2
79
- * @param {Value} $context (16px) - The font-size context, defaults to [$default-font-size](./#variable-default-font-size).
80
- *
81
- * @return {Number} - The calculated span in px
82
- */
66
+ @if not($units) {
67
+ $units: 1;
68
+ }
69
+ @if not($increment) {
70
+ $increment: 1;
71
+ }
83
72
 
84
- @function hrhythm($fraction: 1/2, $context: $default-font-size)
85
- {
86
- // Cannot multiply with 0
87
- @if $fraction == 0 {
88
- @return $fraction;
73
+ @if $size-px {
74
+ @while $size-px >= -rhythm-units($units) {
75
+ $units: $units + $increment;
76
+ }
89
77
  }
90
78
 
91
- @return $fraction * $gutter-width;
79
+ $span: -rhythm-units($units);
80
+
81
+ @return $span;
92
82
  }
93
83
 
94
84
 
95
85
  // 2. MIXINS
96
86
 
97
-
98
- /**
99
- * Use for top and bottom margins and paddings.
100
- *
101
- * @example
102
- * @include vrhythm(1, padding-top);
103
- *
104
- * @since 0.1
105
- *
106
- * @param {Number} $span - The number of rhythm-units - whole or fraction - to span
107
- * @param {String} $property - The property to be set, e.g. padding, margin-top
108
- * @param {Value} $context (16px) - The font-size context
109
- */
110
-
111
- @mixin vrhythm($span, $property, $context: $default-font-size)
112
- {
113
- @if strip-unit($span)==0 {
114
- #{$property}: 0;
115
- }
116
- @else {
117
- @if unit($unit)==rem {
118
- #{$property}: $span*$default-line-height;
119
- }
120
- #{$property}: vrhythm($span);
121
- }
122
-
123
- }
124
-
125
-
126
87
  /**
127
88
  * Use for left and right margins and paddings. Uses [$gutter-width](./#variable-gutter-width) declared in grid settings
128
89
  *
129
90
  * @example
130
- * @include hrhythm(1, padding-left);
91
+ * @include rhythm(1, padding-left);
131
92
  *
132
93
  * @since 0.1
133
94
  *
134
- * @param {Number} $fraction - The fraction of the gutter measurement
95
+ * @param {Number} $units - The fraction of the gutter measurement
135
96
  * @param {String} $property - The property to be set, e.g. padding, margin-left
136
97
  * @param {Number} $context (16px) - The font-size context
137
98
  */
138
99
 
139
- @mixin hrhythm($fraction, $property, $context: $default-font-size)
100
+ @mixin rhythm($units, $property, $context: $default-font-size)
140
101
  {
141
- @if strip-unit($span)==0 {
142
- #{$property}: 0;
143
- }
144
- @if unit($unit)==rem {
145
- #{$property}: $fraction*$gutter-width;
146
- }
147
- #{$property}: hrhythm($fraction, $context);
102
+ // @if strip-unit($units)==0 {
103
+ // #{$property}: 0;
104
+ // }
105
+ // @if unit($unit)==rem {
106
+ // #{$property}: $units*$gutter-width;
107
+ // }
108
+ // #{$property}: rhythm($units, $context);
148
109
  }
149
110
 
150
111