compass 0.12.7 → 0.13.alpha.4
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/README.markdown +1 -1
- data/Rakefile +14 -9
- data/VERSION.yml +6 -0
- data/features/command_line.feature +8 -50
- data/features/step_definitions/command_line_steps.rb +3 -2
- data/frameworks/compass/stylesheets/compass/_css3.scss +2 -0
- data/frameworks/compass/stylesheets/compass/_support.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_animation.scss +121 -0
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +10 -6
- data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +32 -36
- data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +32 -35
- data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +12 -15
- data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +27 -48
- data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +22 -35
- data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_box.scss +57 -82
- data/frameworks/compass/stylesheets/compass/css3/_columns.scss +104 -71
- data/frameworks/compass/stylesheets/compass/css3/_filter.scss +38 -18
- data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +294 -0
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +13 -22
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +45 -48
- data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +1 -1
- data/frameworks/compass/stylesheets/compass/css3/_regions.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_selection.scss +31 -0
- data/frameworks/compass/stylesheets/compass/css3/_shared.scss +226 -2
- data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +21 -26
- data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_transform.scss +8 -8
- data/frameworks/compass/stylesheets/compass/css3/_transition.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +43 -4
- data/frameworks/compass/stylesheets/compass/typography/_units.scss +152 -0
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +180 -102
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +5 -3
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +6 -3
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +7 -3
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +2 -2
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +32 -13
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +14 -9
- data/lib/compass/actions.rb +3 -1
- data/lib/compass/commands/update_project.rb +1 -2
- data/lib/compass/commands/watch_project.rb +11 -113
- data/lib/compass/commands.rb +1 -1
- data/lib/compass/compiler.rb +8 -1
- data/lib/compass/configuration/data.rb +1 -1
- data/lib/compass/configuration/helpers.rb +2 -0
- data/lib/compass/exec/project_options_parser.rb +8 -0
- data/lib/compass/logger.rb +2 -0
- data/lib/compass/sass_extensions/functions/cross_browser_support.rb +1 -1
- data/lib/compass/sass_extensions/functions/env.rb +18 -0
- data/lib/compass/sass_extensions/functions/gradient_support.rb +101 -29
- data/lib/compass/sass_extensions/functions/image_size.rb +2 -1
- data/lib/compass/sass_extensions/functions/math.rb +13 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +82 -22
- data/lib/compass/sass_extensions/functions/urls.rb +37 -6
- data/lib/compass/sass_extensions/functions/utility.rb +10 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +11 -9
- data/lib/compass/sass_extensions/sprites/image.rb +7 -2
- data/lib/compass/sass_extensions/sprites/image_methods.rb +5 -1
- data/lib/compass/sass_extensions/sprites/images.rb +29 -0
- data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
- data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
- data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
- data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
- data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +9 -115
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +5 -1
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +8 -14
- data/lib/compass/sass_extensions/sprites.rb +2 -0
- data/lib/compass/sprite_importer/content.erb +29 -24
- data/lib/compass/sprite_importer.rb +7 -11
- data/lib/compass/version.rb +10 -13
- data/lib/compass/watcher/compiler.rb +59 -0
- data/lib/compass/watcher/project_watcher.rb +111 -0
- data/lib/compass/watcher/watch.rb +33 -0
- data/lib/compass/watcher.rb +11 -0
- data/lib/compass.rb +2 -2
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +7 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +11 -0
- data/test/fixtures/stylesheets/busted_font_urls/tmp/screen.css +7 -0
- data/test/fixtures/stylesheets/busted_image_urls/tmp/screen.css +9 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +33 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +33 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +5 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +15 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +24 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +27 -63
- data/test/fixtures/stylesheets/compass/css/flexbox.css +121 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
- data/test/fixtures/stylesheets/compass/css/gradients.css +64 -36
- data/test/fixtures/stylesheets/compass/css/grid_background.css +7 -14
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +4 -2
- data/test/fixtures/stylesheets/compass/css/lists.css +5 -5
- data/test/fixtures/stylesheets/compass/css/pie.css +0 -3
- data/test/fixtures/stylesheets/compass/css/regions.css +4 -2
- data/test/fixtures/stylesheets/compass/css/selection.css +13 -0
- data/test/fixtures/stylesheets/compass/css/sprites.css +251 -250
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +6 -6
- data/test/fixtures/stylesheets/compass/css/transition.css +6 -0
- data/test/fixtures/stylesheets/compass/css/units.css +30 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +22 -1
- data/test/fixtures/stylesheets/compass/css/utilities.css +15 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +177 -8
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +19 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +4 -2
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +9 -9
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +44 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +31 -0
- data/test/fixtures/stylesheets/compass/sass/selection.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +1 -1
- data/test/fixtures/stylesheets/compass/sass/units.scss +45 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +13 -1
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +208 -7
- data/test/fixtures/stylesheets/envtest/css/env.css +8 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +16 -0
- data/test/fixtures/stylesheets/envtest/tmp/env.css +14 -0
- data/test/fixtures/stylesheets/valid/css/simple.css +4 -0
- data/test/helpers/diff.rb +1 -1
- data/test/integrations/compass_test.rb +23 -14
- data/test/integrations/sprites_test.rb +305 -63
- data/test/test_helper.rb +5 -15
- data/test/units/command_line_test.rb +0 -2
- data/test/units/compass_module_test.rb +1 -1
- data/test/units/configuration_test.rb +12 -0
- data/test/units/regressions_test.rb +8 -8
- data/test/units/sass_extensions_test.rb +2 -0
- data/test/units/sass_extenstions/gradients_test.rb +33 -0
- data/test/units/sprites/image_test.rb +5 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/layout_test.rb +29 -4
- data/test/units/watcher/compiler_test.rb +39 -0
- data/test/units/watcher/project_watcher_test.rb +73 -0
- data/test/units/watcher/watch_test.rb +42 -0
- metadata +171 -236
- checksums.yaml +0 -7
- data/frameworks/blueprint/stylesheets/_blueprint.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +0 -101
- data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +0 -36
- data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +0 -28
- data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +0 -88
- data/frameworks/blueprint/stylesheets/blueprint/_form.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +0 -258
- data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +0 -111
- data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +0 -152
- data/frameworks/blueprint/stylesheets/blueprint/_print.scss +0 -86
- data/frameworks/blueprint/stylesheets/blueprint/_reset.scss +0 -3
- data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +0 -121
- data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +0 -52
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +0 -90
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +0 -83
- data/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/frameworks/blueprint/templates/basic/ie.sass +0 -4
- data/frameworks/blueprint/templates/basic/manifest.rb +0 -30
- data/frameworks/blueprint/templates/basic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/basic/print.sass +0 -4
- data/frameworks/blueprint/templates/basic/screen.sass +0 -12
- data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons.sass +0 -49
- data/frameworks/blueprint/templates/buttons/manifest.rb +0 -17
- data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons.sass +0 -13
- data/frameworks/blueprint/templates/link_icons/manifest.rb +0 -23
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +0 -16
- data/frameworks/blueprint/templates/project/manifest.rb +0 -30
- data/frameworks/blueprint/templates/project/partials/_base.sass +0 -11
- data/frameworks/blueprint/templates/project/print.sass +0 -8
- data/frameworks/blueprint/templates/project/screen.sass +0 -46
- data/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/frameworks/blueprint/templates/semantic/ie.sass +0 -16
- data/frameworks/blueprint/templates/semantic/manifest.rb +0 -33
- data/frameworks/blueprint/templates/semantic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/semantic/partials/_form.sass +0 -6
- data/frameworks/blueprint/templates/semantic/partials/_page.sass +0 -17
- data/frameworks/blueprint/templates/semantic/partials/_two_col.sass +0 -38
- data/frameworks/blueprint/templates/semantic/print.sass +0 -5
- data/frameworks/blueprint/templates/semantic/screen.sass +0 -14
- data/lib/compass/commands/generate_grid_background.rb +0 -96
- data/lib/compass/grid_builder.rb +0 -102
- data/test/fixtures/stylesheets/blueprint/config.rb +0 -14
- data/test/fixtures/stylesheets/blueprint/css/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/print.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/screen.css +0 -815
- data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +0 -80
- data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +0 -11
- data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +0 -30
- data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +0 -435
- data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +0 -46
- data/test/fixtures/stylesheets/blueprint/css/single-imports/link-icons.css +0 -40
- data/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +0 -651
- data/test/fixtures/stylesheets/blueprint/css/single-imports/print.css +0 -60
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +0 -75
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +0 -437
- data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +0 -45
- data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +0 -146
- data/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +0 -35
- data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/doc.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/email.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/external.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/feed.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/im.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/pdf.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/visited.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/xls.png +0 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +0 -18
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/buttons.scss +0 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/colors.scss +0 -34
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/debug.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/fancy-type.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/form.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/grid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/ie.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/interaction.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/link-icons.scss +0 -13
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/liquid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/print.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset-utilities.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset.scss +0 -1
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/rtl.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/scaffolding.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/typography.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/utilities.scss +0 -3
- data/test/fixtures/stylesheets/compass/images/flag-s4798b5a210.png +0 -0
- data/test/units/compass_png_test.rb +0 -46
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import "shared";
|
|
2
|
+
|
|
3
|
+
// Add the selection selector to any element
|
|
4
|
+
//
|
|
5
|
+
// There are two usage modes: at the stylesheet root, include the mixin with
|
|
6
|
+
// styles passed as mixin content. This applies to all elements. For example:
|
|
7
|
+
//
|
|
8
|
+
// @include selection {
|
|
9
|
+
// background-color: #fe57a1;
|
|
10
|
+
// color: #fff;
|
|
11
|
+
// }
|
|
12
|
+
//
|
|
13
|
+
// If a specific element is being styled, pass "&" as an argument to the mixin
|
|
14
|
+
// as well. For example:
|
|
15
|
+
//
|
|
16
|
+
// .hot-pink {
|
|
17
|
+
// @include selection("&") {
|
|
18
|
+
// background-color: #fe57a1;
|
|
19
|
+
// color: #fff;
|
|
20
|
+
// }
|
|
21
|
+
// }
|
|
22
|
+
@mixin selection($selector: "") {
|
|
23
|
+
#{$selector}::selection {
|
|
24
|
+
@content;
|
|
25
|
+
}
|
|
26
|
+
@if $experimental-support-for-mozilla {
|
|
27
|
+
#{$selector}::-moz-selection {
|
|
28
|
+
@content;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
@mixin experimental($property, $value,
|
|
8
8
|
$moz : $experimental-support-for-mozilla,
|
|
9
9
|
$webkit : $experimental-support-for-webkit,
|
|
10
|
-
$o : $experimental-support-for-opera,
|
|
11
10
|
$ms : $experimental-support-for-microsoft,
|
|
11
|
+
$o : $experimental-support-for-opera,
|
|
12
12
|
$khtml : $experimental-support-for-khtml,
|
|
13
13
|
$official : true
|
|
14
14
|
) {
|
|
@@ -20,12 +20,24 @@
|
|
|
20
20
|
@if $official { #{$property} : $value; }
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// This mixin is a shortcut for applying only a single experimental value
|
|
24
|
+
@mixin experimental-only-for($property, $value,
|
|
25
|
+
$moz : false,
|
|
26
|
+
$webkit : false,
|
|
27
|
+
$ms : false,
|
|
28
|
+
$o : false,
|
|
29
|
+
$khtml : false,
|
|
30
|
+
$official : false
|
|
31
|
+
) {
|
|
32
|
+
@include experimental($property, $value, $moz, $webkit, $o, $ms, $khtml, $official);
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
// Same as experimental(), but for cases when the property is the same and the value is vendorized
|
|
24
36
|
@mixin experimental-value($property, $value,
|
|
25
37
|
$moz : $experimental-support-for-mozilla,
|
|
26
38
|
$webkit : $experimental-support-for-webkit,
|
|
27
|
-
$o : $experimental-support-for-opera,
|
|
28
39
|
$ms : $experimental-support-for-microsoft,
|
|
40
|
+
$o : $experimental-support-for-opera,
|
|
29
41
|
$khtml : $experimental-support-for-khtml,
|
|
30
42
|
$official : true
|
|
31
43
|
) {
|
|
@@ -36,3 +48,215 @@
|
|
|
36
48
|
@if $o and $experimental-support-for-opera { #{$property} : -o-#{$value}; }
|
|
37
49
|
@if $official { #{$property} : #{$value}; }
|
|
38
50
|
}
|
|
51
|
+
|
|
52
|
+
// A debug tool for checking browser support
|
|
53
|
+
@mixin debug-support-matrix($experimental: true, $ie: true) {
|
|
54
|
+
@debug #{'$moz-'}$experimental-support-for-mozilla
|
|
55
|
+
#{'$webkit-'}$experimental-support-for-webkit
|
|
56
|
+
#{'$microsoft-'}$experimental-support-for-microsoft
|
|
57
|
+
#{'$opera-'}$experimental-support-for-opera
|
|
58
|
+
#{'$khtml-'}$experimental-support-for-khtml;
|
|
59
|
+
@debug #{'$ie6-'}$legacy-support-for-ie6
|
|
60
|
+
#{'$ie7-'}$legacy-support-for-ie7
|
|
61
|
+
#{'$ie8-'}$legacy-support-for-ie8;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Capture the current exerimental support settings
|
|
65
|
+
@function capture-experimental-matrix() {
|
|
66
|
+
@return $experimental-support-for-mozilla
|
|
67
|
+
$experimental-support-for-webkit
|
|
68
|
+
$experimental-support-for-microsoft
|
|
69
|
+
$experimental-support-for-opera
|
|
70
|
+
$experimental-support-for-khtml;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Capture the current legacy-ie support settings
|
|
74
|
+
@function capture-legacy-ie-matrix() {
|
|
75
|
+
@return $legacy-support-for-ie6
|
|
76
|
+
$legacy-support-for-ie7
|
|
77
|
+
$legacy-support-for-ie8;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Capture and store support
|
|
81
|
+
$experimental-matrix: capture-experimental-matrix();
|
|
82
|
+
$legacy-ie-matrix: capture-legacy-ie-matrix();
|
|
83
|
+
|
|
84
|
+
@mixin capture-experimental-matrix {
|
|
85
|
+
$experimental-matrix: capture-experimental-matrix();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@mixin capture-legacy-ie-matrix {
|
|
89
|
+
$legacy-ie-matrix: capture-legacy-ie-matrix();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@mixin capture-support-matrix {
|
|
93
|
+
@include capture-experimental-matrix;
|
|
94
|
+
@include capture-legacy-ie-matrix;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Change the experimental-support settings in specific contexts.
|
|
98
|
+
@mixin set-experimental-support(
|
|
99
|
+
$moz : false,
|
|
100
|
+
$webkit : false,
|
|
101
|
+
$ms : false,
|
|
102
|
+
$o : false,
|
|
103
|
+
$khtml : false
|
|
104
|
+
) {
|
|
105
|
+
$experimental-support-for-mozilla : $moz;
|
|
106
|
+
$experimental-support-for-webkit : $webkit;
|
|
107
|
+
$experimental-support-for-microsoft : $ms;
|
|
108
|
+
$experimental-support-for-opera : $o;
|
|
109
|
+
$experimental-support-for-khtml : $khtml;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@mixin capture-and-set-experimental(
|
|
113
|
+
$moz : false,
|
|
114
|
+
$webkit : false,
|
|
115
|
+
$ms : false,
|
|
116
|
+
$o : false,
|
|
117
|
+
$khtml : false
|
|
118
|
+
) {
|
|
119
|
+
@include capture-experimental-matrix;
|
|
120
|
+
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@mixin capture-and-adjust-experimental(
|
|
124
|
+
$moz : $experimental-support-for-mozilla,
|
|
125
|
+
$webkit : $experimental-support-for-webkit,
|
|
126
|
+
$ms : $experimental-support-for-microsoft,
|
|
127
|
+
$o : $experimental-support-for-opera,
|
|
128
|
+
$khtml : $experimental-support-for-khtml
|
|
129
|
+
) {
|
|
130
|
+
@include capture-experimental-matrix;
|
|
131
|
+
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Change the legacy-support-for-ie* settings in specific contexts.
|
|
135
|
+
@mixin set-legacy-ie-support(
|
|
136
|
+
$ie6: false,
|
|
137
|
+
$ie7: false,
|
|
138
|
+
$ie8: false
|
|
139
|
+
) {
|
|
140
|
+
$legacy-support-for-ie6: $ie6;
|
|
141
|
+
$legacy-support-for-ie7: $ie7;
|
|
142
|
+
$legacy-support-for-ie8: $ie8;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@mixin capture-and-set-legacy-ie(
|
|
146
|
+
$ie6: false,
|
|
147
|
+
$ie7: false,
|
|
148
|
+
$ie8: false
|
|
149
|
+
) {
|
|
150
|
+
@include capture-legacy-ie-matrix;
|
|
151
|
+
@include set-legacy-ie-support($ie6, $ie7, $ie8);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@mixin capture-and-adjust-legacy-ie(
|
|
155
|
+
$ie6: $legacy-support-for-ie6,
|
|
156
|
+
$ie7: $legacy-support-for-ie7,
|
|
157
|
+
$ie8: $legacy-support-for-ie8
|
|
158
|
+
) {
|
|
159
|
+
@include capture-and-set-legacy-ie($ie6, $ie7, $ie8);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Capture current browser support matrix, and set a new matrix of support.
|
|
163
|
+
@mixin capture-and-set-support(
|
|
164
|
+
$moz : false,
|
|
165
|
+
$webkit : false,
|
|
166
|
+
$ms : false,
|
|
167
|
+
$o : false,
|
|
168
|
+
$khtml : false,
|
|
169
|
+
$ie6 : false,
|
|
170
|
+
$ie7 : false,
|
|
171
|
+
$ie8 : false
|
|
172
|
+
) {
|
|
173
|
+
// Capture the current state
|
|
174
|
+
@include capture-support-matrix;
|
|
175
|
+
|
|
176
|
+
// Change support settings
|
|
177
|
+
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
|
|
178
|
+
@include set-legacy-ie-support($ie6, $ie7, $ie8);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Capture current browser support matrix, and set a new matrix of support.
|
|
182
|
+
@mixin capture-and-adjust-support(
|
|
183
|
+
$moz : $experimental-support-for-mozilla,
|
|
184
|
+
$webkit : $experimental-support-for-webkit,
|
|
185
|
+
$ms : $experimental-support-for-microsoft,
|
|
186
|
+
$o : $experimental-support-for-opera,
|
|
187
|
+
$khtml : $experimental-support-for-khtml,
|
|
188
|
+
$ie6 : $legacy-support-for-ie6,
|
|
189
|
+
$ie7 : $legacy-support-for-ie7,
|
|
190
|
+
$ie8 : $legacy-support-for-ie8
|
|
191
|
+
) {
|
|
192
|
+
@include capture-and-set-support($moz, $webkit, $ms, $o, $khtml, $ie6, $ie7, $ie8);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
// This mixin allows you to change the experimental support settings for
|
|
197
|
+
// child (@content) styles.
|
|
198
|
+
@mixin with-only-support-for(
|
|
199
|
+
$moz : false,
|
|
200
|
+
$webkit : false,
|
|
201
|
+
$ms : false,
|
|
202
|
+
$o : false,
|
|
203
|
+
$khtml : false,
|
|
204
|
+
$ie6 : false,
|
|
205
|
+
$ie7 : false,
|
|
206
|
+
$ie8 : false
|
|
207
|
+
) {
|
|
208
|
+
// Capture current state
|
|
209
|
+
$wo-experimental-matrix : capture-experimental-matrix();
|
|
210
|
+
$wo-legacy-ie-matrix : capture-legacy-ie-matrix();
|
|
211
|
+
|
|
212
|
+
// Set new states
|
|
213
|
+
@include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
|
|
214
|
+
@include set-legacy-ie-support($ie6, $ie7, $ie8);
|
|
215
|
+
|
|
216
|
+
// Apply styles
|
|
217
|
+
@content;
|
|
218
|
+
|
|
219
|
+
// Return to original support settings
|
|
220
|
+
@include set-experimental-support($wo-experimental-matrix...);
|
|
221
|
+
@include set-legacy-ie-support($wo-legacy-ie-matrix...);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// This mixin is a shortcut for making slight adjustments to browser support
|
|
225
|
+
// for child (@content) styles
|
|
226
|
+
@mixin adjust-support-for(
|
|
227
|
+
$moz : $experimental-support-for-mozilla,
|
|
228
|
+
$webkit : $experimental-support-for-webkit,
|
|
229
|
+
$ms : $experimental-support-for-microsoft,
|
|
230
|
+
$o : $experimental-support-for-opera,
|
|
231
|
+
$khtml : $experimental-support-for-khtml,
|
|
232
|
+
$ie6 : $legacy-support-for-ie6,
|
|
233
|
+
$ie7 : $legacy-support-for-ie7,
|
|
234
|
+
$ie8 : $legacy-support-for-ie8
|
|
235
|
+
) {
|
|
236
|
+
@include with-only-support-for($moz, $webkit, $ms, $o, $khtml, $ie6, $ie7, $ie8) {
|
|
237
|
+
@content;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Set a default value if the given arglist is empty
|
|
242
|
+
@function set-arglist-default(
|
|
243
|
+
$arglist,
|
|
244
|
+
$default
|
|
245
|
+
) {
|
|
246
|
+
$default: if(length($default) > 0, $default, null);
|
|
247
|
+
$output: compact();
|
|
248
|
+
@each $layer in $arglist {
|
|
249
|
+
$output: append($output, if($layer == 'default', $default, $layer));
|
|
250
|
+
}
|
|
251
|
+
@return if(length($output) > 0, $output, $default);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// @private Returns the legacy value for a given box-model
|
|
255
|
+
// - Used by background-clip and -origin.
|
|
256
|
+
@function legacy-box($box) {
|
|
257
|
+
$box: unquote($box);
|
|
258
|
+
@if $box == padding-box { $box: padding; }
|
|
259
|
+
@if $box == border-box { $box: border; }
|
|
260
|
+
@if $box == content-box { $box: content; }
|
|
261
|
+
@return $box;
|
|
262
|
+
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
// Text Shadow
|
|
2
|
+
|
|
1
3
|
@import "shared";
|
|
2
4
|
|
|
5
|
+
|
|
3
6
|
// These defaults make the arguments optional for this mixin
|
|
4
7
|
// If you like, set different defaults in your project
|
|
5
8
|
|
|
6
|
-
$default-text-shadow-color:
|
|
7
|
-
$default-text-shadow-h-offset: 0px
|
|
8
|
-
$default-text-shadow-v-offset: 0px
|
|
9
|
-
$default-text-shadow-blur:
|
|
10
|
-
$default-text-shadow-spread:
|
|
9
|
+
$default-text-shadow-color : #aaa !default;
|
|
10
|
+
$default-text-shadow-h-offset : 0px !default;
|
|
11
|
+
$default-text-shadow-v-offset : 0px !default;
|
|
12
|
+
$default-text-shadow-blur : 1px !default;
|
|
13
|
+
$default-text-shadow-spread : false !default;
|
|
14
|
+
|
|
11
15
|
|
|
12
16
|
// Provides cross-browser text shadows when one or more shadows are needed.
|
|
13
17
|
// Each shadow argument should adhere to the standard css3 syntax for the
|
|
@@ -18,32 +22,23 @@ $default-text-shadow-spread: false !default;
|
|
|
18
22
|
// then with the spread included. This allows you to progressively
|
|
19
23
|
// enhance the browsers that do support the spread parameter.
|
|
20
24
|
@mixin text-shadow(
|
|
21
|
-
$shadow
|
|
22
|
-
$shadow-2 : false,
|
|
23
|
-
$shadow-3 : false,
|
|
24
|
-
$shadow-4 : false,
|
|
25
|
-
$shadow-5 : false,
|
|
26
|
-
$shadow-6 : false,
|
|
27
|
-
$shadow-7 : false,
|
|
28
|
-
$shadow-8 : false,
|
|
29
|
-
$shadow-9 : false,
|
|
30
|
-
$shadow-10: false
|
|
25
|
+
$shadow...
|
|
31
26
|
) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
27
|
+
$shadow: if(length($shadow) > 0, $shadow, default);
|
|
28
|
+
$default: -compass-space-list(compact($default-text-shadow-h-offset $default-text-shadow-v-offset $default-text-shadow-blur $default-text-shadow-spread $default-text-shadow-color));
|
|
35
29
|
$shadows-without-spread: join((),(),comma);
|
|
36
30
|
$shadows: join((),(),comma);
|
|
37
31
|
$has-spread: false;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
|
|
33
|
+
@each $layer in $shadow {
|
|
34
|
+
$layer: if($layer == 'default', $default, $layer);
|
|
35
|
+
@if length($layer) > 4 {
|
|
41
36
|
$has-spread: true;
|
|
42
|
-
$shadows-without-spread: append($shadows-without-spread, nth($
|
|
43
|
-
$shadows: append($shadows, $
|
|
44
|
-
} else {
|
|
45
|
-
$shadows-without-spread: append($shadows-without-spread, $
|
|
46
|
-
$shadows: append($shadows, $
|
|
37
|
+
$shadows-without-spread: append($shadows-without-spread, nth($layer,1) nth($layer,2) nth($layer,3) nth($layer,5));
|
|
38
|
+
$shadows: append($shadows, $layer);
|
|
39
|
+
} @else {
|
|
40
|
+
$shadows-without-spread: append($shadows-without-spread, $layer);
|
|
41
|
+
$shadows: append($shadows, $layer);
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
44
|
@if $has-spread {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
@mixin apply-transform($transform) {
|
|
10
10
|
@include experimental(transform, $transform,
|
|
11
|
-
-moz, -webkit,
|
|
11
|
+
-moz, -webkit, not -ms, -o, not -khtml, official
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
@mixin apply-origin($origin) {
|
|
18
18
|
@include experimental(transform-origin, $origin,
|
|
19
|
-
-moz, -webkit,
|
|
19
|
+
-moz, -webkit, not -ms, -o, not -khtml, official
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
@include apply-origin($originx);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
|
|
37
37
|
// A full transform mixin with everything you could want
|
|
38
38
|
//
|
|
@@ -104,11 +104,11 @@ $default-skew-y : 5deg !default;
|
|
|
104
104
|
$only3d: $only3d or -compass-list-size(-compass-list($origin)) > 2;
|
|
105
105
|
@if $only3d {
|
|
106
106
|
@include experimental(transform-origin, $origin,
|
|
107
|
-
-moz, -webkit, -
|
|
107
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
108
108
|
);
|
|
109
109
|
} @else {
|
|
110
110
|
@include experimental(transform-origin, $origin,
|
|
111
|
-
-moz, -webkit, -
|
|
111
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -147,11 +147,11 @@ $default-skew-y : 5deg !default;
|
|
|
147
147
|
) {
|
|
148
148
|
@if $only3d {
|
|
149
149
|
@include experimental(transform, $transform,
|
|
150
|
-
-moz, -webkit, -
|
|
150
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
151
151
|
);
|
|
152
152
|
} @else {
|
|
153
153
|
@include experimental(transform, $transform,
|
|
154
|
-
-moz, -webkit, -
|
|
154
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -179,7 +179,7 @@ $default-skew-y : 5deg !default;
|
|
|
179
179
|
// values from 500 to 1000 are more-or-less "normal" - a good starting-point.
|
|
180
180
|
@mixin perspective($p) {
|
|
181
181
|
@include experimental(perspective, $p,
|
|
182
|
-
-moz, -webkit, -
|
|
182
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -190,7 +190,7 @@ $default-skew-y : 5deg !default;
|
|
|
190
190
|
// where the two arguments represent x/y coordinates
|
|
191
191
|
@mixin perspective-origin($origin: 50%) {
|
|
192
192
|
@include experimental(perspective-origin, $origin,
|
|
193
|
-
-moz, -webkit, -
|
|
193
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -202,7 +202,7 @@ $default-skew-y : 5deg !default;
|
|
|
202
202
|
// Browsers default to `flat`, mixin defaults to `preserve-3d`.
|
|
203
203
|
@mixin transform-style($style: preserve-3d) {
|
|
204
204
|
@include experimental(transform-style, $style,
|
|
205
|
-
-moz, -webkit, -
|
|
205
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -214,7 +214,7 @@ $default-skew-y : 5deg !default;
|
|
|
214
214
|
// Browsers default to visible, mixin defaults to hidden
|
|
215
215
|
@mixin backface-visibility($visibility: hidden) {
|
|
216
216
|
@include experimental(backface-visibility, $visibility,
|
|
217
|
-
-moz, -webkit, -
|
|
217
|
+
-moz, -webkit, -ms, -o, not -khtml, official
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -68,7 +68,7 @@ $transitionable-prefixed-values: transform, transform-origin !default;
|
|
|
68
68
|
@if type-of($duration-1) == string { $duration-1: unquote($duration-1); }
|
|
69
69
|
$durations: compact($duration-1, $duration-2, $duration-3, $duration-4, $duration-5, $duration-6, $duration-7, $duration-8, $duration-9, $duration-10);
|
|
70
70
|
@include experimental(transition-duration, $durations,
|
|
71
|
-
-moz, -webkit,
|
|
71
|
+
-moz, -webkit, not -ms, -o, not -khtml, official
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -92,7 +92,7 @@ $transitionable-prefixed-values: transform, transform-origin !default;
|
|
|
92
92
|
$function-1: unquote($function-1);
|
|
93
93
|
$functions: compact($function-1, $function-2, $function-3, $function-4, $function-5, $function-6, $function-7, $function-8, $function-9, $function-10);
|
|
94
94
|
@include experimental(transition-timing-function, $functions,
|
|
95
|
-
-moz, -webkit,
|
|
95
|
+
-moz, -webkit, not -ms, -o, not -khtml, official
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -115,7 +115,7 @@ $transitionable-prefixed-values: transform, transform-origin !default;
|
|
|
115
115
|
@if type-of($delay-1) == string { $delay-1: unquote($delay-1); }
|
|
116
116
|
$delays: compact($delay-1, $delay-2, $delay-3, $delay-4, $delay-5, $delay-6, $delay-7, $delay-8, $delay-9, $delay-10);
|
|
117
117
|
@include experimental(transition-delay, $delays,
|
|
118
|
-
-moz, -webkit,
|
|
118
|
+
-moz, -webkit, not -ms, -o, not -khtml, official
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
// User Interface
|
|
1
|
+
// User Interface
|
|
2
2
|
// This file can be expanded to handle all the user interface properties as
|
|
3
3
|
// they become available in browsers:
|
|
4
4
|
// http://www.w3.org/TR/2000/WD-css3-userint-20000216
|
|
5
|
+
|
|
5
6
|
@import "shared";
|
|
6
7
|
|
|
8
|
+
// @private css3-feature-support variables must always include a list of five boolean values
|
|
9
|
+
// representing in order: -moz, -webkit, -ms, -o, -khtml
|
|
10
|
+
// - mozilla support handled seperately below
|
|
11
|
+
$userselect-support: not -moz, -webkit, -ms, not -o, -khtml;
|
|
12
|
+
|
|
7
13
|
|
|
8
14
|
// This property controls the selection model and granularity of an element.
|
|
9
15
|
//
|
|
@@ -11,7 +17,40 @@
|
|
|
11
17
|
// [ none | text | toggle | element | elements | all | inherit ]
|
|
12
18
|
@mixin user-select($select) {
|
|
13
19
|
$select: unquote($select);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
|
|
21
|
+
@if $experimental-support-for-mozilla {
|
|
22
|
+
-moz-user-select: if($select == 'none', -moz-none, $select);
|
|
23
|
+
}
|
|
24
|
+
@include experimental(user-select, $select, $userselect-support...);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Style the html5 input placeholder in browsers that support it.
|
|
28
|
+
//
|
|
29
|
+
// There are two usage modes: at the stylesheet root, include the mixin with
|
|
30
|
+
// styles passed as mixin content. This applies to all elements. For example:
|
|
31
|
+
//
|
|
32
|
+
// @include input-placeholder {
|
|
33
|
+
// color: #bfbfbf;
|
|
34
|
+
// font-style: italic;
|
|
35
|
+
// }
|
|
36
|
+
//
|
|
37
|
+
// If a specific element is being styled, pass "&" as an argument to the mixin
|
|
38
|
+
// as well. For example:
|
|
39
|
+
//
|
|
40
|
+
// .textinput {
|
|
41
|
+
// @include input-placeholder("&") {
|
|
42
|
+
// color: #bfbfbf;
|
|
43
|
+
// font-style: italic;
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
@mixin input-placeholder($selector: "") {
|
|
47
|
+
@if $experimental-support-for-webkit {
|
|
48
|
+
#{$selector}::-webkit-input-placeholder { @content; }
|
|
49
|
+
}
|
|
50
|
+
@if $experimental-support-for-mozilla {
|
|
51
|
+
#{$selector}:-moz-placeholder { @content; }
|
|
52
|
+
}
|
|
53
|
+
@if $experimental-support-for-microsoft {
|
|
54
|
+
#{$selector}:-ms-input-placeholder { @content; }
|
|
55
|
+
}
|
|
17
56
|
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// @private Default font-size for all browsers
|
|
2
|
+
$browser-default-font-size: 16px;
|
|
3
|
+
|
|
4
|
+
// Base font size in pixels, if not already defined.
|
|
5
|
+
// Should be the same as the font-size of the html element.
|
|
6
|
+
$base-font-size: 16px !default;
|
|
7
|
+
|
|
8
|
+
// Whether to output fallback values in px when outputting rems.
|
|
9
|
+
$rem-with-px-fallback: true !default;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// Convert any CSS <length> or <percentage> value to any another.
|
|
13
|
+
//
|
|
14
|
+
// @param $length
|
|
15
|
+
// A css <length> or <percentage> value
|
|
16
|
+
//
|
|
17
|
+
// @param $to-unit
|
|
18
|
+
// String matching a css unit keyword, e.g. 'em', '%', etc.
|
|
19
|
+
//
|
|
20
|
+
// @param $from-context
|
|
21
|
+
// When converting from relative units, the absolute length (in px) to
|
|
22
|
+
// which $length refers (e.g. for $lengths in em units, would normally be the
|
|
23
|
+
// font-size of the current element).
|
|
24
|
+
//
|
|
25
|
+
// @param $to-context
|
|
26
|
+
// For converting to relative units, the absolute length in px to which the
|
|
27
|
+
// output value will refer. Defaults to the same as $from-context, since it is
|
|
28
|
+
// rarely needed.
|
|
29
|
+
@function convert-length(
|
|
30
|
+
$length,
|
|
31
|
+
$to-unit,
|
|
32
|
+
$from-context: $base-font-size,
|
|
33
|
+
$to-context: $from-context
|
|
34
|
+
) {
|
|
35
|
+
|
|
36
|
+
$from-unit: unit($length);
|
|
37
|
+
|
|
38
|
+
// Optimize for cases where `from` and `to` units are accidentally the same.
|
|
39
|
+
@if $from-unit == $to-unit { @return $length; }
|
|
40
|
+
|
|
41
|
+
// Context values must be in px so we can determine a conversion ratio for
|
|
42
|
+
// relative units.
|
|
43
|
+
@if unit($from-context) != 'px' { @warn "Paremeter $from-context must resolve to a value in pixel units."; }
|
|
44
|
+
@if unit($to-context) != 'px' { @warn "Parameter $to-context must resolve to a value in pixel units."; }
|
|
45
|
+
|
|
46
|
+
// Convert input length to pixels
|
|
47
|
+
$px-length: $length;
|
|
48
|
+
|
|
49
|
+
@if $from-unit != 'px' {
|
|
50
|
+
// Convert relative units using the from-context parameter.
|
|
51
|
+
@if $from-unit == 'em' { $px-length: $length * $from-context / 1em }
|
|
52
|
+
@else if $from-unit == 'rem' { $px-length: $length * $base-font-size / 1rem }
|
|
53
|
+
@else if $from-unit == '%' { $px-length: $length * $from-context / 100% }
|
|
54
|
+
@else if $from-unit == 'ex' { $px-length: $length * $from-context / 2ex }
|
|
55
|
+
// Convert absolute units using Sass' conversion table.
|
|
56
|
+
@else if $from-unit == 'in' or
|
|
57
|
+
$from-unit == 'mm' or
|
|
58
|
+
$from-unit == 'cm' or
|
|
59
|
+
$from-unit == 'pt' or
|
|
60
|
+
$from-unit == 'pc' { $px-length: 0px + $length }
|
|
61
|
+
// Certain units can't be converted.
|
|
62
|
+
@else if $from-unit == 'ch' or
|
|
63
|
+
$from-unit == 'vw' or
|
|
64
|
+
$from-unit == 'vh' or
|
|
65
|
+
$from-unit == 'vmin' {
|
|
66
|
+
@warn "#{$from-unit} units can't be reliably converted; Returning original value.";
|
|
67
|
+
@return $length;
|
|
68
|
+
}
|
|
69
|
+
@else {
|
|
70
|
+
@warn "#{$from-unit} is an unknown length unit. Returning original value.";
|
|
71
|
+
@return $length;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Convert length in pixels to the output unit
|
|
76
|
+
$output-length: $px-length;
|
|
77
|
+
@if $to-unit != 'px' {
|
|
78
|
+
// Relative units
|
|
79
|
+
@if $to-unit == 'em' { $output-length: $px-length * 1em / $to-context }
|
|
80
|
+
@else if $to-unit == 'rem' { $output-length: $px-length * 1rem / $base-font-size }
|
|
81
|
+
@else if $to-unit == '%' { $output-length: $px-length * 100% / $to-context }
|
|
82
|
+
@else if $to-unit == 'ex' { $output-length: $px-length * 2ex / $to-context }
|
|
83
|
+
// Absolute units
|
|
84
|
+
@else if $to-unit == 'in' { $output-length: 0in + $px-length }
|
|
85
|
+
@else if $to-unit == 'mm' { $output-length: 0mm + $px-length }
|
|
86
|
+
@else if $to-unit == 'cm' { $output-length: 0cm + $px-length }
|
|
87
|
+
@else if $to-unit == 'pt' { $output-length: 0pt + $px-length }
|
|
88
|
+
@else if $to-unit == 'pc' { $output-length: 0pc + $px-length }
|
|
89
|
+
// Non-convertible units
|
|
90
|
+
@else if $to-unit == 'ch' or
|
|
91
|
+
$to-unit == 'vw' or
|
|
92
|
+
$to-unit == 'vh' or
|
|
93
|
+
$to-unit == 'vmin' {
|
|
94
|
+
@warn "#{$to-unit} units can't be reliably converted; Returning original value.";
|
|
95
|
+
@return $length;
|
|
96
|
+
}
|
|
97
|
+
@else {
|
|
98
|
+
@warn "#{$to-unit} is an unknown length unit. Returning original value.";
|
|
99
|
+
@return $length;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@return $output-length;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// Output a given style rule containing rem values along with an (optional)
|
|
108
|
+
// fallback rule for older browsers (with rem values converted to px).
|
|
109
|
+
//
|
|
110
|
+
// @param $property
|
|
111
|
+
// The css property name.
|
|
112
|
+
//
|
|
113
|
+
// @param $values
|
|
114
|
+
// The value (or space-separated list of values) for the property.
|
|
115
|
+
//
|
|
116
|
+
// @param $use-px-fallback
|
|
117
|
+
// [ true | false ]
|
|
118
|
+
//
|
|
119
|
+
@mixin rem($property, $values, $use-px-fallback: $rem-with-px-fallback) {
|
|
120
|
+
// Create a couple of empty lists as output buffers.
|
|
121
|
+
$px-values: ();
|
|
122
|
+
$rem-values: ();
|
|
123
|
+
|
|
124
|
+
// Loop through the $values list
|
|
125
|
+
@each $value in $values {
|
|
126
|
+
// For each property value, if it's in rem or px, derive both rem and
|
|
127
|
+
// px values for it and add those to the end of the appropriate buffer.
|
|
128
|
+
// Ensure all pixel values are rounded to the nearest pixel.
|
|
129
|
+
@if type-of($value) == number and not unitless($value) and (unit($value) == px or unit($value) == rem) {
|
|
130
|
+
@if unit($value) == px {
|
|
131
|
+
$px-values: join($px-values, round($value));
|
|
132
|
+
$rem-values: join($rem-values, convert-length($value, rem));
|
|
133
|
+
}
|
|
134
|
+
@else {
|
|
135
|
+
$px-values: join($px-values, round(convert-length($value, px)));
|
|
136
|
+
$rem-values: join($rem-values, $value);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
@else {
|
|
140
|
+
$px-values: join($px-values, $value);
|
|
141
|
+
$rem-values: join($rem-values, $value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Use pixel fallback for browsers that don't understand rem units.
|
|
146
|
+
@if $use-px-fallback {
|
|
147
|
+
#{$property}: $px-values;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Use rem values for everyone else (overrides pixel values).
|
|
151
|
+
#{$property}: $rem-values;
|
|
152
|
+
}
|