typey 1.0.3 → 1.1.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: 8a1c139e99533ba0abdfb4d0dd7655b83ae682ba
4
- data.tar.gz: b6bef027eae10d375ba0b52845d36c0ad7500af3
3
+ metadata.gz: e348cf7ae35571ee211401f450885e3734c4a0fb
4
+ data.tar.gz: 282ccd59ceb3c1cfc78082d8ca2b1184ff9f4ff3
5
5
  SHA512:
6
- metadata.gz: 0a60614ec5ebbf26ce47ef905cd118b421d0facf37d2a1b9f1d7033ed78022cf6c5434ae37c74a0a05c6e47fbf7150198db5d13a13d8c217a9c58230adf00dad
7
- data.tar.gz: 8f6af191adc9f9cc474a816fe7169e6f342dd82baa36f2e4ed40cd9d18c24d19270be67a7aad2c83e8cf400b1bf2a3bf78a41d7628e999f242286e597ba57d0d
6
+ metadata.gz: baa3aa85f77a74a1a2a5f5b472bd0c90394497bdf93ab77c0a9ef9525e92f4992839cc9dc584da3033fbff807cdfbec7f39bc40ffacd8a6df30e7d9fa87357ba
7
+ data.tar.gz: 63e08afe02d48031f8859953ce2d5eff261dcbcf5140e649b98e8b43bd117d6a4ba2638ec87cfb8d1cf4f1cd48aca850d04526e3aa0ea329100ac19e8b7e6df0
data/README.md CHANGED
@@ -19,11 +19,6 @@ RubyGems & Compass
19
19
  * config.rb: `require 'typey'`
20
20
  * SCSS: `@import 'typey'`
21
21
 
22
- Bower
23
-
24
- * Terminal: `bower install typey --save`
25
- * SCSS: `@import 'bower_components/typey/typey'`
26
-
27
22
  ## Getting started
28
23
 
29
24
  ### How do I tell typey what to do?
@@ -138,6 +133,7 @@ $typefaces: (
138
133
  font-family: $monaco,
139
134
  letter-spacing: .5px,
140
135
  weight: bold,
136
+ style: normal,
141
137
  case: uppercase,
142
138
  )
143
139
  );
@@ -153,7 +149,7 @@ typeface has been.
153
149
 
154
150
  ```sass
155
151
  h1, h2, h3 {
156
- @include typeface(helvetica);
152
+ @include typeface(sans-serif);
157
153
  }
158
154
  ```
159
155
 
@@ -168,7 +164,9 @@ $typestyles: (
168
164
  font-size: xl,
169
165
  line-height: 1.25,
170
166
  weight: bold,
171
- case: uppercase
167
+ style: italic,
168
+ case: uppercase,
169
+ letter-spacing: -2px
172
170
  ),
173
171
  heading-2: (
174
172
  font-size: l,
@@ -1,3 +1,4 @@
1
+ /*! typey | GPLv2 License | https://github.com/jptaranto/typey */
1
2
  @import "typey/functions/helpers";
2
3
  @import "typey/functions/validators";
3
4
  @import "typey/functions/em-calculators";
@@ -111,6 +111,20 @@ $typey-debug: false !default;
111
111
  // Debug grid coloring
112
112
  $typey-debug-color: #4affff !default;
113
113
 
114
+ // Lets store the allowed values for text-transform and font-style so we can
115
+ // make shorthand work a little better.
116
+ $text-transform-values: (
117
+ lowercase,
118
+ uppercase,
119
+ capitalize
120
+ ) !default;
121
+
122
+ $font-style-values: (
123
+ normal,
124
+ italic,
125
+ oblique
126
+ ) !default;
127
+
114
128
  // Warnings for $base-unit.
115
129
  @if $base-unit != px and $base-unit != rem and $base-unit != em {
116
130
  @error "$base-unit must be one of the following unit types: rem, em or px";
@@ -9,6 +9,7 @@
9
9
  $font-family: false;
10
10
  $letter-spacing: false;
11
11
  $weight: false;
12
+ $style: false;
12
13
  $case: false;
13
14
 
14
15
  // Assign values to variables when $typeface is a keyed map.
@@ -22,6 +23,9 @@
22
23
  @if map-has-key($typeface, weight) {
23
24
  $weight: map-get($typeface, weight);
24
25
  }
26
+ @if map-has-key($typeface, style) {
27
+ $style: map-get($typeface, style);
28
+ }
25
29
  @if map-has-key($typeface, case) {
26
30
  $case: map-get($typeface, case);
27
31
  }
@@ -48,9 +52,13 @@
48
52
  $weight: $value;
49
53
  }
50
54
  // This is a case value.
51
- @if type-of($value) == "string" and not(map-has-key($font-weight, $value)) {
55
+ @else if type-of($value) == "string" and index($text-transform-values, $value) != null {
52
56
  $case: $value;
53
57
  }
58
+ // This is a style value.
59
+ @else if type-of($value) == "string" and index($font-style-values, $value) != null {
60
+ $style: $value;
61
+ }
54
62
  }
55
63
  }
56
64
  }
@@ -73,6 +81,9 @@
73
81
  @if $weight {
74
82
  font-weight: weight($weight);
75
83
  }
84
+ @if $style {
85
+ font-style: $style;
86
+ }
76
87
  @if $case {
77
88
  text-transform: $case;
78
89
  }
@@ -12,7 +12,9 @@
12
12
  $font-size: false;
13
13
  $line-height: false;
14
14
  $weight: false;
15
+ $style: false;
15
16
  $case: false;
17
+ $letter-spacing: false;
16
18
 
17
19
  // Assign values to variables when $typestyle is a keyed map.
18
20
  @if type-of($typestyle) == "map" {
@@ -25,9 +27,15 @@
25
27
  @if map-has-key($typestyle, weight) {
26
28
  $weight: map-get($typestyle, weight);
27
29
  }
30
+ @if map-has-key($typestyle, style) {
31
+ $style: map-get($typestyle, style);
32
+ }
28
33
  @if map-has-key($typestyle, case) {
29
34
  $case: map-get($typestyle, case);
30
35
  }
36
+ @if map-has-key($typestyle, letter-spacing) {
37
+ $letter-spacing: map-get($typestyle, letter-spacing);
38
+ }
31
39
  }
32
40
 
33
41
  // Assign values to variables when $typestyle is shorthand.
@@ -38,7 +46,7 @@
38
46
  $font-size: $value;
39
47
  }
40
48
  // This is a line-height value.
41
- @else if type-of($value) == "number" and not(index($typestyle, $value) == 1) {
49
+ @else if type-of($value) == "number" and index($typestyle, $value) == 2 {
42
50
  $line-height: $value;
43
51
  }
44
52
  // This is a font-weight value.
@@ -46,9 +54,17 @@
46
54
  $weight: $value;
47
55
  }
48
56
  // This is a case value.
49
- @else if type-of($value) == "string" and not(index($typestyle, $value) == 1) {
57
+ @else if type-of($value) == "string" and index($text-transform-values, $value) != null {
50
58
  $case: $value;
51
59
  }
60
+ // This is a style value.
61
+ @else if type-of($value) == "string" and index($font-style-values, $value) != null {
62
+ $style: $value;
63
+ }
64
+ // This is a letter-spacing value.
65
+ @else if type-of($value) == "number" and index($typestyle, $value) != 2 and index($typestyle, $value) != 1 {
66
+ $letter-spacing: $value;
67
+ }
52
68
  }
53
69
  }
54
70
 
@@ -72,7 +88,13 @@
72
88
  @if $weight {
73
89
  font-weight: weight($weight);
74
90
  }
91
+ @if $style {
92
+ font-style: $style;
93
+ }
75
94
  @if $case {
76
95
  text-transform: $case;
77
96
  }
97
+ @if $letter-spacing {
98
+ letter-spacing: calculate-em-px($letter-spacing, $font-size);
99
+ }
78
100
  }
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.homepage = 'http://github.com/jptaranto/typey'
9
9
  spec.rubyforge_project =
10
10
 
11
- spec.version = '1.0.3'
12
- spec.date = '2016-07-19'
11
+ spec.version = '1.1.1'
12
+ spec.date = '2017-01-16'
13
13
  spec.licenses = ['GPL-2']
14
14
 
15
15
  spec.authors = ['Jack Taranto']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typey
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Taranto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubyforge_project: 1.0.3
75
+ rubyforge_project: 1.1.1
76
76
  rubygems_version: 2.4.6
77
77
  signing_key:
78
78
  specification_version: 4