typey 1.0.0.beta.5 → 1.0.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,63 +0,0 @@
1
- // Generate a value to be used as line-height from either:
2
- // a) a multiple of $base-line-height
3
- // b) a static px or pt value
4
- //
5
- // Example usage with multiple:
6
- // line-height: line-height(2);
7
- // Example usage with static value:
8
- // line-height: line-height(18px);
9
- //
10
- // @param number $x
11
- // Multiple of line height to be used or px/pt value to be converted.
12
- // @param number|string $context
13
- // (optional) Only used if em is the $base-unit. The value of the elements/parents
14
- // font-size if it differs from $base-font-size. Specified as a t-shirt size or
15
- // value in px.
16
- //
17
- // @return number
18
- // The calculated height in $base-unit.
19
- @function line-height($x, $context: $base-font-size) {
20
- @if type-of($x) == "number" and unitless($x) {
21
- @return output-from-multiplier($x, $context);
22
- }
23
- @if type-of($x) == "number" and not unitless($x) {
24
- @if unit($x) == px {
25
- @return convert-unit($x, $context);
26
- }
27
- @else {
28
- @error "line-height() only accepts unitless numbers or values in px";
29
- }
30
- }
31
- @else {
32
- @error "line-height() only accepts unitless numbers or values in px";
33
- }
34
- }
35
-
36
- // Define line-height (with fallback).
37
- // This is only necessary to use if you want to provide fallbacks when you are
38
- // using rem as $base-unit.
39
- //
40
- // @param number $x
41
- // Multiple of line height to be used or px/pt value to be converted.
42
- // @param number|string $context
43
- // (optional) Only used if em is the $base-unit. The value of the elements/parents
44
- // font-size if it differs from $base-font-size. Specified as a t-shirt size or
45
- // value in px.
46
- @mixin line-height($x, $context: $base-font-size) {
47
- @if $base-unit == rem {
48
- @if $rem-fallback == true {
49
- @if type-of($x) == "number" and unitless($x) {
50
- line-height: $x * $base-line-height;
51
- }
52
- @if type-of($x) == "number" and not unitless($x) {
53
- @if unit($x) == px {
54
- line-height: $x;
55
- }
56
- @else {
57
- @error "line-height() only accepts unitless numbers or values in px";
58
- }
59
- }
60
- }
61
- }
62
- line-height: line-height($x, $context);
63
- }
@@ -1,49 +0,0 @@
1
- // Define a type layout (font-size and line-height).
2
- //
3
- // @param number|string $size
4
- // A size from the $font-size map or a px value.
5
- // @param number $x
6
- // Multiple of line height to be used or px value to be converted.
7
- // @param number|string $context
8
- // (optional) Only used if em is the $base-unit. The value of the elements/parents
9
- // font-size if it differs from $base-font-size. Specified as a t-shirt size or
10
- // value in px.
11
- @mixin type-layout($size, $x, $context: $size) {
12
- @if $base-unit == rem {
13
- @if $rem-fallback == true {
14
- @if type-of($size) == "string" {
15
- $map-size: map-get($font-size, $size);
16
- font-size: $map-size;
17
- }
18
- @if type-of($size) == "number" and not unitless($size) {
19
- $unit: unit($size);
20
- @if $unit == px {
21
- font-size: $size;
22
- }
23
- @else {
24
- @warn "font-size() only accepts values in px";
25
- }
26
- }
27
- @if type-of($x) == "number" and unitless($x) {
28
- line-height: $x * $base-line-height;
29
- }
30
- @if type-of($x) == "number" and not unitless($x) {
31
- line-height: $x;
32
- }
33
- }
34
- }
35
- @if $base-unit == rem or $base-unit == px {
36
- font-size: font-size($size);
37
- line-height: line-height($x);
38
- }
39
- @if $base-unit == em {
40
- @if $size == $context {
41
- font-size: font-size($size, $base-font-size);
42
- line-height: line-height($x, $size);
43
- }
44
- @else {
45
- font-size: font-size($size, $context);
46
- line-height: line-height($x, $size);
47
- }
48
- }
49
- }