type-heading 0.0.11

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 00fbaca7ce7ee0da0212f26d431e27a35936e4f8
4
+ data.tar.gz: b225b572c51e1cc511851194dcebdcae00f9d576
5
+ SHA512:
6
+ metadata.gz: ed262801c66a5c88fc20bffd4834c843f56784a939de24ca71a75e502a6c225a3e5bb8c1ae9fdff9f93b87d4fbd20e8dd19d0c16a6c38cab10336851f0a7b113
7
+ data.tar.gz: 5f430dbf16853bb60ea207cdf89db8ac184e58cb687bc4c52f286e1fe8e1bebefd42673ae3694e0b2448059d2dd68545072c9b5bdf044863f40f67d0a2982404
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ [![Gem Version](https://badge.fury.io/rb/type-heading.svg)](http://badge.fury.io/rb/type-heading)
2
+
3
+ # Type Heading - Alpha
4
+
5
+ A responsive typography tool.
6
+
7
+ **Note:** Type heading is currently in [Alpha](http://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha).
8
+ Currently, Type Heading should only be used for testing and/or development, not
9
+ production work.
10
+
11
+ ## Requirements
12
+
13
+ To use Type Heading, you will need at least:
14
+
15
+ - Ruby: 2.1.5
16
+ - Sass 3.3.13
17
+ - Compass 1.0.1
18
+
19
+ ## Get Started
20
+
21
+ * [Github](https://github.com/ellioseven/type-heading)
22
+ * [Documentation](http://ellioseven.github.io/type-heading/)
@@ -0,0 +1 @@
1
+ require 'type-heading'
@@ -0,0 +1,14 @@
1
+ base_directory = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
+ type_heading_stylesheets_path = File.join(base_directory, 'stylesheets')
3
+ type_heading_templates_path = File.join(base_directory, 'templates')
4
+
5
+ if (defined? Compass)
6
+ Compass::Frameworks.register('type-heading', :stylesheets_directory => type_heading_stylesheets_path, :templates_directory => type_heading_templates_path)
7
+ else
8
+ # compass not found, register on the Sass path via the environment.
9
+ if ENV.has_key?("SASS_PATH")
10
+ ENV["SASS_PATH"] = ENV["SASS_PATH"] + File::PATH_SEPARATOR + type_heading_stylesheets_path
11
+ else
12
+ ENV["SASS_PATH"] = type_heading_stylesheets_path
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ // Type Heading
2
+
3
+ // Imports
4
+ // ------------------------------
5
+
6
+ @import "type-heading/settings";
7
+ @import "type-heading/functions/helpers";
8
+ @import "type-heading/functions/heading";
9
+ @import "type-heading/functions/property";
10
+ @import "type-heading/mixins/breakpoint";
11
+ @import "type-heading/mixins/property";
12
+ @import "type-heading/mixins/heading";
@@ -0,0 +1,46 @@
1
+ // Settings
2
+ //
3
+ // @group Settings
4
+ // @author Elliot Mitchum
5
+
6
+ // th-base-font-size
7
+ // Font size used for relative calculations.
8
+ //
9
+ // @since 0.0.10
10
+ // @type string
11
+
12
+ $th-base-font-size: 16px !default;
13
+
14
+ // th-headings
15
+ // Define headings and their values.
16
+ //
17
+ // @since 0.0.10
18
+ // @type map
19
+
20
+ $th-headings: () !default;
21
+
22
+ // th-property-defaults
23
+ // Define default property values.
24
+ //
25
+ // @since 0.0.10
26
+ // @type map
27
+
28
+ $th-property-defaults: (
29
+ font-size: 16px,
30
+ line-height: 24px,
31
+ margin-top: 20px,
32
+ margin-bottom: 20px
33
+ ) !default;
34
+
35
+ // th-property-defaults
36
+ // Define units for heading properties.
37
+ //
38
+ // @since 0.0.11
39
+ // @type map
40
+
41
+ $th-property-units: (
42
+ font-size: false,
43
+ line-height: false,
44
+ margin-top: false,
45
+ margin-bottom: false
46
+ ) !default;
@@ -0,0 +1,141 @@
1
+ // Heading
2
+ //
3
+ // @group Functions / Heading
4
+ // @author Elliot Mitchum
5
+
6
+ // th-heading
7
+ // Return a heading list.
8
+ //
9
+ // @since 0.0.10
10
+ // @type function
11
+ //
12
+ // @requires {function} th-heading-get-map
13
+ // @requires {function} _th-heading-has-next
14
+ // @requires {function} _th-heading-get-next
15
+ //
16
+ // @param {list | string} $heading A heading map key or list (required).
17
+ // @param {number} $breakpoint A heading list breakpoint.
18
+ //
19
+ // @returns {list} A heading list.
20
+ //
21
+ // @example scss Return a heading list.
22
+ // // // h1: (10px 20px (30px 40px), 50px 60px (70px 80px) 768px)
23
+ // // th-heading(h1)
24
+ // // // 10px 20px (30px 40px)
25
+ // // @example scss Return a heading list with breakpoint.
26
+ // // // h1: (10px 20px (30px 40px), 50px 60px (70px 80px) 768px)
27
+ // // th-heading(h1, 768px)
28
+ // // // 50px 60px (70px 80px) 768px
29
+
30
+ @function th-heading(
31
+ $heading,
32
+ $breakpoint: false
33
+ ){
34
+ $_return: $heading;
35
+ @if string == type-of($heading) {
36
+ $_return: th-heading-get-map($heading);
37
+ @if _th-heading-has-next($_return) {
38
+ $_return: _th-heading-get-next($_return, $breakpoint);
39
+ }
40
+ }
41
+ @return $_return;
42
+ }
43
+
44
+ // th-heading-get-map
45
+ // Return a heading map.
46
+ //
47
+ // @since 0.0.10
48
+ // @type function
49
+ //
50
+ // @param {string} $heading A heading map key (required).
51
+ //
52
+ // @returns {list} A heading map.
53
+ //
54
+ // @example scss Return h1 heading map.
55
+ // // // h1: (10px 20px (30px 40px), 50px 60px (70px 80px) 768px)
56
+ // // th-heading-get-map(h1)
57
+ // // // 10px 20px (30px 40px), 50px 60px (70px 80px) 768px
58
+
59
+ @function th-heading-get-map(
60
+ $heading
61
+ ){
62
+ $_return: $heading;
63
+ @if string == type-of($heading) and map-has-key($th-headings, $heading) {
64
+ $_return: map-get($th-headings, $heading);
65
+ }
66
+ @return $_return;
67
+ }
68
+
69
+ // _th-heading-has-next
70
+ // Check a for multiple heading lists.
71
+ //
72
+ // @since 0.0.10
73
+ // @type function
74
+ // @access private
75
+ //
76
+ // @requires {function} th-heading-get-map
77
+ //
78
+ // @param {list | string} $heading A heading map key or list (required).
79
+ //
80
+ // @returns {boolean} If heading map contains multiple lists.
81
+ //
82
+ // @example scss Check heading with next.
83
+ // // // h1: (10px 20px (30px 40px), 50px 60px (70px 80px) 768px)
84
+ // // _th-heading-has-next(h1)
85
+ // // // true
86
+ // @example scss Check heading without next.
87
+ // // // h5: (10px 20px (30px 40px))
88
+ // // _th-heading-has-next(h5)
89
+ // // // false
90
+
91
+ @function _th-heading-has-next(
92
+ $heading
93
+ ){
94
+ $_return: false;
95
+ $heading: th-heading-get-map($heading);
96
+ @if list-separator($heading) == comma {
97
+ $_return: true;
98
+ }
99
+ @return $_return;
100
+ }
101
+
102
+ // _th-heading-get-next
103
+ // Return a heading list by breakpoint.
104
+ //
105
+ // @since 0.0.10
106
+ // @type function
107
+ // @access private
108
+ //
109
+ // @requires {function} th-heading-get-map
110
+ // @requires {function} th-property
111
+ //
112
+ // @param {list | string} $heading A heading map key or list (required).
113
+ // @param {boolean | number} $breakpoint (false) A heading list breakpoint.
114
+ //
115
+ // @returns {list} Heading list.
116
+ //
117
+ // @example scss Return h1 heading map.
118
+ // // // h1: (10px 20px (30px 40px), 50px 60px (70px 80px) 768px)
119
+ // // _th-heading-get-next(h1, 768px)
120
+ // // // 50px 60px (70px 80px) 768px
121
+
122
+ @function _th-heading-get-next(
123
+ $heading,
124
+ $breakpoint: false
125
+ ){
126
+ $_return: $heading;
127
+ $heading: th-heading-get-map($heading);
128
+ @if $breakpoint {
129
+ @each $heading-list in $heading {
130
+ @if th-property(
131
+ $heading: $heading-list,
132
+ $property-name: breakpoint,
133
+ $convert: false) == $breakpoint {
134
+ $_return: $heading-list;
135
+ }
136
+ }
137
+ } @else {
138
+ $_return: nth($heading, 1);
139
+ }
140
+ @return $_return;
141
+ }