typey 1.0.0.alpha.4 → 1.0.0.alpha.5
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/stylesheets/typey/_defaults.scss +22 -2
- data/stylesheets/typey/_font-size.scss +28 -13
- data/stylesheets/typey/_helpers.scss +39 -7
- data/stylesheets/typey/_line-height.scss +18 -7
- data/typey.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f582671fc72dca0711c61757f16b4d90dd3fa5
|
4
|
+
data.tar.gz: 1c65a7f0073d6c7c30375c4c7cbbf49ab18387a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58c36316968c1c9294632bcc62fc9d769bfbc8cc1a070f9fc9868653c33d5b80f58b447ab3dc37c0a748391715546d4e0e90884b96c5ea66ab038d7de083062f
|
7
|
+
data.tar.gz: cb6f5c2ff66819c0afc270afbfcb66286d38a863f367e5e42d0fa84b2839442f80b78f76c876197c0f9968285cb1d952a5fa5f16dc31002a69f3f7e815f3e7e1
|
@@ -34,6 +34,26 @@ $font-weight: (
|
|
34
34
|
lighter: 200
|
35
35
|
) !default;
|
36
36
|
|
37
|
+
// Warnings for $base-unit.
|
38
|
+
@if $base-unit != px and $base-unit != pt and $base-unit != rem and $base-unit != em {
|
39
|
+
@warn "$base-unit must be one of the following unit types: px, pt, rem, em";
|
40
|
+
}
|
41
|
+
|
42
|
+
// Warnings for $base-font-size and $base-line-height.
|
43
|
+
@if unit($base-font-size) != px and unit($base-font-size) != pt {
|
44
|
+
@warn "$base-font-size must be one of the following unit types: px, pt";
|
45
|
+
}
|
46
|
+
@if unit($base-line-height) != unit($base-font-size) {
|
47
|
+
@warn "$base-line-height must use the same unit as $base-font-size.";
|
48
|
+
}
|
49
|
+
|
50
|
+
// Warnings for $font-size
|
51
|
+
@each $key, $size in $font-size {
|
52
|
+
@if unit($size) != unit($base-font-size) {
|
53
|
+
@warn "Size '#{$key}' in $font-size map does not match the $base-font-size unit.";
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
37
57
|
// Define defaults (in the HTML element).
|
38
58
|
//
|
39
59
|
// @param number $base-font-size
|
@@ -50,10 +70,10 @@ $font-weight: (
|
|
50
70
|
@if $base-unit == rem {
|
51
71
|
font-size: $base-font-size / $browser-font-size * 100%;
|
52
72
|
line-height: $base-line-height;
|
53
|
-
line-height: $base-line-height / $base-font-size
|
73
|
+
line-height: output-unit($base-line-height / $base-font-size);
|
54
74
|
}
|
55
75
|
@if $base-unit == em {
|
56
76
|
font-size: $base-font-size / $browser-font-size * 100%;
|
57
|
-
line-height: $base-line-height / $base-font-size
|
77
|
+
line-height: output-unit($base-line-height / $base-font-size);
|
58
78
|
}
|
59
79
|
}
|
@@ -12,21 +12,36 @@
|
|
12
12
|
// The selected font-size in $base-unit.
|
13
13
|
@function font-size($size, $context: $base-font-size) {
|
14
14
|
@if type-of($size) == 'string' {
|
15
|
-
|
16
|
-
|
17
|
-
@
|
18
|
-
|
19
|
-
@if $base-unit == rem {
|
20
|
-
@return ($map-size / $base-font-size) + $base-unit;
|
21
|
-
}
|
22
|
-
@if $base-unit == em {
|
23
|
-
@if type-of($context) == 'string' {
|
24
|
-
$context-map-size: map-get($font-size, $context);
|
25
|
-
@return ($map-size / $context-map-size) + $base-unit;
|
15
|
+
@if map-has-key($font-size, $size) {
|
16
|
+
$map-size: map-get($font-size, $size);
|
17
|
+
@if $base-unit == px or $base-unit == pt {
|
18
|
+
@return output-unit(strip-unit($map-size));
|
26
19
|
}
|
27
|
-
@if
|
28
|
-
@return ($map-size / $
|
20
|
+
@if $base-unit == rem {
|
21
|
+
@return output-unit(($map-size / $base-font-size));
|
29
22
|
}
|
23
|
+
@if $base-unit == em {
|
24
|
+
@if type-of($context) == 'string' {
|
25
|
+
@if map-has-key($font-size, $context) {
|
26
|
+
$context-map-size: map-get($font-size, $context);
|
27
|
+
@return output-unit(($map-size / $context-map-size));
|
28
|
+
}
|
29
|
+
@else {
|
30
|
+
@warn "'#{$context}' not found in $font-size map.";
|
31
|
+
}
|
32
|
+
}
|
33
|
+
@if type-of($context) == 'number' {
|
34
|
+
@if unit($context) == unit($base-font-size) {
|
35
|
+
@return output-unit(($map-size / $context));
|
36
|
+
}
|
37
|
+
@else {
|
38
|
+
@warn "The unit used for $context does not match the $base-font-size unit.";
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
@else {
|
44
|
+
@warn "'#{$size}' not found in $font-size map.";
|
30
45
|
}
|
31
46
|
}
|
32
47
|
}
|
@@ -1,3 +1,25 @@
|
|
1
|
+
// Output a number in the $base-unit.
|
2
|
+
//
|
3
|
+
// @param number $number
|
4
|
+
// The number (without unit) to output.
|
5
|
+
//
|
6
|
+
// @return number
|
7
|
+
// The number with the base unit
|
8
|
+
@function output-unit($number) {
|
9
|
+
@if $base-unit == px {
|
10
|
+
@return $number * 1px;
|
11
|
+
}
|
12
|
+
@if $base-unit == pt {
|
13
|
+
@return $number * 1pt;
|
14
|
+
}
|
15
|
+
@if $base-unit == rem {
|
16
|
+
@return $number * 1rem;
|
17
|
+
}
|
18
|
+
@if $base-unit == em {
|
19
|
+
@return $number * 1em;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
1
23
|
// Remove the unit from a number.
|
2
24
|
//
|
3
25
|
// @param number $number
|
@@ -28,20 +50,30 @@
|
|
28
50
|
$unit: unit($number);
|
29
51
|
@if $unit == px or $unit == pt {
|
30
52
|
@if $base-unit == px or $base-unit == pt {
|
31
|
-
@return strip-unit($number)
|
53
|
+
@return output-unit(strip-unit($number));
|
32
54
|
}
|
33
55
|
@if $base-unit == rem {
|
34
56
|
@if $unit == unit($base-font-size) {
|
35
|
-
@return ($number / $base-font-size)
|
57
|
+
@return output-unit(($number / $base-font-size));
|
36
58
|
}
|
37
59
|
}
|
38
|
-
@if $base-unit == em {
|
60
|
+
@if $base-unit == em {
|
39
61
|
@if type-of($context) == 'string' {
|
40
|
-
|
41
|
-
|
62
|
+
@if map-has-key($font-size, $context) {
|
63
|
+
$context-map-size: map-get($font-size, $context);
|
64
|
+
@return output-unit(($number / $context-map-size));
|
65
|
+
}
|
66
|
+
@else {
|
67
|
+
@warn "'#{$context}' not found in $font-size map.";
|
68
|
+
}
|
42
69
|
}
|
43
|
-
@if type-of($context) == 'number' {
|
44
|
-
@
|
70
|
+
@if type-of($context) == 'number' {
|
71
|
+
@if unit($context) == unit($base-font-size) {
|
72
|
+
@return output-unit(($number / $context));
|
73
|
+
}
|
74
|
+
@else {
|
75
|
+
@warn "The unit used for $context does not match the $base-font-size unit.";
|
76
|
+
}
|
45
77
|
}
|
46
78
|
}
|
47
79
|
}
|
@@ -19,25 +19,36 @@
|
|
19
19
|
@function line-height($x, $context: $base-font-size) {
|
20
20
|
@if type-of($x) == 'number' and unitless($x) {
|
21
21
|
@if $base-unit == px or $base-unit == pt {
|
22
|
-
@return strip-unit($x * $base-line-height)
|
22
|
+
@return output-unit(strip-unit($x * $base-line-height));
|
23
23
|
}
|
24
24
|
@if $base-unit == rem {
|
25
|
-
@return ($x * $base-line-height) / $base-font-size
|
25
|
+
@return output-unit(($x * $base-line-height) / $base-font-size);
|
26
26
|
}
|
27
27
|
@if $base-unit == em {
|
28
|
-
@if
|
28
|
+
@if map-has-key($font-size, $context) {
|
29
29
|
$context-map-size: map-get($font-size, $context);
|
30
|
-
@return ($x * $base-line-height) / $context-map-size
|
30
|
+
@return output-unit(($x * $base-line-height) / $context-map-size);
|
31
31
|
}
|
32
|
-
@
|
33
|
-
@
|
32
|
+
@else {
|
33
|
+
@warn "'#{$context}' not found in $font-size map.";
|
34
|
+
}
|
35
|
+
@if type-of($context) == 'number' {
|
36
|
+
@if unit($context) == unit($base-font-size) {
|
37
|
+
@return output-unit(($x * $base-line-height) / $context);
|
38
|
+
}
|
39
|
+
@else {
|
40
|
+
@warn "The unit used for $context does not match the $base-font-size unit.";
|
41
|
+
}
|
34
42
|
}
|
35
43
|
}
|
36
44
|
}
|
37
45
|
@if type-of($x) == 'number' and not unitless($x) {
|
38
|
-
@if unit($x) ==
|
46
|
+
@if unit($x) == unit($base-font-size) {
|
39
47
|
@return convert-unit($x, $context);
|
40
48
|
}
|
49
|
+
@else {
|
50
|
+
@warn "line-height() accepts only numbers or values with the same unit as $base-font-size.";
|
51
|
+
}
|
41
52
|
}
|
42
53
|
}
|
43
54
|
|
data/typey.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Taranto
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 1.3.1
|
65
65
|
requirements: []
|
66
|
-
rubyforge_project: 1.0.0.alpha.
|
66
|
+
rubyforge_project: 1.0.0.alpha.5
|
67
67
|
rubygems_version: 2.0.14
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|