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 +4 -4
- data/sass/piecss/behavior/base/normalize.scss +1 -1
- data/sass/piecss/behavior/grid/rhythm.scss +0 -33
- data/sass/piecss/settings/constants.scss +6 -0
- data/sass/piecss/settings/form.scss +5 -5
- data/sass/piecss/utilities/layout.scss +9 -5
- data/sass/piecss/utilities/miscellaneous.scss +49 -61
- data/sass/piecss/utilities/rhythm.scss +47 -86
- data/sass/piecss/utilities/sides.scss +244 -252
- data/sass/piecss/utilities/typography.scss +22 -27
- data/sass/piecss/utilities/units.scss +37 -59
- data/sass/piecss/utilities.scss +1 -0
- data/templates/project/screen.scss +4 -4
- metadata +2 -2
@@ -6,8 +6,6 @@
|
|
6
6
|
// strip-unit
|
7
7
|
// to-unit
|
8
8
|
// to-px
|
9
|
-
// 2. Mixins:
|
10
|
-
// rem
|
11
9
|
|
12
10
|
|
13
11
|
// 1. FUNCTIONS
|
@@ -23,11 +21,7 @@
|
|
23
21
|
* @return {Number} - The value stripped of its unit
|
24
22
|
*/
|
25
23
|
|
26
|
-
@function strip-unit($value)
|
27
|
-
{
|
28
|
-
@if $value==0 {
|
29
|
-
@return $value;
|
30
|
-
}
|
24
|
+
@function strip-unit($value) {
|
31
25
|
@return $value / ($value * 0 + 1);
|
32
26
|
}
|
33
27
|
|
@@ -37,34 +31,47 @@
|
|
37
31
|
*
|
38
32
|
* @since 0.1
|
39
33
|
*
|
34
|
+
* @throws Argument $number needs to be a number.
|
35
|
+
*
|
40
36
|
* @param {Number} $target-px - The final size in px
|
41
|
-
* @param {Number} $unit ($unit) - The final unit to which $target-px is converted, e.g.
|
37
|
+
* @param {Number} $unit ($unit) - The final unit to which $target-px is converted, e.g. 1px, 1rem, 1em, 1%
|
42
38
|
* @param {Number} $context ($default-font-size) - The context of the targeted element, for calculations to em
|
43
39
|
*
|
44
40
|
* @return {Number} - The value in the requested unit
|
45
41
|
*/
|
46
42
|
|
47
|
-
@function to-unit($
|
48
|
-
{
|
49
|
-
|
50
|
-
|
51
|
-
$value: to-px($value);
|
43
|
+
@function to-unit($number, $unit: $unit, $context: $default-font-size) {
|
44
|
+
@if not(type-of($number)==number) {
|
45
|
+
@warn 'Argument $number needs to be a number.';
|
46
|
+
@return $number;
|
52
47
|
}
|
53
48
|
|
54
|
-
@if unit($
|
55
|
-
|
49
|
+
@if strip-unit($number)==0 {
|
50
|
+
@return strip-unit($number);
|
56
51
|
}
|
57
|
-
|
58
|
-
|
52
|
+
|
53
|
+
@if unitless($number) and not($number==0) {
|
54
|
+
/* We're dealing with a rhythm number, convert to px */
|
55
|
+
$number: -rhythm-units($number);
|
56
|
+
}
|
57
|
+
|
58
|
+
@if unit($number) != px {
|
59
|
+
/* Convert the value to px first */
|
60
|
+
$number: to-px($number);
|
59
61
|
}
|
60
|
-
|
61
|
-
|
62
|
+
|
63
|
+
@if unit($unit)=='px' {
|
64
|
+
} @elseif unit($unit)=='%' {
|
65
|
+
$number: percentage($number / $context);
|
66
|
+
} @elseif unit($unit)=='rem' {
|
67
|
+
$number: $number / $default-font-size * $unit;
|
68
|
+
} @else {
|
69
|
+
$number: $number / $context * $unit;
|
62
70
|
}
|
63
71
|
|
64
|
-
@return $
|
72
|
+
@return $number;
|
65
73
|
}
|
66
74
|
|
67
|
-
|
68
75
|
/**
|
69
76
|
* Convert any unit to a px value, within the context of it's containing element
|
70
77
|
*
|
@@ -76,18 +83,13 @@
|
|
76
83
|
* @return {Number} - The value in px
|
77
84
|
*/
|
78
85
|
|
79
|
-
@function to-px($value, $context: $default-font-size)
|
80
|
-
{
|
81
|
-
@
|
82
|
-
@debug $value;
|
83
|
-
}
|
84
|
-
@elseif unit($value)=="rem" {
|
86
|
+
@function to-px($value, $context: $default-font-size) {
|
87
|
+
@if unit($value)=='px' {
|
88
|
+
} @elseif unit($value)=='rem' {
|
85
89
|
$value: rem-to-px($value);
|
86
|
-
}
|
87
|
-
@elseif unit($value)=="em" {
|
90
|
+
} @elseif unit($value)=='em' {
|
88
91
|
$value: em-to-px($value, $context);
|
89
|
-
}
|
90
|
-
@elseif unit($value)=="%" {
|
92
|
+
} @elseif unit($value)=='%' {
|
91
93
|
$value: percentage-to-px($value);
|
92
94
|
}
|
93
95
|
|
@@ -105,8 +107,7 @@
|
|
105
107
|
* @return {Number} - The value in px
|
106
108
|
*/
|
107
109
|
|
108
|
-
@function rem-to-px($value)
|
109
|
-
{
|
110
|
+
@function rem-to-px($value) {
|
110
111
|
@return $default-font-size * strip-unit($value);
|
111
112
|
}
|
112
113
|
|
@@ -121,8 +122,7 @@
|
|
121
122
|
* @return {Number} - The value in px
|
122
123
|
*/
|
123
124
|
|
124
|
-
@function em-to-px($value, $context: $default-font-size)
|
125
|
-
{
|
125
|
+
@function em-to-px($value, $context: $default-font-size) {
|
126
126
|
@return $context * strip-unit($value);
|
127
127
|
}
|
128
128
|
|
@@ -139,28 +139,6 @@
|
|
139
139
|
* @return {Number} - The value in px
|
140
140
|
*/
|
141
141
|
|
142
|
-
@function percentage-to-px($value, $context: $default-font-
|
143
|
-
|
144
|
-
@return $value/10% + 0px;
|
142
|
+
@function percentage-to-px($value, $context: $default-font-size) {
|
143
|
+
@return $value/100% * $context;
|
145
144
|
}
|
146
|
-
|
147
|
-
|
148
|
-
// 2. MIXINS
|
149
|
-
|
150
|
-
|
151
|
-
/**
|
152
|
-
* Mixin a property in rem and the fallback in another unit
|
153
|
-
*
|
154
|
-
* @since 0.1
|
155
|
-
*
|
156
|
-
* @param {Number} $target-px - The targeted size in px
|
157
|
-
* @param {String} $property - The property-name
|
158
|
-
* @param {Number} $unit ($rem-fallback-unit) - The fallback unit to use
|
159
|
-
* @param {Number} $context-px ($default-font-size) - The context of the targeted element
|
160
|
-
*/
|
161
|
-
|
162
|
-
@mixin rem($target-px, $property, $unit: $rem-fallback-unit, $context: $default-font-size)
|
163
|
-
{
|
164
|
-
#{$property}: to-unit($target-px, $context, $rem-fallback-unit);
|
165
|
-
#{$property}: to-unit($target-px, $default-font-size, 1rem);
|
166
|
-
}
|
data/sass/piecss/utilities.scss
CHANGED
@@ -89,8 +89,8 @@ $debug-rhythm: false;
|
|
89
89
|
// Or, import individually:
|
90
90
|
|
91
91
|
/*
|
92
|
-
@import "
|
93
|
-
@import "
|
94
|
-
@import "
|
95
|
-
@import "
|
92
|
+
@import "piecss/behavior/base";
|
93
|
+
@import "piecss/behavior/grid";
|
94
|
+
@import "piecss/behavior/form";
|
95
|
+
@import "piecss/behavior/list";
|
96
96
|
*/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piecss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.6
|
4
|
+
version: 0.1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Babs Gosgens
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A collection of tools for building responsive websites.
|