compass 0.13.alpha.4 → 0.13.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/README.markdown +2 -3
  3. data/Rakefile +91 -5
  4. data/VERSION.yml +1 -1
  5. data/examples/compass/images/emblem-a043c4f148.png +0 -0
  6. data/examples/compass/images/flag-03c3b29b35.png +0 -0
  7. data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
  8. data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
  9. data/features/command_line.feature +2 -6
  10. data/features/step_definitions/command_line_steps.rb +1 -0
  11. data/frameworks/compass/stylesheets/compass/_css3.scss +0 -1
  12. data/frameworks/compass/stylesheets/compass/_support.scss +353 -35
  13. data/frameworks/compass/stylesheets/compass/css3/_animation.scss +49 -48
  14. data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +4 -8
  15. data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +15 -19
  16. data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +17 -19
  17. data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +4 -8
  18. data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +37 -39
  19. data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +45 -20
  20. data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +6 -8
  21. data/frameworks/compass/stylesheets/compass/css3/_box.scss +12 -13
  22. data/frameworks/compass/stylesheets/compass/css3/_columns.scss +46 -26
  23. data/frameworks/compass/stylesheets/compass/css3/_deprecated-support.scss +272 -0
  24. data/frameworks/compass/stylesheets/compass/css3/_filter.scss +17 -10
  25. data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +134 -281
  26. data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +5 -5
  27. data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +14 -11
  28. data/frameworks/compass/stylesheets/compass/css3/_images.scss +77 -67
  29. data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +15 -6
  30. data/frameworks/compass/stylesheets/compass/css3/_opacity.scss +6 -2
  31. data/frameworks/compass/stylesheets/compass/css3/_pie.scss +1 -73
  32. data/frameworks/compass/stylesheets/compass/css3/_regions.scss +7 -6
  33. data/frameworks/compass/stylesheets/compass/css3/_selection.scss +45 -17
  34. data/frameworks/compass/stylesheets/compass/css3/_shared.scss +4 -261
  35. data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +1 -1
  36. data/frameworks/compass/stylesheets/compass/css3/_transform.scss +24 -32
  37. data/frameworks/compass/stylesheets/compass/css3/_transition.scss +102 -152
  38. data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +42 -27
  39. data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +2 -1
  40. data/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss +1 -1
  41. data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +2 -2
  42. data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +1 -1
  43. data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
  44. data/frameworks/compass/stylesheets/compass/utilities/_sass.scss +2 -0
  45. data/frameworks/compass/stylesheets/compass/utilities/color/_brightness.scss +12 -0
  46. data/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss +36 -12
  47. data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +6 -2
  48. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +23 -4
  49. data/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +1 -1
  50. data/frameworks/compass/stylesheets/compass/utilities/sass/_lists.scss +16 -0
  51. data/frameworks/compass/stylesheets/compass/utilities/sass/_maps.scss +19 -0
  52. data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +25 -18
  53. data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +3 -1
  54. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +3 -3
  55. data/lib/compass.rb +1 -1
  56. data/lib/compass/browser_support.rb +1 -1
  57. data/lib/compass/caniuse.rb +247 -0
  58. data/lib/compass/configuration/adapters.rb +7 -1
  59. data/lib/compass/sass_extensions/functions.rb +5 -0
  60. data/lib/compass/sass_extensions/functions/constants.rb +2 -2
  61. data/lib/compass/sass_extensions/functions/cross_browser_support.rb +176 -1
  62. data/lib/compass/sass_extensions/functions/display.rb +24 -19
  63. data/lib/compass/sass_extensions/functions/env.rb +37 -8
  64. data/lib/compass/sass_extensions/functions/gradient_support.rb +10 -13
  65. data/lib/compass/sass_extensions/functions/math.rb +31 -13
  66. data/lib/compass/sass_extensions/functions/sprites.rb +48 -25
  67. data/lib/compass/sass_extensions/monkey_patches/browser_support.rb +42 -13
  68. data/lib/compass/sass_extensions/sprites/image.rb +14 -4
  69. data/lib/compass/sass_extensions/sprites/image_methods.rb +19 -3
  70. data/lib/compass/sprite_importer/content.erb +8 -7
  71. data/lib/compass/watcher/project_watcher.rb +75 -42
  72. data/lib/compass/watcher/watch.rb +35 -17
  73. data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
  74. data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
  75. data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
  76. data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
  77. data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
  78. data/test/fixtures/stylesheets/compass/config.rb +1 -0
  79. data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +1 -9
  80. data/test/fixtures/stylesheets/compass/css/animation.css +1 -9
  81. data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
  82. data/test/fixtures/stylesheets/compass/css/background-clip.css +4 -8
  83. data/test/fixtures/stylesheets/compass/css/background-origin.css +4 -8
  84. data/test/fixtures/stylesheets/compass/css/background-size.css +3 -10
  85. data/test/fixtures/stylesheets/compass/css/border_radius.css +3 -3
  86. data/test/fixtures/stylesheets/compass/css/{box-sizeing.css → box-sizing.css} +2 -2
  87. data/test/fixtures/stylesheets/compass/css/box_shadow.css +15 -5
  88. data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
  89. data/test/fixtures/stylesheets/compass/css/browser-support.css +306 -0
  90. data/test/fixtures/stylesheets/compass/css/color.css +18 -0
  91. data/test/fixtures/stylesheets/compass/css/columns.css +27 -18
  92. data/test/fixtures/stylesheets/compass/css/filters.css +6 -6
  93. data/test/fixtures/stylesheets/compass/css/flexbox.css +84 -111
  94. data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
  95. data/test/fixtures/stylesheets/compass/css/gradients.css +53 -53
  96. data/test/fixtures/stylesheets/compass/css/grid_background.css +11 -11
  97. data/test/fixtures/stylesheets/compass/css/hyphenation.css +2 -4
  98. data/test/fixtures/stylesheets/compass/css/lists.css +6 -12
  99. data/test/fixtures/stylesheets/compass/css/regions.css +2 -2
  100. data/test/fixtures/stylesheets/compass/css/selection.css +41 -4
  101. data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +16 -0
  102. data/test/fixtures/stylesheets/compass/css/support.css +62 -0
  103. data/test/fixtures/stylesheets/compass/css/transform.css +64 -136
  104. data/test/fixtures/stylesheets/compass/css/transition.css +27 -45
  105. data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
  106. data/test/fixtures/stylesheets/compass/css/user-interface.css +34 -7
  107. data/test/fixtures/stylesheets/compass/css/utilities.css +7 -7
  108. data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +6 -9
  109. data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
  110. data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
  111. data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
  112. data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
  113. data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
  114. data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
  115. data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +1 -3
  116. data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
  117. data/test/fixtures/stylesheets/compass/sass/background-clip.scss +0 -5
  118. data/test/fixtures/stylesheets/compass/sass/background-origin.scss +0 -5
  119. data/test/fixtures/stylesheets/compass/sass/background-size.scss +0 -5
  120. data/test/fixtures/stylesheets/compass/sass/{box-sizeing.scss → box-sizing.scss} +1 -1
  121. data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +2 -0
  122. data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
  123. data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
  124. data/test/fixtures/stylesheets/compass/sass/color.scss +22 -0
  125. data/test/fixtures/stylesheets/compass/sass/filters.scss +1 -0
  126. data/test/fixtures/stylesheets/compass/sass/flexbox.scss +84 -40
  127. data/test/fixtures/stylesheets/compass/sass/gradients.sass +3 -2
  128. data/test/fixtures/stylesheets/compass/sass/selection.scss +29 -4
  129. data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +7 -0
  130. data/test/fixtures/stylesheets/compass/sass/support.scss +137 -0
  131. data/test/fixtures/stylesheets/compass/sass/transition.scss +0 -3
  132. data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
  133. data/test/fixtures/stylesheets/compass/sass/user-interface.scss +16 -5
  134. data/test/fixtures/stylesheets/compass/sass/utilities.scss +4 -4
  135. data/test/fixtures/stylesheets/envtest/css/env.css +4 -4
  136. data/test/fixtures/stylesheets/envtest/tmp/env.css +4 -4
  137. data/test/integrations/sprites_test.rb +30 -1
  138. data/test/test_helper.rb +2 -2
  139. data/test/units/caniuse_test.rb +115 -0
  140. data/test/units/command_line_test.rb +1 -0
  141. data/test/units/sass_extensions_test.rb +5 -0
  142. data/test/units/sprites/image_test.rb +12 -0
  143. data/test/units/sprites/sprite_map_test.rb +11 -0
  144. data/test/units/watcher/project_watcher_test.rb +26 -18
  145. metadata +96 -42
  146. data/examples/compass/src/pie.scss +0 -110
  147. data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +0 -87
  148. data/frameworks/compass/templates/pie/LICENSE +0 -12
  149. data/frameworks/compass/templates/pie/LICENSE-APACHE2.txt +0 -13
  150. data/frameworks/compass/templates/pie/LICENSE-GPL2.txt +0 -278
  151. data/frameworks/compass/templates/pie/PIE.htc +0 -96
  152. data/frameworks/compass/templates/pie/manifest.rb +0 -39
  153. data/frameworks/compass/templates/pie/pie.scss +0 -74
  154. data/lib/compass/sass_extensions/functions/utility.rb +0 -10
  155. data/test/fixtures/stylesheets/compass/css/pie.css +0 -23
  156. data/test/fixtures/stylesheets/compass/sass/pie.scss +0 -47
@@ -3,13 +3,11 @@
3
3
  // they become available in browsers:
4
4
  // http://www.w3.org/TR/2000/WD-css3-userint-20000216
5
5
 
6
- @import "shared";
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;
6
+ @import "compass/support";
12
7
 
8
+ // The prefixed support threshold for user-select.
9
+ // Defaults to the $graceful-usage-threshold.
10
+ $userselect-support-threshold: $graceful-usage-threshold !default;
13
11
 
14
12
  // This property controls the selection model and granularity of an element.
15
13
  //
@@ -18,39 +16,56 @@ $userselect-support: not -moz, -webkit, -ms, not -o, -khtml;
18
16
  @mixin user-select($select) {
19
17
  $select: unquote($select);
20
18
 
21
- @if $experimental-support-for-mozilla {
22
- -moz-user-select: if($select == 'none', -moz-none, $select);
19
+ @include with-each-prefix(user-select-none, $userselect-support-threshold) {
20
+ // old Firefox used a proprietary `-moz-none` value, starting with Firefox 21 `none` behaves like `-moz-none`
21
+ // @link https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
22
+ @include prefix-prop(user-select, if($current-prefix == -moz and $select == 'none', -moz-none, $select));
23
23
  }
24
- @include experimental(user-select, $select, $userselect-support...);
25
24
  }
26
25
 
26
+ // The prefixed support threshold for input-placeholder.
27
+ // Defaults to the $graceful-usage-threshold.
28
+ $input-placeholder-support-threshold: $graceful-usage-threshold !default;
29
+
27
30
  // Style the html5 input placeholder in browsers that support it.
28
31
  //
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:
32
+ // The styles for the input placeholder are passed as mixin content
33
+ // and the selector comes from the mixin's context.
31
34
  //
32
- // @include input-placeholder {
33
- // color: #bfbfbf;
34
- // font-style: italic;
35
+ // For example:
36
+ //
37
+ // #{elements-of-type(text-input)} {
38
+ // @include input-placeholder {
39
+ // color: #bfbfbf;
40
+ // font-style: italic;
41
+ // }
35
42
  // }
36
43
  //
37
- // If a specific element is being styled, pass "&" as an argument to the mixin
38
- // as well. For example:
44
+ // if you want to apply the placeholder styles to all elements supporting
45
+ // the `input-placeholder` psuedoclass (beware of performance impacts):
39
46
  //
40
- // .textinput {
41
- // @include input-placeholder("&") {
47
+ // * {
48
+ // @include input-placeholder {
42
49
  // color: #bfbfbf;
43
50
  // font-style: italic;
44
51
  // }
45
52
  // }
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; }
53
+ @mixin input-placeholder {
54
+ @include with-each-prefix(css-placeholder, $input-placeholder-support-threshold) {
55
+ @if $current-prefix == -webkit {
56
+ &::-webkit-input-placeholder { @content; }
57
+ }
58
+ @elseif $current-prefix == -moz {
59
+ // for Firefox 19 and below
60
+ @if support-legacy-browser("firefox", "19", $input-placeholder-support-threshold) {
61
+ &:-moz-placeholder { @content; }
62
+ }
63
+ // for Firefox 20 and above
64
+ &::-moz-placeholder { @content; }
65
+ }
66
+ @elseif $current-prefix == -ms {
67
+ &:-ms-input-placeholder { @content; }
68
+ }
55
69
  }
70
+ // This is not standardized yet so no official selector is generated.
56
71
  }
@@ -1,3 +1,4 @@
1
+ @import "compass/support";
1
2
  @import "compass/layout/grid-background";
2
3
  @import "compass/typography/units";
3
4
 
@@ -96,7 +97,7 @@ $relative-font-sizing: if($rhythm-unit == px, false, true);
96
97
  @mixin establish-baseline($font-size: $base-font-size) {
97
98
  $relative-size: 100% * ($font-size / $browser-default-font-size);
98
99
 
99
- @if $legacy-support-for-ie6 and (not $relative-font-sizing) {
100
+ @if support-legacy-browser(ie, "6") and (not $relative-font-sizing) {
100
101
  // IE 6 refuses to resize fonts set in pixels and it weirdly resizes fonts
101
102
  // whose root is set in ems. So we set the root font size in percentages of
102
103
  // the default font size, even if we are using absolute sizes elsewhere.
@@ -1,5 +1,5 @@
1
1
  // a link that only has an underline when you hover over it
2
2
  @mixin hover-link {
3
3
  text-decoration: none;
4
- &:hover {
4
+ &:hover, &:focus {
5
5
  text-decoration: underline; } }
@@ -46,9 +46,9 @@
46
46
  left: $padding;
47
47
  right: $padding;
48
48
  }
49
- &:first-child #{if($legacy-support-for-ie6, ', &.first', '')} { padding-#{$direction}: 0; }
49
+ &:first-child #{if(support-legacy-browser("ie", "6", $css-sel2-support-threshold), ', &.first', '')} { padding-#{$direction}: 0; }
50
50
  &:last-child { padding-#{opposite-position($direction)}: 0; }
51
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
51
+ @if support-legacy-browser("ie", "7", $css-sel2-support-threshold) {
52
52
  &.last { padding-#{opposite-position($direction)}: 0; } }
53
53
  }
54
54
  }
@@ -31,7 +31,7 @@
31
31
  &:last-child {
32
32
  &:after { content: ""; }
33
33
  }
34
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
34
+ @if support-legacy-browser("ie", "7", $css-sel2-support-threshold) {
35
35
  &.last {
36
36
  &:after { content: ""; }
37
37
  }
@@ -1,4 +1,4 @@
1
- @import "compass/css3/shared";
1
+ @import "compass/css3/deprecated-support";
2
2
 
3
3
  // To get full firefox support, you must install the ellipsis pattern:
4
4
  //
@@ -0,0 +1,2 @@
1
+ @import "sass/lists";
2
+ @import "sass/maps";
@@ -0,0 +1,12 @@
1
+ // Computes the "brightness" of a color
2
+ //
3
+ // Brightness is similiar to lightness in HSL but more closely approximates
4
+ // how humans perceive the intensity of the different RGB components of
5
+ // a color. Brightness is sometimes called luminance.
6
+ //
7
+ // Returns a number between 0% and 100%, where 100% is fully bright
8
+ // (white) and 0% is fully dark (black).
9
+ @function brightness($color) {
10
+ @return ((red($color) * .299) + (green($color) * .587) + (blue($color) * .114)) / 255 * 100%;
11
+ }
12
+
@@ -1,28 +1,52 @@
1
+ @import "compass/utilities/color/brightness";
2
+
1
3
  $contrasted-dark-default: #000 !default;
2
4
  $contrasted-light-default: #fff !default;
3
- $contrasted-lightness-threshold: 30% !default;
4
5
 
5
- // Returns the `$light` color when the `$color` is dark
6
- // and the `$dark` color when the `$color` is light.
7
- // The `$threshold` is a percent between `0%` and `100%` and it determines
8
- // when the lightness of `$color` changes from "dark" to "light".
6
+ // Returns either the `$light` or `$dark` color
7
+ // by deciding which contrasts more with `$color`.
8
+ //
9
+ // E.g. This can be used to select the more readable foreground color
10
+ // for a given background color.
11
+ //
12
+ // `$dark` defaults to black and `$light` defaults to white.
13
+ //
14
+ // When `$color` is `null`, this function returns `null`.
9
15
  @function contrast-color(
10
16
  $color,
11
17
  $dark: $contrasted-dark-default,
12
18
  $light: $contrasted-light-default,
13
- $threshold: $contrasted-lightness-threshold
19
+ $threshold: null
14
20
  ) {
15
- @return if(lightness($color) < $threshold, $light, $dark)
21
+ @if $threshold {
22
+ // Deprecated in Compass 0.13
23
+ @warn "The $threshold argment to contrast-color is no longer needed and will be removed in the next release."
24
+ }
25
+ @if $color == null {
26
+ @return null;
27
+ }
28
+ @else {
29
+ $color-brightness: brightness($color);
30
+ $dark-text-brightness: brightness($dark);
31
+ $light-text-brightness: brightness($light);
32
+
33
+ @return if(abs($color-brightness - $light-text-brightness) > abs($color-brightness - $dark-text-brightness), $light, $dark);
34
+ }
16
35
  }
17
36
 
18
- // Sets the specified background color and calculates a dark or light contrasted text color.
19
- // The arguments are passed through to the [contrast-color function](#function-contrast-color).
37
+ // Sets the specified background color and calculates a dark or light
38
+ // contrasted text color. The arguments are passed through to the
39
+ // [contrast-color function](#function-contrast-color).
20
40
  @mixin contrasted(
21
41
  $background-color,
22
42
  $dark: $contrasted-dark-default,
23
43
  $light: $contrasted-light-default,
24
- $threshold: $contrasted-lightness-threshold
44
+ $threshold: null
25
45
  ) {
46
+ @if $threshold {
47
+ // Deprecated in Compass 0.13
48
+ @warn "The $threshold argment to contrasted is no longer needed and will be removed in the next release."
49
+ }
26
50
  background-color: $background-color;
27
- color: contrast-color($background-color, $dark, $light, $threshold);
28
- }
51
+ color: contrast-color($background-color, $dark, $light);
52
+ }
@@ -1,5 +1,9 @@
1
1
  @import "compass/support";
2
2
 
3
+ // The legacy support threshold for float.
4
+ // Defaults to the $critical-usage-threshold.
5
+ $legacy-float-support-threshold: $critical-usage-threshold !default;
6
+
3
7
  // Implementation of float:left with fix for the
4
8
  // [double-margin bug in IE5/6](http://www.positioniseverything.net/explorer/doubled-margin.html)
5
9
  @mixin float-left {
@@ -14,7 +18,7 @@
14
18
  // [double-margin bug in IE5/6](http://www.positioniseverything.net/explorer/doubled-margin.html)
15
19
  @mixin float($side: left) {
16
20
  float: unquote($side);
17
- @if $legacy-support-for-ie6 {
21
+ @if support-legacy-browser("ie", "6", $legacy-float-support-threshold) {
18
22
  display: inline; } }
19
23
 
20
24
  // Resets floated elements back to their default of `float: none` and defaults
@@ -30,5 +34,5 @@
30
34
  // +reset-float
31
35
  @mixin reset-float($display: block) {
32
36
  float: none;
33
- @if $legacy-support-for-ie6 {
37
+ @if support-legacy-browser("ie", "6", $legacy-float-support-threshold) {
34
38
  display: $display; } }
@@ -1,5 +1,9 @@
1
1
  @import "compass/support";
2
2
 
3
+ // The legacy support threshold for has-layout.
4
+ // Defaults to the $critical-usage-threshold.
5
+ $has-layout-support-threshold: $critical-usage-threshold !default;
6
+
3
7
  // The `zoom` approach generates less CSS but does not validate.
4
8
  // Set this to `block` to use the display-property to hack the
5
9
  // element to gain layout.
@@ -9,7 +13,7 @@ $default-has-layout-approach: zoom !default;
9
13
  // to gain the "hasLayout" property in internet explorer.
10
14
  // More information on [hasLayout](http://reference.sitepoint.com/css/haslayout).
11
15
  @mixin has-layout($approach: $default-has-layout-approach) {
12
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
16
+ @if support-legacy-browser("ie", "7", $has-layout-support-threshold) {
13
17
  @if $approach == zoom {
14
18
  @include has-layout-zoom;
15
19
  } @else if $approach == block {
@@ -22,13 +26,13 @@ $default-has-layout-approach: zoom !default;
22
26
  }
23
27
 
24
28
  @mixin has-layout-zoom {
25
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
29
+ @if support-legacy-browser("ie", "7", $has-layout-support-threshold) {
26
30
  *zoom: 1;
27
31
  }
28
32
  }
29
33
 
30
34
  @mixin has-layout-block {
31
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
35
+ @if support-legacy-browser("ie", "7", $has-layout-support-threshold) {
32
36
  // This makes ie6 get layout
33
37
  display: inline-block;
34
38
  // and this puts it back to block
@@ -36,11 +40,26 @@ $default-has-layout-approach: zoom !default;
36
40
  }
37
41
  }
38
42
 
43
+
44
+ // The legacy support threshold for IE6 attribute hack.
45
+ // Defaults to the $critical-usage-threshold.
46
+ $ie6-attribute-hack-support-threshold: $critical-usage-threshold !default;
47
+
39
48
  // A hack to supply IE6 (and below) with a different property value.
40
49
  // [Read more](http://www.cssportal.com/css-hacks/#in_css-important).
41
50
  @mixin bang-hack($property, $value, $ie6-value) {
42
- @if $legacy-support-for-ie6 {
51
+ @if support-legacy-browser("ie", "6", $ie6-attribute-hack-support-threshold) {
52
+ @warn "it's recommended to use the underscore-hack() mixin instead of bang-hack()";
43
53
  #{$property}: #{$value} !important;
44
54
  #{$property}: #{$ie6-value};
45
55
  }
46
56
  }
57
+
58
+ // A hack to supply IE6 (and below) with a different property value.
59
+ // [Read more](http://www.paulirish.com/2009/browser-specific-css-hacks/)
60
+ @mixin underscore-hack($property, $value, $ie6-value) {
61
+ @if support-legacy-browser("ie", "6", $ie6-attribute-hack-support-threshold) {
62
+ #{$property}: #{$value};
63
+ _#{$property}: #{$ie6-value};
64
+ }
65
+ }
@@ -13,4 +13,4 @@
13
13
  // @private This mixin is not meant to be used directly.
14
14
  @mixin hacked-minimum($property, $value) {
15
15
  min-#{$property}: $value;
16
- @include bang-hack($property, auto, $value); }
16
+ @include underscore-hack($property, auto, $value); }
@@ -0,0 +1,16 @@
1
+ @function newline() {
2
+ @return "
3
+ ";
4
+ }
5
+
6
+ // Joins a list into a string with the separator given.
7
+ @function list-join($list, $separator: ", ") {
8
+ $result: "";
9
+ @each $value in $list {
10
+ @if str-length($result) > 0 {
11
+ $result: $result + $separator;
12
+ }
13
+ $result: $result + #{$value};
14
+ }
15
+ @return $result;
16
+ }
@@ -0,0 +1,19 @@
1
+ // Returns true if a $map is a superset of $sub-map.
2
+ @function map-contains-all($map, $sub-map) {
3
+ @each $key, $value in $sub-map {
4
+ @if not (map-has-key($map, $key) and map-get($map, $key) == $value) {
5
+ @return false;
6
+ }
7
+ }
8
+ @return true;
9
+ }
10
+
11
+ // Returns true if a $map has any key-value pair in $sub-map.
12
+ @function map-contains-any($map, $sub-map) {
13
+ @each $key, $value in $sub-map {
14
+ @if map-has-key($map, $key) and map-get($map, $key) == $value {
15
+ @return true;
16
+ }
17
+ }
18
+ @return false;
19
+ }
@@ -1,5 +1,5 @@
1
1
  // Determines those states for which you want to enable magic sprite selectors
2
- $sprite-selectors: hover, target, active !default;
2
+ $sprite-selectors: hover, target, active, focus !default;
3
3
 
4
4
  // Set the width and height of an element to the original
5
5
  // dimensions of an image before it was included in the sprite.
@@ -21,7 +21,10 @@ $use-percentages: false) {
21
21
 
22
22
 
23
23
  // Determines if you want to include magic selectors in your sprites
24
- $disable-magic-sprite-selectors:false !default;
24
+ $disable-magic-sprite-selectors: false !default;
25
+
26
+ // Set this to underscore if you prefer
27
+ $default-sprite-separator: "-" !default;
25
28
 
26
29
  // Include the position and (optionally) dimensions of this `$sprite`
27
30
  // in the given sprite `$map`. The sprite url should come from either a base
@@ -29,15 +32,17 @@ $disable-magic-sprite-selectors:false !default;
29
32
  //
30
33
  // background: $map no-repeat;
31
34
  @mixin sprite($map, $sprite, $dimensions: false, $offset-x: 0, $offset-y: 0,
32
- $use-percentages: false) {
35
+ $use-percentages: false,
36
+ $use-magic-selectors: not $disable-magic-sprite-selectors,
37
+ $separator: $default-sprite-separator) {
33
38
  @include sprite-background-position($map, $sprite, $offset-x, $offset-y,
34
- $use-percentages);
39
+ $use-percentages);
35
40
  @if $dimensions {
36
41
  @include sprite-dimensions($map, $sprite);
37
42
  }
38
- @if not $disable-magic-sprite-selectors {
43
+ @if $use-magic-selectors {
39
44
  @include sprite-selectors($map, $sprite, $sprite, $offset-x, $offset-y,
40
- $use-percentages);
45
+ $use-percentages, $separator);
41
46
  }
42
47
  }
43
48
 
@@ -45,14 +50,15 @@ $use-percentages: false) {
45
50
  // `$full-sprite-name`
46
51
  // @private
47
52
  @mixin sprite-selectors($map, $sprite-name, $full-sprite-name, $offset-x: 0,
48
- $offset-y: 0, $use-percentages: false) {
49
- @each $selector in $sprite-selectors {
50
- @if sprite_has_selector($map, $sprite-name, $selector) {
51
- @if sprite_has_valid_selector("#{$full-sprite-name}-#{$selector}") {
52
- &:#{$selector}, &.#{$full-sprite-name}-#{$selector} {
53
- @include sprite-background-position($map,
54
- "#{$sprite-name}_#{$selector}", $offset-x, $offset-y,
55
- $use-percentages);
53
+ $offset-y: 0, $use-percentages: false,
54
+ $separator: $default-sprite-separator) {
55
+ @each $state in $sprite-selectors {
56
+ $sprite-class: "#{$full-sprite-name}#{$separator}#{$state}";
57
+ @if sprite_has_selector($map, $sprite-name, $state) {
58
+ @if sprite_has_valid_selector($sprite-class) {
59
+ &:#{$state}, &.#{$sprite-class} {
60
+ @include sprite-background-position($map, sprite_selector_file($map, $sprite-name, $state),
61
+ $offset-x, $offset-y, $use-percentages);
56
62
  }
57
63
  }
58
64
  }
@@ -68,16 +74,17 @@ $offset-y: 0, $use-percentages: false) {
68
74
  // Positions are returned in pixel units. Set `$use_percentages` to true to
69
75
  // instead get percentages.
70
76
  @mixin sprites($map, $sprite-names, $base-class: false, $dimensions: false,
71
- $prefix: sprite-map-name($map), $offset-x: 0, $offset-y: 0, $use-percentages:
72
- false) {
77
+ $prefix: sprite-map-name($map), $offset-x: 0, $offset-y: 0,
78
+ $use-percentages: false,
79
+ $separator: $default-sprite-separator) {
73
80
  @each $sprite-name in $sprite-names {
74
81
  @if sprite_does_not_have_parent($map, $sprite-name) {
75
- $full-sprite-name: "#{$prefix}-#{$sprite-name}";
82
+ $full-sprite-name: "#{$prefix}#{$separator}#{$sprite-name}";
76
83
  @if sprite_has_valid_selector($full-sprite-name) {
77
84
  .#{$full-sprite-name} {
78
85
  @if $base-class { @extend #{$base-class}; }
79
86
  @include sprite($map, $sprite-name, $dimensions, $offset-x, $offset-y,
80
- $use-percentages);
87
+ $use-percentages, $separator: $separator);
81
88
  }
82
89
  }
83
90
  }