sass 3.2.0.alpha.259 → 3.2.0.alpha.260

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/REVISION CHANGED
@@ -1 +1 @@
1
- 389e108b5727c26e31d93a25ea7f0115fe270954
1
+ 8616d4cac0394349552d5efc9d69c072e2d0f529
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.259
1
+ 3.2.0.alpha.260
@@ -144,6 +144,9 @@ module Sass::Script
144
144
  # \{#join join($list1, $list2, \[$separator\])}
145
145
  # : Joins together two lists into one.
146
146
  #
147
+ # \{#append append($list1, $val, \[$separator\])}
148
+ # : Appends a single value onto the end of a list.
149
+ #
147
150
  # ## Introspection Functions
148
151
  #
149
152
  # \{#type_of type-of($value)}
@@ -582,7 +585,10 @@ module Sass::Script
582
585
  return Sass::Script::String.new("alpha(#{args.map {|a| a.to_s}.join(", ")})")
583
586
  end
584
587
 
585
- opacity(*args)
588
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 1)") if args.size != 1
589
+
590
+ assert_type args.first, :Color
591
+ Sass::Script::Number.new(args.first.alpha)
586
592
  end
587
593
  declare :alpha, [:color]
588
594
 
@@ -595,6 +601,7 @@ module Sass::Script
595
601
  # @see #transparentize
596
602
  # @raise [ArgumentError] If `color` isn't a color
597
603
  def opacity(color)
604
+ return Sass::Script::String.new("opacity(#{color})") if color.is_a?(Sass::Script::Number)
598
605
  assert_type color, :Color
599
606
  Sass::Script::Number.new(color.alpha)
600
607
  end
@@ -685,16 +692,21 @@ module Sass::Script
685
692
  # @example
686
693
  # saturate(hsl(120, 30%, 90%), 20%) => hsl(120, 50%, 90%)
687
694
  # saturate(#855, 20%) => #9e3f3f
688
- # @param color [Color]
689
- # @param amount [Number]
690
- # @return [Color]
691
- # @see #desaturate
692
- # @raise [ArgumentError] If `color` isn't a color,
693
- # or `number` isn't a number between 0% and 100%
694
- def saturate(color, amount)
695
+ # @overload saturate(color, amount)
696
+ # @param color [Color]
697
+ # @param amount [Number]
698
+ # @return [Color]
699
+ # @see #desaturate
700
+ # @raise [ArgumentError] If `color` isn't a color,
701
+ # or `number` isn't a number between 0% and 100%
702
+ def saturate(color, amount = nil)
703
+ # Support the filter effects definition of saturate.
704
+ # https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
705
+ return Sass::Script::String.new("saturate(#{color})") if amount.nil?
695
706
  _adjust(color, amount, :saturation, 0..100, :+, "%")
696
707
  end
697
708
  declare :saturate, [:color, :amount]
709
+ declare :saturate, [:amount]
698
710
 
699
711
  # Makes a color less saturated.
700
712
  # Takes a color and an amount between 0% and 100%,
@@ -995,21 +1007,13 @@ module Sass::Script
995
1007
  declare :mix, [:color_1, :color_2]
996
1008
  declare :mix, [:color_1, :color_2, :weight]
997
1009
 
998
- # @overload grayscale(color)
999
- # Converts a color to grayscale.
1000
- # This is identical to `desaturate(color, 100%)`.
1001
- #
1002
- # @param color [Color]
1003
- # @return [Color]
1004
- # @raise [ArgumentError] if `color` isn't a color
1005
- # @see #desaturate
1006
- # @overload grayscale(number)
1007
- # Returns an unquoted string `grayscale(number)`, as though the function
1008
- # were not defined. This is for the `grayscale` function used in
1009
- # `-webkit-filter`.
1010
+ # Converts a color to grayscale.
1011
+ # This is identical to `desaturate(color, 100%)`.
1010
1012
  #
1011
- # @param number [Number]
1012
- # @return [Sass::Script::String]
1013
+ # @param color [Color]
1014
+ # @return [Color]
1015
+ # @raise [ArgumentError] if `color` isn't a color
1016
+ # @see #desaturate
1013
1017
  def grayscale(color)
1014
1018
  return Sass::Script::String.new("grayscale(#{color})") if color.is_a?(Sass::Script::Number)
1015
1019
  desaturate color, Number.new(100)
@@ -1035,6 +1039,8 @@ module Sass::Script
1035
1039
  # @return [Color]
1036
1040
  # @raise [ArgumentError] if `color` isn't a color
1037
1041
  def invert(color)
1042
+ return Sass::Script::String.new("invert(#{color})") if color.is_a?(Sass::Script::Number)
1043
+
1038
1044
  assert_type color, :Color
1039
1045
  color.with(
1040
1046
  :red => (255 - color.red),
@@ -1328,14 +1334,14 @@ module Sass::Script
1328
1334
  # append(10px 20px, 30px) => 10px 20px 30px
1329
1335
  # append((blue, red), green) => blue, red, green
1330
1336
  # append(10px 20px, 30px 40px) => 10px 20px (30px 40px)
1331
- # join(10px, 20px, comma) => 10px, 20px
1332
- # join((blue, red), green, space) => blue red green
1333
- # @overload join(list, val, separator: auto)
1334
- # @param list1 [Literal] The first list to join
1335
- # @param list2 [Literal] The second list to join
1337
+ # append(10px, 20px, comma) => 10px, 20px
1338
+ # append((blue, red), green, space) => blue red green
1339
+ # @overload append(list, val, separator: auto)
1340
+ # @param list [Literal] The list to add the value to
1341
+ # @param val [Literal] The value to add to the end of the list
1336
1342
  # @param separator [String] How the list separator (comma or space) should be determined.
1337
1343
  # If this is `comma` or `space`, that is always the separator;
1338
- # if this is `auto` (the default), the separator is determined as explained above.
1344
+ # if this is `auto` (the default), the separator is the same as that used by the list.
1339
1345
  def append(list, val, separator = Sass::Script::String.new("auto"))
1340
1346
  assert_type separator, :String
1341
1347
  unless %w[auto space comma].include?(separator.value)
@@ -51,6 +51,8 @@ module Sass
51
51
  UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/
52
52
  s = if Sass::Util.ruby1_8?
53
53
  '\200-\377'
54
+ elsif Sass::Util.macruby?
55
+ '\u0080-\uD7FF\uE000-\uFFFD\U00010000-\U0010FFFF'
54
56
  else
55
57
  '\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'
56
58
  end
@@ -91,7 +91,7 @@ class Sass::Tree::Visitors::DeepCopy < Sass::Tree::Visitors::Base
91
91
  end
92
92
 
93
93
  def visit_media(node)
94
- node.query = node.query.deep_copy
94
+ node.query = node.query.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c}
95
95
  yield
96
96
  end
97
97
 
@@ -489,6 +489,13 @@ module Sass
489
489
  ruby1_8? && Sass::Util::RUBY_VERSION[2] < 7
490
490
  end
491
491
 
492
+ # Whether or not this is running under MacRuby.
493
+ #
494
+ # @return [Boolean]
495
+ def macruby?
496
+ RUBY_ENGINE == 'macruby'
497
+ end
498
+
492
499
  # Checks that the encoding of a string is valid in Ruby 1.9
493
500
  # and cleans up potential encoding gotchas like the UTF-8 BOM.
494
501
  # If it's not, yields an error string describing the invalid character
@@ -336,6 +336,18 @@ class SassFunctionTest < Test::Unit::TestCase
336
336
  assert_error_message("12 is not a color for `alpha'", "alpha(12)")
337
337
  end
338
338
 
339
+ def test_opacity
340
+ assert_equal("1", evaluate("opacity(#123456)"))
341
+ assert_equal("0.34", evaluate("opacity(rgba(0, 1, 2, 0.34))"))
342
+ assert_equal("0", evaluate("opacity(hsla(0, 1, 2, 0))"))
343
+ assert_equal("0", evaluate("opacity($color: hsla(0, 1, 2, 0))"))
344
+ assert_equal("opacity(20%)", evaluate("opacity(20%)"))
345
+ end
346
+
347
+ def test_opacity_exception
348
+ assert_error_message("\"foo\" is not a color for `opacity'", "opacity(foo)")
349
+ end
350
+
339
351
  def test_opacify
340
352
  assert_equal("rgba(0, 0, 0, 0.75)", evaluate("opacify(rgba(0, 0, 0, 0.5), 0.25)"))
341
353
  assert_equal("rgba(0, 0, 0, 0.3)", evaluate("opacify(rgba(0, 0, 0, 0.2), 0.1)"))
@@ -435,6 +447,7 @@ class SassFunctionTest < Test::Unit::TestCase
435
447
  assert_equal("#88aa88", evaluate("saturate(#8a8, 0%)"))
436
448
  assert_equal("rgba(158, 63, 63, 0.5)", evaluate("saturate(rgba(136, 85, 85, 0.5), 20%)"))
437
449
  assert_equal("rgba(158, 63, 63, 0.5)", evaluate("saturate($color: rgba(136, 85, 85, 0.5), $amount: 20%)"))
450
+ assert_equal("saturate(50%)", evaluate("saturate(50%)"))
438
451
  end
439
452
 
440
453
  def test_saturate_tests_bounds
@@ -828,6 +841,7 @@ class SassFunctionTest < Test::Unit::TestCase
828
841
  def test_invert
829
842
  assert_equal("#112233", evaluate("invert(#edc)"))
830
843
  assert_equal("rgba(245, 235, 225, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5))"))
844
+ assert_equal("invert(20%)", evaluate("invert(20%)"))
831
845
  end
832
846
 
833
847
  def test_invert_tests_types
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302363
4
+ hash: 592302357
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 259
12
- version: 3.2.0.alpha.259
11
+ - 260
12
+ version: 3.2.0.alpha.260
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum