compass 0.11.beta.2 → 0.11.beta.3
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.
- data/VERSION.yml +1 -1
- data/examples/compass/src/utilities.scss +2 -2
- data/features/step_definitions/command_line_steps.rb +1 -1
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +1 -1
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +1 -1
- data/frameworks/compass/stylesheets/_compass.scss +1 -0
- data/frameworks/compass/stylesheets/compass/_css3.scss +1 -0
- data/frameworks/compass/stylesheets/compass/_reset-legacy.scss +3 -0
- data/frameworks/compass/stylesheets/compass/_typography.scss +4 -0
- data/frameworks/compass/stylesheets/compass/_utilities.scss +6 -3
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +13 -0
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +10 -10
- data/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss +135 -0
- data/frameworks/compass/stylesheets/compass/reset/_utilities.scss +34 -28
- data/frameworks/compass/stylesheets/compass/typography/_links.scss +3 -0
- data/frameworks/compass/stylesheets/compass/typography/_lists.scss +4 -0
- data/frameworks/compass/stylesheets/compass/typography/_text.scss +3 -0
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +124 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss +5 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss +28 -0
- data/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss +7 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss +34 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +61 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss +47 -0
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +44 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +25 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss +2 -0
- data/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss +34 -0
- data/frameworks/compass/stylesheets/compass/utilities/_color.scss +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.scss +5 -3
- data/frameworks/compass/stylesheets/compass/utilities/_lists.scss +6 -4
- data/frameworks/compass/stylesheets/compass/utilities/_text.scss +5 -3
- data/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss +28 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +3 -5
- data/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +2 -27
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -7
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +2 -33
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +2 -60
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +2 -46
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +2 -34
- data/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +2 -24
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +3 -2
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +2 -33
- data/frameworks/compass/templates/ellipsis/ellipsis.sass +1 -1
- data/frameworks/compass/templates/pie/manifest.rb +1 -1
- data/lib/compass.rb +2 -0
- data/lib/compass/compiler.rb +18 -4
- data/lib/compass/configuration.rb +1 -1
- data/lib/compass/configuration/data.rb +10 -0
- data/lib/compass/configuration/file_data.rb +43 -0
- data/lib/compass/configuration/helpers.rb +8 -2
- data/lib/compass/configuration/inheritance.rb +2 -2
- data/lib/compass/configuration/serialization.rb +51 -76
- data/lib/compass/sass_extensions/functions/colors.rb +1 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +9 -5
- data/test/compass_test.rb +35 -7
- data/test/fixtures/stylesheets/blueprint/css/screen.css +18 -14
- data/test/fixtures/stylesheets/compass/css/fonts.css +2 -6
- data/test/fixtures/stylesheets/compass/css/lists.css +0 -6
- data/test/fixtures/stylesheets/compass/css/reset.css +18 -14
- data/test/fixtures/stylesheets/compass/css/utilities.css +13 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +1 -1
- data/test/fixtures/stylesheets/compass/sass/lists.scss +2 -2
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +14 -0
- metadata +30 -31
data/VERSION.yml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
@import "yui/modules/base";
|
4
4
|
@import "blueprint/grid";
|
5
5
|
@import "blueprint/scaffolding";
|
6
|
-
@import "compass/
|
6
|
+
@import "compass/typography/text/ellipsis";
|
7
7
|
|
8
8
|
html {
|
9
9
|
@include yui-base; }
|
@@ -55,7 +55,7 @@ h2 {
|
|
55
55
|
ul.inline {
|
56
56
|
@include inline-list; }
|
57
57
|
ul.comma-delimited {
|
58
|
-
@include
|
58
|
+
@include delimited-list; }
|
59
59
|
ol.pretty {
|
60
60
|
@include pretty-bullets("blue_arrow.gif", 5px, 7px, 18px); } }
|
61
61
|
|
@@ -193,7 +193,7 @@ end
|
|
193
193
|
|
194
194
|
Then /^the following configuration properties are set in ([^ ]+):$/ do |config_file, table|
|
195
195
|
|
196
|
-
config = Compass::Configuration::
|
196
|
+
config = Compass::Configuration::FileData.new_from_file(config_file)
|
197
197
|
table.hashes.each do |hash|
|
198
198
|
config.send(hash['property']).should == hash['value']
|
199
199
|
end
|
@@ -1,6 +1,9 @@
|
|
1
|
+
@import "utilities/color";
|
1
2
|
@import "utilities/general";
|
2
|
-
@import "utilities/links";
|
3
|
-
@import "utilities/lists";
|
4
3
|
@import "utilities/sprites";
|
5
4
|
@import "utilities/tables";
|
6
|
-
|
5
|
+
|
6
|
+
// deprecated
|
7
|
+
@import "typography/links";
|
8
|
+
@import "typography/lists";
|
9
|
+
@import "typography/text";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@import "shared";
|
2
|
+
|
3
|
+
// Change the appearance for Mozilla, Webkit and the future
|
4
|
+
//
|
5
|
+
// @param $ap
|
6
|
+
// [ none | normal | icon | window | button | menu | field ]
|
7
|
+
|
8
|
+
@mixin appearance($ap) {
|
9
|
+
$ap: unquote($ap);
|
10
|
+
@include experimental(appearance, $ap,
|
11
|
+
-moz, -webkit, not -o, not -ms, not -khtml, official
|
12
|
+
);
|
13
|
+
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
@charset "UTF-8";
|
2
1
|
@import "shared";
|
3
2
|
|
4
3
|
// Cross-browser support for @font-face. Supports IE, Gecko, Webkit, Opera.
|
@@ -14,19 +13,20 @@
|
|
14
13
|
// If you need to generate other formats check out the Font Squirrel
|
15
14
|
// [font generator](http://www.fontsquirrel.com/fontface/generator)
|
16
15
|
|
17
|
-
@mixin font-face(
|
16
|
+
@mixin font-face(
|
17
|
+
$name,
|
18
|
+
$font-files,
|
19
|
+
$eot: false
|
20
|
+
) {
|
21
|
+
$iefont: unquote("#{$eot}?iefix");
|
18
22
|
@font-face {
|
19
23
|
font-family: quote($name);
|
20
|
-
@if $eot {
|
21
|
-
|
22
|
-
|
23
|
-
@media screen and (max-device-width: 480px) {
|
24
|
-
@font-face {
|
25
|
-
font-family: quote($name);
|
26
|
-
src: $font-files;
|
24
|
+
@if $eot {
|
25
|
+
src: font-url($eot);
|
26
|
+
$font-files: font-url($iefont) unquote("format('eot')"), $font-files;
|
27
27
|
}
|
28
|
+
src: $font-files;
|
28
29
|
}
|
29
|
-
|
30
30
|
}
|
31
31
|
|
32
32
|
// EXAMPLE
|
@@ -0,0 +1,135 @@
|
|
1
|
+
// Based on [Eric Meyer's reset](http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/)
|
2
|
+
// Global reset rules.
|
3
|
+
// For more specific resets, use the reset mixins provided below
|
4
|
+
//
|
5
|
+
// *Please Note*: tables still need `cellspacing="0"` in the markup.
|
6
|
+
@mixin global-reset {
|
7
|
+
html, body, div, span, applet, object, iframe,
|
8
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
9
|
+
a, abbr, acronym, address, big, cite, code,
|
10
|
+
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
11
|
+
small, strike, strong, sub, sup, tt, var,
|
12
|
+
dl, dt, dd, ol, ul, li,
|
13
|
+
fieldset, form, label, legend,
|
14
|
+
table, caption, tbody, tfoot, thead, tr, th, td {
|
15
|
+
@include reset-box-model;
|
16
|
+
@include reset-font; }
|
17
|
+
body {
|
18
|
+
@include reset-body; }
|
19
|
+
ol, ul {
|
20
|
+
@include reset-list-style; }
|
21
|
+
table {
|
22
|
+
@include reset-table; }
|
23
|
+
caption, th, td {
|
24
|
+
@include reset-table-cell; }
|
25
|
+
q, blockquote {
|
26
|
+
@include reset-quotation; }
|
27
|
+
a img {
|
28
|
+
@include reset-image-anchor-border; } }
|
29
|
+
|
30
|
+
// Reset all elements within some selector scope. To reset the selector itself,
|
31
|
+
// mixin the appropriate reset mixin for that element type as well. This could be
|
32
|
+
// useful if you want to style a part of your page in a dramatically different way.
|
33
|
+
//
|
34
|
+
// *Please Note*: tables still need `cellspacing="0"` in the markup.
|
35
|
+
@mixin nested-reset {
|
36
|
+
div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
|
37
|
+
pre, a, abbr, acronym, address, code, del, dfn, em, img,
|
38
|
+
dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr {
|
39
|
+
@include reset-box-model;
|
40
|
+
@include reset-font; }
|
41
|
+
table {
|
42
|
+
@include reset-table; }
|
43
|
+
caption, th, td {
|
44
|
+
@include reset-table-cell; }
|
45
|
+
q, blockquote {
|
46
|
+
@include reset-quotation; }
|
47
|
+
a img {
|
48
|
+
@include reset-image-anchor-border; } }
|
49
|
+
|
50
|
+
// Reset the box model measurements.
|
51
|
+
@mixin reset-box-model {
|
52
|
+
margin: 0;
|
53
|
+
padding: 0;
|
54
|
+
border: 0;
|
55
|
+
outline: 0; }
|
56
|
+
|
57
|
+
// Reset the font and vertical alignment.
|
58
|
+
@mixin reset-font {
|
59
|
+
font: {
|
60
|
+
weight: inherit;
|
61
|
+
style: inherit;
|
62
|
+
size: 100%;
|
63
|
+
family: inherit; };
|
64
|
+
vertical-align: baseline; }
|
65
|
+
|
66
|
+
// Resets the outline when focus.
|
67
|
+
// For accessibility you need to apply some styling in its place.
|
68
|
+
@mixin reset-focus {
|
69
|
+
outline: 0; }
|
70
|
+
|
71
|
+
// Reset a body element.
|
72
|
+
@mixin reset-body {
|
73
|
+
line-height: 1;
|
74
|
+
color: black;
|
75
|
+
background: white; }
|
76
|
+
|
77
|
+
// Reset the list style of an element.
|
78
|
+
@mixin reset-list-style {
|
79
|
+
list-style: none; }
|
80
|
+
|
81
|
+
// Reset a table
|
82
|
+
@mixin reset-table {
|
83
|
+
border-collapse: separate;
|
84
|
+
border-spacing: 0;
|
85
|
+
vertical-align: middle; }
|
86
|
+
|
87
|
+
// Reset a table cell (`th`, `td`)
|
88
|
+
@mixin reset-table-cell {
|
89
|
+
text-align: left;
|
90
|
+
font-weight: normal;
|
91
|
+
vertical-align: middle; }
|
92
|
+
|
93
|
+
// Reset a quotation (`q`, `blockquote`)
|
94
|
+
@mixin reset-quotation {
|
95
|
+
quotes: "" "";
|
96
|
+
&:before, &:after {
|
97
|
+
content: ""; } }
|
98
|
+
|
99
|
+
// Resets the border.
|
100
|
+
@mixin reset-image-anchor-border {
|
101
|
+
border: none; }
|
102
|
+
|
103
|
+
// Unrecognized elements are displayed inline.
|
104
|
+
// This reset provides a basic reset for html5 elements
|
105
|
+
// so they are rendered correctly in browsers that don't recognize them
|
106
|
+
// and reset in browsers that have default styles for them.
|
107
|
+
@mixin reset-html5 {
|
108
|
+
article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
|
109
|
+
@include reset-box-model;
|
110
|
+
display: block; } }
|
111
|
+
|
112
|
+
// Resets the display of inline and block elements to their default display
|
113
|
+
// according to their tag type. Elements that have a default display that varies across
|
114
|
+
// versions of html or browser are not handled here, but this covers the 90% use case.
|
115
|
+
// Usage Example:
|
116
|
+
//
|
117
|
+
// // Turn off the display for both of these classes
|
118
|
+
// .unregistered-only, .registered-only
|
119
|
+
// display: none
|
120
|
+
// // Now turn only one of them back on depending on some other context.
|
121
|
+
// body.registered
|
122
|
+
// +reset-display(".registered-only")
|
123
|
+
// body.unregistered
|
124
|
+
// +reset-display(".unregistered-only")
|
125
|
+
@mixin reset-display($selector: "", $important: false) {
|
126
|
+
#{append-selector(elements-of-type("inline"), $selector)} {
|
127
|
+
@if $important {
|
128
|
+
display: inline !important; }
|
129
|
+
@else {
|
130
|
+
display: inline; } }
|
131
|
+
#{append-selector(elements-of-type("block"), $selector)} {
|
132
|
+
@if $important {
|
133
|
+
display: block !important; }
|
134
|
+
@else {
|
135
|
+
display: block; } } }
|
@@ -1,17 +1,20 @@
|
|
1
|
-
// Based on [Eric Meyer's reset](http://meyerweb.com/eric/
|
1
|
+
// Based on [Eric Meyer's reset 2.0](http://meyerweb.com/eric/tools/css/reset/index.html)
|
2
2
|
// Global reset rules.
|
3
3
|
// For more specific resets, use the reset mixins provided below
|
4
|
-
//
|
5
|
-
// *Please Note*: tables still need `cellspacing="0"` in the markup.
|
6
4
|
@mixin global-reset {
|
7
5
|
html, body, div, span, applet, object, iframe,
|
8
6
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
9
7
|
a, abbr, acronym, address, big, cite, code,
|
10
|
-
del, dfn, em,
|
8
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
11
9
|
small, strike, strong, sub, sup, tt, var,
|
10
|
+
b, u, i, center,
|
12
11
|
dl, dt, dd, ol, ul, li,
|
13
12
|
fieldset, form, label, legend,
|
14
|
-
table, caption, tbody, tfoot, thead, tr, th, td
|
13
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
14
|
+
article, aside, canvas, details, embed,
|
15
|
+
figure, figcaption, footer, header, hgroup,
|
16
|
+
menu, nav, output, ruby, section, summary,
|
17
|
+
time, mark, audio, video {
|
15
18
|
@include reset-box-model;
|
16
19
|
@include reset-font; }
|
17
20
|
body {
|
@@ -25,17 +28,26 @@
|
|
25
28
|
q, blockquote {
|
26
29
|
@include reset-quotation; }
|
27
30
|
a img {
|
28
|
-
@include reset-image-anchor-border; }
|
31
|
+
@include reset-image-anchor-border; }
|
32
|
+
@include reset-html5; }
|
29
33
|
|
30
34
|
// Reset all elements within some selector scope. To reset the selector itself,
|
31
35
|
// mixin the appropriate reset mixin for that element type as well. This could be
|
32
36
|
// useful if you want to style a part of your page in a dramatically different way.
|
33
|
-
//
|
34
|
-
// *Please Note*: tables still need `cellspacing="0"` in the markup.
|
35
37
|
@mixin nested-reset {
|
36
|
-
div, span, object, iframe,
|
37
|
-
|
38
|
-
|
38
|
+
div, span, applet, object, iframe,
|
39
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
40
|
+
a, abbr, acronym, address, big, cite, code,
|
41
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
42
|
+
small, strike, strong, sub, sup, tt, var,
|
43
|
+
b, u, i, center,
|
44
|
+
dl, dt, dd, ol, ul, li,
|
45
|
+
fieldset, form, label, legend,
|
46
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
47
|
+
article, aside, canvas, details, embed,
|
48
|
+
figure, figcaption, footer, header, hgroup,
|
49
|
+
menu, nav, output, ruby, section, summary,
|
50
|
+
time, mark, audio, video {
|
39
51
|
@include reset-box-model;
|
40
52
|
@include reset-font; }
|
41
53
|
table {
|
@@ -51,16 +63,12 @@
|
|
51
63
|
@mixin reset-box-model {
|
52
64
|
margin: 0;
|
53
65
|
padding: 0;
|
54
|
-
border: 0;
|
55
|
-
outline: 0; }
|
66
|
+
border: 0; }
|
56
67
|
|
57
68
|
// Reset the font and vertical alignment.
|
58
69
|
@mixin reset-font {
|
59
|
-
font:
|
60
|
-
|
61
|
-
style: inherit;
|
62
|
-
size: 100%;
|
63
|
-
family: inherit; };
|
70
|
+
font-size: 100%;
|
71
|
+
font: inherit;
|
64
72
|
vertical-align: baseline; }
|
65
73
|
|
66
74
|
// Resets the outline when focus.
|
@@ -70,9 +78,7 @@
|
|
70
78
|
|
71
79
|
// Reset a body element.
|
72
80
|
@mixin reset-body {
|
73
|
-
line-height: 1;
|
74
|
-
color: black;
|
75
|
-
background: white; }
|
81
|
+
line-height: 1; }
|
76
82
|
|
77
83
|
// Reset the list style of an element.
|
78
84
|
@mixin reset-list-style {
|
@@ -80,9 +86,8 @@
|
|
80
86
|
|
81
87
|
// Reset a table
|
82
88
|
@mixin reset-table {
|
83
|
-
border-collapse:
|
84
|
-
border-spacing: 0;
|
85
|
-
vertical-align: middle; }
|
89
|
+
border-collapse: collapse;
|
90
|
+
border-spacing: 0; }
|
86
91
|
|
87
92
|
// Reset a table cell (`th`, `td`)
|
88
93
|
@mixin reset-table-cell {
|
@@ -92,9 +97,10 @@
|
|
92
97
|
|
93
98
|
// Reset a quotation (`q`, `blockquote`)
|
94
99
|
@mixin reset-quotation {
|
95
|
-
quotes:
|
100
|
+
quotes: none;
|
96
101
|
&:before, &:after {
|
97
|
-
content: "";
|
102
|
+
content: "";
|
103
|
+
content: none; } }
|
98
104
|
|
99
105
|
// Resets the border.
|
100
106
|
@mixin reset-image-anchor-border {
|
@@ -105,8 +111,8 @@
|
|
105
111
|
// so they are rendered correctly in browsers that don't recognize them
|
106
112
|
// and reset in browsers that have default styles for them.
|
107
113
|
@mixin reset-html5 {
|
108
|
-
article, aside,
|
109
|
-
|
114
|
+
article, aside, details, figcaption, figure,
|
115
|
+
footer, header, hgroup, menu, nav, section {
|
110
116
|
display: block; } }
|
111
117
|
|
112
118
|
// Resets the display of inline and block elements to their default display
|
@@ -0,0 +1,124 @@
|
|
1
|
+
// The base font size
|
2
|
+
$base-font-size: 16px !default;
|
3
|
+
|
4
|
+
// The base line height is the basic unit of line hightness.
|
5
|
+
$base-line-height: 24px !default;
|
6
|
+
|
7
|
+
// set the default border style for rhythm borders
|
8
|
+
$default-rhythm-border-style: solid !default;
|
9
|
+
|
10
|
+
// The IE font ratio is a fact of life. Deal with it.
|
11
|
+
$ie-font-ratio: 16px / 100%;
|
12
|
+
|
13
|
+
// The basic unit of font rhythm
|
14
|
+
$base-rhythm-unit: $base-line-height / $base-font-size * 1em;
|
15
|
+
|
16
|
+
// The leader is the amount of whitespace in a line.
|
17
|
+
// It might be useful in your calculations
|
18
|
+
$base-leader: ($base-line-height - $base-font-size) * 1em / $base-font-size;
|
19
|
+
|
20
|
+
// The half-leader is the amount of whitespace above and below a line.
|
21
|
+
// It might be useful in your calculations
|
22
|
+
$base-half-leader: $base-leader / 2;
|
23
|
+
|
24
|
+
// Establishes a font baseline for the given font-size in pixels
|
25
|
+
@mixin establish-baseline($font-size: $base-font-size) {
|
26
|
+
body {
|
27
|
+
font-size: $font-size / $ie-font-ratio;
|
28
|
+
@include adjust-leading-to(1, $font-size);
|
29
|
+
}
|
30
|
+
html>body {
|
31
|
+
font-size: $font-size;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
// Show a background image that can be used to debug your alignments.
|
36
|
+
@mixin debug-vertical-alignment($img: 'underline.png') {
|
37
|
+
background: url($img);
|
38
|
+
}
|
39
|
+
|
40
|
+
// Adjust a block to have a different font size and leading to maintain the rhythm.
|
41
|
+
// $lines is a number that is how many times the baseline rhythm this
|
42
|
+
// font size should use up. Does not have to be an integer, but it defaults
|
43
|
+
// to the smallest integer that is large enough to fit the font.
|
44
|
+
// Use $from_size to adjust from a non-base font-size.
|
45
|
+
@mixin adjust-font-size-to($to-size, $lines: ceil($to-size / $base-line-height), $from-size: $base-font-size) {
|
46
|
+
font-size: 1em * $to-size / $from-size;
|
47
|
+
@include adjust-leading-to($lines, $to-size);
|
48
|
+
}
|
49
|
+
|
50
|
+
@mixin adjust-leading-to($lines, $font-size: $base-font-size) {
|
51
|
+
line-height: 1em * $lines * $base-line-height / $font-size;
|
52
|
+
}
|
53
|
+
|
54
|
+
// Apply leading whitespace
|
55
|
+
@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) {
|
56
|
+
#{$property}-top: 1em * $lines * $base-line-height / $font-size;
|
57
|
+
}
|
58
|
+
|
59
|
+
@mixin padding-leader($lines: 1, $font-size: $base-font-size) {
|
60
|
+
@include leader($lines, $font-size, padding);
|
61
|
+
}
|
62
|
+
|
63
|
+
@mixin margin-leader($lines: 1, $font-size: $base-font-size) {
|
64
|
+
@include leader($lines, $font-size, margin);
|
65
|
+
}
|
66
|
+
|
67
|
+
// Apply trailing whitespace
|
68
|
+
@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) {
|
69
|
+
#{$property}-bottom: 1em * $lines * $base-line-height / $font-size;
|
70
|
+
}
|
71
|
+
|
72
|
+
@mixin padding-trailer($lines: 1, $font-size: $base-font-size) {
|
73
|
+
@include trailer($lines, $font-size, padding);
|
74
|
+
}
|
75
|
+
|
76
|
+
@mixin margin-trailer($lines: 1, $font-size: $base-font-size) {
|
77
|
+
@include trailer($lines, $font-size, margin);
|
78
|
+
}
|
79
|
+
|
80
|
+
// Whitespace application shortcut
|
81
|
+
// Apply top margin/padding + bottom padding/margin
|
82
|
+
@mixin rhythm($leader: 0, $padding-leader: 0, $padding-trailer: 0, $trailer: 0, $font-size: $base-font-size) {
|
83
|
+
@include leader($leader, $font-size);
|
84
|
+
@include padding-leader($padding-leader, $font-size);
|
85
|
+
@include padding-trailer($padding-trailer, $font-size);
|
86
|
+
@include trailer($trailer, $font-size);
|
87
|
+
}
|
88
|
+
|
89
|
+
// Apply a border width to any side without destroying the vertical rhythm
|
90
|
+
@mixin apply-side-rhythm-border($side, $width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
91
|
+
border-#{$side}: {
|
92
|
+
style: $border-style;
|
93
|
+
width: 1em * $width / $font-size;
|
94
|
+
};
|
95
|
+
padding-#{$side}: 1em / $font-size * ($lines * $base-line-height - $width);
|
96
|
+
}
|
97
|
+
|
98
|
+
// Aplly rhythm borders equally to all sides
|
99
|
+
@mixin rhythm-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
100
|
+
border: {
|
101
|
+
style: $border-style;
|
102
|
+
width: 1em * $width / $font-size; };
|
103
|
+
padding: 1em / $font-size * ($lines * $base-line-height - $width);
|
104
|
+
}
|
105
|
+
|
106
|
+
// Apply a leading rhythm border
|
107
|
+
@mixin leading-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
108
|
+
@include apply-side-rhythm-border(top, $width, $lines, $font-size, $border-style);
|
109
|
+
}
|
110
|
+
|
111
|
+
// Apply a trailing rhythm border
|
112
|
+
@mixin trailing-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
113
|
+
@include apply-side-rhythm-border(bottom, $width, $lines, $font-size, $border-style);
|
114
|
+
}
|
115
|
+
|
116
|
+
// Apply both leading and trailing rhythm borders
|
117
|
+
@mixin horizontal-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
118
|
+
@include leading-border($width, $lines, $font-size, $border-style);
|
119
|
+
@include trailing-border($width, $lines, $font-size, $border-style);
|
120
|
+
}
|
121
|
+
|
122
|
+
@mixin h-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) {
|
123
|
+
@include horizontal-borders($width, $lines, $font-size, $border-style);
|
124
|
+
}
|