sass 3.2.0.alpha.258 → 3.2.0.alpha.259
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/sass/script/functions.rb +28 -34
- data/test/sass/functions_test.rb +0 -14
- metadata +3 -3
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
389e108b5727c26e31d93a25ea7f0115fe270954
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.0.alpha.
|
1
|
+
3.2.0.alpha.259
|
@@ -144,9 +144,6 @@ 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
|
-
#
|
150
147
|
# ## Introspection Functions
|
151
148
|
#
|
152
149
|
# \{#type_of type-of($value)}
|
@@ -585,10 +582,7 @@ module Sass::Script
|
|
585
582
|
return Sass::Script::String.new("alpha(#{args.map {|a| a.to_s}.join(", ")})")
|
586
583
|
end
|
587
584
|
|
588
|
-
|
589
|
-
|
590
|
-
assert_type args.first, :Color
|
591
|
-
Sass::Script::Number.new(args.first.alpha)
|
585
|
+
opacity(*args)
|
592
586
|
end
|
593
587
|
declare :alpha, [:color]
|
594
588
|
|
@@ -601,7 +595,6 @@ module Sass::Script
|
|
601
595
|
# @see #transparentize
|
602
596
|
# @raise [ArgumentError] If `color` isn't a color
|
603
597
|
def opacity(color)
|
604
|
-
return Sass::Script::String.new("opacity(#{color})") if color.is_a?(Sass::Script::Number)
|
605
598
|
assert_type color, :Color
|
606
599
|
Sass::Script::Number.new(color.alpha)
|
607
600
|
end
|
@@ -692,21 +685,16 @@ module Sass::Script
|
|
692
685
|
# @example
|
693
686
|
# saturate(hsl(120, 30%, 90%), 20%) => hsl(120, 50%, 90%)
|
694
687
|
# saturate(#855, 20%) => #9e3f3f
|
695
|
-
# @
|
696
|
-
#
|
697
|
-
#
|
698
|
-
#
|
699
|
-
#
|
700
|
-
#
|
701
|
-
|
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?
|
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)
|
706
695
|
_adjust(color, amount, :saturation, 0..100, :+, "%")
|
707
696
|
end
|
708
697
|
declare :saturate, [:color, :amount]
|
709
|
-
declare :saturate, [:amount]
|
710
698
|
|
711
699
|
# Makes a color less saturated.
|
712
700
|
# Takes a color and an amount between 0% and 100%,
|
@@ -1007,13 +995,21 @@ module Sass::Script
|
|
1007
995
|
declare :mix, [:color_1, :color_2]
|
1008
996
|
declare :mix, [:color_1, :color_2, :weight]
|
1009
997
|
|
1010
|
-
#
|
1011
|
-
#
|
998
|
+
# @overload grayscale(color)
|
999
|
+
# Converts a color to grayscale.
|
1000
|
+
# This is identical to `desaturate(color, 100%)`.
|
1012
1001
|
#
|
1013
|
-
#
|
1014
|
-
#
|
1015
|
-
#
|
1016
|
-
#
|
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
|
+
#
|
1011
|
+
# @param number [Number]
|
1012
|
+
# @return [Sass::Script::String]
|
1017
1013
|
def grayscale(color)
|
1018
1014
|
return Sass::Script::String.new("grayscale(#{color})") if color.is_a?(Sass::Script::Number)
|
1019
1015
|
desaturate color, Number.new(100)
|
@@ -1039,8 +1035,6 @@ module Sass::Script
|
|
1039
1035
|
# @return [Color]
|
1040
1036
|
# @raise [ArgumentError] if `color` isn't a color
|
1041
1037
|
def invert(color)
|
1042
|
-
return Sass::Script::String.new("invert(#{color})") if color.is_a?(Sass::Script::Number)
|
1043
|
-
|
1044
1038
|
assert_type color, :Color
|
1045
1039
|
color.with(
|
1046
1040
|
:red => (255 - color.red),
|
@@ -1334,14 +1328,14 @@ module Sass::Script
|
|
1334
1328
|
# append(10px 20px, 30px) => 10px 20px 30px
|
1335
1329
|
# append((blue, red), green) => blue, red, green
|
1336
1330
|
# append(10px 20px, 30px 40px) => 10px 20px (30px 40px)
|
1337
|
-
#
|
1338
|
-
#
|
1339
|
-
# @overload
|
1340
|
-
# @param
|
1341
|
-
# @param
|
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
|
1342
1336
|
# @param separator [String] How the list separator (comma or space) should be determined.
|
1343
1337
|
# If this is `comma` or `space`, that is always the separator;
|
1344
|
-
# if this is `auto` (the default), the separator is
|
1338
|
+
# if this is `auto` (the default), the separator is determined as explained above.
|
1345
1339
|
def append(list, val, separator = Sass::Script::String.new("auto"))
|
1346
1340
|
assert_type separator, :String
|
1347
1341
|
unless %w[auto space comma].include?(separator.value)
|
data/test/sass/functions_test.rb
CHANGED
@@ -336,18 +336,6 @@ 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
|
-
|
351
339
|
def test_opacify
|
352
340
|
assert_equal("rgba(0, 0, 0, 0.75)", evaluate("opacify(rgba(0, 0, 0, 0.5), 0.25)"))
|
353
341
|
assert_equal("rgba(0, 0, 0, 0.3)", evaluate("opacify(rgba(0, 0, 0, 0.2), 0.1)"))
|
@@ -447,7 +435,6 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
447
435
|
assert_equal("#88aa88", evaluate("saturate(#8a8, 0%)"))
|
448
436
|
assert_equal("rgba(158, 63, 63, 0.5)", evaluate("saturate(rgba(136, 85, 85, 0.5), 20%)"))
|
449
437
|
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%)"))
|
451
438
|
end
|
452
439
|
|
453
440
|
def test_saturate_tests_bounds
|
@@ -841,7 +828,6 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
841
828
|
def test_invert
|
842
829
|
assert_equal("#112233", evaluate("invert(#edc)"))
|
843
830
|
assert_equal("rgba(245, 235, 225, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5))"))
|
844
|
-
assert_equal("invert(20%)", evaluate("invert(20%)"))
|
845
831
|
end
|
846
832
|
|
847
833
|
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:
|
4
|
+
hash: 592302363
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 3.2.0.alpha.
|
11
|
+
- 259
|
12
|
+
version: 3.2.0.alpha.259
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Nathan Weizenbaum
|