piecss 0.1.0.alpha.01

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +7 -0
  3. data/lib/piecss.rb +6 -0
  4. data/sass/piecss/behavior.scss +11 -0
  5. data/sass/piecss/behavior/anchor.scss +30 -0
  6. data/sass/piecss/behavior/base.scss +4 -0
  7. data/sass/piecss/behavior/base/normalize.scss +458 -0
  8. data/sass/piecss/behavior/base/preset.scss +57 -0
  9. data/sass/piecss/behavior/form.scss +120 -0
  10. data/sass/piecss/behavior/grid.scss +4 -0
  11. data/sass/piecss/behavior/grid/layout.scss +170 -0
  12. data/sass/piecss/behavior/grid/rhythm.scss +54 -0
  13. data/sass/piecss/behavior/list.scss +189 -0
  14. data/sass/piecss/settings.scss +18 -0
  15. data/sass/piecss/settings/base.scss +177 -0
  16. data/sass/piecss/settings/breakpoint.scss +32 -0
  17. data/sass/piecss/settings/constants.scss +147 -0
  18. data/sass/piecss/settings/fonts.scss +31 -0
  19. data/sass/piecss/settings/fonts/_asap.scss +44 -0
  20. data/sass/piecss/settings/fonts/_bree-serif.scss +23 -0
  21. data/sass/piecss/settings/fonts/_example.scss +43 -0
  22. data/sass/piecss/settings/fonts/_lato.scss +32 -0
  23. data/sass/piecss/settings/fonts/_monospace.scss +39 -0
  24. data/sass/piecss/settings/fonts/_pt-sans.scss +40 -0
  25. data/sass/piecss/settings/fonts/_raleway.scss +31 -0
  26. data/sass/piecss/settings/fonts/_righteous.scss +23 -0
  27. data/sass/piecss/settings/fonts/_roboto.scss +34 -0
  28. data/sass/piecss/settings/fonts/_sans-serif.scss +39 -0
  29. data/sass/piecss/settings/fonts/_serif.scss +39 -0
  30. data/sass/piecss/settings/fonts/_sofia-pro.scss +40 -0
  31. data/sass/piecss/settings/fonts/_varela-round.scss +24 -0
  32. data/sass/piecss/settings/fonts/_verdana.scss +40 -0
  33. data/sass/piecss/settings/fonts/icon-fonts/_fontawesome.scss +33 -0
  34. data/sass/piecss/settings/fonts/icon-fonts/_foundation-accessability.scss +75 -0
  35. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_bootstrap.scss +84 -0
  36. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_core.scss +129 -0
  37. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_extras.scss +93 -0
  38. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_icons.scss +381 -0
  39. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_mixins.scss +48 -0
  40. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_path.scss +14 -0
  41. data/sass/piecss/settings/fonts/icon-fonts/fontawesome/_variables.scss +734 -0
  42. data/sass/piecss/settings/fonts/icon-fonts/foundation-accessability/_settings.scss +28 -0
  43. data/sass/piecss/settings/form.scss +664 -0
  44. data/sass/piecss/settings/grid.scss +157 -0
  45. data/sass/piecss/settings/list.scss +216 -0
  46. data/sass/piecss/utilities.scss +16 -0
  47. data/sass/piecss/utilities/README.md +105 -0
  48. data/sass/piecss/utilities/breakpoint.scss +46 -0
  49. data/sass/piecss/utilities/cache.scss +74 -0
  50. data/sass/piecss/utilities/elements.scss +182 -0
  51. data/sass/piecss/utilities/image.scss +58 -0
  52. data/sass/piecss/utilities/layout.scss +367 -0
  53. data/sass/piecss/utilities/list.scss +26 -0
  54. data/sass/piecss/utilities/miscellaneous.scss +260 -0
  55. data/sass/piecss/utilities/rhythm.scss +173 -0
  56. data/sass/piecss/utilities/sides.scss +376 -0
  57. data/sass/piecss/utilities/typography.scss +295 -0
  58. data/sass/piecss/utilities/units.scss +166 -0
  59. data/templates/project/_settings.scss +24 -0
  60. data/templates/project/examples.html +224 -0
  61. data/templates/project/manifest.rb +13 -0
  62. data/templates/project/screen.scss +96 -0
  63. metadata +133 -0
@@ -0,0 +1,376 @@
1
+ // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
+
3
+
4
+ // Content
5
+ // 1. Functions
6
+ // value-map
7
+ // 2. Mixins
8
+ // padding
9
+ // padding-top
10
+ // padding-right
11
+ // padding-bottom
12
+ // padding-left
13
+ // margin
14
+ // margin-top
15
+ // margin-right
16
+ // margin-bottom
17
+ // margin-left
18
+ // -unit-sides
19
+ // -sides
20
+
21
+
22
+ // 1. FUNCTIONS
23
+
24
+
25
+ /**
26
+ * Takes a list of values and returns a spacing map
27
+ *
28
+ * @since 0.1
29
+ *
30
+ * @param {*} $sides - A list of value arguments like CSS's normal padding (0 0 0 0)
31
+ * @param {String} $property (padding) - The property to which the values should be applied
32
+ */
33
+
34
+ @function value-map($sides, $property: padding)
35
+ {
36
+ // SASS appends a comma to the $sides list,
37
+ // don't know how to get around this but list the values
38
+ $sides: nth($sides,1);
39
+
40
+ @if is-value-map($sides) {
41
+ @return $sides;
42
+ }
43
+
44
+ // Create map to hold our spacing values;
45
+ $spacing: ();
46
+
47
+ @if $property==padding or $property==margin {
48
+ $length: length($sides);
49
+ @if $length==1 {
50
+ $spacing: (top:$sides,right:$sides,bottom:$sides,left:$sides);
51
+ }
52
+ @elseif $length==2 {
53
+ $spacing: (top:nth($sides,1),right:nth($sides,2),bottom:nth($sides,1),left:nth($sides,2));
54
+ }
55
+ @elseif $length==3 {
56
+ $spacing: (top:nth($sides,1),right:nth($sides,2),bottom:nth($sides,3),left:nth($sides,2));
57
+ }
58
+ @else {
59
+ $spacing: (top:nth($sides,1),right:nth($sides,2),bottom:nth($sides,3),left:nth($sides,4));
60
+ }
61
+ }
62
+
63
+ @elseif str-index($property, top) {
64
+ $spacing: (top: $sides);
65
+ }
66
+
67
+ @elseif str-index($property, right) {
68
+ $spacing: (right: $sides);
69
+ }
70
+
71
+ @elseif str-index($property, bottom) {
72
+ $spacing: (bottom: $sides);
73
+ }
74
+
75
+ @elseif str-index($property, left) {
76
+ $spacing: (left: $sides);
77
+ }
78
+
79
+ @return $spacing;
80
+ }
81
+
82
+ /**
83
+ * Checks if a Map is a proper value-map (side:value).
84
+ *
85
+ * @since 0.1
86
+ *
87
+ * @param {Map} - A value map
88
+ *
89
+ * @return {Bool}
90
+ */
91
+
92
+ @function is-value-map($values)
93
+ {
94
+ // Inspect the $sides array, is it alreay a spacing map?
95
+ $is-map: false;
96
+ @if map-has-key($values, top)==true {
97
+ $is-map: true;
98
+ }
99
+ @elseif map-has-key($values, right)==true {
100
+ $is-map: true;
101
+ }
102
+ @elseif map-has-key($values, bottom)==true {
103
+ $is-map: true;
104
+ }
105
+ @elseif map-has-key($values, left)==true {
106
+ $is-map: true;
107
+ }
108
+
109
+ @return $is-map;
110
+ }
111
+
112
+
113
+ // 2. MIXINS
114
+
115
+
116
+ /**
117
+ * Mixin padding for any or all sides, in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
118
+ *
119
+ * @since 0.1
120
+ *
121
+ * @param {Map} $sides - A spacing map in px (top:0,right:0,bottom:0,left:0)
122
+ */
123
+
124
+ @mixin padding($sides...)
125
+ {
126
+ $sides: value-map($sides, padding);
127
+ @include -unit-sides($sides, padding);
128
+ }
129
+ /**
130
+ * Mixin top padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
131
+ *
132
+ * @since 0.1
133
+ *
134
+ * @param {Number} $value - A value in px
135
+ */
136
+
137
+ @mixin padding-top($value)
138
+ {
139
+ $sides: value-map($value, padding-top);
140
+ @include -unit-sides($sides, padding);
141
+ }
142
+
143
+ /**
144
+ * Mixin right padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
145
+ *
146
+ * @since 0.1
147
+ *
148
+ * @param {Number} $value - A value in px
149
+ */
150
+
151
+ @mixin padding-right($value)
152
+ {
153
+ $sides: value-map($value, padding-right);
154
+ @include -unit-sides($sides, padding);
155
+ }
156
+
157
+ /**
158
+ * Mixin bottom padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
159
+ *
160
+ * @since 0.1
161
+ *
162
+ * @param {Number} $value - A value in px
163
+ */
164
+
165
+ @mixin padding-bottom($value)
166
+ {
167
+ $sides: value-map($value, padding-bottom);
168
+ @include -unit-sides($sides, padding);
169
+ }
170
+
171
+ /**
172
+ * Mixin left padding in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
173
+ *
174
+ * @since 0.1
175
+ *
176
+ * @param {Number} $value - A value in px
177
+ */
178
+
179
+ @mixin padding-left($value)
180
+ {
181
+ $sides: value-map($value, padding-left);
182
+ @include -unit-sides($sides, padding);
183
+ }
184
+
185
+
186
+ /**
187
+ * Mixin margin for any or all sides, in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
188
+ *
189
+ * @since 0.1
190
+ *
191
+ * @param {Map} $sides - A spacing map in px (top:0,right:0,bottom:0,left:0)
192
+ */
193
+
194
+ @mixin margin($sides...)
195
+ {
196
+ $sides: value-map($sides, margin);
197
+ @include -unit-sides($sides, margin);
198
+ }
199
+ /**
200
+ * Mixin top margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
201
+ *
202
+ * @since 0.1
203
+ *
204
+ * @param {Number} $value - A value in px
205
+ */
206
+
207
+ @mixin margin-top($value)
208
+ {
209
+ $sides: value-map($value, margin-top);
210
+ @include -unit-sides($sides, margin);
211
+ }
212
+
213
+ /**
214
+ * Mixin right margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
215
+ *
216
+ * @since 0.1
217
+ *
218
+ * @param {Number} $value - A value in px
219
+ */
220
+
221
+ @mixin margin-right($value)
222
+ {
223
+ $sides: value-map($value, margin-right);
224
+ @include -unit-sides($sides, margin);
225
+ }
226
+
227
+ /**
228
+ * Mixin bottom margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
229
+ *
230
+ * @since 0.1
231
+ *
232
+ * @param {Number} $value - A value in px
233
+ */
234
+
235
+ @mixin margin-bottom($value)
236
+ {
237
+ $sides: value-map($value, margin-bottom);
238
+ @include -unit-sides($sides, margin);
239
+ }
240
+
241
+ /**
242
+ * Mixin right margin in final unit (defaults to em). The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used. With rem fallback if the final unit of output is rem.
243
+ *
244
+ * @since 0.1
245
+ *
246
+ * @param {Number} $value - A value in px
247
+ */
248
+
249
+ @mixin margin-left($value)
250
+ {
251
+ $sides: value-map($value, margin-left);
252
+ @include -unit-sides($sides, margin);
253
+ }
254
+
255
+ /**
256
+ * Like [-sides](./#mixin--sides), but with rem fallback if the final unit is rem
257
+ *
258
+ * @access private
259
+ *
260
+ * @since 0.1
261
+ *
262
+ * @param {Map} $sides - A spacing map in final values (top:0,right:0,bottom:0,left:0)
263
+ * @param {String} $property - The property to apply the values to (padding, margin)
264
+ */
265
+
266
+ @mixin -unit-sides($sides, $property: padding)
267
+ {
268
+ // Convert the values into the final unit of output
269
+ $unit-values: ();
270
+ $fallback-values: ();
271
+
272
+ $keys: map-keys($sides);
273
+ @each $side in $keys {
274
+
275
+ // Isolate the value
276
+ $value: nth(map-get($sides, $side), 1);
277
+
278
+ // Catch 0 values
279
+ @if strip-unit($value)==0 {
280
+ $value: 0px;
281
+ }
282
+ // Catch rhythm values
283
+ @if unitless($value) {
284
+ @if $side==top or $side==bottom {
285
+ $value: vrhythm($value);
286
+ }
287
+ @if $side==right or $side==left {
288
+ $value: hrhythm($value);
289
+ }
290
+ }
291
+
292
+ // Create new maps
293
+ @if unit($unit)==rem {
294
+ $fallback-values: map-merge($fallback-values, ($side: to-unit($value, $fallback-values)) );
295
+ }
296
+ $unit-values: map-merge($unit-values, ($side: to-unit($value)) )
297
+ }
298
+
299
+
300
+ // Now, render the property and include rem fallback if needed
301
+ @if unit($unit)==rem {
302
+ @include -sides($fallback-values, $property);
303
+ }
304
+ @include -sides($unit-values, $property);
305
+ }
306
+
307
+
308
+ /**
309
+ * Mixin the value for any or all sides for padding or margin. The mixin will determine if the shorthand notation, or a single side (...-top, ...-right, ...-bottom, --left) should be used.
310
+ *
311
+ * @access private
312
+ *
313
+ * @since 0.1
314
+ *
315
+ * @param {Map} $sides - A spacing map in final values (top:0,right:0,bottom:0,left:0)
316
+ * @param {String} $property - The property to apply the values to (padding, margin)
317
+ */
318
+
319
+ @mixin -sides($sides, $property: padding)
320
+ {
321
+ // Initialize some variables
322
+ $top: '';
323
+ $right: '';
324
+ $bottom: '';
325
+ $left: '';
326
+
327
+ @if map-has-key($sides, top) {
328
+ $top: map-get($sides, top);
329
+ $top: if(abs($top)==0, 0, $top);
330
+ }
331
+
332
+ @if map-has-key($sides, right) {
333
+ $right: map-get($sides, right);
334
+ $right: if(abs($right)==0, 0, $right);
335
+ }
336
+
337
+ @if map-has-key($sides, bottom) {
338
+ $bottom: map-get($sides, bottom);
339
+ $bottom: if(abs($bottom)==0, 0, $bottom);
340
+ }
341
+
342
+ @if map-has-key($sides, left) {
343
+ $left: map-get($sides, left);
344
+ $left: if(abs($left)==0, 0, $left);
345
+ }
346
+
347
+ @if length($sides)==4 {
348
+
349
+ @if ($top==$bottom and $right==$left and $top==$right) {
350
+ #{$property}: #{$top};
351
+ }
352
+ @elseif ($top==$bottom and $right==$left) {
353
+ #{$property}: #{$top} #{$right};
354
+ }
355
+ @else {
356
+ #{$property}: #{$top} #{$right} #{$bottom} #{$left};
357
+ }
358
+
359
+ }
360
+ @else {
361
+
362
+ @if $top {
363
+ #{$property}-top: #{$top};
364
+ }
365
+ @if $right {
366
+ #{$property}-right: #{$right};
367
+ }
368
+ @if $bottom {
369
+ #{$property}-bottom: #{$bottom};
370
+ }
371
+ @if $left {
372
+ #{$property}-left: #{$left};
373
+ }
374
+
375
+ }
376
+ }
@@ -0,0 +1,295 @@
1
+ // Copyright (C) 2014 Babs Gösgens. Licensed under MIT; see LICENSE.txt
2
+
3
+
4
+ // Content
5
+ // 1. functions:
6
+ // extract-type-style
7
+ // extract-type-variant
8
+ // extract-type-weight
9
+ // extract-type-family
10
+ // font-size
11
+ // line-height
12
+ // weight-number-to-string
13
+ // 2. mixins:
14
+ // font
15
+ // font-style
16
+ // font-variant
17
+ // font-weight
18
+ // font-family
19
+ // font-size
20
+ // line-height
21
+
22
+
23
+ // 1. FUNCTIONS
24
+
25
+
26
+ /**
27
+ * Extract the style property from a type array
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @todo parameter should either be a space separated list, or property map
32
+ *
33
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
34
+ *
35
+ * @return {String} - font-type property
36
+ */
37
+
38
+ @function extract-type-style($type) {
39
+ @return nth($type, 1);
40
+ }
41
+
42
+
43
+ /**
44
+ * Extract the variant property from a type array
45
+ *
46
+ * @since 0.1
47
+ *
48
+ * @todo parameter should either be a space separated list, or property map
49
+ *
50
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
51
+ *
52
+ * @return {String} - font-variant property
53
+ */
54
+
55
+ @function extract-type-variant($type)
56
+ {
57
+ @return nth($type, 2);
58
+ }
59
+
60
+
61
+ /**
62
+ * Extract the weight property from a type array
63
+ *
64
+ * @since 0.1
65
+ *
66
+ * @todo parameter should either be a space separated list, or property map
67
+ *
68
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
69
+ *
70
+ * @return {String} - font-weight property
71
+ */
72
+
73
+ @function extract-type-weight($type)
74
+ {
75
+ @return nth($type, 3);
76
+ }
77
+
78
+
79
+ /**
80
+ * Extract the family property from a type array
81
+ *
82
+ * @since 0.1
83
+ *
84
+ * @todo parameter should either be a space separated list, or property map
85
+ *
86
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
87
+ *
88
+ * @return {String} - font-family property
89
+ */
90
+
91
+ @function extract-type-family($type)
92
+ {
93
+ @return nth($type, 4);
94
+ }
95
+
96
+
97
+ /**
98
+ * @alias to-unit
99
+ * @deprecated
100
+ */
101
+
102
+ @function font-size($target-px, $unit: $unit, $context: $default-font-size)
103
+ {
104
+ @return to-unit($target-px, $unit, $context);
105
+ }
106
+
107
+
108
+ /**
109
+ * Find the optimal line-height for a given font-size.
110
+ * If the specified span is too small for the font-size, find the next best one based on the specified increment.
111
+ *
112
+ * @since 0.1
113
+ *
114
+ * @param {Number} $font-size - the font-size in px
115
+ * @param {Number} $span (1) - the desired line-height in rhythm-units, 1 equals 1 $rhythm
116
+ * @param {Number} $increment (1) - the increment in rhythm-units
117
+ *
118
+ * @return {Number} - line-height in px
119
+ */
120
+
121
+ @function line-height($font-size: $default-font-size, $span: 1, $increment: 1)
122
+ {
123
+ $line-height: $span * $rhythm;
124
+
125
+ @if $font-size >= $line-height {
126
+ // call line-height again, but increase span with increment
127
+ @return line-height($font-size, $span + $increment, $increment);
128
+ }
129
+
130
+ @return $line-height;
131
+ }
132
+
133
+
134
+ /**
135
+ * Returns the correct typographic weight corresponding to the weight number
136
+ *
137
+ * @since 0.1
138
+ *
139
+ * @throws Not a valid weight
140
+ *
141
+ * @param {Number} $weight (400) - a valid weight number: 100 | ... | 900
142
+ *
143
+ * @return {String} - weight, defaults to 'regular'
144
+ */
145
+
146
+ @function weight-number-to-string($weight: regular)
147
+ {
148
+ @if $weight == 100 { @return "ultra-light"; }
149
+ @if $weight == 200 { @return "light"; }
150
+ @if $weight == 300 { @return "book"; }
151
+ @if $weight == 400 { @return "regular"; }
152
+ @if $weight == 500 { @return "medium"; }
153
+ @if $weight == 600 { @return "semi-bold"; }
154
+ @if $weight == 700 { @return "bold"; }
155
+ @if $weight == 800 { @return "extra-bold"; }
156
+ @if $weight == 900 { @return "heavy"; }
157
+ @else {
158
+ @warn "Not a valid weight";
159
+ @return false;
160
+ }
161
+ }
162
+
163
+
164
+ // 2. MIXINS
165
+
166
+
167
+ /**
168
+ * Mixes in the shorthand font tag. This is the only mixin that takes the font-size and line-height in their final unit of output.
169
+ * More info: [$default-font-size](./#variable-default-font-size), [$default-line-height](./#variable-default-line-height)
170
+ *
171
+ * @since 0.1
172
+ *
173
+ * @todo Accept properties in the same way as the default CSS font implementation
174
+ *
175
+ * @param {List | Bool} $type - a valid type array ($style, $variant, $weight, $family) or false to only output font-size and line-height
176
+ * @param {Number} $font-size ($default-font-size) - font-size in the final unit of output
177
+ * @param {Number} $line-height ($default-line-height) - line-height in the final unit of output
178
+ */
179
+
180
+ @mixin font($type, $font-size:$default-font-size, $line-height:$default-line-height)
181
+ {
182
+ @if unit($unit)==rem {
183
+ @include font-size($font-size, 1px);
184
+ }
185
+
186
+ @if $type {
187
+ $font-style : extract-type-style($type);
188
+ $font-variant : extract-type-variant($type);
189
+ $font-weight : extract-type-weight($type);
190
+ $font-family : extract-type-family($type);
191
+
192
+ font: #{$font-style} #{$font-variant} #{$font-weight} #{$font-size}/#{$line-height} #{$font-family};
193
+ }
194
+ @else {
195
+ font: #{$font-size}/#{$line-height};
196
+ }
197
+ }
198
+
199
+
200
+ /**
201
+ * Extracts the style from a type array and mixes in font-style
202
+ *
203
+ * @since 0.1
204
+ *
205
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
206
+ */
207
+
208
+ @mixin font-style($type)
209
+ {
210
+ font-style: extract-type-style($type);
211
+ }
212
+
213
+
214
+ /**
215
+ * Extracts the variant from a type array and mixes in font-variant
216
+ *
217
+ * @since 0.1
218
+ *
219
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
220
+ */
221
+
222
+ @mixin font-variant($type)
223
+ {
224
+ font-variant: extract-type-variant($type);
225
+ }
226
+
227
+
228
+ /**
229
+ * Extracts the weight from a type array and mixes in font-weight
230
+ *
231
+ * @since 0.1
232
+ *
233
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
234
+ */
235
+
236
+ @mixin font-weight($type)
237
+ {
238
+ font-weight: extract-type-weight($type);
239
+ }
240
+
241
+
242
+ /**
243
+ * Extracts the family from a type array and mixes in font-family
244
+ *
245
+ * @since 0.1
246
+ *
247
+ * @param {List} $type: a valid type list ($style, $variant, $weight, $family)
248
+ */
249
+
250
+ @mixin font-family($type)
251
+ {
252
+ font-family: extract-type-family($type);
253
+ }
254
+
255
+
256
+ /**
257
+ * Takes a size in px and calculates it back to the final font-unit. Provides fallback if the final output is in rem.
258
+ *
259
+ * @since 0.1
260
+ *
261
+ * @param {Number} $target-px - The font-size in px
262
+ * @param {Number} $unit ($unit) - The final unit to which $target-px is converted, e.g.px | rem | em | %
263
+ * @param {Number} $context ($default-font-size) - The context of the targeted element, for calculations to em or %
264
+ */
265
+
266
+ @mixin font-size($target-px, $unit: $unit, $context: $default-font-size)
267
+ {
268
+ @if unit($unit) == rem {
269
+ font-size: $target-px;
270
+ }
271
+ font-size: to-unit($target-px, $unit, $context);
272
+ }
273
+
274
+ /**
275
+ * Takes the font-size as an argument and calculates the best possible line-height for it.
276
+ * If the $line-height-unit equals to 1%, it is used to calculate the line-height instead.
277
+ * More info: [$default-font-size](./#variable-default-font-size), [$line-height-unit](./#variable-line-height-unit)
278
+ *
279
+ * @since 0.1
280
+ *
281
+ * @param {Number} $span - The number of rhythm-units - whole or fraction - to span
282
+ * @param {Value} $context ($default-font-size) - The font-size context
283
+ * @param {Number} $unit ($line-height-unit) - The final unit to which $target-px is converted, e.g.px | rem | em | %
284
+ */
285
+
286
+ @mixin line-height($span, $context: $default-font-size, $line-height-unit: $line-height-unit)
287
+ {
288
+
289
+ @if unit($line-height-unit) == "%" {
290
+ line-height: $span * $default-line-height / $context * 100%;
291
+ }
292
+ @else {
293
+ @include vrhythm($span, 'line-height', $context);
294
+ }
295
+ }