sass 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/script/functions.rb +195 -183
- data/lib/sass/selector/sequence.rb +6 -6
- data/lib/sass/selector/simple_sequence.rb +6 -6
- data/lib/sass/tree/visitors/set_options.rb +4 -0
- data/lib/sass/util.rb +1 -1
- data/test/sass/cache_test.rb +51 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b1f65147a1c8475b358cc3769c042b4e61b3973
|
4
|
+
data.tar.gz: 8bef79f9df38193e0891505f82f1d523d6229383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb1fa87bbd19535fcf56757318b75946833c85b1bf17caced90dddbad38ae0e6738c0e9b8d5480942f8a0e8a8014f9f40b4814a47fac6312ddc8b361da4b3db
|
7
|
+
data.tar.gz: 21b79150a581f91e5d92161cb41a85b85ae35ee45e3750034c23a85ae046f6c50d5d8b084eafa68d328588ebcdb2e1253878bbfcb7fa74f9367e5bbc6c190b5a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.3
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
14 March 2014 23:31:57 UTC
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'sass/script/value/helpers'
|
2
2
|
|
3
3
|
module Sass::Script
|
4
|
+
# @comment
|
5
|
+
# YARD can't handle some multiline tags, and we need really long tags for function declarations.
|
6
|
+
# rubocop:disable LineLength
|
4
7
|
# Methods in this module are accessible from the SassScript context.
|
5
8
|
# For example, you can write
|
6
9
|
#
|
@@ -93,16 +96,13 @@ module Sass::Script
|
|
93
96
|
#
|
94
97
|
# ## Other Color Functions
|
95
98
|
#
|
96
|
-
# \{#adjust_color adjust-color($color, \[$red\], \[$green\], \[$blue\],
|
97
|
-
# \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
|
99
|
+
# \{#adjust_color adjust-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
|
98
100
|
# : Increases or decreases one or more components of a color.
|
99
101
|
#
|
100
|
-
# \{#scale_color scale-color($color, \[$red\], \[$green\], \[$blue\],
|
101
|
-
# \[$saturation\], \[$lightness\], \[$alpha\])}
|
102
|
+
# \{#scale_color scale-color($color, \[$red\], \[$green\], \[$blue\], \[$saturation\], \[$lightness\], \[$alpha\])}
|
102
103
|
# : Fluidly scales one or more properties of a color.
|
103
104
|
#
|
104
|
-
# \{#change_color change-color($color, \[$red\], \[$green\], \[$blue\],
|
105
|
-
# \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
|
105
|
+
# \{#change_color change-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\])}
|
106
106
|
# : Changes one or more properties of a color.
|
107
107
|
#
|
108
108
|
# \{#ie_hex_str ie-hex-str($color)}
|
@@ -302,6 +302,9 @@ module Sass::Script
|
|
302
302
|
# safe to call {Value::Base#to_s #to_s} (or other methods that use the string
|
303
303
|
# representation) on those objects without first setting {Tree::Node#options=
|
304
304
|
# the #options attribute}.
|
305
|
+
#
|
306
|
+
# @comment
|
307
|
+
# rubocop:enable LineLength
|
305
308
|
module Functions
|
306
309
|
@signatures = {}
|
307
310
|
|
@@ -565,15 +568,15 @@ module Sass::Script
|
|
565
568
|
#
|
566
569
|
# @see #rgba
|
567
570
|
# @overload rgb($red, $green, $blue)
|
568
|
-
#
|
569
|
-
#
|
570
|
-
#
|
571
|
-
#
|
572
|
-
#
|
573
|
-
#
|
574
|
-
#
|
575
|
-
#
|
576
|
-
#
|
571
|
+
# @param $red [Sass::Script::Value::Number] The amount of red in the color.
|
572
|
+
# Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
573
|
+
# inclusive
|
574
|
+
# @param $green [Sass::Script::Value::Number] The amount of green in the
|
575
|
+
# color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
576
|
+
# inclusive
|
577
|
+
# @param $blue [Sass::Script::Value::Number] The amount of blue in the
|
578
|
+
# color. Must be between 0 and 255 inclusive, or between `0%` and `100%`
|
579
|
+
# inclusive
|
577
580
|
# @return [Sass::Script::Value::Color]
|
578
581
|
# @raise [ArgumentError] if any parameter is the wrong type or out of bounds
|
579
582
|
def rgb(red, green, blue)
|
@@ -653,12 +656,12 @@ module Sass::Script
|
|
653
656
|
#
|
654
657
|
# @see #hsla
|
655
658
|
# @overload hsl($hue, $saturation, $lightness)
|
656
|
-
#
|
657
|
-
#
|
658
|
-
#
|
659
|
-
#
|
660
|
-
#
|
661
|
-
#
|
659
|
+
# @param $hue [Sass::Script::Value::Number] The hue of the color. Should be
|
660
|
+
# between 0 and 360 degrees, inclusive
|
661
|
+
# @param $saturation [Sass::Script::Value::Number] The saturation of the
|
662
|
+
# color. Must be between `0%` and `100%`, inclusive
|
663
|
+
# @param $lightness [Sass::Script::Value::Number] The lightness of the
|
664
|
+
# color. Must be between `0%` and `100%`, inclusive
|
662
665
|
# @return [Sass::Script::Value::Color]
|
663
666
|
# @raise [ArgumentError] if `$saturation` or `$lightness` are out of bounds
|
664
667
|
# or any parameter is the wrong type
|
@@ -675,14 +678,14 @@ module Sass::Script
|
|
675
678
|
#
|
676
679
|
# @see #hsl
|
677
680
|
# @overload hsla($hue, $saturation, $lightness, $alpha)
|
678
|
-
#
|
679
|
-
#
|
680
|
-
#
|
681
|
-
#
|
682
|
-
#
|
683
|
-
#
|
684
|
-
#
|
685
|
-
#
|
681
|
+
# @param $hue [Sass::Script::Value::Number] The hue of the color. Should be
|
682
|
+
# between 0 and 360 degrees, inclusive
|
683
|
+
# @param $saturation [Sass::Script::Value::Number] The saturation of the
|
684
|
+
# color. Must be between `0%` and `100%`, inclusive
|
685
|
+
# @param $lightness [Sass::Script::Value::Number] The lightness of the
|
686
|
+
# color. Must be between `0%` and `100%`, inclusive
|
687
|
+
# @param $alpha [Sass::Script::Value::Number] The opacity of the color. Must
|
688
|
+
# be between 0 and 1, inclusive
|
686
689
|
# @return [Sass::Script::Value::Color]
|
687
690
|
# @raise [ArgumentError] if `$saturation`, `$lightness`, or `$alpha` are out
|
688
691
|
# of bounds or any parameter is the wrong type
|
@@ -709,7 +712,7 @@ module Sass::Script
|
|
709
712
|
# [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
|
710
713
|
#
|
711
714
|
# @overload red($color)
|
712
|
-
#
|
715
|
+
# @param $color [Sass::Script::Value::Color]
|
713
716
|
# @return [Sass::Script::Value::Number] The red component, between 0 and 255
|
714
717
|
# inclusive
|
715
718
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -725,7 +728,7 @@ module Sass::Script
|
|
725
728
|
# [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
|
726
729
|
#
|
727
730
|
# @overload green($color)
|
728
|
-
#
|
731
|
+
# @param $color [Sass::Script::Value::Color]
|
729
732
|
# @return [Sass::Script::Value::Number] The green component, between 0 and
|
730
733
|
# 255 inclusive
|
731
734
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -741,7 +744,7 @@ module Sass::Script
|
|
741
744
|
# [hsl-to-rgb]: http://www.w3.org/TR/css3-color/#hsl-color
|
742
745
|
#
|
743
746
|
# @overload blue($color)
|
744
|
-
#
|
747
|
+
# @param $color [Sass::Script::Value::Color]
|
745
748
|
# @return [Sass::Script::Value::Number] The blue component, between 0 and
|
746
749
|
# 255 inclusive
|
747
750
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -759,7 +762,7 @@ module Sass::Script
|
|
759
762
|
# [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
|
760
763
|
#
|
761
764
|
# @overload hue($color)
|
762
|
-
#
|
765
|
+
# @param $color [Sass::Script::Value::Color]
|
763
766
|
# @return [Sass::Script::Value::Number] The hue component, between 0deg and
|
764
767
|
# 360deg
|
765
768
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -777,7 +780,7 @@ module Sass::Script
|
|
777
780
|
# [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
|
778
781
|
#
|
779
782
|
# @overload saturation($color)
|
780
|
-
#
|
783
|
+
# @param $color [Sass::Script::Value::Color]
|
781
784
|
# @return [Sass::Script::Value::Number] The saturation component, between 0%
|
782
785
|
# and 100%
|
783
786
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -795,7 +798,7 @@ module Sass::Script
|
|
795
798
|
# [rgb-to-hsl]: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV
|
796
799
|
#
|
797
800
|
# @overload lightness($color)
|
798
|
-
#
|
801
|
+
# @param $color [Sass::Script::Value::Color]
|
799
802
|
# @return [Sass::Script::Value::Number] The lightness component, between 0%
|
800
803
|
# and 100%
|
801
804
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -812,7 +815,7 @@ module Sass::Script
|
|
812
815
|
# syntax as a special case.
|
813
816
|
#
|
814
817
|
# @overload alpha($color)
|
815
|
-
#
|
818
|
+
# @param $color [Sass::Script::Value::Color]
|
816
819
|
# @return [Sass::Script::Value::Number] The alpha component, between 0 and 1
|
817
820
|
# @raise [ArgumentError] if `$color` isn't a color
|
818
821
|
def alpha(*args)
|
@@ -835,7 +838,7 @@ module Sass::Script
|
|
835
838
|
# otherwise specified.
|
836
839
|
#
|
837
840
|
# @overload opacity($color)
|
838
|
-
#
|
841
|
+
# @param $color [Sass::Script::Value::Color]
|
839
842
|
# @return [Sass::Script::Value::Number] The alpha component, between 0 and 1
|
840
843
|
# @raise [ArgumentError] if `$color` isn't a color
|
841
844
|
def opacity(color)
|
@@ -855,9 +858,9 @@ module Sass::Script
|
|
855
858
|
# opacify(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.6)
|
856
859
|
# opacify(rgba(0, 0, 17, 0.8), 0.2) => #001
|
857
860
|
# @overload opacify($color, $amount)
|
858
|
-
#
|
859
|
-
#
|
860
|
-
#
|
861
|
+
# @param $color [Sass::Script::Value::Color]
|
862
|
+
# @param $amount [Sass::Script::Value::Number] The amount to increase the
|
863
|
+
# opacity by, between 0 and 1
|
861
864
|
# @return [Sass::Script::Value::Color]
|
862
865
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
863
866
|
# is the wrong type
|
@@ -877,9 +880,9 @@ module Sass::Script
|
|
877
880
|
# transparentize(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.4)
|
878
881
|
# transparentize(rgba(0, 0, 0, 0.8), 0.2) => rgba(0, 0, 0, 0.6)
|
879
882
|
# @overload transparentize($color, $amount)
|
880
|
-
#
|
881
|
-
#
|
882
|
-
#
|
883
|
+
# @param $color [Sass::Script::Value::Color]
|
884
|
+
# @param $amount [Sass::Script::Value::Number] The amount to decrease the
|
885
|
+
# opacity by, between 0 and 1
|
883
886
|
# @return [Sass::Script::Value::Color]
|
884
887
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
885
888
|
# is the wrong type
|
@@ -899,9 +902,9 @@ module Sass::Script
|
|
899
902
|
# lighten(hsl(0, 0%, 0%), 30%) => hsl(0, 0, 30)
|
900
903
|
# lighten(#800, 20%) => #e00
|
901
904
|
# @overload lighten($color, $amount)
|
902
|
-
#
|
903
|
-
#
|
904
|
-
#
|
905
|
+
# @param $color [Sass::Script::Value::Color]
|
906
|
+
# @param $amount [Sass::Script::Value::Number] The amount to increase the
|
907
|
+
# lightness by, between `0%` and `100%`
|
905
908
|
# @return [Sass::Script::Value::Color]
|
906
909
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
907
910
|
# is the wrong type
|
@@ -918,9 +921,9 @@ module Sass::Script
|
|
918
921
|
# darken(hsl(25, 100%, 80%), 30%) => hsl(25, 100%, 50%)
|
919
922
|
# darken(#800, 20%) => #200
|
920
923
|
# @overload darken($color, $amount)
|
921
|
-
#
|
922
|
-
#
|
923
|
-
#
|
924
|
+
# @param $color [Sass::Script::Value::Color]
|
925
|
+
# @param $amount [Sass::Script::Value::Number] The amount to dencrease the
|
926
|
+
# lightness by, between `0%` and `100%`
|
924
927
|
# @return [Sass::Script::Value::Color]
|
925
928
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
926
929
|
# is the wrong type
|
@@ -937,9 +940,9 @@ module Sass::Script
|
|
937
940
|
# saturate(hsl(120, 30%, 90%), 20%) => hsl(120, 50%, 90%)
|
938
941
|
# saturate(#855, 20%) => #9e3f3f
|
939
942
|
# @overload saturate($color, $amount)
|
940
|
-
#
|
941
|
-
#
|
942
|
-
#
|
943
|
+
# @param $color [Sass::Script::Value::Color]
|
944
|
+
# @param $amount [Sass::Script::Value::Number] The amount to increase the
|
945
|
+
# saturation by, between `0%` and `100%`
|
943
946
|
# @return [Sass::Script::Value::Color]
|
944
947
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
945
948
|
# is the wrong type
|
@@ -960,9 +963,9 @@ module Sass::Script
|
|
960
963
|
# desaturate(hsl(120, 30%, 90%), 20%) => hsl(120, 10%, 90%)
|
961
964
|
# desaturate(#855, 20%) => #726b6b
|
962
965
|
# @overload desaturate($color, $amount)
|
963
|
-
#
|
964
|
-
#
|
965
|
-
#
|
966
|
+
# @param $color [Sass::Script::Value::Color]
|
967
|
+
# @param $amount [Sass::Script::Value::Number] The amount to decrease the
|
968
|
+
# saturation by, between `0%` and `100%`
|
966
969
|
# @return [Sass::Script::Value::Color]
|
967
970
|
# @raise [ArgumentError] if `$amount` is out of bounds, or either parameter
|
968
971
|
# is the wrong type
|
@@ -980,9 +983,9 @@ module Sass::Script
|
|
980
983
|
# adjust-hue(hsl(120, 30%, 90%), 060deg) => hsl(60, 30%, 90%)
|
981
984
|
# adjust-hue(#811, 45deg) => #886a11
|
982
985
|
# @overload adjust_hue($color, $degrees)
|
983
|
-
#
|
984
|
-
#
|
985
|
-
#
|
986
|
+
# @param $color [Sass::Script::Value::Color]
|
987
|
+
# @param $degrees [Sass::Script::Value::Number] The number of degrees to
|
988
|
+
# rotate the hue
|
986
989
|
# @return [Sass::Script::Value::Color]
|
987
990
|
# @raise [ArgumentError] if either parameter is the wrong type
|
988
991
|
def adjust_hue(color, degrees)
|
@@ -999,7 +1002,7 @@ module Sass::Script
|
|
999
1002
|
# ie-hex-str(#3322BB) => #FF3322BB
|
1000
1003
|
# ie-hex-str(rgba(0, 255, 0, 0.5)) => #8000FF00
|
1001
1004
|
# @overload ie_hex_str($color)
|
1002
|
-
#
|
1005
|
+
# @param $color [Sass::Script::Value::Color]
|
1003
1006
|
# @return [Sass::Script::Value::String] The IE-formatted string
|
1004
1007
|
# representation of the color
|
1005
1008
|
# @raise [ArgumentError] if `$color` isn't a color
|
@@ -1023,23 +1026,26 @@ module Sass::Script
|
|
1023
1026
|
# adjust-color(#102030, $blue: 5) => #102035
|
1024
1027
|
# adjust-color(#102030, $red: -5, $blue: 5) => #0b2035
|
1025
1028
|
# adjust-color(hsl(25, 100%, 80%), $lightness: -30%, $alpha: -0.4) => hsla(25, 100%, 50%, 0.6)
|
1026
|
-
# @
|
1027
|
-
#
|
1028
|
-
# @
|
1029
|
-
#
|
1030
|
-
#
|
1031
|
-
#
|
1032
|
-
#
|
1033
|
-
#
|
1034
|
-
#
|
1035
|
-
#
|
1036
|
-
#
|
1037
|
-
#
|
1038
|
-
#
|
1039
|
-
#
|
1040
|
-
#
|
1041
|
-
#
|
1042
|
-
#
|
1029
|
+
# @comment
|
1030
|
+
# rubocop:disable LineLength
|
1031
|
+
# @overload adjust_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
|
1032
|
+
# @comment
|
1033
|
+
# rubocop:disable LineLength
|
1034
|
+
# @param $color [Sass::Script::Value::Color]
|
1035
|
+
# @param $red [Sass::Script::Value::Number] The adjustment to make on the
|
1036
|
+
# red component, between -255 and 255 inclusive
|
1037
|
+
# @param $green [Sass::Script::Value::Number] The adjustment to make on the
|
1038
|
+
# green component, between -255 and 255 inclusive
|
1039
|
+
# @param $blue [Sass::Script::Value::Number] The adjustment to make on the
|
1040
|
+
# blue component, between -255 and 255 inclusive
|
1041
|
+
# @param $hue [Sass::Script::Value::Number] The adjustment to make on the
|
1042
|
+
# hue component, in degrees
|
1043
|
+
# @param $saturation [Sass::Script::Value::Number] The adjustment to make on
|
1044
|
+
# the saturation component, between `-100%` and `100%` inclusive
|
1045
|
+
# @param $lightness [Sass::Script::Value::Number] The adjustment to make on
|
1046
|
+
# the lightness component, between `-100%` and `100%` inclusive
|
1047
|
+
# @param $alpha [Sass::Script::Value::Number] The adjustment to make on the
|
1048
|
+
# alpha component, between -1 and 1 inclusive
|
1043
1049
|
# @return [Sass::Script::Value::Color]
|
1044
1050
|
# @raise [ArgumentError] if any parameter is the wrong type or out-of
|
1045
1051
|
# bounds, or if RGB properties and HSL properties are adjusted at the
|
@@ -1101,15 +1107,18 @@ module Sass::Script
|
|
1101
1107
|
# scale-color(hsl(120, 70%, 80%), $lightness: 50%) => hsl(120, 70%, 90%)
|
1102
1108
|
# scale-color(rgb(200, 150%, 170%), $green: -40%, $blue: 70%) => rgb(200, 90, 229)
|
1103
1109
|
# scale-color(hsl(200, 70%, 80%), $saturation: -90%, $alpha: -30%) => hsla(200, 7%, 80%, 0.7)
|
1104
|
-
# @
|
1105
|
-
#
|
1106
|
-
# @
|
1107
|
-
#
|
1108
|
-
#
|
1109
|
-
#
|
1110
|
-
#
|
1111
|
-
#
|
1112
|
-
#
|
1110
|
+
# @comment
|
1111
|
+
# rubocop:disable LineLength
|
1112
|
+
# @overload scale_color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha])
|
1113
|
+
# @comment
|
1114
|
+
# rubocop:disable LineLength
|
1115
|
+
# @param $color [Sass::Script::Value::Color]
|
1116
|
+
# @param $red [Sass::Script::Value::Number]
|
1117
|
+
# @param $green [Sass::Script::Value::Number]
|
1118
|
+
# @param $blue [Sass::Script::Value::Number]
|
1119
|
+
# @param $saturation [Sass::Script::Value::Number]
|
1120
|
+
# @param $lightness [Sass::Script::Value::Number]
|
1121
|
+
# @param $alpha [Sass::Script::Value::Number]
|
1113
1122
|
# @return [Sass::Script::Value::Color]
|
1114
1123
|
# @raise [ArgumentError] if any parameter is the wrong type or out-of
|
1115
1124
|
# bounds, or if RGB properties and HSL properties are adjusted at the
|
@@ -1159,23 +1168,26 @@ module Sass::Script
|
|
1159
1168
|
# change-color(#102030, $blue: 5) => #102005
|
1160
1169
|
# change-color(#102030, $red: 120, $blue: 5) => #782005
|
1161
1170
|
# change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)
|
1162
|
-
# @
|
1163
|
-
#
|
1164
|
-
# @
|
1165
|
-
#
|
1166
|
-
#
|
1167
|
-
#
|
1168
|
-
#
|
1169
|
-
#
|
1170
|
-
#
|
1171
|
-
#
|
1172
|
-
#
|
1173
|
-
#
|
1174
|
-
#
|
1175
|
-
#
|
1176
|
-
#
|
1177
|
-
#
|
1178
|
-
#
|
1171
|
+
# @comment
|
1172
|
+
# rubocop:disable LineLength
|
1173
|
+
# @overload change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])
|
1174
|
+
# @comment
|
1175
|
+
# rubocop:disable LineLength
|
1176
|
+
# @param $color [Sass::Script::Value::Color]
|
1177
|
+
# @param $red [Sass::Script::Value::Number] The new red component for the
|
1178
|
+
# color, within 0 and 255 inclusive
|
1179
|
+
# @param $green [Sass::Script::Value::Number] The new green component for
|
1180
|
+
# the color, within 0 and 255 inclusive
|
1181
|
+
# @param $blue [Sass::Script::Value::Number] The new blue component for the
|
1182
|
+
# color, within 0 and 255 inclusive
|
1183
|
+
# @param $hue [Sass::Script::Value::Number] The new hue component for the
|
1184
|
+
# color, in degrees
|
1185
|
+
# @param $saturation [Sass::Script::Value::Number] The new saturation
|
1186
|
+
# component for the color, between `0%` and `100%` inclusive
|
1187
|
+
# @param $lightness [Sass::Script::Value::Number] The new lightness
|
1188
|
+
# component for the color, within `0%` and `100%` inclusive
|
1189
|
+
# @param $alpha [Sass::Script::Value::Number] The new alpha component for
|
1190
|
+
# the color, within 0 and 1 inclusive
|
1179
1191
|
# @return [Sass::Script::Value::Color]
|
1180
1192
|
# @raise [ArgumentError] if any parameter is the wrong type or out-of
|
1181
1193
|
# bounds, or if RGB properties and HSL properties are adjusted at the
|
@@ -1212,11 +1224,11 @@ module Sass::Script
|
|
1212
1224
|
# mix(#f00, #00f, 25%) => #3f00bf
|
1213
1225
|
# mix(rgba(255, 0, 0, 0.5), #00f) => rgba(63, 0, 191, 0.75)
|
1214
1226
|
# @overload mix($color1, $color2, $weight: 50%)
|
1215
|
-
#
|
1216
|
-
#
|
1217
|
-
#
|
1218
|
-
#
|
1219
|
-
#
|
1227
|
+
# @param $color1 [Sass::Script::Value::Color]
|
1228
|
+
# @param $color2 [Sass::Script::Value::Color]
|
1229
|
+
# @param $weight [Sass::Script::Value::Number] The relative weight of each
|
1230
|
+
# color. Closer to `0%` gives more weight to `$color`, closer to `100%`
|
1231
|
+
# gives more weight to `$color2`
|
1220
1232
|
# @return [Sass::Script::Value::Color]
|
1221
1233
|
# @raise [ArgumentError] if `$weight` is out of bounds or any parameter is
|
1222
1234
|
# the wrong type
|
@@ -1265,7 +1277,7 @@ module Sass::Script
|
|
1265
1277
|
#
|
1266
1278
|
# @see #desaturate
|
1267
1279
|
# @overload grayscale($color)
|
1268
|
-
#
|
1280
|
+
# @param $color [Sass::Script::Value::Color]
|
1269
1281
|
# @return [Sass::Script::Value::Color]
|
1270
1282
|
# @raise [ArgumentError] if `$color` isn't a color
|
1271
1283
|
def grayscale(color)
|
@@ -1281,7 +1293,7 @@ module Sass::Script
|
|
1281
1293
|
#
|
1282
1294
|
# @see #adjust_hue #adjust-hue
|
1283
1295
|
# @overload complement($color)
|
1284
|
-
#
|
1296
|
+
# @param $color [Sass::Script::Value::Color]
|
1285
1297
|
# @return [Sass::Script::Value::Color]
|
1286
1298
|
# @raise [ArgumentError] if `$color` isn't a color
|
1287
1299
|
def complement(color)
|
@@ -1293,7 +1305,7 @@ module Sass::Script
|
|
1293
1305
|
# are inverted, while the opacity is left alone.
|
1294
1306
|
#
|
1295
1307
|
# @overload invert($color)
|
1296
|
-
#
|
1308
|
+
# @param $color [Sass::Script::Value::Color]
|
1297
1309
|
# @return [Sass::Script::Value::Color]
|
1298
1310
|
# @raise [ArgumentError] if `$color` isn't a color
|
1299
1311
|
def invert(color)
|
@@ -1317,7 +1329,7 @@ module Sass::Script
|
|
1317
1329
|
# unquote("foo") => foo
|
1318
1330
|
# unquote(foo) => foo
|
1319
1331
|
# @overload unquote($string)
|
1320
|
-
#
|
1332
|
+
# @param $string [Sass::Script::Value::String]
|
1321
1333
|
# @return [Sass::Script::Value::String]
|
1322
1334
|
# @raise [ArgumentError] if `$string` isn't a string
|
1323
1335
|
def unquote(string)
|
@@ -1337,7 +1349,7 @@ module Sass::Script
|
|
1337
1349
|
# quote("foo") => "foo"
|
1338
1350
|
# quote(foo) => "foo"
|
1339
1351
|
# @overload quote($string)
|
1340
|
-
#
|
1352
|
+
# @param $string [Sass::Script::Value::String]
|
1341
1353
|
# @return [Sass::Script::Value::String]
|
1342
1354
|
# @raise [ArgumentError] if `$string` isn't a string
|
1343
1355
|
def quote(string)
|
@@ -1355,7 +1367,7 @@ module Sass::Script
|
|
1355
1367
|
# @example
|
1356
1368
|
# str-length("foo") => 3
|
1357
1369
|
# @overload str_length($string)
|
1358
|
-
#
|
1370
|
+
# @param $string [Sass::Script::Value::String]
|
1359
1371
|
# @return [Sass::Script::Value::Number]
|
1360
1372
|
# @raise [ArgumentError] if `$string` isn't a string
|
1361
1373
|
def str_length(string)
|
@@ -1375,12 +1387,12 @@ module Sass::Script
|
|
1375
1387
|
# str-insert("abcd", "X", 5) => "abcdX"
|
1376
1388
|
#
|
1377
1389
|
# @overload str_insert($string, $insert, $index)
|
1378
|
-
#
|
1379
|
-
#
|
1380
|
-
#
|
1381
|
-
#
|
1382
|
-
#
|
1383
|
-
#
|
1390
|
+
# @param $string [Sass::Script::Value::String]
|
1391
|
+
# @param $insert [Sass::Script::Value::String]
|
1392
|
+
# @param $index [Sass::Script::Value::Number] The position at which
|
1393
|
+
# `$insert` will be inserted. Negative indices count from the end of
|
1394
|
+
# `$string`. An index that's outside the bounds of the string will insert
|
1395
|
+
# `$insert` at the front or back of the string
|
1384
1396
|
# @return [Sass::Script::Value::String] The result string. This will be
|
1385
1397
|
# quoted if and only if `$string` was quoted
|
1386
1398
|
# @raise [ArgumentError] if any parameter is the wrong type
|
@@ -1412,8 +1424,8 @@ module Sass::Script
|
|
1412
1424
|
# str-index(abcd, c) => 3
|
1413
1425
|
#
|
1414
1426
|
# @overload str_index($string, $substring)
|
1415
|
-
#
|
1416
|
-
#
|
1427
|
+
# @param $string [Sass::Script::Value::String]
|
1428
|
+
# @param $substring [Sass::Script::Value::String]
|
1417
1429
|
# @return [Sass::Script::Value::Number, Sass::Script::Value::Null]
|
1418
1430
|
# @raise [ArgumentError] if any parameter is the wrong type
|
1419
1431
|
def str_index(string, substring)
|
@@ -1437,14 +1449,14 @@ module Sass::Script
|
|
1437
1449
|
# str-slice("abcd", 2, -2) => "bc"
|
1438
1450
|
#
|
1439
1451
|
# @overload str_slice($string, $start-at, $end-at: -1)
|
1440
|
-
#
|
1441
|
-
#
|
1442
|
-
#
|
1443
|
-
#
|
1444
|
-
#
|
1445
|
-
#
|
1446
|
-
#
|
1447
|
-
#
|
1452
|
+
# @param $start-at [Sass::Script::Value::Number] The index of the first
|
1453
|
+
# character of the substring. If this is negative, it counts from the end
|
1454
|
+
# of `$string`
|
1455
|
+
# @param $end-before [Sass::Script::Value::Number] The index of the last
|
1456
|
+
# character of the substring. If this is negative, it counts from the end
|
1457
|
+
# of `$string`. Defaults to -1
|
1458
|
+
# @return [Sass::Script::Value::String] The substring. This will be quoted
|
1459
|
+
# if and only if `$string` was quoted
|
1448
1460
|
# @raise [ArgumentError] if any parameter is the wrong type
|
1449
1461
|
def str_slice(string, start_at, end_at = nil)
|
1450
1462
|
assert_type string, :String, :string
|
@@ -1471,7 +1483,7 @@ module Sass::Script
|
|
1471
1483
|
# to-upper-case(abcd) => ABCD
|
1472
1484
|
#
|
1473
1485
|
# @overload to_upper_case($string)
|
1474
|
-
#
|
1486
|
+
# @param $string [Sass::Script::Value::String]
|
1475
1487
|
# @return [Sass::Script::Value::String]
|
1476
1488
|
# @raise [ArgumentError] if `$string` isn't a string
|
1477
1489
|
def to_upper_case(string)
|
@@ -1486,7 +1498,7 @@ module Sass::Script
|
|
1486
1498
|
# to-lower-case(ABCD) => abcd
|
1487
1499
|
#
|
1488
1500
|
# @overload to_lower_case($string)
|
1489
|
-
#
|
1501
|
+
# @param $string [Sass::Script::Value::String]
|
1490
1502
|
# @return [Sass::Script::Value::String]
|
1491
1503
|
# @raise [ArgumentError] if `$string` isn't a string
|
1492
1504
|
def to_lower_case(string)
|
@@ -1505,7 +1517,7 @@ module Sass::Script
|
|
1505
1517
|
# type-of(#fff) => color
|
1506
1518
|
# type-of(blue) => color
|
1507
1519
|
# @overload type_of($value)
|
1508
|
-
#
|
1520
|
+
# @param $value [Sass::Script::Value::Base] The value to inspect
|
1509
1521
|
# @return [Sass::Script::Value::String] The unquoted string name of the
|
1510
1522
|
# value's type
|
1511
1523
|
def type_of(value)
|
@@ -1520,7 +1532,7 @@ module Sass::Script
|
|
1520
1532
|
# feature-exists(what-is-this-i-dont-know) => false
|
1521
1533
|
#
|
1522
1534
|
# @overload feature_exists($feature)
|
1523
|
-
#
|
1535
|
+
# @param $feature [Sass::Script::Value::String] The name of the feature
|
1524
1536
|
# @return [Sass::Script::Value::Bool] Whether the feature is supported in this version of Sass
|
1525
1537
|
# @raise [ArgumentError] if `$feature` isn't a string
|
1526
1538
|
def feature_exists(feature)
|
@@ -1539,7 +1551,7 @@ module Sass::Script
|
|
1539
1551
|
# unit(10px * 5em) => "em*px"
|
1540
1552
|
# unit(10px * 5em / 30cm / 1rem) => "em*px/cm*rem"
|
1541
1553
|
# @overload unit($number)
|
1542
|
-
#
|
1554
|
+
# @param $number [Sass::Script::Value::Number]
|
1543
1555
|
# @return [Sass::Script::Value::String] The unit(s) of the number, as a
|
1544
1556
|
# quoted string
|
1545
1557
|
# @raise [ArgumentError] if `$number` isn't a number
|
@@ -1555,7 +1567,7 @@ module Sass::Script
|
|
1555
1567
|
# unitless(100) => true
|
1556
1568
|
# unitless(100px) => false
|
1557
1569
|
# @overload unitless($number)
|
1558
|
-
#
|
1570
|
+
# @param $number [Sass::Script::Value::Number]
|
1559
1571
|
# @return [Sass::Script::Value::Bool]
|
1560
1572
|
# @raise [ArgumentError] if `$number` isn't a number
|
1561
1573
|
def unitless(number)
|
@@ -1571,8 +1583,8 @@ module Sass::Script
|
|
1571
1583
|
# comparable(100px, 3em) => false
|
1572
1584
|
# comparable(10cm, 3mm) => true
|
1573
1585
|
# @overload comparable($number1, $number2)
|
1574
|
-
#
|
1575
|
-
#
|
1586
|
+
# @param $number1 [Sass::Script::Value::Number]
|
1587
|
+
# @param $number2 [Sass::Script::Value::Number]
|
1576
1588
|
# @return [Sass::Script::Value::Bool]
|
1577
1589
|
# @raise [ArgumentError] if either parameter is the wrong type
|
1578
1590
|
def comparable(number1, number2)
|
@@ -1588,7 +1600,7 @@ module Sass::Script
|
|
1588
1600
|
# percentage(0.2) => 20%
|
1589
1601
|
# percentage(100px / 50px) => 200%
|
1590
1602
|
# @overload percentage($number)
|
1591
|
-
#
|
1603
|
+
# @param $number [Sass::Script::Value::Number]
|
1592
1604
|
# @return [Sass::Script::Value::Number]
|
1593
1605
|
# @raise [ArgumentError] if `$number` isn't a unitless number
|
1594
1606
|
def percentage(number)
|
@@ -1605,7 +1617,7 @@ module Sass::Script
|
|
1605
1617
|
# round(10.4px) => 10px
|
1606
1618
|
# round(10.6px) => 11px
|
1607
1619
|
# @overload round($number)
|
1608
|
-
#
|
1620
|
+
# @param $number [Sass::Script::Value::Number]
|
1609
1621
|
# @return [Sass::Script::Value::Number]
|
1610
1622
|
# @raise [ArgumentError] if `$number` isn't a number
|
1611
1623
|
def round(number)
|
@@ -1619,7 +1631,7 @@ module Sass::Script
|
|
1619
1631
|
# ceil(10.4px) => 11px
|
1620
1632
|
# ceil(10.6px) => 11px
|
1621
1633
|
# @overload ceil($number)
|
1622
|
-
#
|
1634
|
+
# @param $number [Sass::Script::Value::Number]
|
1623
1635
|
# @return [Sass::Script::Value::Number]
|
1624
1636
|
# @raise [ArgumentError] if `$number` isn't a number
|
1625
1637
|
def ceil(number)
|
@@ -1633,7 +1645,7 @@ module Sass::Script
|
|
1633
1645
|
# floor(10.4px) => 10px
|
1634
1646
|
# floor(10.6px) => 10px
|
1635
1647
|
# @overload floor($number)
|
1636
|
-
#
|
1648
|
+
# @param $number [Sass::Script::Value::Number]
|
1637
1649
|
# @return [Sass::Script::Value::Number]
|
1638
1650
|
# @raise [ArgumentError] if `$number` isn't a number
|
1639
1651
|
def floor(number)
|
@@ -1647,7 +1659,7 @@ module Sass::Script
|
|
1647
1659
|
# abs(10px) => 10px
|
1648
1660
|
# abs(-10px) => 10px
|
1649
1661
|
# @overload abs($number)
|
1650
|
-
#
|
1662
|
+
# @param $number [Sass::Script::Value::Number]
|
1651
1663
|
# @return [Sass::Script::Value::Number]
|
1652
1664
|
# @raise [ArgumentError] if `$number` isn't a number
|
1653
1665
|
def abs(number)
|
@@ -1662,7 +1674,7 @@ module Sass::Script
|
|
1662
1674
|
# min(1px, 4px) => 1px
|
1663
1675
|
# min(5em, 3em, 4em) => 3em
|
1664
1676
|
# @overload min($numbers...)
|
1665
|
-
#
|
1677
|
+
# @param $numbers [[Sass::Script::Value::Number]]
|
1666
1678
|
# @return [Sass::Script::Value::Number]
|
1667
1679
|
# @raise [ArgumentError] if any argument isn't a number, or if not all of
|
1668
1680
|
# the arguments have comparable units
|
@@ -1679,7 +1691,7 @@ module Sass::Script
|
|
1679
1691
|
# max(1px, 4px) => 4px
|
1680
1692
|
# max(5em, 3em, 4em) => 5em
|
1681
1693
|
# @overload max($numbers...)
|
1682
|
-
#
|
1694
|
+
# @param $numbers [[Sass::Script::Value::Number]]
|
1683
1695
|
# @return [Sass::Script::Value::Number]
|
1684
1696
|
# @raise [ArgumentError] if any argument isn't a number, or if not all of
|
1685
1697
|
# the arguments have comparable units
|
@@ -1698,7 +1710,7 @@ module Sass::Script
|
|
1698
1710
|
# length(10px 20px 30px) => 3
|
1699
1711
|
# length((width: 10px, height: 20px)) => 2
|
1700
1712
|
# @overload length($list)
|
1701
|
-
#
|
1713
|
+
# @param $list [Sass::Script::Value::Base]
|
1702
1714
|
# @return [Sass::Script::Value::Number]
|
1703
1715
|
def length(list)
|
1704
1716
|
number(list.to_a.size)
|
@@ -1717,11 +1729,11 @@ module Sass::Script
|
|
1717
1729
|
# @example
|
1718
1730
|
# set-nth($list: 10px 20px 30px, $n: 2, $value: -20px) => 10px -20px 30px
|
1719
1731
|
# @overload set-nth($list, $n, $value)
|
1720
|
-
#
|
1721
|
-
#
|
1722
|
-
#
|
1723
|
-
#
|
1724
|
-
#
|
1732
|
+
# @param $list [Sass::Script::Value::Base] The list that will be copied, having the element
|
1733
|
+
# at index `$n` changed.
|
1734
|
+
# @param $n [Sass::Script::Value::Number] The index of the item to set.
|
1735
|
+
# Negative indices count from the end of the list.
|
1736
|
+
# @param $value [Sass::Script::Value::Base] The new value at index `$n`.
|
1725
1737
|
# @return [Sass::Script::Value::List]
|
1726
1738
|
# @raise [ArgumentError] if `$n` isn't an integer between 1 and the length
|
1727
1739
|
# of `$list`
|
@@ -1750,9 +1762,9 @@ module Sass::Script
|
|
1750
1762
|
# nth((Helvetica, Arial, sans-serif), 3) => sans-serif
|
1751
1763
|
# nth((width: 10px, length: 20px), 2) => length, 20px
|
1752
1764
|
# @overload nth($list, $n)
|
1753
|
-
#
|
1754
|
-
#
|
1755
|
-
#
|
1765
|
+
# @param $list [Sass::Script::Value::Base]
|
1766
|
+
# @param $n [Sass::Script::Value::Number] The index of the item to get.
|
1767
|
+
# Negative indices count from the end of the list.
|
1756
1768
|
# @return [Sass::Script::Value::Base]
|
1757
1769
|
# @raise [ArgumentError] if `$n` isn't an integer between 1 and the length
|
1758
1770
|
# of `$list`
|
@@ -1779,11 +1791,11 @@ module Sass::Script
|
|
1779
1791
|
# join(10px, 20px, comma) => 10px, 20px
|
1780
1792
|
# join((blue, red), (#abc, #def), space) => blue red #abc #def
|
1781
1793
|
# @overload join($list1, $list2, $separator: auto)
|
1782
|
-
#
|
1783
|
-
#
|
1784
|
-
#
|
1785
|
-
#
|
1786
|
-
#
|
1794
|
+
# @param $list1 [Sass::Script::Value::Base]
|
1795
|
+
# @param $list2 [Sass::Script::Value::Base]
|
1796
|
+
# @param $separator [Sass::Script::Value::String] The list separator to use.
|
1797
|
+
# If this is `comma` or `space`, that separator will be used. If this is
|
1798
|
+
# `auto` (the default), the separator is determined as explained above.
|
1787
1799
|
# @return [Sass::Script::Value::List]
|
1788
1800
|
def join(list1, list2, separator = identifier("auto"))
|
1789
1801
|
assert_type separator, :String, :separator
|
@@ -1812,11 +1824,11 @@ module Sass::Script
|
|
1812
1824
|
# append(10px, 20px, comma) => 10px, 20px
|
1813
1825
|
# append((blue, red), green, space) => blue red green
|
1814
1826
|
# @overload append($list, $val, $separator: auto)
|
1815
|
-
#
|
1816
|
-
#
|
1817
|
-
#
|
1818
|
-
#
|
1819
|
-
#
|
1827
|
+
# @param $list [Sass::Script::Value::Base]
|
1828
|
+
# @param $val [Sass::Script::Value::Base]
|
1829
|
+
# @param $separator [Sass::Script::Value::String] The list separator to use.
|
1830
|
+
# If this is `comma` or `space`, that separator will be used. If this is
|
1831
|
+
# `auto` (the default), the separator is determined as explained above.
|
1820
1832
|
# @return [Sass::Script::Value::List]
|
1821
1833
|
def append(list, val, separator = identifier("auto"))
|
1822
1834
|
assert_type separator, :String, :separator
|
@@ -1844,7 +1856,7 @@ module Sass::Script
|
|
1844
1856
|
# zip(1px 1px 3px, solid dashed solid, red green blue)
|
1845
1857
|
# => 1px solid red, 1px dashed green, 3px solid blue
|
1846
1858
|
# @overload zip($lists...)
|
1847
|
-
#
|
1859
|
+
# @param $lists [[Sass::Script::Value::Base]]
|
1848
1860
|
# @return [Sass::Script::Value::List]
|
1849
1861
|
def zip(*lists)
|
1850
1862
|
length = nil
|
@@ -1875,8 +1887,8 @@ module Sass::Script
|
|
1875
1887
|
# index(1px solid red, dashed) => null
|
1876
1888
|
# index((width: 10px, height: 20px), (height, 20px)) => 2
|
1877
1889
|
# @overload index($list, $value)
|
1878
|
-
#
|
1879
|
-
#
|
1890
|
+
# @param $list [Sass::Script::Value::Base]
|
1891
|
+
# @param $value [Sass::Script::Value::Base]
|
1880
1892
|
# @return [Sass::Script::Value::Number, Sass::Script::Value::Null] The
|
1881
1893
|
# 1-based index of `$value` in `$list`, or `null`
|
1882
1894
|
def index(list, value)
|
@@ -1894,7 +1906,7 @@ module Sass::Script
|
|
1894
1906
|
# list-separator(1px, 2px, 3px) => comma
|
1895
1907
|
# list-separator('foo') => space
|
1896
1908
|
# @overload list_separator($list)
|
1897
|
-
#
|
1909
|
+
# @param $list [Sass::Script::Value::Base]
|
1898
1910
|
# @return [Sass::Script::Value::String] `comma` or `space`
|
1899
1911
|
def list_separator(list)
|
1900
1912
|
identifier((list.separator || :space).to_s)
|
@@ -1909,8 +1921,8 @@ module Sass::Script
|
|
1909
1921
|
# map-get(("foo": 1, "bar": 2), "bar") => 2
|
1910
1922
|
# map-get(("foo": 1, "bar": 2), "baz") => null
|
1911
1923
|
# @overload map_get($map, $key)
|
1912
|
-
#
|
1913
|
-
#
|
1924
|
+
# @param $map [Sass::Script::Value::Map]
|
1925
|
+
# @param $key [Sass::Script::Value::Base]
|
1914
1926
|
# @return [Sass::Script::Value::Base] The value indexed by `$key`, or `null`
|
1915
1927
|
# if the map doesn't contain the given key
|
1916
1928
|
# @raise [ArgumentError] if `$map` is not a map
|
@@ -1933,8 +1945,8 @@ module Sass::Script
|
|
1933
1945
|
# map-merge(("foo": 1), ("bar": 2)) => ("foo": 1, "bar": 2)
|
1934
1946
|
# map-merge(("foo": 1, "bar": 2), ("bar": 3)) => ("foo": 1, "bar": 3)
|
1935
1947
|
# @overload map_merge($map1, $map2)
|
1936
|
-
#
|
1937
|
-
#
|
1948
|
+
# @param $map1 [Sass::Script::Value::Map]
|
1949
|
+
# @param $map2 [Sass::Script::Value::Map]
|
1938
1950
|
# @return [Sass::Script::Value::Map]
|
1939
1951
|
# @raise [ArgumentError] if either parameter is not a map
|
1940
1952
|
def map_merge(map1, map2)
|
@@ -1950,8 +1962,8 @@ module Sass::Script
|
|
1950
1962
|
# map-remove(("foo": 1, "bar": 2), "bar") => ("foo": 1)
|
1951
1963
|
# map-remove(("foo": 1, "bar": 2), "baz") => ("foo": 1, "bar": 2)
|
1952
1964
|
# @overload map_remove($map, $key)
|
1953
|
-
#
|
1954
|
-
#
|
1965
|
+
# @param $map [Sass::Script::Value::Map]
|
1966
|
+
# @param $key [Sass::Script::Value::Base]
|
1955
1967
|
# @return [Sass::Script::Value::Map]
|
1956
1968
|
# @raise [ArgumentError] if `$map` is not a map
|
1957
1969
|
def map_remove(map, key)
|
@@ -1967,7 +1979,7 @@ module Sass::Script
|
|
1967
1979
|
# @example
|
1968
1980
|
# map-keys(("foo": 1, "bar": 2)) => "foo", "bar"
|
1969
1981
|
# @overload map_keys($map)
|
1970
|
-
#
|
1982
|
+
# @param $map [Map]
|
1971
1983
|
# @return [List] the list of keys, comma-separated
|
1972
1984
|
# @raise [ArgumentError] if `$map` is not a map
|
1973
1985
|
def map_keys(map)
|
@@ -1983,7 +1995,7 @@ module Sass::Script
|
|
1983
1995
|
# map-values(("foo": 1, "bar": 2)) => 1, 2
|
1984
1996
|
# map-values(("foo": 1, "bar": 2, "baz": 1)) => 1, 2, 1
|
1985
1997
|
# @overload map_values($map)
|
1986
|
-
#
|
1998
|
+
# @param $map [Map]
|
1987
1999
|
# @return [List] the list of values, comma-separated
|
1988
2000
|
# @raise [ArgumentError] if `$map` is not a map
|
1989
2001
|
def map_values(map)
|
@@ -1998,8 +2010,8 @@ module Sass::Script
|
|
1998
2010
|
# map-has-key(("foo": 1, "bar": 2), "foo") => true
|
1999
2011
|
# map-has-key(("foo": 1, "bar": 2), "baz") => false
|
2000
2012
|
# @overload map_has_key($map, $key)
|
2001
|
-
#
|
2002
|
-
#
|
2013
|
+
# @param $map [Sass::Script::Value::Map]
|
2014
|
+
# @param $key [Sass::Script::Value::Base]
|
2003
2015
|
# @return [Sass::Script::Value::Bool]
|
2004
2016
|
# @raise [ArgumentError] if `$map` is not a map
|
2005
2017
|
def map_has_key(map, key)
|
@@ -2019,7 +2031,7 @@ module Sass::Script
|
|
2019
2031
|
#
|
2020
2032
|
# @include foo($arg1: val, $arg2: val);
|
2021
2033
|
# @overload keywords($args)
|
2022
|
-
#
|
2034
|
+
# @param $args [Sass::Script::Value::ArgList]
|
2023
2035
|
# @return [Sass::Script::Value::Map]
|
2024
2036
|
# @raise [ArgumentError] if `$args` isn't a variable argument list
|
2025
2037
|
def keywords(args)
|
@@ -2036,10 +2048,10 @@ module Sass::Script
|
|
2036
2048
|
# if(true, 1px, 2px) => 1px
|
2037
2049
|
# if(false, 1px, 2px) => 2px
|
2038
2050
|
# @overload if($condition, $if-true, $if-false)
|
2039
|
-
#
|
2040
|
-
#
|
2041
|
-
#
|
2042
|
-
#
|
2051
|
+
# @param $condition [Sass::Script::Value::Base] Whether the `$if-true` or
|
2052
|
+
# `$if-false` will be returned
|
2053
|
+
# @param $if-true [Sass::Script::Tree::Node]
|
2054
|
+
# @param $if-false [Sass::Script::Tree::Node]
|
2043
2055
|
# @return [Sass::Script::Value::Base] `$if-true` or `$if-false`
|
2044
2056
|
def if(condition, if_true, if_false)
|
2045
2057
|
if condition.to_bool
|
@@ -2079,7 +2091,7 @@ module Sass::Script
|
|
2079
2091
|
# call($fn, (a b c), 2) => b
|
2080
2092
|
#
|
2081
2093
|
# @overload call($name, $args...)
|
2082
|
-
#
|
2094
|
+
# @param $name [String] The name of the function to call.
|
2083
2095
|
def call(name, *args)
|
2084
2096
|
assert_type name, :String, :name
|
2085
2097
|
kwargs = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -78,12 +78,12 @@ module Sass
|
|
78
78
|
# Non-destructively extends this selector with the extensions specified in a hash
|
79
79
|
# (which should come from {Sass::Tree::Visitors::Cssize}).
|
80
80
|
#
|
81
|
-
# @overload
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
81
|
+
# @overload do_extend(extends, parent_directives)
|
82
|
+
# @param extends [Sass::Util::SubsetMap{Selector::Simple =>
|
83
|
+
# Sass::Tree::Visitors::Cssize::Extend}]
|
84
|
+
# The extensions to perform on this selector
|
85
|
+
# @param parent_directives [Array<Sass::Tree::DirectiveNode>]
|
86
|
+
# The directives containing this selector.
|
87
87
|
# @return [Array<Sequence>] A list of selectors generated
|
88
88
|
# by extending this selector with `extends`.
|
89
89
|
# These correspond to a {CommaSequence}'s {CommaSequence#members members array}.
|
@@ -131,12 +131,12 @@ module Sass
|
|
131
131
|
# Non-destrucively extends this selector with the extensions specified in a hash
|
132
132
|
# (which should come from {Sass::Tree::Visitors::Cssize}).
|
133
133
|
#
|
134
|
-
# @overload
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
134
|
+
# @overload do_extend(extends, parent_directives)
|
135
|
+
# @param extends [{Selector::Simple =>
|
136
|
+
# Sass::Tree::Visitors::Cssize::Extend}]
|
137
|
+
# The extensions to perform on this selector
|
138
|
+
# @param parent_directives [Array<Sass::Tree::DirectiveNode>]
|
139
|
+
# The directives containing this selector.
|
140
140
|
# @return [Array<Sequence>] A list of selectors generated
|
141
141
|
# by extending this selector with `extends`.
|
142
142
|
# @see CommaSequence#do_extend
|
@@ -41,6 +41,7 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
|
|
41
41
|
k.options = @options
|
42
42
|
v.options = @options if v
|
43
43
|
end
|
44
|
+
node.splat.options = @options if node.splat
|
44
45
|
yield
|
45
46
|
end
|
46
47
|
|
@@ -63,12 +64,15 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
|
|
63
64
|
k.options = @options
|
64
65
|
v.options = @options if v
|
65
66
|
end
|
67
|
+
node.splat.options = @options if node.splat
|
66
68
|
yield
|
67
69
|
end
|
68
70
|
|
69
71
|
def visit_mixin(node)
|
70
72
|
node.args.each {|a| a.options = @options}
|
71
73
|
node.keywords.each {|k, v| v.options = @options}
|
74
|
+
node.splat.options = @options if node.splat
|
75
|
+
node.kwarg_splat.options = @options if node.kwarg_splat
|
72
76
|
yield
|
73
77
|
end
|
74
78
|
|
data/lib/sass/util.rb
CHANGED
data/test/sass/cache_test.rb
CHANGED
@@ -66,17 +66,52 @@ class CacheTest < Test::Unit::TestCase
|
|
66
66
|
assert_equal an_object, cache.retrieve("an_object", "")
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
raise 'Unmarshalable'
|
72
|
-
end
|
69
|
+
def test_cache_node_with_unmarshalable_option
|
70
|
+
engine_with_unmarshalable_options("foo {a: b + c}").to_tree
|
73
71
|
end
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
# Regression tests
|
74
|
+
|
75
|
+
def test_cache_mixin_def_splat_sass_node_with_unmarshalable_option
|
76
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
77
|
+
=color($args...)
|
78
|
+
color: red
|
79
|
+
SASS
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_cache_mixin_def_splat_scss_node_with_unmarshalable_option
|
83
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
84
|
+
@mixin color($args...) {
|
85
|
+
color: red;
|
86
|
+
}
|
87
|
+
SCSS
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_cache_function_splat_sass_node_with_unmarshalable_option
|
91
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
92
|
+
@function color($args...)
|
93
|
+
@return red
|
94
|
+
SASS
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_cache_function_splat_scss_node_with_unmarshalable_option
|
98
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
99
|
+
@function color($args...) {
|
100
|
+
@return red;
|
101
|
+
}
|
102
|
+
SCSS
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_cache_include_splat_sass_node_with_unmarshalable_option
|
106
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
107
|
+
@include color($args..., $kwargs...)
|
108
|
+
SASS
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_cache_include_splat_scss_node_with_unmarshalable_option
|
112
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
113
|
+
@include color($args..., $kwargs...);
|
114
|
+
SCSS
|
80
115
|
end
|
81
116
|
|
82
117
|
private
|
@@ -86,4 +121,11 @@ class CacheTest < Test::Unit::TestCase
|
|
86
121
|
div { @include color(red); }
|
87
122
|
SCSS
|
88
123
|
end
|
124
|
+
|
125
|
+
def engine_with_unmarshalable_options(src, options={})
|
126
|
+
Sass::Engine.new(src, {
|
127
|
+
:syntax => :scss, :object => Class.new.new, :filename => 'file.scss',
|
128
|
+
:importer => Sass::Importers::Filesystem.new(absolutize('templates'))
|
129
|
+
}.merge(options))
|
130
|
+
end
|
89
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: yard
|