typey 1.0.0.beta.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +144 -36
- data/stylesheets/_typey.scss +4 -3
- data/stylesheets/typey/_defaults.scss +80 -1
- data/stylesheets/typey/_font-stacks.scss +3 -10
- data/stylesheets/typey/functions/_depreciated.scss +4 -4
- data/stylesheets/typey/functions/_extras.scss +2 -2
- data/stylesheets/typey/functions/_helpers.scss +6 -0
- data/stylesheets/typey/functions/_sizers.scss +10 -36
- data/stylesheets/typey/functions/_validators.scss +9 -4
- data/stylesheets/typey/mixins/_line-height.scss +0 -2
- data/stylesheets/typey/mixins/_spacing.scss +89 -0
- data/stylesheets/typey/mixins/_type-layout.scss +4 -44
- data/stylesheets/typey/mixins/_typeface.scss +79 -0
- data/stylesheets/typey/mixins/_typeset.scss +73 -0
- data/typey.gemspec +2 -2
- metadata +8 -7
- data/stylesheets/typey/mixins/_margin.scss +0 -146
- data/stylesheets/typey/mixins/_padding.scss +0 -146
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aaaa94b9fc5bbb1ba9535d3fc643a979df870cd
|
4
|
+
data.tar.gz: 5d1be72fbb224ccdc14ce915720a1fe1318ecab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874b0b8be17298ed1dbb640b88f97fc5a5b8270caafc0b1755781ed7cd258f5c4cf7b4d640eaa5f5c4f4a8073dcf0f0847ef725daff5e8dff3cb90ec325148c4
|
7
|
+
data.tar.gz: 4aed9114b169470077708e511c6a523d782090f9ee28643fe284ba27fabd5ad2506c1c075d042f7e3c213445c91f543c18874618703017cdb396400643aa7c9d
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ makes for leaner and cleaner code.
|
|
38
38
|
|
39
39
|
### Decide how you want typey to output
|
40
40
|
|
41
|
-
|
41
|
+
First you'll need to choose the unit typey outputs your values in. You have three
|
42
42
|
choices: `rem`, `em`, or `px`. Each has it's own pros and cons. We don't quite
|
43
43
|
have enough space here to go over them so do your research before you jump in.
|
44
44
|
Generally speaking, it is actually quite easy to change this value in typey later on.
|
@@ -47,7 +47,7 @@ Generally speaking, it is actually quite easy to change this value in typey late
|
|
47
47
|
$base-unit: rem;
|
48
48
|
```
|
49
49
|
|
50
|
-
|
50
|
+
Now we define our base font size and line height.
|
51
51
|
|
52
52
|
```sass
|
53
53
|
$base-font-size: 16px;
|
@@ -58,8 +58,8 @@ Ok, so we have our base sizing, now we need to choose the approach that we are g
|
|
58
58
|
to layout type with. We have two options available to us: `rhythm` and `ratio`. Rhythm
|
59
59
|
allows us to specify line-heights as a multiple of $base-line-height, where as ratio
|
60
60
|
allows us to specify line-heights as a multiple of our elements font-size. Rhythm is
|
61
|
-
the default, but for
|
62
|
-
is to use ratio.
|
61
|
+
the default, but for many people working with web typography the simplest approach
|
62
|
+
is to use ratio.
|
63
63
|
|
64
64
|
```sass
|
65
65
|
$line-height-method: rhythm;
|
@@ -85,7 +85,10 @@ $print-font-size: 12pt;
|
|
85
85
|
|
86
86
|
Ok on to the fun stuff. Defining font sizes! You should define as many of your
|
87
87
|
font-sizes as possible inside the `$font-size` map with t-shirt sizes (which are
|
88
|
-
easier to keep track of than individual values).
|
88
|
+
easier to keep track of than individual values). You can have as many as you like
|
89
|
+
and they can be any size you like. Use values taken from a design or roll your
|
90
|
+
own using a modular scale. T-shirt sizes are best practice here but you can use
|
91
|
+
any naming scheme you like.
|
89
92
|
|
90
93
|
```sass
|
91
94
|
$font-size: (
|
@@ -97,7 +100,7 @@ $font-size: (
|
|
97
100
|
```
|
98
101
|
|
99
102
|
Now we are all set, we need to define our defaults for the `html` element. We can
|
100
|
-
do this
|
103
|
+
do this easily:
|
101
104
|
|
102
105
|
```sass
|
103
106
|
html {
|
@@ -105,46 +108,160 @@ html {
|
|
105
108
|
}
|
106
109
|
```
|
107
110
|
|
108
|
-
##
|
111
|
+
## Define typefaces. New in typey 1.0
|
109
112
|
|
110
|
-
|
113
|
+
Defining typefaces helps us keep track of a few common properties a typeface is
|
114
|
+
likely to need, ensuring they are all used together where ever the font is used
|
115
|
+
in our stylesheets.
|
111
116
|
|
112
|
-
|
113
|
-
setting it's line-height to be 2x the $base-line-height.
|
117
|
+
First you need to define the font families you are going to use as variables.
|
114
118
|
|
115
119
|
```sass
|
116
|
-
|
117
|
-
|
120
|
+
$helvetica: Helvetica, sans-serif;
|
121
|
+
$garamond: Garamond, serif;
|
122
|
+
$monaco: Monaco, monospace, monospace;
|
123
|
+
```
|
124
|
+
|
125
|
+
Now you can define the $typefaces map. It accepts keyed values and lets you set
|
126
|
+
a font-family, letter-spacing, weight and case. It also uses shorthand and it
|
127
|
+
does not matter what order you list properties in when using shorthand but best
|
128
|
+
practice is [font-family] [letter-spacing] [weight] [case]. You may not want to
|
129
|
+
set these all globally, so font-family is the only required value.
|
130
|
+
|
131
|
+
```sass
|
132
|
+
$typefaces: (
|
133
|
+
sans-serif: (
|
134
|
+
font-family: $helvetica,
|
135
|
+
letter-spacing: -.5px,
|
136
|
+
),
|
137
|
+
serif: $garamond,
|
138
|
+
monospace: (
|
139
|
+
font-family: $monaco,
|
140
|
+
letter-spacing: .5px,
|
141
|
+
weight: bold,
|
142
|
+
case: uppercase,
|
143
|
+
)
|
144
|
+
);
|
145
|
+
```
|
146
|
+
|
147
|
+
Keep in mind the value for weight, is actually a key in the font-size map. By
|
148
|
+
default typey defines these with bold, normal and lighter, but if you need your
|
149
|
+
own weights, define the `$font-weight` map yourself.
|
150
|
+
|
151
|
+
Embedding a typeface is now really straightforward. You can sleep safe knowing
|
152
|
+
that all important defaults for your font have been included where ever the
|
153
|
+
typeface has been.
|
154
|
+
|
155
|
+
```sass
|
156
|
+
h1, h2, h3 {
|
157
|
+
@include typeface(helvetica);
|
118
158
|
}
|
119
159
|
```
|
120
160
|
|
121
|
-
|
161
|
+
## Advanced typesetting. New in typey 1.0
|
122
162
|
|
123
|
-
|
124
|
-
|
163
|
+
You can now define all your font-sizes and line-heights (amongst other things) together
|
164
|
+
in a lovely, easy to read (and re-call) map.
|
165
|
+
|
166
|
+
```sass
|
167
|
+
$typestyles: (
|
168
|
+
heading-1: (
|
169
|
+
font-size: xl,
|
170
|
+
line-height: 1.25,
|
171
|
+
weight: bold,
|
172
|
+
case: uppercase
|
173
|
+
),
|
174
|
+
heading-2: (
|
175
|
+
font-size: l,
|
176
|
+
line-height: 1.25,
|
177
|
+
weight: normal
|
178
|
+
)
|
179
|
+
)
|
180
|
+
```
|
181
|
+
|
182
|
+
Or you can use the even easier to express shorthand.
|
183
|
+
|
184
|
+
```sass
|
185
|
+
$typestyles: (
|
186
|
+
heading-1: xl 1.25 bold uppercase,
|
187
|
+
heading-2: l 1.25 normal
|
188
|
+
)
|
189
|
+
```
|
190
|
+
|
191
|
+
The shorthand is very forgiving. It only requires that the first value be a
|
192
|
+
font-size. After that you can enter any combination of line-height, font-weight,
|
193
|
+
and case (in any order and all properties are optional). You can also use a
|
194
|
+
combination of shorthand and keyed maps if you like!
|
195
|
+
|
196
|
+
The value for weight, is also a key from the `$font-weight` map.
|
197
|
+
|
198
|
+
To take a defined typestyle and then apply that to an element, all you need do
|
199
|
+
is:
|
125
200
|
|
126
201
|
```sass
|
127
202
|
h1 {
|
128
|
-
@include
|
203
|
+
@include typeset(heading-1);
|
129
204
|
}
|
130
205
|
```
|
131
206
|
|
132
|
-
|
207
|
+
In the beta versions of typey, the `type-layout` mixin was used to accomplish
|
208
|
+
virtually the same thing. While you can still use this method fine the new
|
209
|
+
`typeset` mixin provides a much cleaner solution and will be expanded to support
|
210
|
+
things like responsive type in the future.
|
133
211
|
|
134
212
|
```sass
|
135
213
|
h1 {
|
136
|
-
@include type-layout(xl, 1.
|
214
|
+
@include type-layout(xl, 1.5);
|
137
215
|
}
|
138
216
|
```
|
139
217
|
|
218
|
+
### Using rhythm line-height
|
219
|
+
|
220
|
+
Using rhythm as the $line-height-method, you must make sure to set all line-height
|
221
|
+
values as multiples of $base-line-height. As so:
|
222
|
+
|
223
|
+
```sass
|
224
|
+
$typestyles: (
|
225
|
+
heading-1: (
|
226
|
+
font-size: xl,
|
227
|
+
line-height: 2
|
228
|
+
)
|
229
|
+
)
|
230
|
+
```
|
231
|
+
|
232
|
+
### Using ratio line-height
|
233
|
+
|
234
|
+
Using ratio as the $line-height-method, you must make sure to set all line-height
|
235
|
+
values as a ratio of the font-size. As so:
|
236
|
+
|
237
|
+
```sass
|
238
|
+
$typestyles: (
|
239
|
+
heading-1: (
|
240
|
+
font-size: xl,
|
241
|
+
line-height: 1.25
|
242
|
+
)
|
243
|
+
)
|
244
|
+
```
|
245
|
+
|
246
|
+
The advantage of ratio line-height is you can always skip out on adding a line-height
|
247
|
+
and just inherit the base ratio.
|
248
|
+
|
249
|
+
```sass
|
250
|
+
$typestyles: (
|
251
|
+
heading-1: (
|
252
|
+
font-size: xl
|
253
|
+
)
|
254
|
+
)
|
255
|
+
```
|
256
|
+
|
140
257
|
All ratios are outputted as unitless values instead of your base unit.
|
141
258
|
|
142
259
|
## Add some margins or padding
|
143
260
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
261
|
+
Typey always uses a vertical rhythm approach for margins and padding regardless
|
262
|
+
of whether you are using the ratio method. This way margins and padding will
|
263
|
+
always be consistent in your stylesheets. You can specify these using the various
|
264
|
+
margin and padding mixins.
|
148
265
|
|
149
266
|
```sass
|
150
267
|
div {
|
@@ -199,8 +316,8 @@ li {
|
|
199
316
|
}
|
200
317
|
```
|
201
318
|
|
202
|
-
All of typey's
|
203
|
-
the $font-size map.
|
319
|
+
All of typey's font-size, line-height, type-layout, margin and padding mixins
|
320
|
+
accept a px value instead of a multiple/ratio or key from the $font-size map.
|
204
321
|
|
205
322
|
## Really quite tricky stuff (em as the $base-unit)
|
206
323
|
|
@@ -224,17 +341,8 @@ h2 {
|
|
224
341
|
}
|
225
342
|
```
|
226
343
|
|
227
|
-
|
228
|
-
|
229
|
-
```sass
|
230
|
-
h2 {
|
231
|
-
@include type-layout(l, 2);
|
232
|
-
|
233
|
-
span {
|
234
|
-
@include type-layout(m, 2, l);
|
235
|
-
}
|
236
|
-
}
|
237
|
-
```
|
344
|
+
As you any nested element can have it's font-size changed, all of typeys sizing
|
345
|
+
mixins accept a context argument, including `typeset` and `type-layout`.
|
238
346
|
|
239
347
|
## Extras
|
240
348
|
|
@@ -286,7 +394,7 @@ h1 {
|
|
286
394
|
|
287
395
|
## More examples
|
288
396
|
|
289
|
-
Grab a copy of the source code
|
397
|
+
Grab a copy of the source code and look in the examples folder to see typey in action.
|
290
398
|
|
291
399
|
## Reference
|
292
400
|
|
data/stylesheets/_typey.scss
CHANGED
@@ -5,12 +5,13 @@
|
|
5
5
|
@import "typey/functions/sizers";
|
6
6
|
@import "typey/functions/extras";
|
7
7
|
@import "typey/functions/depreciated";
|
8
|
-
@import "typey/defaults";
|
9
8
|
@import "typey/font-stacks";
|
9
|
+
@import "typey/defaults";
|
10
10
|
@import "typey/mixins/debug";
|
11
11
|
@import "typey/mixins/define-type-sizing";
|
12
12
|
@import "typey/mixins/font-size";
|
13
13
|
@import "typey/mixins/line-height";
|
14
|
+
@import "typey/mixins/spacing";
|
15
|
+
@import "typey/mixins/typeface";
|
16
|
+
@import "typey/mixins/typeset";
|
14
17
|
@import "typey/mixins/type-layout";
|
15
|
-
@import "typey/mixins/margin";
|
16
|
-
@import "typey/mixins/padding";
|
@@ -58,6 +58,52 @@ $font-weight: (
|
|
58
58
|
lighter: 200
|
59
59
|
) !default;
|
60
60
|
|
61
|
+
// Declare typefaces
|
62
|
+
// These can use any key you like, and allow you to set global letter-spacing,
|
63
|
+
// weight and case for font-families. You can then use the
|
64
|
+
// font-family mixin to embed your font families anywhere you like.
|
65
|
+
//
|
66
|
+
// Each key in the $typefaces map can either be a keyed map of settings
|
67
|
+
// using any combination of the keys below, or it can be a shorthand list
|
68
|
+
// of each property value. When using shorthand it doesn't matter what order
|
69
|
+
// each value is arranged in, but best practice is to do it in the order:
|
70
|
+
// [font-family] [letter-spacing] [weight] [case]
|
71
|
+
//
|
72
|
+
// @setting list font-family
|
73
|
+
// Any standard CSS font-family. Use typey pre-written stacks or roll your own.
|
74
|
+
// @setting number letter-spacing
|
75
|
+
// CSS letter-spacing. Specified as a px value when font-size is the
|
76
|
+
// $base-font-size.
|
77
|
+
// @setting string weight
|
78
|
+
// A key from the $font-weight map. Only specify this if you want a consistant
|
79
|
+
// font-weight used accross the board with this typeface.
|
80
|
+
// @setting string case
|
81
|
+
// A value for CSS text-transform. Only specify this if you want a consistant
|
82
|
+
// case used accross the board with this typeface.
|
83
|
+
$typefaces: () !default;
|
84
|
+
|
85
|
+
// Declare typestyles
|
86
|
+
// These can use any key you like, and allow you to set an easily reusable type
|
87
|
+
// style. They can be as simple as a font-size and line-height, or can go on
|
88
|
+
// to encompass a full range of css type properties.
|
89
|
+
//
|
90
|
+
// Each key in the $typestyles map can either be a keyed map of settings
|
91
|
+
// using any combination of the keys below, or it can be a shorthand list
|
92
|
+
// of each property value. When using shorthand for $typestyles, the first value
|
93
|
+
// must always be font-size. After that it doesn't matter what order each value
|
94
|
+
// is arranged in, but best practice is to do it in the order:
|
95
|
+
// [font-size] [line-height] [weight] [case]
|
96
|
+
//
|
97
|
+
// @setting number|string font-size
|
98
|
+
// A size from the $font-size map or px value to be converted
|
99
|
+
// @setting number $x line-height
|
100
|
+
// Multiple of line height, ratio or px value to be converted.
|
101
|
+
// @setting string weight
|
102
|
+
// A key from the $font-weight map.
|
103
|
+
// @setting string case
|
104
|
+
// A value for CSS text-transform.
|
105
|
+
$typestyles: () !default;
|
106
|
+
|
61
107
|
// Debug grid
|
62
108
|
// Shows horizontal lines for each elements line height.
|
63
109
|
$typey-debug: false !default;
|
@@ -83,9 +129,42 @@ $typey-debug-color: #4affff !default;
|
|
83
129
|
@error "$print-font-size must be in pt";
|
84
130
|
}
|
85
131
|
|
86
|
-
// Warnings for $font-size
|
132
|
+
// Warnings for $font-size.
|
87
133
|
@each $key, $size in $font-size {
|
88
134
|
@if unit($size) != px {
|
89
135
|
@error "Size '#{$key}' in $font-size map is not specified in px";
|
90
136
|
}
|
91
137
|
}
|
138
|
+
|
139
|
+
// Warnings for $font-weight.
|
140
|
+
$typey-text-transform-properties: none capitalize uppercase lowercase initial inherit;
|
141
|
+
@each $property in $typey-text-transform-properties {
|
142
|
+
@if map-has-key($font-weight, $property) {
|
143
|
+
@warn "'#{$property}' used in $font-weight map is a potential value of the text-transform property and will conflict when using typey shorthand";
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
// Warnings for $typefaces.
|
148
|
+
@each $key, $typeface in $typefaces {
|
149
|
+
@if type-of($typeface) != "map" and type-of($typeface) != "list" {
|
150
|
+
@error "Typeface '#{$key}' in $typefaces map must be a keyed map or a shorthand list in the format: [font-family] [letter-spacing] [weight] [case]";
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
// Warnings for $typestyles.
|
155
|
+
@each $key, $typestyle in $typestyles {
|
156
|
+
@if type-of($typestyle) != "map" and type-of($typestyle) != "list" {
|
157
|
+
@error "Typestyle '#{$key}' in $typestyles map must be a keyed map or a shorthand list in the format: [font-size] [line-height] [weight] [case]";
|
158
|
+
}
|
159
|
+
@if type-of($typestyle) == "list" {
|
160
|
+
@each $value in $typestyle {
|
161
|
+
@if index($typestyle, $value) == 1 {
|
162
|
+
$allowed-types: "font-size", "px";
|
163
|
+
$type: typey-check-value($value);
|
164
|
+
@if index($allowed-types, $type) == null {
|
165
|
+
@error "Incorrect shorthand format used in '#{$key}' in $typestyles map: [font-size] must appear first";
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
@@ -1,11 +1,4 @@
|
|
1
1
|
// Three standard do-all stacks.
|
2
|
-
$serif-stack:
|
3
|
-
$sans-serif-stack: "Helvetica Neue", Helvetica,
|
4
|
-
$
|
5
|
-
|
6
|
-
// Specific font stacks.
|
7
|
-
$arial-stack: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
8
|
-
$helvetica-stack: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
9
|
-
$baskerville-stack: Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif;
|
10
|
-
$monaco-stack: Monaco, Consolas, "Lucida Console", monospace, monospace;
|
11
|
-
$trebuchet-ms-stack: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
|
2
|
+
$serif-stack: "Calisto MT", "Book Antiqua", serif !default;
|
3
|
+
$sans-serif-stack: "Helvetica Neue", Helvetica, sans-serif !default;
|
4
|
+
$monospace-stack: Consolas, "Lucida Console", monospace, monospace !default;
|
@@ -10,7 +10,7 @@
|
|
10
10
|
// @return string
|
11
11
|
// The selected font-weight.
|
12
12
|
@function output-unit($number) {
|
13
|
-
@warn "output-unit() is depreciated. Please use typey-output-in-base-unit() instead
|
13
|
+
@warn "output-unit() is depreciated. Please use typey-output-in-base-unit() instead";
|
14
14
|
@return typey-output-in-base-unit($number);
|
15
15
|
}
|
16
16
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
// @return number
|
23
23
|
// The number without the unit.
|
24
24
|
@function strip-unit($number) {
|
25
|
-
@warn "strip-unit() is depreciated. Please use typey-strip-unit() instead
|
25
|
+
@warn "strip-unit() is depreciated. Please use typey-strip-unit() instead";
|
26
26
|
@return typey-strip-unit($number);
|
27
27
|
}
|
28
28
|
|
@@ -38,7 +38,7 @@
|
|
38
38
|
// @return number
|
39
39
|
// The number converted to the base unit.
|
40
40
|
@function convert-unit($number, $context: $base-font-size) {
|
41
|
-
@warn "convert-unit() is depreciated. Please use output-from-px() instead
|
41
|
+
@warn "convert-unit() is depreciated. Please use output-from-px() instead";
|
42
42
|
@return output-from-px($number, $context);
|
43
43
|
}
|
44
44
|
|
@@ -50,6 +50,6 @@
|
|
50
50
|
// @return string
|
51
51
|
// The selected font-weight.
|
52
52
|
@function font-weight($weight) {
|
53
|
-
@warn "font-weight() is depreciated. Please use weight() instead
|
53
|
+
@warn "font-weight() is depreciated. Please use weight() instead";
|
54
54
|
@return weight($weight);
|
55
55
|
}
|
@@ -11,11 +11,11 @@
|
|
11
11
|
@return map-get($font-weight, $weight);
|
12
12
|
}
|
13
13
|
@else {
|
14
|
-
@error "'#{$weight}' not found in $font-weight map
|
14
|
+
@error "'#{$weight}' not found in $font-weight map";
|
15
15
|
}
|
16
16
|
}
|
17
17
|
@else {
|
18
|
-
@error "Weight specified for weight() is not a string
|
18
|
+
@error "Weight specified for weight() is not a string";
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
@@ -6,6 +6,9 @@
|
|
6
6
|
// @return number
|
7
7
|
// The number with the base unit
|
8
8
|
@function typey-output-in-base-unit($number) {
|
9
|
+
@if $number == 0 {
|
10
|
+
@return 0;
|
11
|
+
}
|
9
12
|
@if $base-unit == rem {
|
10
13
|
@return $number * 1rem;
|
11
14
|
}
|
@@ -27,6 +30,9 @@
|
|
27
30
|
// @return number
|
28
31
|
// The number with the base unit
|
29
32
|
@function typey-output-in-unit($number, $unit: $base-unit) {
|
33
|
+
@if $number == 0 {
|
34
|
+
@return 0;
|
35
|
+
}
|
30
36
|
@if $unit == rem {
|
31
37
|
@return $number * 1rem;
|
32
38
|
}
|
@@ -34,7 +34,7 @@
|
|
34
34
|
// line-height: line-height(1.5);
|
35
35
|
//
|
36
36
|
// @param number $x
|
37
|
-
// Multiple of line
|
37
|
+
// Multiple of $base-line-height to be used, px value to be converted, or ratio of
|
38
38
|
// font-size.
|
39
39
|
// @param number|string $context
|
40
40
|
// (optional) Only used if em is the $base-unit. The value of the
|
@@ -58,26 +58,26 @@
|
|
58
58
|
}
|
59
59
|
}
|
60
60
|
|
61
|
-
// Generate a value to be used as
|
61
|
+
// Generate a value to be used as some form of height or spacing from either:
|
62
62
|
// a) a multiple of $base-line-height
|
63
63
|
// b) a static px value
|
64
64
|
//
|
65
65
|
// Example usage with multiple:
|
66
|
-
//
|
66
|
+
// height: spacing(2);
|
67
67
|
// Example usage with static value:
|
68
|
-
//
|
68
|
+
// margin-bottom: spacing(18px);
|
69
69
|
//
|
70
70
|
// @param number $x
|
71
|
-
// Multiple of line
|
71
|
+
// Multiple of $base-line-height to be used or px value to be converted.
|
72
72
|
// @param number|string $context
|
73
73
|
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
74
74
|
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
75
75
|
// value in px.
|
76
76
|
//
|
77
77
|
// @return number
|
78
|
-
// The calculated
|
79
|
-
@function
|
80
|
-
$allowed-types: "multiplier", "px";
|
78
|
+
// The calculated spacing in $base-unit.
|
79
|
+
@function spacing($x, $context: $base-font-size) {
|
80
|
+
$allowed-types: "multiplier", "px", "auto";
|
81
81
|
$type: typey-validator($x, $allowed-types);
|
82
82
|
@if $type == "multiplier" {
|
83
83
|
@return output-from-multiplier($x, $context);
|
@@ -85,33 +85,7 @@
|
|
85
85
|
@if $type == "px" {
|
86
86
|
@return output-from-px($x, $context);
|
87
87
|
}
|
88
|
-
|
89
|
-
|
90
|
-
// Generate a value to be used as padding from either:
|
91
|
-
// a) a multiple of $base-line-height
|
92
|
-
// b) a static px value
|
93
|
-
//
|
94
|
-
// Example usage with multiple:
|
95
|
-
// line-height: line-height(2);
|
96
|
-
// Example usage with static value:
|
97
|
-
// line-height: line-height(18px);
|
98
|
-
//
|
99
|
-
// @param number $x
|
100
|
-
// Multiple of line height to be used or px value to be converted.
|
101
|
-
// @param number|string $context
|
102
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
103
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
104
|
-
// value in px.
|
105
|
-
//
|
106
|
-
// @return number
|
107
|
-
// The calculated height in $base-unit.
|
108
|
-
@function padding($x, $context: $base-font-size) {
|
109
|
-
$allowed-types: "multiplier", "px";
|
110
|
-
$type: typey-validator($x, $allowed-types);
|
111
|
-
@if $type == "multiplier" {
|
112
|
-
@return output-from-multiplier($x, $context);
|
113
|
-
}
|
114
|
-
@if $type == "px" {
|
115
|
-
@return output-from-px($x, $context);
|
88
|
+
@if $type == "auto" {
|
89
|
+
@return auto;
|
116
90
|
}
|
117
91
|
}
|
@@ -24,6 +24,9 @@
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
@if type-of($x) == "string" {
|
27
|
+
@if $x == "auto" {
|
28
|
+
@return "auto";
|
29
|
+
}
|
27
30
|
@if map-has-key($font-size, $x) {
|
28
31
|
@return "font-size";
|
29
32
|
}
|
@@ -34,13 +37,15 @@
|
|
34
37
|
@if type-of($x) == "list" {
|
35
38
|
@if list-separator($x) == space {
|
36
39
|
@each $value in $x {
|
37
|
-
@if type-of($value) == "number" {
|
38
|
-
@if
|
39
|
-
@
|
40
|
+
@if type-of($value) == "number" or $value == "auto" {
|
41
|
+
@if type-of($value) == "number" {
|
42
|
+
@if not unitless($value) and unit($value) != px {
|
43
|
+
@error "All units must be expressed in px";
|
44
|
+
}
|
40
45
|
}
|
41
46
|
}
|
42
47
|
@else {
|
43
|
-
@error "Values specified inside lists must be a number";
|
48
|
+
@error "Values specified inside lists must be a number or 'auto'";
|
44
49
|
}
|
45
50
|
}
|
46
51
|
@return "list";
|
@@ -0,0 +1,89 @@
|
|
1
|
+
// Define spacing (with fallbacks).
|
2
|
+
//
|
3
|
+
// @param string $type
|
4
|
+
// The type of spacing: margin, padding, margin-top, etc.
|
5
|
+
// @param number|list|string $spacing
|
6
|
+
// Multiple of $base-line-height to be used or px value to be converted.
|
7
|
+
// Can be a SASS list using the same parameters as the CSS margin property:
|
8
|
+
// i.e. top right bottom left, 1 0 2 0.
|
9
|
+
// Can also be the string "auto" when used as margin.
|
10
|
+
// @param number|string $context
|
11
|
+
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
12
|
+
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
13
|
+
// value in px.
|
14
|
+
@mixin spacing($property, $spacing, $context: $base-font-size) {
|
15
|
+
$allowed-types: "multiplier", "px", "list";
|
16
|
+
$type: typey-validator($spacing, $allowed-types);
|
17
|
+
|
18
|
+
$px-fallback-list: ();
|
19
|
+
$converted-list: ();
|
20
|
+
|
21
|
+
@each $x in $spacing {
|
22
|
+
@if $base-unit == rem {
|
23
|
+
$allowed-types: "multiplier", "px", "auto";
|
24
|
+
$type: typey-validator($x, $allowed-types);
|
25
|
+
@if $type == "multiplier" {
|
26
|
+
$spacing: $x * $base-line-height;
|
27
|
+
$px-fallback-list: join($px-fallback-list, $spacing, $separator: space);
|
28
|
+
}
|
29
|
+
@if $type == "px" {
|
30
|
+
$px-fallback-list: join($px-fallback-list, $x, $separator: space);
|
31
|
+
}
|
32
|
+
@if $type == "auto" {
|
33
|
+
$px-fallback-list: join($px-fallback-list, $x, $separator: space);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
$spacing: spacing($x, $context);
|
37
|
+
$converted-list: join($converted-list, $spacing, $separator: space);
|
38
|
+
}
|
39
|
+
|
40
|
+
@if $base-unit == rem {
|
41
|
+
@if $rem-fallback == true {
|
42
|
+
#{$property}: $px-fallback-list;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
#{$property}: $converted-list;
|
46
|
+
}
|
47
|
+
|
48
|
+
// Wrapper mixins for various spacing properties.
|
49
|
+
// These can be used to provide easily sized spacing in the base unit.
|
50
|
+
//
|
51
|
+
// @param number|list|string $x
|
52
|
+
// Multiple of $base-line-height to be used or px value to be converted.
|
53
|
+
// Can be a SASS list using the same parameters as the CSS margin property:
|
54
|
+
// i.e. top right bottom left, 1 0 2 0.
|
55
|
+
// Can also be the string "auto" when used as margin.
|
56
|
+
// @param number|string $context
|
57
|
+
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
58
|
+
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
59
|
+
// value in px.
|
60
|
+
@mixin margin($x, $context: $base-font-size) {
|
61
|
+
@include spacing(margin, $x, $context);
|
62
|
+
}
|
63
|
+
@mixin margin-top($x, $context: $base-font-size) {
|
64
|
+
@include spacing(margin-top, $x, $context);
|
65
|
+
}
|
66
|
+
@mixin margin-bottom($x, $context: $base-font-size) {
|
67
|
+
@include spacing(margin-bottom, $x, $context);
|
68
|
+
}
|
69
|
+
@mixin margin-left($x, $context: $base-font-size) {
|
70
|
+
@include spacing(margin-left, $x, $context);
|
71
|
+
}
|
72
|
+
@mixin margin-right($x, $context: $base-font-size) {
|
73
|
+
@include spacing(margin-right, $x, $context);
|
74
|
+
}
|
75
|
+
@mixin padding($x, $context: $base-font-size) {
|
76
|
+
@include spacing(padding, $x, $context);
|
77
|
+
}
|
78
|
+
@mixin padding-top($x, $context: $base-font-size) {
|
79
|
+
@include spacing(padding-top, $x, $context);
|
80
|
+
}
|
81
|
+
@mixin padding-bottom($x, $context: $base-font-size) {
|
82
|
+
@include spacing(padding-bottom, $x, $context);
|
83
|
+
}
|
84
|
+
@mixin padding-left($x, $context: $base-font-size) {
|
85
|
+
@include spacing(padding-left, $x, $context);
|
86
|
+
}
|
87
|
+
@mixin padding-right($x, $context: $base-font-size) {
|
88
|
+
@include spacing(padding-right, $x, $context);
|
89
|
+
}
|
@@ -8,48 +8,8 @@
|
|
8
8
|
// (optional) Only used if em is the $base-unit. The value of the
|
9
9
|
// elements/parents font-size if it differs from $base-font-size.
|
10
10
|
// Specified as a t-shirt size or value in px.
|
11
|
-
@mixin type-layout($size, $line-height
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
$allowed-types-lh: "multiplier", "px";
|
16
|
-
$type-lh: typey-validator($line-height, $allowed-types-lh);
|
17
|
-
|
18
|
-
@if $base-unit == rem {
|
19
|
-
@if $rem-fallback == true {
|
20
|
-
@if $type-size == "font-size" {
|
21
|
-
$map-size: map-get($font-size, $size);
|
22
|
-
font-size: $map-size;
|
23
|
-
}
|
24
|
-
@if $type-size == "px" {
|
25
|
-
font-size: $size;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
@if $rem-fallback {
|
29
|
-
@if $type-lh == "multiplier" and $line-height-method == "rhythm" {
|
30
|
-
line-height: $line-height * $base-line-height;
|
31
|
-
}
|
32
|
-
@if $type-lh == "px" {
|
33
|
-
line-height: $line-height;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
@if $base-unit == rem or $base-unit == px {
|
39
|
-
font-size: font-size($size);
|
40
|
-
line-height: line-height($line-height, $context);
|
41
|
-
}
|
42
|
-
|
43
|
-
@if $base-unit == em {
|
44
|
-
@if $size == $context {
|
45
|
-
font-size: font-size($size, $base-font-size);
|
46
|
-
line-height: line-height($line-height, $size);
|
47
|
-
}
|
48
|
-
@else {
|
49
|
-
font-size: font-size($size, $context);
|
50
|
-
line-height: line-height($line-height, $size);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
@include typey-debug-grid($line-height, $context);
|
11
|
+
@mixin type-layout($size, $line-height, $context: $base-font-size) {
|
12
|
+
@include font-size($size, $context);
|
13
|
+
@include line-height($line-height, $size);
|
14
|
+
@include typey-debug-grid($line-height, $size);
|
55
15
|
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// Embed a typeface.
|
2
|
+
//
|
3
|
+
// @param string $typeface
|
4
|
+
// A font family from the $typefaces map.
|
5
|
+
@mixin typeface($typeface) {
|
6
|
+
$typeface-name: $typeface;
|
7
|
+
$typeface: map-get($typefaces, $typeface);
|
8
|
+
|
9
|
+
$font-family: false;
|
10
|
+
$letter-spacing: false;
|
11
|
+
$weight: false;
|
12
|
+
$case: false;
|
13
|
+
|
14
|
+
// Assign values to variables when $typeface is a keyed map.
|
15
|
+
@if type-of($typeface) == "map" {
|
16
|
+
@if map-has-key($typeface, font-family) {
|
17
|
+
$font-family: map-get($typeface, font-family);
|
18
|
+
}
|
19
|
+
@if map-has-key($typeface, letter-spacing) {
|
20
|
+
$letter-spacing: map-get($typeface, letter-spacing);
|
21
|
+
}
|
22
|
+
@if map-has-key($typeface, weight) {
|
23
|
+
$weight: map-get($typeface, weight);
|
24
|
+
}
|
25
|
+
@if map-has-key($typeface, case) {
|
26
|
+
$case: map-get($typeface, case);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
// Assign values to variables when $typeface is shorthand.
|
31
|
+
@if type-of($typeface) == "list" {
|
32
|
+
@if (list-separator($typeface) == "comma") {
|
33
|
+
// This shorthand is just a list of fonts.
|
34
|
+
$font-family: $typeface;
|
35
|
+
}
|
36
|
+
@else {
|
37
|
+
@each $value in $typeface {
|
38
|
+
// This is a font-family.
|
39
|
+
@if type-of($value) == "list" {
|
40
|
+
$font-family: $value;
|
41
|
+
}
|
42
|
+
// This is a letter-spacing value.
|
43
|
+
@if type-of($value) == "number" {
|
44
|
+
$letter-spacing: $value;
|
45
|
+
}
|
46
|
+
// This is a font-weight value.
|
47
|
+
@if map-has-key($font-weight, $value) {
|
48
|
+
$weight: $value;
|
49
|
+
}
|
50
|
+
// This is a case value.
|
51
|
+
@if type-of($value) == "string" and not(map-has-key($font-weight, $value)) {
|
52
|
+
$case: $value;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
// Output properties.
|
59
|
+
@if $font-family {
|
60
|
+
font-family: $font-family;
|
61
|
+
}
|
62
|
+
@else {
|
63
|
+
@error "Typeface '#{$typeface-name}' does not have a font-family";
|
64
|
+
}
|
65
|
+
@if $letter-spacing {
|
66
|
+
@if ($letter-spacing == 0) {
|
67
|
+
letter-spacing: 0;
|
68
|
+
}
|
69
|
+
@else {
|
70
|
+
letter-spacing: calculate-em-px($letter-spacing, $base-font-size);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
@if $weight {
|
74
|
+
font-weight: weight($weight);
|
75
|
+
}
|
76
|
+
@if $case {
|
77
|
+
text-transform: $case;
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
// Typeset your type.
|
2
|
+
//
|
3
|
+
// @param string $typestyle
|
4
|
+
// A type style from the $typestyles map.
|
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
|
+
@mixin typeset($typestyle, $context: $base-font-size) {
|
10
|
+
$typestyle: map-get($typestyles, $typestyle);
|
11
|
+
|
12
|
+
$font-size: false;
|
13
|
+
$line-height: false;
|
14
|
+
$weight: false;
|
15
|
+
$case: false;
|
16
|
+
|
17
|
+
// Assign values to variables when $typestyle is a keyed map.
|
18
|
+
@if type-of($typestyle) == "map" {
|
19
|
+
@if map-has-key($typestyle, font-size) {
|
20
|
+
$font-size: map-get($typestyle, font-size);
|
21
|
+
}
|
22
|
+
@if map-has-key($typestyle, line-height) {
|
23
|
+
$line-height: map-get($typestyle, line-height);
|
24
|
+
}
|
25
|
+
@if map-has-key($typestyle, weight) {
|
26
|
+
$weight: map-get($typestyle, weight);
|
27
|
+
}
|
28
|
+
@if map-has-key($typestyle, case) {
|
29
|
+
$case: map-get($typestyle, case);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
// Assign values to variables when $typestyle is shorthand.
|
34
|
+
@if type-of($typestyle) == "list" {
|
35
|
+
@each $value in $typestyle {
|
36
|
+
// The first value is always font-size.
|
37
|
+
@if index($typestyle, $value) == 1 {
|
38
|
+
$font-size: $value;
|
39
|
+
}
|
40
|
+
// This is a line-height value.
|
41
|
+
@if type-of($value) == "number" and not(index($typestyle, $value) == 1) {
|
42
|
+
$line-height: $value;
|
43
|
+
}
|
44
|
+
// This is a font-weight value.
|
45
|
+
@if map-has-key($font-weight, $value) {
|
46
|
+
$weight: $value;
|
47
|
+
}
|
48
|
+
// This is a case value.
|
49
|
+
@if type-of($value) == "string" and not(index($typestyle, $value) == 1) {
|
50
|
+
$case: $value;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
// Output properties.
|
56
|
+
@if $font-size {
|
57
|
+
@include font-size($font-size, $context);
|
58
|
+
}
|
59
|
+
@if $line-height {
|
60
|
+
@include typey-debug-grid($line-height, $font-size);
|
61
|
+
@include line-height($line-height, $font-size);
|
62
|
+
}
|
63
|
+
@else {
|
64
|
+
// Using default line-height so set debug grid accordingly.
|
65
|
+
@include typey-debug-grid($base-line-height, $font-size);
|
66
|
+
}
|
67
|
+
@if $weight {
|
68
|
+
font-weight: weight($weight);
|
69
|
+
}
|
70
|
+
@if $case {
|
71
|
+
text-transform: $case;
|
72
|
+
}
|
73
|
+
}
|
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
|
12
|
-
spec.date = '2016-04-
|
11
|
+
spec.version = '1.0.0'
|
12
|
+
spec.date = '2016-04-21'
|
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
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Taranto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -48,9 +48,10 @@ files:
|
|
48
48
|
- stylesheets/typey/mixins/_define-type-sizing.scss
|
49
49
|
- stylesheets/typey/mixins/_font-size.scss
|
50
50
|
- stylesheets/typey/mixins/_line-height.scss
|
51
|
-
- stylesheets/typey/mixins/
|
52
|
-
- stylesheets/typey/mixins/_padding.scss
|
51
|
+
- stylesheets/typey/mixins/_spacing.scss
|
53
52
|
- stylesheets/typey/mixins/_type-layout.scss
|
53
|
+
- stylesheets/typey/mixins/_typeface.scss
|
54
|
+
- stylesheets/typey/mixins/_typeset.scss
|
54
55
|
- typey.gemspec
|
55
56
|
homepage: http://github.com/jptaranto/typey
|
56
57
|
licenses:
|
@@ -67,11 +68,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
68
|
version: '0'
|
68
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
70
|
requirements:
|
70
|
-
- - "
|
71
|
+
- - ">="
|
71
72
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
73
|
+
version: '0'
|
73
74
|
requirements: []
|
74
|
-
rubyforge_project: 1.0.0
|
75
|
+
rubyforge_project: 1.0.0
|
75
76
|
rubygems_version: 2.4.6
|
76
77
|
signing_key:
|
77
78
|
specification_version: 4
|
@@ -1,146 +0,0 @@
|
|
1
|
-
// Define margin (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
|
-
//
|
5
|
-
// @param number|list $x
|
6
|
-
// Multiple of line height to be used or px value to be converted.
|
7
|
-
// Uses the same parameters as the CSS margin property:
|
8
|
-
// i.e. top right bottom left, 1 0 2 0.
|
9
|
-
// @param number|string $context
|
10
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
11
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
12
|
-
// value in px.
|
13
|
-
@mixin margin($list, $context: $base-font-size) {
|
14
|
-
$allowed-types: "multiplier", "px", "list";
|
15
|
-
$type: typey-validator($list, $allowed-types);
|
16
|
-
|
17
|
-
$px-list: ();
|
18
|
-
$converted-list: ();
|
19
|
-
|
20
|
-
@each $x in $list {
|
21
|
-
@if $base-unit == rem {
|
22
|
-
$allowed-types: "multiplier", "px";
|
23
|
-
$type: typey-validator($x, $allowed-types);
|
24
|
-
@if $type == "multiplier" {
|
25
|
-
$margin: $x * $base-line-height;
|
26
|
-
$px-list: join($px-list, $margin, $separator: space);
|
27
|
-
}
|
28
|
-
@if $type == "px" {
|
29
|
-
$px-list: join($px-list, $x, $separator: space);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
$margin: margin($x, $context);
|
33
|
-
$converted-list: join($converted-list, $margin, $separator: space);
|
34
|
-
}
|
35
|
-
|
36
|
-
@if $base-unit == rem {
|
37
|
-
@if $rem-fallback == true {
|
38
|
-
margin: $px-list;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
margin: $converted-list;
|
42
|
-
}
|
43
|
-
|
44
|
-
// Define margin-top (with fallback).
|
45
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
46
|
-
// using rem as $base-unit.
|
47
|
-
//
|
48
|
-
// @param number $x
|
49
|
-
// Multiple of line height to be used or px value to be converted.
|
50
|
-
// @param number|string $context
|
51
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
52
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
53
|
-
// value in px.
|
54
|
-
@mixin margin-top($x, $context: $base-font-size) {
|
55
|
-
$allowed-types: "multiplier", "px";
|
56
|
-
$type: typey-validator($x, $allowed-types);
|
57
|
-
@if $base-unit == rem {
|
58
|
-
@if $rem-fallback == true {
|
59
|
-
@if $type == "multiplier" {
|
60
|
-
margin-top: $x * $base-line-height;
|
61
|
-
}
|
62
|
-
@if $type == "px" {
|
63
|
-
margin-top: $x;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
margin-top: margin($x, $context);
|
68
|
-
}
|
69
|
-
|
70
|
-
// Define margin-bottom (with fallback).
|
71
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
72
|
-
// using rem as $base-unit.
|
73
|
-
//
|
74
|
-
// @param number $x
|
75
|
-
// Multiple of line height to be used or px value to be converted.
|
76
|
-
// @param number|string $context
|
77
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
78
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
79
|
-
// value in px.
|
80
|
-
@mixin margin-bottom($x, $context: $base-font-size) {
|
81
|
-
$allowed-types: "multiplier", "px";
|
82
|
-
$type: typey-validator($x, $allowed-types);
|
83
|
-
@if $base-unit == rem {
|
84
|
-
@if $rem-fallback == true {
|
85
|
-
@if $type == "multiplier" {
|
86
|
-
margin-bottom: $x * $base-line-height;
|
87
|
-
}
|
88
|
-
@if $type == "px" {
|
89
|
-
margin-bottom: $x;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
margin-bottom: margin($x, $context);
|
94
|
-
}
|
95
|
-
|
96
|
-
// Define margin-left (with fallback).
|
97
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
98
|
-
// using rem as $base-unit.
|
99
|
-
//
|
100
|
-
// @param number $x
|
101
|
-
// Multiple of line height to be used or px value to be converted.
|
102
|
-
// @param number|string $context
|
103
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
104
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
105
|
-
// value in px.
|
106
|
-
@mixin margin-left($x, $context: $base-font-size) {
|
107
|
-
$allowed-types: "multiplier", "px";
|
108
|
-
$type: typey-validator($x, $allowed-types);
|
109
|
-
@if $base-unit == rem {
|
110
|
-
@if $rem-fallback == true {
|
111
|
-
@if $type == "multiplier" {
|
112
|
-
margin-left: $x * $base-line-height;
|
113
|
-
}
|
114
|
-
@if $type == "px" {
|
115
|
-
margin-left: $x;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
margin-left: margin($x, $context);
|
120
|
-
}
|
121
|
-
|
122
|
-
// Define margin-right (with fallback).
|
123
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
124
|
-
// using rem as $base-unit.
|
125
|
-
//
|
126
|
-
// @param number $x
|
127
|
-
// Multiple of line height to be used or px value to be converted.
|
128
|
-
// @param number|string $context
|
129
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
130
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
131
|
-
// value in px.
|
132
|
-
@mixin margin-right($x, $context: $base-font-size) {
|
133
|
-
$allowed-types: "multiplier", "px";
|
134
|
-
$type: typey-validator($x, $allowed-types);
|
135
|
-
@if $base-unit == rem {
|
136
|
-
@if $rem-fallback == true {
|
137
|
-
@if $type == "multiplier" {
|
138
|
-
margin-right: $x * $base-line-height;
|
139
|
-
}
|
140
|
-
@if $type == "px" {
|
141
|
-
margin-right: $x;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
margin-right: margin($x, $context);
|
146
|
-
}
|
@@ -1,146 +0,0 @@
|
|
1
|
-
// Define padding (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
|
-
//
|
5
|
-
// @param number|list $x
|
6
|
-
// Multiple of line height to be used or px value to be converted.
|
7
|
-
// Uses the same parameters as the CSS padding property:
|
8
|
-
// i.e. top right bottom left, 1 0 2 0.
|
9
|
-
// @param number|string $context
|
10
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
11
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
12
|
-
// value in px.
|
13
|
-
@mixin padding($list, $context: $base-font-size) {
|
14
|
-
$allowed-types: "multiplier", "px", "list";
|
15
|
-
$type: typey-validator($list, $allowed-types);
|
16
|
-
|
17
|
-
$px-list: ();
|
18
|
-
$converted-list: ();
|
19
|
-
|
20
|
-
@each $x in $list {
|
21
|
-
@if $base-unit == rem {
|
22
|
-
$allowed-types: "multiplier", "px";
|
23
|
-
$type: typey-validator($x, $allowed-types);
|
24
|
-
@if $type == "multiplier" {
|
25
|
-
$padding: $x * $base-line-height;
|
26
|
-
$px-list: join($px-list, $padding, $separator: space);
|
27
|
-
}
|
28
|
-
@if $type == "px" {
|
29
|
-
$px-list: join($px-list, $x, $separator: space);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
$padding: padding($x, $context);
|
33
|
-
$converted-list: join($converted-list, $padding, $separator: space);
|
34
|
-
}
|
35
|
-
|
36
|
-
@if $base-unit == rem {
|
37
|
-
@if $rem-fallback == true {
|
38
|
-
padding: $px-list;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
padding: $converted-list;
|
42
|
-
}
|
43
|
-
|
44
|
-
// Define padding-top (with fallback).
|
45
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
46
|
-
// using rem as $base-unit.
|
47
|
-
//
|
48
|
-
// @param number $x
|
49
|
-
// Multiple of line height to be used or px value to be converted.
|
50
|
-
// @param number|string $context
|
51
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
52
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
53
|
-
// value in px.
|
54
|
-
@mixin padding-top($x, $context: $base-font-size) {
|
55
|
-
$allowed-types: "multiplier", "px";
|
56
|
-
$type: typey-validator($x, $allowed-types);
|
57
|
-
@if $base-unit == rem {
|
58
|
-
@if $rem-fallback == true {
|
59
|
-
@if $type == "multiplier" {
|
60
|
-
padding-top: $x * $base-line-height;
|
61
|
-
}
|
62
|
-
@if $type == "px" {
|
63
|
-
padding-top: $x;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
padding-top: padding($x, $context);
|
68
|
-
}
|
69
|
-
|
70
|
-
// Define padding-bottom (with fallback).
|
71
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
72
|
-
// using rem as $base-unit.
|
73
|
-
//
|
74
|
-
// @param number $x
|
75
|
-
// Multiple of line height to be used or px value to be converted.
|
76
|
-
// @param number|string $context
|
77
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
78
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
79
|
-
// value in px.
|
80
|
-
@mixin padding-bottom($x, $context: $base-font-size) {
|
81
|
-
$allowed-types: "multiplier", "px";
|
82
|
-
$type: typey-validator($x, $allowed-types);
|
83
|
-
@if $base-unit == rem {
|
84
|
-
@if $rem-fallback == true {
|
85
|
-
@if $type == "multiplier" {
|
86
|
-
padding-bottom: $x * $base-line-height;
|
87
|
-
}
|
88
|
-
@if $type == "px" {
|
89
|
-
padding-bottom: $x;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
padding-bottom: padding($x, $context);
|
94
|
-
}
|
95
|
-
|
96
|
-
// Define padding-left (with fallback).
|
97
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
98
|
-
// using rem as $base-unit.
|
99
|
-
//
|
100
|
-
// @param number $x
|
101
|
-
// Multiple of line height to be used or px value to be converted.
|
102
|
-
// @param number|string $context
|
103
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
104
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
105
|
-
// value in px.
|
106
|
-
@mixin padding-left($x, $context: $base-font-size) {
|
107
|
-
$allowed-types: "multiplier", "px";
|
108
|
-
$type: typey-validator($x, $allowed-types);
|
109
|
-
@if $base-unit == rem {
|
110
|
-
@if $rem-fallback == true {
|
111
|
-
@if $type == "multiplier" {
|
112
|
-
padding-left: $x * $base-line-height;
|
113
|
-
}
|
114
|
-
@if $type == "px" {
|
115
|
-
padding-left: $x;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
padding-left: padding($x, $context);
|
120
|
-
}
|
121
|
-
|
122
|
-
// Define padding-right (with fallback).
|
123
|
-
// This is only necessary to use if you want to provide fallbacks when you are
|
124
|
-
// using rem as $base-unit.
|
125
|
-
//
|
126
|
-
// @param number $x
|
127
|
-
// Multiple of line height to be used or px value to be converted.
|
128
|
-
// @param number|string $context
|
129
|
-
// (optional) Only used if em is the $base-unit. The value of the elements/parents
|
130
|
-
// font-size if it differs from $base-font-size. Specified as a t-shirt size or
|
131
|
-
// value in px.
|
132
|
-
@mixin padding-right($x, $context: $base-font-size) {
|
133
|
-
$allowed-types: "multiplier", "px";
|
134
|
-
$type: typey-validator($x, $allowed-types);
|
135
|
-
@if $base-unit == rem {
|
136
|
-
@if $rem-fallback == true {
|
137
|
-
@if $type == "multiplier" {
|
138
|
-
padding-right: $x * $base-line-height;
|
139
|
-
}
|
140
|
-
@if $type == "px" {
|
141
|
-
padding-right: $x;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
padding-right: padding($x, $context);
|
146
|
-
}
|