typey 1.0.0.beta.6 → 1.0.0.beta.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8898792b278d464c815124ef1afbaa7ae18ea7a6
4
- data.tar.gz: 222024e2a09ab32650c7220aa09427c12e54fca8
3
+ metadata.gz: 085e5f970aa194b2550fc3b61bd25eae2bfecb73
4
+ data.tar.gz: 60062ba4fdad99e314274aae29764f6723b2a471
5
5
  SHA512:
6
- metadata.gz: 9d601cc92f82925469b575f6260cf7bf872926dff1ad1e2645f8b8a4cfdc24a4edbb67c10c4f0eefc30b7171466ec9323141619d8c50f5ce25a7a22d7f89ad7f
7
- data.tar.gz: 2cdd1be4ec90de348a3ec457be208fe50bcb6663ab628da9e48c4a31e70893408168f06b0ff63fc08d81a18b6f056cec6b1e5b475aba3b5a2fd7c9eff7ec78ad
6
+ metadata.gz: 77e006349cca554d66f6df6521647e880aabeb1de06e07c037c25a97bd8cf75761c6b2834d234bcbee4f0f74619a33536a31ae1f136aa1382b878100c989046b
7
+ data.tar.gz: 386985ec32299afac9ec212b527418f754311107f3e33694e48c8cd064b95a7df3be3a251287a47e139d920c93fd71b233aaf41a2ee721f04b33fd4bc97b05d3
data/README.md CHANGED
@@ -140,8 +140,7 @@ h1 {
140
140
  }
141
141
  ```
142
142
 
143
- All ratios are outputted as `em` instead of your base unit as they will always
144
- be relative to their element's font-size.
143
+ All ratios are outputted as unitless values instead of your base unit.
145
144
 
146
145
  ## Add some margins or padding
147
146
 
@@ -266,10 +265,31 @@ strong {
266
265
  }
267
266
  ```
268
267
 
269
- ## More examples
268
+ ## Debug grid
269
+
270
+ You can turn the debug grid on or off with the global variable below (and also choose
271
+ a custom color!).
272
+
273
+ ```sass
274
+ $typey-debug: true;
275
+ $typey-debug-color: red;
276
+ ```
277
+
278
+ Now the grid will show whenever a type-layout() or line-height() mixin is used and will
279
+ be sized to the element's line-height automatically. If you want to output it
280
+ manually you can use the typey-debug-grid() mixin, which takes a few arguments -
281
+ the line-height (as a ratio, multiplier or px value), and the context (only used
282
+ for ems), and also a custom color.
270
283
 
271
- Grab a copy of the source code (make sure you get the same version you have installed) and look in the examples folder for a few more hints.
284
+ ```sass
285
+ h1 {
286
+ @include typey-debug-grid(2, $context: xl, $color: blue);
287
+ }
288
+ ```
289
+
290
+ ## More examples
272
291
 
292
+ Grab a copy of the source code (make sure you get the same version you have installed) and look in the examples folder to see typey in action.
273
293
  ## Reference
274
294
 
275
295
  The reference section has been removed for now in favour of the better detailed examples above. For explanation on all the individual functions and mixins inside typey you can just download the source code and ogle at the documentation contained within. Once the typey website launches it will include a complete reference section. Stay tuned.
@@ -7,6 +7,7 @@
7
7
  @import "typey/functions/depreciated";
8
8
  @import "typey/defaults";
9
9
  @import "typey/font-stacks";
10
+ @import "typey/mixins/debug";
10
11
  @import "typey/mixins/define-type-sizing";
11
12
  @import "typey/mixins/font-size";
12
13
  @import "typey/mixins/line-height";
@@ -58,6 +58,13 @@ $font-weight: (
58
58
  lighter: 200
59
59
  ) !default;
60
60
 
61
+ // Debug grid
62
+ // Shows horizontal lines for each elements line height.
63
+ $typey-debug: false !default;
64
+
65
+ // Debug grid coloring
66
+ $typey-debug-color: #4affff !default;
67
+
61
68
  // Warnings for $base-unit.
62
69
  @if $base-unit != px and $base-unit != rem and $base-unit != em {
63
70
  @error "$base-unit must be one of the following unit types: rem, em or px";
@@ -37,7 +37,7 @@
37
37
  @if $base-unit == rem {
38
38
  @return typey-output-in-base-unit(($map-size / $base-font-size));
39
39
  }
40
- @if $base-unit == px or $base-unit == pt {
40
+ @if $base-unit == px {
41
41
  @return typey-output-in-base-unit(typey-strip-unit($map-size));
42
42
  }
43
43
  @if $base-unit == em {
@@ -79,5 +79,5 @@
79
79
  // @return number
80
80
  // The ratio in em.
81
81
  @function output-from-ratio($ratio: $base-line-height-ratio) {
82
- @return $ratio * 1em;
82
+ @return $ratio;
83
83
  }
@@ -0,0 +1,41 @@
1
+ // Output a horizontal grid to help with debugging typography.
2
+ //
3
+ // @param number $line-height
4
+ // Multiple of line height to be used, line-height ratio or px value to be converted.
5
+ // @param number|string $context
6
+ // (optional) Only used if em is the $base-unit. The value of the
7
+ // elements/parents font-size if it differs from $base-font-size.
8
+ // Specified as a t-shirt size or value in px.
9
+ // @param string $color
10
+ // (optional) Use a custom grid color.
11
+ @mixin typey-debug-grid($line-height: $base-line-height, $context: $base-font-size, $color: $typey-debug-color) {
12
+ @if $typey-debug == true {
13
+ $allowed-types: "multiplier", "px";
14
+ $type: typey-validator($line-height, $allowed-types);
15
+ $grid-height: 0;
16
+ @if $line-height-method == "rhythm" {
17
+ $grid-height: line-height($line-height, $context);
18
+ }
19
+ @if $line-height-method == "ratio" {
20
+ @if $line-height == $base-line-height {
21
+ $grid-height: line-height($base-line-height-ratio, $context) * 1em;
22
+ }
23
+ @else {
24
+ $grid-height: line-height($line-height, $context) * 1em;
25
+ }
26
+ }
27
+
28
+ position: relative;
29
+ background-image: repeating-linear-gradient(180deg, $color, $color 1px, transparent 1px, transparent $grid-height);
30
+
31
+ &:after {
32
+ content: "";
33
+ position: absolute;
34
+ bottom: -1px;
35
+ left: 0;
36
+ height: 1px;
37
+ width: 100%;
38
+ background-color: $color;
39
+ }
40
+ }
41
+ }
@@ -19,7 +19,7 @@
19
19
  @if $line-height == $base-line-height {
20
20
  $line-height: $base-line-height-ratio;
21
21
  }
22
- line-height: $line-height * 1em;
22
+ line-height: $line-height;
23
23
  }
24
24
  @else {
25
25
  @if $base-unit == rem {
@@ -1,6 +1,4 @@
1
1
  // Define line-height (with fallback).
2
- // This is only necessary to use if you want to provide fallbacks when you are
3
- // using rem as $base-unit.
4
2
  //
5
3
  // @param number $x
6
4
  // Multiple of line height to be used or px value to be converted.
@@ -22,4 +20,6 @@
22
20
  }
23
21
  }
24
22
  line-height: line-height($x, $context);
23
+
24
+ @include typey-debug-grid($x, $context);
25
25
  }
@@ -50,4 +50,6 @@
50
50
  line-height: line-height($line-height, $size);
51
51
  }
52
52
  }
53
+
54
+ @include typey-debug-grid($line-height, $context);
53
55
  }
data/typey.gemspec CHANGED
@@ -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.0.beta.6'
12
- spec.date = '2015-08-05'
11
+ spec.version = '1.0.0.beta.7'
12
+ spec.date = '2015-08-07'
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.0.beta.6
4
+ version: 1.0.0.beta.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Taranto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-05 00:00:00.000000000 Z
11
+ date: 2015-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -44,6 +44,7 @@ files:
44
44
  - stylesheets/typey/functions/_outputters.scss
45
45
  - stylesheets/typey/functions/_sizers.scss
46
46
  - stylesheets/typey/functions/_validators.scss
47
+ - stylesheets/typey/mixins/_debug.scss
47
48
  - stylesheets/typey/mixins/_define-type-sizing.scss
48
49
  - stylesheets/typey/mixins/_font-size.scss
49
50
  - stylesheets/typey/mixins/_line-height.scss
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
71
  - !ruby/object:Gem::Version
71
72
  version: 1.3.1
72
73
  requirements: []
73
- rubyforge_project: 1.0.0.beta.6
74
+ rubyforge_project: 1.0.0.beta.7
74
75
  rubygems_version: 2.4.6
75
76
  signing_key:
76
77
  specification_version: 4