Comparing version 2.3.0 to 2.4.0
@@ -0,1 +1,5 @@ | ||
## 2.4.0 - 20 Jun. 2018 | ||
* New Option: | ||
* `useCalc` (default: `false`) to flip unit based `background-position` using `calc`. **Thanks @zoreet** | ||
## 2.3.0 - 9 Jun. 2018 | ||
@@ -2,0 +6,0 @@ * Skip processing CSS variables. **Thanks @danfooo** |
@@ -24,2 +24,3 @@ 'use strict' | ||
addKey('stringMap', []) | ||
addKey('useCalc', false) | ||
@@ -26,0 +27,0 @@ // default strings map |
@@ -418,3 +418,5 @@ 'use strict' | ||
? context.util.complement(parts[0]) | ||
: context.util.swapLeftRight(parts[0])) | ||
: (parts[0].match(this.cache.length) | ||
? this.flipLength(parts[0], context) | ||
: context.util.swapLeftRight(parts[0]))) | ||
state.value = state.value.replace(this.cache.match, function () { return parts.shift() }) | ||
@@ -425,2 +427,8 @@ } | ||
}, | ||
'flipLength': function (value, context) { | ||
if (context.config.useCalc) { | ||
return 'calc(100% - ' + value + ')' | ||
} | ||
return context.util.swapLeftRight(value) | ||
}, | ||
'update': function (context, value, name) { | ||
@@ -443,2 +451,3 @@ if (name.match(this.cache.gradient)) { | ||
'position': context.util.regex(['position'], 'g'), | ||
'length': context.util.regex(['length'], 'gi'), | ||
'gradient': /gradient$/i, | ||
@@ -445,0 +454,0 @@ 'angle': /\d+(deg|g?rad|turn)/i, |
{ | ||
"author": "Mohammad Younes", | ||
"name": "rtlcss", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)", | ||
@@ -6,0 +6,0 @@ "homepage": "http://rtlcss.com/", |
@@ -122,3 +122,10 @@ module.exports = [ | ||
'reversable': true | ||
}, | ||
{ | ||
'should': 'Should flip background-position when expressed in units (useCalc:true)', | ||
'expected': 'div { background-position: calc(100% - 10px) 0 }', | ||
'input': 'div { background-position: 10px 0 }', | ||
'reversable': false, | ||
'options': { 'useCalc': true } | ||
} | ||
] |
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
138786
3255