autoprefixer-rails 0.8.20130902 → 0.8.20130903

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/ChangeLog CHANGED
@@ -11,6 +11,10 @@
11
11
  * Fix selector prefixes order.
12
12
  * Fix browser versions order in inspect.
13
13
 
14
+ 20130903:
15
+ * Fix old WebKit gradients convertor on rgba() colors.
16
+ * Allow to write old direction syntax in gradients.
17
+
14
18
  == 0.7 (We Do Not Sow)
15
19
  * Add vendor prefixes to selectors.
16
20
  * Add ::selection and ::placeholder selectors support.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- autoprefixer-rails (0.8.20130902)
4
+ autoprefixer-rails (0.8.20130903)
5
5
  execjs
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module AutoprefixerRails
2
- VERSION = '0.8.20130902'.freeze unless defined? AutoprefixerRails::VERSION
2
+ VERSION = '0.8.20130903'.freeze unless defined? AutoprefixerRails::VERSION
3
3
  end
@@ -2815,7 +2815,7 @@ require.register("autoprefixer/lib/autoprefixer/hacks/fullscreen.js", function(e
2815
2815
  });
2816
2816
  require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exports, require, module){
2817
2817
  (function() {
2818
- var Gradient, OldValue, Value, utils,
2818
+ var Gradient, OldValue, Value, isDirection, utils,
2819
2819
  __hasProp = {}.hasOwnProperty,
2820
2820
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
2821
2821
 
@@ -2825,6 +2825,8 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2825
2825
 
2826
2826
  utils = require('../utils');
2827
2827
 
2828
+ isDirection = new RegExp('(top|left|right|bottom)', 'gi');
2829
+
2828
2830
  Gradient = (function(_super) {
2829
2831
  var i, _i, _len, _ref;
2830
2832
 
@@ -2837,7 +2839,7 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2837
2839
  _ref = Gradient.names;
2838
2840
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2839
2841
  i = _ref[_i];
2840
- Gradient.regexps[i] = new RegExp('(^|\\s|,)' + i + '\\(([^)]+)\\)', 'gi');
2842
+ Gradient.regexps[i] = new RegExp('(^|\\s|,)' + i + '\\((.+)\\)', 'gi');
2841
2843
  }
2842
2844
 
2843
2845
  function Gradient(name, prefixes) {
@@ -2848,8 +2850,10 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2848
2850
 
2849
2851
  Gradient.prototype.addPrefix = function(prefix, string) {
2850
2852
  var _this = this;
2851
- return string.replace(this.regexp, function(all, before, params) {
2852
- params = params.trim().split(/\s*,\s*/);
2853
+ return string.replace(this.regexp, function(all, before, args) {
2854
+ var params;
2855
+ params = _this.splitParams(args);
2856
+ params = _this.newDirection(params);
2853
2857
  if (prefix === '-webkit- old') {
2854
2858
  if (_this.name !== 'linear-gradient') {
2855
2859
  return all;
@@ -2857,6 +2861,12 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2857
2861
  if (params[0] && params[0].indexOf('deg') !== -1) {
2858
2862
  return all;
2859
2863
  }
2864
+ if (args.indexOf('-corner') !== -1) {
2865
+ return all;
2866
+ }
2867
+ if (args.indexOf('-side') !== -1) {
2868
+ return all;
2869
+ }
2860
2870
  params = _this.oldDirection(params);
2861
2871
  params = _this.colorStops(params);
2862
2872
  return '-webkit-gradient(linear, ' + params.join(', ') + ')';
@@ -2881,10 +2891,59 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2881
2891
  };
2882
2892
 
2883
2893
  Gradient.prototype.oldDirections = {
2884
- top: 'bottom left, top left',
2885
- left: 'top right, top left',
2886
- bottom: 'top left, bottom left',
2887
- right: 'top left, top right'
2894
+ 'top': 'bottom left, top left',
2895
+ 'left': 'top right, top left',
2896
+ 'bottom': 'top left, bottom left',
2897
+ 'right': 'top left, top right',
2898
+ 'top right': 'bottom left, top right',
2899
+ 'top left': 'bottom right, top left',
2900
+ 'bottom right': 'top left, bottom right',
2901
+ 'bottom left': 'top right, bottom left'
2902
+ };
2903
+
2904
+ Gradient.prototype.splitParams = function(params) {
2905
+ var array, char, func, param, _j, _len1;
2906
+ array = [];
2907
+ param = '';
2908
+ func = 0;
2909
+ for (_j = 0, _len1 = params.length; _j < _len1; _j++) {
2910
+ char = params[_j];
2911
+ if (char === ')' && func > 0) {
2912
+ func -= 1;
2913
+ param += char;
2914
+ } else if (char === '(') {
2915
+ param += char;
2916
+ func += 1;
2917
+ } else if (func > 0) {
2918
+ param += char;
2919
+ } else if (char === ',') {
2920
+ array.push(param.trim());
2921
+ param = '';
2922
+ } else {
2923
+ param += char;
2924
+ }
2925
+ }
2926
+ array.push(param.trim());
2927
+ return array;
2928
+ };
2929
+
2930
+ Gradient.prototype.newDirection = function(params) {
2931
+ var first, value;
2932
+ first = params[0];
2933
+ if (first.indexOf('to ') === -1 && isDirection.test(first)) {
2934
+ first = first.split(' ');
2935
+ first = (function() {
2936
+ var _j, _len1, _results;
2937
+ _results = [];
2938
+ for (_j = 0, _len1 = first.length; _j < _len1; _j++) {
2939
+ value = first[_j];
2940
+ _results.push(this.directions[value.toLowerCase()] || value);
2941
+ }
2942
+ return _results;
2943
+ }).call(this);
2944
+ params[0] = 'to ' + first.join(' ');
2945
+ }
2946
+ return params;
2888
2947
  };
2889
2948
 
2890
2949
  Gradient.prototype.fixDirection = function(param) {
@@ -2932,16 +2991,30 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
2932
2991
 
2933
2992
  Gradient.prototype.colorStops = function(params) {
2934
2993
  return params.map(function(param, i) {
2935
- var color, position, _ref1;
2936
- _ref1 = param.split(' '), color = _ref1[0], position = _ref1[1];
2994
+ var color, position, separator;
2937
2995
  if (i === 0) {
2938
2996
  return param;
2939
- } else if (i === 1) {
2997
+ }
2998
+ separator = param.lastIndexOf(' ');
2999
+ if (separator === -1) {
3000
+ color = param;
3001
+ position = void 0;
3002
+ } else {
3003
+ color = param.slice(0, separator);
3004
+ position = param.slice(separator + 1);
3005
+ }
3006
+ if (position && position.indexOf(')') !== -1) {
3007
+ color += ' ' + position;
3008
+ position = void 0;
3009
+ }
3010
+ if (i === 1) {
2940
3011
  return "from(" + color + ")";
2941
3012
  } else if (i === params.length - 1) {
2942
3013
  return "to(" + color + ")";
2943
- } else {
3014
+ } else if (position) {
2944
3015
  return "color-stop(" + position + ", " + color + ")";
3016
+ } else {
3017
+ return "color-stop(" + color + ")";
2945
3018
  }
2946
3019
  });
2947
3020
  };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoprefixer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.20130902
4
+ version: 0.8.20130903
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-02 00:00:00.000000000 Z
12
+ date: 2013-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  segments:
86
86
  - 0
87
- hash: -1111151196267356471
87
+ hash: -3100066590030577154
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: -1111151196267356471
96
+ hash: -3100066590030577154
97
97
  requirements: []
98
98
  rubyforge_project:
99
99
  rubygems_version: 1.8.23