sass 3.5.5 → 3.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 156f6a86b72d2df83e67cb687eb8c2ce986ee242
4
- data.tar.gz: eadb5e80b5ab509cda145d3843715f0ca55a8fca
3
+ metadata.gz: 2a0be81d849341f77d658cfb6a44988a273038b3
4
+ data.tar.gz: e2d3106b331b62359df2b422d4d7142af4cf215e
5
5
  SHA512:
6
- metadata.gz: 6cc1352915b32f8cad9138f7f6eed0e1efe4c1f5f519d10d1efea311c57b755cbcf651daa5d24211f785ee58d0a410d2bce17ac21d874448cdc611ab62515fd8
7
- data.tar.gz: fbdf035e2c5ed04de78592f64b9a1d163bb7bc1533e63c4c479e7d494847745b2ea0ceb52f720818e4586fa994a665653f16de93f61d6f503e09d8a90b42ffea
6
+ metadata.gz: fd05bc99a4719679bcdfde4d7d2e755080ecb93ba1b48ebab9d43a0ed24a03b2ea5ca190efd3dcace28c9b0bfdf56cb469d7efddc39a8ab70f1e0996769feb65
7
+ data.tar.gz: db99debfdb3863aa2d04fa105e1be80403ba82e94f9f76f40cd26e5072b56a13215f78c6cf02bb901a96565c6224efef4acfe3903ea02ffb90301915ddf7427f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.5.5
1
+ 3.5.6
@@ -1 +1 @@
1
- 05 January 2018 01:22:10 UTC
1
+ 23 March 2018 00:44:24 UTC
@@ -92,7 +92,7 @@ END
92
92
  end
93
93
 
94
94
  opts.on("-v", "--version", "Print the Sass version.") do
95
- puts("Sass #{Sass.version[:string]}")
95
+ puts("Ruby Sass #{Sass.version[:string]}")
96
96
  exit
97
97
  end
98
98
  end
@@ -653,7 +653,15 @@ module Sass::Script
653
653
  # inclusive
654
654
  # @return [Sass::Script::Value::Color]
655
655
  # @raise [ArgumentError] if any parameter is the wrong type or out of bounds
656
- def rgb(red, green, blue)
656
+ def rgb(red, green = nil, blue = nil)
657
+ if green.nil?
658
+ return unquoted_string("rgb(#{red})") if var?(red)
659
+ raise ArgumentError.new("wrong number of arguments (1 for 3)")
660
+ elsif blue.nil?
661
+ return unquoted_string("rgb(#{red}, #{green})") if var?(red) || var?(green)
662
+ raise ArgumentError.new("wrong number of arguments (2 for 3)")
663
+ end
664
+
657
665
  if special_number?(red) || special_number?(green) || special_number?(blue)
658
666
  return unquoted_string("rgb(#{red}, #{green}, #{blue})")
659
667
  end
@@ -677,6 +685,8 @@ module Sass::Script
677
685
  Sass::Script::Value::Color.new(color_attrs)
678
686
  end
679
687
  declare :rgb, [:red, :green, :blue]
688
+ declare :rgb, [:red, :green]
689
+ declare :rgb, [:red]
680
690
 
681
691
  # Creates a {Sass::Script::Value::Color Color} from red, green, blue, and
682
692
  # alpha values.
@@ -711,9 +721,22 @@ module Sass::Script
711
721
  # is the wrong type
712
722
  def rgba(*args)
713
723
  case args.size
724
+ when 1
725
+ return unquoted_string("rgba(#{args.first})") if var?(args.first)
726
+ raise ArgumentError.new("wrong number of arguments (1 for 4)")
714
727
  when 2
715
728
  color, alpha = args
716
729
 
730
+ if var?(color)
731
+ return unquoted_string("rgba(#{color}, #{alpha})")
732
+ elsif var?(alpha)
733
+ if color.is_a?(Sass::Script::Value::Color)
734
+ return unquoted_string("rgba(#{color.red}, #{color.green}, #{color.blue}, #{alpha})")
735
+ else
736
+ return unquoted_string("rgba(#{color}, #{alpha})")
737
+ end
738
+ end
739
+
717
740
  assert_type color, :Color, :color
718
741
  if special_number?(alpha)
719
742
  unquoted_string("rgba(#{color.red}, #{color.green}, #{color.blue}, #{alpha})")
@@ -722,6 +745,12 @@ module Sass::Script
722
745
  check_alpha_unit alpha, 'rgba'
723
746
  color.with(:alpha => alpha.value)
724
747
  end
748
+ when 3
749
+ if var?(args[0]) || var?(args[1]) || var?(args[2])
750
+ unquoted_string("rgba(#{args.join(', ')})")
751
+ else
752
+ raise ArgumentError.new("wrong number of arguments (3 for 4)")
753
+ end
725
754
  when 4
726
755
  red, green, blue, alpha = args
727
756
  if special_number?(red) || special_number?(green) ||
@@ -735,7 +764,9 @@ module Sass::Script
735
764
  end
736
765
  end
737
766
  declare :rgba, [:red, :green, :blue, :alpha]
767
+ declare :rgba, [:red, :green, :blue]
738
768
  declare :rgba, [:color, :alpha]
769
+ declare :rgba, [:red]
739
770
 
740
771
  # Creates a {Sass::Script::Value::Color Color} from hue, saturation, and
741
772
  # lightness values. Uses the algorithm from the [CSS3 spec][].
@@ -753,7 +784,15 @@ module Sass::Script
753
784
  # @return [Sass::Script::Value::Color]
754
785
  # @raise [ArgumentError] if `$saturation` or `$lightness` are out of bounds
755
786
  # or any parameter is the wrong type
756
- def hsl(hue, saturation, lightness)
787
+ def hsl(hue, saturation = nil, lightness = nil)
788
+ if saturation.nil?
789
+ return unquoted_string("hsl(#{hue})") if var?(hue)
790
+ raise ArgumentError.new("wrong number of arguments (1 for 3)")
791
+ elsif lightness.nil?
792
+ return unquoted_string("hsl(#{hue}, #{saturation})") if var?(hue) || var?(saturation)
793
+ raise ArgumentError.new("wrong number of arguments (2 for 3)")
794
+ end
795
+
757
796
  if special_number?(hue) || special_number?(saturation) || special_number?(lightness)
758
797
  unquoted_string("hsl(#{hue}, #{saturation}, #{lightness})")
759
798
  else
@@ -761,6 +800,8 @@ module Sass::Script
761
800
  end
762
801
  end
763
802
  declare :hsl, [:hue, :saturation, :lightness]
803
+ declare :hsl, [:hue, :saturation]
804
+ declare :hsl, [:hue]
764
805
 
765
806
  # Creates a {Sass::Script::Value::Color Color} from hue,
766
807
  # saturation, lightness, and alpha values. Uses the algorithm from
@@ -781,7 +822,21 @@ module Sass::Script
781
822
  # @return [Sass::Script::Value::Color]
782
823
  # @raise [ArgumentError] if `$saturation`, `$lightness`, or `$alpha` are out
783
824
  # of bounds or any parameter is the wrong type
784
- def hsla(hue, saturation, lightness, alpha)
825
+ def hsla(hue, saturation = nil, lightness = nil, alpha = nil)
826
+ if saturation.nil?
827
+ return unquoted_string("hsla(#{hue})") if var?(hue)
828
+ raise ArgumentError.new("wrong number of arguments (1 for 4)")
829
+ elsif lightness.nil?
830
+ return unquoted_string("hsla(#{hue}, #{saturation})") if var?(hue) || var?(saturation)
831
+ raise ArgumentError.new("wrong number of arguments (2 for 4)")
832
+ elsif alpha.nil?
833
+ if var?(hue) || var?(saturation) || var?(lightness)
834
+ return unquoted_string("hsla(#{hue}, #{saturation}, #{lightness})")
835
+ else
836
+ raise ArgumentError.new("wrong number of arguments (2 for 4)")
837
+ end
838
+ end
839
+
785
840
  if special_number?(hue) || special_number?(saturation) ||
786
841
  special_number?(lightness) || special_number?(alpha)
787
842
  return unquoted_string("hsla(#{hue}, #{saturation}, #{lightness}, #{alpha})")
@@ -803,6 +858,9 @@ module Sass::Script
803
858
  :hue => h, :saturation => s, :lightness => l, :alpha => alpha.value)
804
859
  end
805
860
  declare :hsla, [:hue, :saturation, :lightness, :alpha]
861
+ declare :hsla, [:hue, :saturation, :lightness]
862
+ declare :hsla, [:hue, :saturation]
863
+ declare :hsla, [:hue]
806
864
 
807
865
  # Gets the red component of a color. Calculated from HSL where necessary via
808
866
  # [this algorithm][hsl-to-rgb].
@@ -215,6 +215,14 @@ module Sass::Script::Value
215
215
  literal.is_a?(Sass::Script::Value::String) && literal.value =~ /calc\(/
216
216
  end
217
217
 
218
+ # Returns true when the literal is a string containing a var().
219
+ #
220
+ # @param literal [Sass::Script::Value::Base] The value to check
221
+ # @return Boolean
222
+ def var?(literal)
223
+ literal.is_a?(Sass::Script::Value::String) && literal.value =~ /var\(/
224
+ end
225
+
218
226
  # Returns whether the literal is a special CSS value that may evaluate to a
219
227
  # number, such as `calc()` or `var()`.
220
228
  #
@@ -189,6 +189,7 @@ module Sass::Script::Value
189
189
  # @raise [Sass::UnitConversionError] if `other` has incompatible units
190
190
  def mod(other)
191
191
  if other.is_a?(Number)
192
+ return Number.new(Float::NAN) if other.value == 0
192
193
  operate(other, :%)
193
194
  else
194
195
  raise NoMethodError.new(nil, :mod)
@@ -472,7 +473,7 @@ module Sass::Script::Value
472
473
  sans_common_units(@numerator_units, @denominator_units)
473
474
 
474
475
  @denominator_units.each_with_index do |d, i|
475
- next unless convertable?(d) && (u = @numerator_units.find(&method(:convertable?)))
476
+ next unless convertable?(d) && (u = @numerator_units.find {|n| convertable?([n, d])})
476
477
  @value /= conversion_factor(d, u)
477
478
  @denominator_units.delete_at(i)
478
479
  @numerator_units.delete_at(@numerator_units.index(u))
@@ -898,7 +898,7 @@ module Sass
898
898
  (?!
899
899
  url\(
900
900
  )
901
- [^()\[\]{}"'#/ \t\r\n\f#{top_level ? ";!" : ""}]
901
+ [^()\[\]{}"'#/ \t\r\n\f#{top_level ? ";" : ""}]
902
902
  |
903
903
  \#(?!\{)
904
904
  |
@@ -392,7 +392,8 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
392
392
  # @param node [Sass::Script::Tree::PropNode] A custom property node.
393
393
  # @return [String]
394
394
  def format_custom_property_value(node)
395
- if node.style == :compact || node.style == :compressed || !node.resolved_value.include?("\n")
395
+ value = node.resolved_value.sub(/\n[ \t\r\f\n]*\Z/, ' ')
396
+ if node.style == :compact || node.style == :compressed || !value.include?("\n")
396
397
  # Folding not involving newlines was done in the parser. We can safely
397
398
  # fold newlines here because tokens like strings can't contain literal
398
399
  # newlines, so we know any adjacent whitespace is tokenized as whitespace.
@@ -401,7 +402,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
401
402
 
402
403
  # Find the smallest amount of indentation in the custom property and use
403
404
  # that as the base indentation level.
404
- lines = node.resolved_value.split("\n")
405
+ lines = value.split("\n")
405
406
  indented_lines = lines[1..-1]
406
407
  min_indentation = indented_lines.
407
408
  map {|line| line[/^[ \t]*/]}.
@@ -76,7 +76,6 @@ module Sass
76
76
  end
77
77
  end
78
78
 
79
- @@version[:string] << " (#{name})"
80
79
  @@version
81
80
  end
82
81
 
@@ -1318,7 +1318,7 @@ SCSS
1318
1318
  evaluate("rgb($red: 255, $green: 255)")
1319
1319
  flunk("Expected exception")
1320
1320
  rescue Sass::SyntaxError => e
1321
- assert_equal("Function rgb requires an argument named $blue", e.message)
1321
+ assert_equal("wrong number of arguments (2 for 3) for `rgb'", e.message)
1322
1322
  end
1323
1323
 
1324
1324
  def test_keyword_args_with_extra_argument
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.5.5
4
+ version: 3.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -10,76 +10,76 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-01-05 00:00:00.000000000 Z
13
+ date: 2018-03-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sass-listen
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 4.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 4.0.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: yard
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 0.8.7.6
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.8.7.6
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: redcarpet
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '3.3'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '3.3'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: nokogiri
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: 1.6.0
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: 1.6.0
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: minitest
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '5'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '5'
85
85
  description: |2
@@ -95,7 +95,7 @@ executables:
95
95
  extensions: []
96
96
  extra_rdoc_files: []
97
97
  files:
98
- - .yardopts
98
+ - ".yardopts"
99
99
  - CODE_OF_CONDUCT.md
100
100
  - CONTRIBUTING.md
101
101
  - MIT-LICENSE
@@ -376,17 +376,17 @@ require_paths:
376
376
  - lib
377
377
  required_ruby_version: !ruby/object:Gem::Requirement
378
378
  requirements:
379
- - - '>='
379
+ - - ">="
380
380
  - !ruby/object:Gem::Version
381
381
  version: 2.0.0
382
382
  required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  requirements:
384
- - - '>='
384
+ - - ">="
385
385
  - !ruby/object:Gem::Version
386
386
  version: '0'
387
387
  requirements: []
388
388
  rubyforge_project: sass
389
- rubygems_version: 2.4.8
389
+ rubygems_version: 2.6.14
390
390
  signing_key:
391
391
  specification_version: 4
392
392
  summary: A powerful but elegant CSS compiler that makes CSS fun again.