type-heading 0.0.11 → 0.0.13
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/README.md +3 -4
- data/stylesheets/_type-heading.scss +2 -0
- data/stylesheets/type-heading/functions/_core.scss +38 -0
- data/stylesheets/type-heading/functions/_heading.scss +2 -0
- data/stylesheets/type-heading/functions/_property.scss +2 -0
- data/stylesheets/type-heading/mixins/_breakpoint.scss +21 -36
- data/stylesheets/type-heading/mixins/_core.scss +37 -0
- data/stylesheets/type-heading/mixins/_heading.scss +70 -42
- data/stylesheets/type-heading/mixins/_property.scss +9 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baff6ecab89578b4bf058a21e8769b0addcf3e54
|
4
|
+
data.tar.gz: cd43b78e2651ee84c5611bc32b77f89b1dadf519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066ba92a26378c2de1d4f56925634d2ace28be17793c26f4444fe152d10104fe553be0bc9b64588893857a1d190048eb9dca577b2b2f5d72fc40b3dd1ea95ee9
|
7
|
+
data.tar.gz: 6fed2c309e2797103f11d634342d1ad017b7829d7c3fda0811cb3e0c4c01ef9c0da36e3be41b050aa9e64fc2caa18b4612bea5e09779bca48058447dda7e9224
|
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
[](http://badge.fury.io/rb/type-heading)
|
2
2
|
|
3
|
-
# Type Heading -
|
3
|
+
# Type Heading - BETA
|
4
4
|
|
5
5
|
A responsive typography tool.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
production work.
|
7
|
+
Type heading is currently in **BETA**. It should only be used for testing and/or
|
8
|
+
development, not production work.
|
10
9
|
|
11
10
|
## Requirements
|
12
11
|
|
@@ -5,6 +5,8 @@
|
|
5
5
|
|
6
6
|
@import "type-heading/settings";
|
7
7
|
@import "type-heading/functions/helpers";
|
8
|
+
@import "type-heading/functions/core";
|
9
|
+
@import "type-heading/mixins/core";
|
8
10
|
@import "type-heading/functions/heading";
|
9
11
|
@import "type-heading/functions/property";
|
10
12
|
@import "type-heading/mixins/breakpoint";
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// Breakpoint
|
2
|
+
//
|
3
|
+
// @group Functions / Core
|
4
|
+
// @author Elliot Mitchum
|
5
|
+
|
6
|
+
// _th-core-global-breakpoint
|
7
|
+
// Allows breakpoint override for sections of code.
|
8
|
+
//
|
9
|
+
// @since 0.0.12
|
10
|
+
// @type Number
|
11
|
+
// @access private
|
12
|
+
|
13
|
+
$_th-core-global-breakpoint: false !default;
|
14
|
+
|
15
|
+
// _th-core-global-breakpoint
|
16
|
+
// Returns global breakpoint property.
|
17
|
+
//
|
18
|
+
// @since 0.0.12
|
19
|
+
// @type function
|
20
|
+
// @access private
|
21
|
+
// @group breakpoint
|
22
|
+
//
|
23
|
+
// @param {number} $breakpoint A heading list breakpoint (required).
|
24
|
+
//
|
25
|
+
// @returns {Number} The breakpoint parameter.
|
26
|
+
//
|
27
|
+
// @example scss Return $th-breakpoint-global parameter.
|
28
|
+
// // $breakpoint: _th-core-global-breakpoint($breakpoint);
|
29
|
+
|
30
|
+
@function _th-core-global-breakpoint(
|
31
|
+
$breakpoint
|
32
|
+
){
|
33
|
+
@if global-variable-exists('_th-core-global-breakpoint') and $_th-core-global-breakpoint {
|
34
|
+
@return $_th-core-global-breakpoint;
|
35
|
+
} @else {
|
36
|
+
@return $breakpoint;
|
37
|
+
}
|
38
|
+
}
|
@@ -12,6 +12,7 @@
|
|
12
12
|
// @requires {function} th-heading-get-map
|
13
13
|
// @requires {function} _th-heading-has-next
|
14
14
|
// @requires {function} _th-heading-get-next
|
15
|
+
// @requires {function} _th-core-global-breakpoint
|
15
16
|
//
|
16
17
|
// @param {list | string} $heading A heading map key or list (required).
|
17
18
|
// @param {number} $breakpoint A heading list breakpoint.
|
@@ -32,6 +33,7 @@
|
|
32
33
|
$breakpoint: false
|
33
34
|
){
|
34
35
|
$_return: $heading;
|
36
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
35
37
|
@if string == type-of($heading) {
|
36
38
|
$_return: th-heading-get-map($heading);
|
37
39
|
@if _th-heading-has-next($_return) {
|
@@ -27,6 +27,7 @@ $th-properties: (
|
|
27
27
|
// @requires {function} th-property-get
|
28
28
|
// @requires {function} th-property-default
|
29
29
|
// @requires {function} _th-property-unit-convert
|
30
|
+
// @requires {function} _th-core-global-breakpoint
|
30
31
|
//
|
31
32
|
// @param {list | string} $heading A heading map key or list (required).
|
32
33
|
// @param {string} $property-name (font-size | line-height | margin-top | margin-bottom | breakpoint) A heading property name (required).
|
@@ -69,6 +70,7 @@ $th-properties: (
|
|
69
70
|
){
|
70
71
|
$_return: false;
|
71
72
|
$heading: th-heading($heading, $breakpoint);
|
73
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
72
74
|
$_return: _th-property-get($heading, $property-name);
|
73
75
|
@if $_return == default or $_return == false {
|
74
76
|
$_return: th-property-default($property-name, $base-font-size, false);
|
@@ -3,49 +3,34 @@
|
|
3
3
|
// @group Mixins / Breakpoint
|
4
4
|
// @author Elliot Mitchum
|
5
5
|
|
6
|
-
// th-breakpoint
|
7
|
-
// Output styles
|
6
|
+
// th-breakpoint
|
7
|
+
// Output styles with a breakpoint within a media query.
|
8
8
|
//
|
9
9
|
// @since 0.0.10
|
10
10
|
// @type mixin
|
11
11
|
//
|
12
|
-
// @requires {mixin} th-
|
12
|
+
// @requires {mixin} th-with-breakpoint
|
13
|
+
// @requires {gem} breakpoint - https://github.com/at-import/breakpoint
|
13
14
|
//
|
14
|
-
// @param {
|
15
|
-
// @param {number | boolean} $breakpoint (false) A heading list breakpoint
|
16
|
-
// @param {string} $direction (min-width | max-width) Media query direction.
|
17
|
-
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
15
|
+
// @param {List} $query The media query to parse (https://github.com/at-import/breakpoint/wiki/Basic-Media-Queries) (required).
|
16
|
+
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
18
17
|
//
|
19
|
-
// @example scss Output
|
20
|
-
// // @include th-breakpoint-
|
21
|
-
// //
|
22
|
-
// //
|
23
|
-
// // )
|
24
|
-
// @example scss Output h1 styles with max width media query.
|
25
|
-
// // @include th-breakpoint-heading(
|
26
|
-
// // $heading: h1,
|
27
|
-
// // $breakpoint: 768px,
|
28
|
-
// // $direction: max-width
|
29
|
-
// // )
|
30
|
-
// @example scss Output h1 styles with a base font size of 48px.
|
31
|
-
// // @include th-breakpoint-heading(
|
32
|
-
// // $heading: h1,
|
33
|
-
// // $base-font-size: 48px
|
34
|
-
// // )
|
18
|
+
// @example scss Output a heading with a 768px within a 768px min-width media query.
|
19
|
+
// // @include th-breakpoint(min-width 768px, 768px) {
|
20
|
+
// // @include th-heading(h1);
|
21
|
+
// // }
|
35
22
|
|
36
|
-
@mixin th-breakpoint
|
37
|
-
$
|
38
|
-
$breakpoint
|
39
|
-
$direction: min-width,
|
40
|
-
$convert: true,
|
41
|
-
$base-font-size: $th-base-font-size
|
23
|
+
@mixin th-breakpoint(
|
24
|
+
$query,
|
25
|
+
$breakpoint
|
42
26
|
){
|
43
|
-
@
|
44
|
-
@include
|
45
|
-
$
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
27
|
+
@if variable-exists('breakpoint') and mixin-exists('breakpoint') {
|
28
|
+
@include breakpoint($query) {
|
29
|
+
@include th-with-breakpoint($breakpoint) {
|
30
|
+
@content;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
} @else {
|
34
|
+
@warn 'th-breakpoint requires the Breakpoint gem - https://github.com/at-import/breakpoint';
|
50
35
|
}
|
51
36
|
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// Core
|
2
|
+
//
|
3
|
+
// @group Mixins / Core
|
4
|
+
// @author Elliot Mitchum
|
5
|
+
|
6
|
+
// _th-core-global-breakpoint
|
7
|
+
// Allows breakpoint override for sections of code.
|
8
|
+
//
|
9
|
+
// @since 0.0.12
|
10
|
+
// @type Number
|
11
|
+
// @access private
|
12
|
+
|
13
|
+
$_th-core-global-breakpoint: false !default;
|
14
|
+
|
15
|
+
// th-with-breakpoint
|
16
|
+
// Use a breakpoint for a section of code.
|
17
|
+
//
|
18
|
+
// @since 0.0.12
|
19
|
+
// @type mixin
|
20
|
+
//
|
21
|
+
// @requires {variable} $_th-core-global-breakpoint
|
22
|
+
//
|
23
|
+
// @param {number} $breakpoint (false) A heading list breakpoint (required).
|
24
|
+
//
|
25
|
+
// @example scss Output a heading with a 768px breakpoint.
|
26
|
+
// // @include th-with-breakpoint(768px) {
|
27
|
+
// // @include th-heading(h1);
|
28
|
+
// // }
|
29
|
+
|
30
|
+
@mixin th-with-breakpoint(
|
31
|
+
$breakpoint
|
32
|
+
){
|
33
|
+
$cache: $_th-core-global-breakpoint;
|
34
|
+
$_th-core-global-breakpoint: $breakpoint !global;
|
35
|
+
@content;
|
36
|
+
$_th-core-global-breakpoint: $cache !global;
|
37
|
+
}
|
@@ -11,14 +11,18 @@
|
|
11
11
|
//
|
12
12
|
// @requires {function} th-heading
|
13
13
|
// @requires {function} th-property-font-size
|
14
|
+
// @requires {function} _th-core-global-breakpoint
|
14
15
|
// @requires {mixin} th-property-margin-top
|
15
16
|
// @requires {mixin} th-property-margin-bottom
|
16
17
|
// @requires {mixin} th-property-font-size
|
17
18
|
// @requires {mixin} th-property-line-height
|
19
|
+
// @requires {mixin} th-with-breakpoint
|
18
20
|
//
|
19
21
|
// @param {string} $heading A heading map key (required).
|
20
22
|
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
23
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
21
24
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
25
|
+
// @param {list | boolean} $include (false font-size line-height margin-top margin-bottom) Include only certain properties in the mixin output.
|
22
26
|
//
|
23
27
|
// @example scss Output h1 styles.
|
24
28
|
// // th-heading(h1)
|
@@ -37,12 +41,18 @@
|
|
37
41
|
// // $heading: h1,
|
38
42
|
// // $base-font-size: 48px
|
39
43
|
// // )
|
44
|
+
// @example scss Output h1 styles but only include font-size and line-height
|
45
|
+
// // th-heading(
|
46
|
+
// // $heading: h1,
|
47
|
+
// // $include: (font-size line-height)
|
48
|
+
// // )
|
40
49
|
|
41
50
|
@mixin th-heading(
|
42
51
|
$heading,
|
43
52
|
$breakpoint: false,
|
44
53
|
$convert: true,
|
45
|
-
$base-font-size: $th-base-font-size
|
54
|
+
$base-font-size: $th-base-font-size,
|
55
|
+
$include: false
|
46
56
|
){
|
47
57
|
$heading: th-heading(
|
48
58
|
$heading: $heading,
|
@@ -54,30 +64,39 @@
|
|
54
64
|
$base-font-size: $base-font-size,
|
55
65
|
$convert: false
|
56
66
|
);
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
67
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
68
|
+
@if not $include or th-list-has($include, margin-top) {
|
69
|
+
@include th-property-margin-top(
|
70
|
+
$heading: $heading,
|
71
|
+
$breakpoint: $breakpoint,
|
72
|
+
$convert: $convert,
|
73
|
+
$base-font-size: $font-size
|
74
|
+
);
|
75
|
+
}
|
76
|
+
@if not $include or th-list-has($include, margin-bottom) {
|
77
|
+
@include th-property-margin-bottom(
|
78
|
+
$heading: $heading,
|
79
|
+
$breakpoint: $breakpoint,
|
80
|
+
$convert: $convert,
|
81
|
+
$base-font-size: $font-size
|
82
|
+
);
|
83
|
+
}
|
84
|
+
@if not $include or th-list-has($include, font-size) {
|
85
|
+
@include th-property-font-size(
|
86
|
+
$heading: $heading,
|
87
|
+
$breakpoint: $breakpoint,
|
88
|
+
$convert: $convert,
|
89
|
+
$base-font-size: $base-font-size
|
90
|
+
);
|
91
|
+
}
|
92
|
+
@if not $include or th-list-has($include, line-height) {
|
93
|
+
@include th-property-line-height(
|
94
|
+
$heading: $heading,
|
95
|
+
$breakpoint: $breakpoint,
|
96
|
+
$convert: $convert,
|
97
|
+
$base-font-size: $font-size
|
98
|
+
);
|
99
|
+
}
|
81
100
|
}
|
82
101
|
|
83
102
|
// th-headings
|
@@ -89,51 +108,60 @@
|
|
89
108
|
// @requires {function} th-heading-get-map
|
90
109
|
// @requires {function} _th-heading-has-next
|
91
110
|
// @requires {function} th-property
|
92
|
-
// @requires {mixin} th-breakpoint
|
111
|
+
// @requires {mixin} th-breakpoint
|
93
112
|
// @requires {mixin} th-heading
|
113
|
+
// @requires {gem} breakpoint - https://github.com/at-import/breakpoint
|
94
114
|
//
|
95
115
|
// @param {list | string} $heading A heading map key or list (required).
|
96
116
|
// @param {string} $direction (min-width | max-width) Media query direction.
|
117
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
97
118
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
98
119
|
//
|
99
|
-
// @example scss Output all h1 styles.
|
120
|
+
// @example scss Output all h1 styles across all breakpoints.
|
100
121
|
// // @include th-headings(h1)
|
101
|
-
// @example scss Output
|
102
|
-
// //
|
122
|
+
// @example scss Output font-size and line-height h1 styles across all breakpoints.
|
123
|
+
// // th-headings(
|
103
124
|
// // $heading: h1,
|
104
|
-
// // $
|
125
|
+
// // $include: (font-size line-height)
|
105
126
|
// // )
|
106
127
|
|
107
128
|
@mixin th-headings(
|
108
129
|
$heading,
|
109
|
-
$direction: min-width,
|
110
130
|
$convert: true,
|
111
|
-
$base-font-size: $th-base-font-size
|
131
|
+
$base-font-size: $th-base-font-size,
|
132
|
+
$include: false
|
112
133
|
){
|
113
134
|
$heading-map: th-heading-get-map($heading);
|
114
135
|
@if _th-heading-has-next($heading-map) {
|
115
136
|
@each $heading in $heading-map {
|
116
137
|
$breakpoint: th-property($heading, breakpoint);
|
117
138
|
@if $breakpoint {
|
118
|
-
@include th-breakpoint
|
139
|
+
@include th-breakpoint(
|
140
|
+
$query: $breakpoint,
|
141
|
+
$breakpoint: $breakpoint
|
142
|
+
){
|
143
|
+
@include th-heading(
|
119
144
|
$heading: $heading,
|
120
|
-
$breakpoint: $breakpoint,
|
121
|
-
$direction: $direction,
|
122
145
|
$convert: $convert,
|
123
|
-
$base-font-size: $base-font-size
|
124
|
-
|
146
|
+
$base-font-size: $base-font-size,
|
147
|
+
$include: $include
|
148
|
+
);
|
149
|
+
}
|
125
150
|
} @else {
|
126
151
|
@include th-heading(
|
127
|
-
|
128
|
-
|
129
|
-
|
152
|
+
$heading: $heading,
|
153
|
+
$convert: $convert,
|
154
|
+
$base-font-size: $base-font-size,
|
155
|
+
$include: $include
|
130
156
|
);
|
131
157
|
}
|
132
158
|
}
|
133
159
|
} @else {
|
134
160
|
@include th-heading(
|
135
|
-
|
136
|
-
|
161
|
+
$heading: $heading,
|
162
|
+
$convert: $convert,
|
163
|
+
$base-font-size: $base-font-size,
|
164
|
+
$include: $include
|
137
165
|
);
|
138
166
|
}
|
139
167
|
}
|
@@ -10,9 +10,11 @@
|
|
10
10
|
// @type mixin
|
11
11
|
//
|
12
12
|
// @requires {function} th-property-font-size
|
13
|
+
// @requires {function} _th-core-global-breakpoint
|
13
14
|
//
|
14
15
|
// @param {string} $heading A heading map key (required).
|
15
16
|
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
17
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
16
18
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
17
19
|
//
|
18
20
|
// @example scss Output h1 font size styles.
|
@@ -29,6 +31,7 @@
|
|
29
31
|
$convert: true,
|
30
32
|
$base-font-size: $th-base-font-size
|
31
33
|
){
|
34
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
32
35
|
font-size: th-property-font-size(
|
33
36
|
$heading: $heading,
|
34
37
|
$breakpoint: $breakpoint,
|
@@ -47,6 +50,7 @@
|
|
47
50
|
//
|
48
51
|
// @param {string} $heading A heading map key (required).
|
49
52
|
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
53
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
50
54
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
51
55
|
//
|
52
56
|
// @example scss Output h1 line height styles.
|
@@ -63,6 +67,7 @@
|
|
63
67
|
$convert: true,
|
64
68
|
$base-font-size: $th-base-font-size
|
65
69
|
){
|
70
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
66
71
|
line-height: th-property-line-height(
|
67
72
|
$heading: $heading,
|
68
73
|
$breakpoint: $breakpoint,
|
@@ -81,6 +86,7 @@
|
|
81
86
|
//
|
82
87
|
// @param {string} $heading A heading map key (required).
|
83
88
|
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
89
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
84
90
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
85
91
|
//
|
86
92
|
// @example scss Output h1 margin top styles.
|
@@ -97,6 +103,7 @@
|
|
97
103
|
$convert: true,
|
98
104
|
$base-font-size: $th-base-font-size
|
99
105
|
){
|
106
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
100
107
|
margin-top: th-property-margin-top(
|
101
108
|
$heading: $heading,
|
102
109
|
$breakpoint: $breakpoint,
|
@@ -115,6 +122,7 @@
|
|
115
122
|
//
|
116
123
|
// @param {string} $heading A heading map key (required).
|
117
124
|
// @param {number | boolean} $breakpoint (false) A heading list breakpoint.
|
125
|
+
// @param {boolean} $convert (true) If returned value should be unit converted.
|
118
126
|
// @param {number} $base-font-size ($th-base-font-size) Font size used for relative calculations.
|
119
127
|
//
|
120
128
|
// @example scss Output h1 margin bottom styles.
|
@@ -131,6 +139,7 @@
|
|
131
139
|
$convert: true,
|
132
140
|
$base-font-size: $th-base-font-size
|
133
141
|
){
|
142
|
+
$breakpoint: _th-core-global-breakpoint($breakpoint);
|
134
143
|
margin-bottom: th-property-margin-bottom(
|
135
144
|
$heading: $heading,
|
136
145
|
$breakpoint: $breakpoint,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: type-heading
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elliot Mitchum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -62,10 +62,12 @@ files:
|
|
62
62
|
- lib/type-heading.rb
|
63
63
|
- stylesheets/_type-heading.scss
|
64
64
|
- stylesheets/type-heading/_settings.scss
|
65
|
+
- stylesheets/type-heading/functions/_core.scss
|
65
66
|
- stylesheets/type-heading/functions/_heading.scss
|
66
67
|
- stylesheets/type-heading/functions/_helpers.scss
|
67
68
|
- stylesheets/type-heading/functions/_property.scss
|
68
69
|
- stylesheets/type-heading/mixins/_breakpoint.scss
|
70
|
+
- stylesheets/type-heading/mixins/_core.scss
|
69
71
|
- stylesheets/type-heading/mixins/_heading.scss
|
70
72
|
- stylesheets/type-heading/mixins/_property.scss
|
71
73
|
- templates/project/manifest.rb
|