Comparing version 1.7.3 to 1.7.4
@@ -130,3 +130,3 @@ function main(configuration) { | ||
"expr": /^(?!text\-).*?transform$/ig, | ||
"match": /((translate)(x|3d)?|skew(x|y)?|rotate(z|3d)?|matrix(3d)?)\((.|\s)*\)/ig, | ||
'negatable': /((translate)(x|3d)?|rotate(z)?)$/ig, | ||
"matrix": /matrix/i, | ||
@@ -166,21 +166,22 @@ "flip": function(value, process){ | ||
var self = this; | ||
var parts = value.match(this.match); | ||
for (var x = 0; parts && x < parts.length; x++) { | ||
parts[x] = parts[x].replace(/([^\(]*)(?:\()(.*)(?:\))/i, function(m, $1, $2){ | ||
var tokens = util.saveFunctions($2); | ||
if ($1.match(self.matrix3D)) | ||
tokens.value = self.flipMatrix3D(tokens.value); | ||
else if ($1.match(self.matrix)) | ||
tokens.value = self.flipMatrix(tokens.value); | ||
else if ($1.match(self.rotate3D)) | ||
tokens.value = self.flipRotate3D(tokens.value); | ||
else if ($1.match(self.skewXY)) | ||
tokens.value = util.negateAll(tokens.value); | ||
else | ||
tokens.value = util.negate(tokens.value); | ||
return $1 + "(" + util.restoreFunctions(tokens) + ")"; | ||
}); | ||
} | ||
return { 'prop': prop, 'value': value.replace(this.match, function () { return parts.shift(); }) }; | ||
var tokens = util.saveFunctions(value) | ||
return { | ||
'prop': prop, | ||
'value': util.restoreFunctions(tokens, function (v, n) { | ||
if (n.length) { | ||
if (n.match(self.matrix3D)) { | ||
v = self.flipMatrix3D(v) | ||
} else if (n.match(self.matrix)) { | ||
v = self.flipMatrix(v) | ||
} else if (n.match(self.rotate3D)) { | ||
v = self.flipRotate3D(v) | ||
} else if (n.match(self.skewXY)) { | ||
v = util.negateAll(v) | ||
} else if (n.match(self.negatable)) { | ||
v = util.negate(v) | ||
} | ||
} | ||
return v | ||
}) | ||
}; | ||
} | ||
@@ -187,0 +188,0 @@ }, |
@@ -135,5 +135,12 @@ function main(configuration) { | ||
}, | ||
restoreFunctions:function (result) { | ||
while (REGEX_TOKEN.test(result.value)) | ||
result.value = result.value.replace(REGEX_TOKEN, function (m, i) { return result.store[i - 1]; }); | ||
restoreFunctions:function (result, callback) { | ||
var detokenizer = new RegExp('(\\w*?)' + TOKEN_CHARACTER + '(\\d+)', 'i') | ||
while (detokenizer.test(result.value)) | ||
result.value = result.value.replace(detokenizer, function (m, n, i) { | ||
var v = result.store[i - 1] | ||
if (typeof callback === 'function') { | ||
return n + callback(v, n) | ||
} | ||
return n + v | ||
}); | ||
return result.value | ||
@@ -145,3 +152,2 @@ }, | ||
for(var x=0;x<what.length;x++){ | ||
var match = ''; | ||
switch(what[x]){ | ||
@@ -148,0 +154,0 @@ case 'percent': |
{ | ||
"author": "Mohammad Younes", | ||
"name": "rtlcss", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/MohammadYounes/rtlcss/issues?state=open", |
@@ -1,3 +0,5 @@ | ||
# RTLCSS [![GitHub version](https://badge.fury.io/gh/MohammadYounes%2Frtlcss.svg)](http://badge.fury.io/gh/MohammadYounes%2Frtlcss) [![NPM version](https://badge.fury.io/js/rtlcss.svg)](http://badge.fury.io/js/rtlcss) [![Build Status](https://travis-ci.org/MohammadYounes/rtlcss.svg?branch=master)](https://travis-ci.org/MohammadYounes/rtlcss) [![DEPENDENCIES](https://david-dm.org/MohammadYounes/rtlcss.svg)](https://david-dm.org/MohammadYounes/rtlcss) [![Twitter](https://img.shields.io/badge/follow-%40rtlcss-blue.svg)](https://twitter.com/rtlcss) | ||
# RTLCSS | ||
[![Twitter](https://img.shields.io/badge/follow-%40rtlcss-blue.svg)](https://twitter.com/rtlcss) | ||
<img style="margin:15px" title="RTL CSS" src="https://cloud.githubusercontent.com/assets/4712046/5889219/190f366a-a425-11e4-8ef5-8b5f60a9e903.png" align="right"/> | ||
@@ -412,2 +414,5 @@ | ||
## Release Notes | ||
* **v1.7.4** [23 Feb. 2016] | ||
* Fixes a bug in flipping multiple transforms. | ||
* **v1.7.3** [30 Jan. 2016] | ||
@@ -414,0 +419,0 @@ * Fixes a bug in flipping N-Values containing comments. |
@@ -770,2 +770,14 @@ var assert = require("assert"); | ||
}, | ||
{ | ||
'should': 'Should mirror multiple transforms : translateX translateY Rotate', | ||
'expected': 'div { transform: translateX(-50.25px) translateY(50.25px) rotate(-20.75deg); }', | ||
'input': 'div { transform: translateX(50.25px) translateY(50.25px) rotate(20.75deg); }', | ||
'reversable': true | ||
}, | ||
{ | ||
'should': 'Should mirror multiple transforms with calc : translateX translateY Rotate', | ||
'expected': 'div { transform: translateX(-ms-calc(-1*(((25%/2) * 10px)))) translateY(-moz-calc(((25%/2) * 10rad))) rotate(calc(-1*(((25%/2) * 10grad)))); }', | ||
'input': 'div { transform: translateX(-ms-calc(((25%/2) * 10px))) translateY(-moz-calc(((25%/2) * 10rad))) rotate(calc(((25%/2) * 10grad))); }', | ||
'reversable': false | ||
} | ||
], | ||
@@ -772,0 +784,0 @@ 'RTLCSS (Options):': [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124249
2401
535