Comparing version 2.4.1 to 2.5.0
@@ -5,3 +5,2 @@ #!/usr/bin/env node | ||
var fs = require('fs') | ||
var sys = require('util') | ||
var chalk = require('chalk') | ||
@@ -173,3 +172,3 @@ var mkdirp = require('mkdirp') | ||
} else { | ||
sys.print(result.css) | ||
console.log(result.css) | ||
} | ||
@@ -176,0 +175,0 @@ } |
@@ -0,1 +1,5 @@ | ||
## 2.5.0 - 08 Feb. 2020 | ||
* `useCalc` to flip unit based `transform-origin`. | ||
* CLI: use `console.log` instead of the [deprecated](https://nodejs.org/docs/latest-v10.x/api/util.html#util_util_print_strings) `util.print`(issue #156). | ||
## 2.4.1 - 28 Nov. 2019 | ||
@@ -2,0 +6,0 @@ * Ignore white spaces before directives prefix. |
@@ -303,2 +303,4 @@ 'use strict' | ||
value = context.util.complement(value) | ||
} else if (value.match(this.cache.length)) { | ||
value = context.util.flipLength(value) | ||
} | ||
@@ -312,2 +314,3 @@ return value | ||
'percent': context.util.regex(['calc', 'percent'], 'i'), | ||
'length': context.util.regex(['length'], 'gi'), | ||
'xKeyword': /(left|right)/i | ||
@@ -422,3 +425,3 @@ } | ||
: (parts[0].match(this.cache.length) | ||
? this.flipLength(parts[0], context) | ||
? context.util.flipLength(parts[0]) | ||
: context.util.swapLeftRight(parts[0]))) | ||
@@ -430,8 +433,2 @@ state.value = state.value.replace(this.cache.match, function () { return parts.shift() }) | ||
}, | ||
'flipLength': function (value, context) { | ||
if (context.config.useCalc) { | ||
return 'calc(100% - ' + value + ')' | ||
} | ||
return context.util.swapLeftRight(value) | ||
}, | ||
'update': function (context, value, name) { | ||
@@ -438,0 +435,0 @@ if (name.match(this.cache.gradient)) { |
@@ -118,7 +118,7 @@ /* | ||
context.util.each(context.config.plugins, function (plugin) { | ||
return context.util.each(plugin.processors, function (directive) { | ||
if (node.prop.match(directive.expr)) { | ||
return context.util.each(plugin.processors, function (processor) { | ||
if (node.prop.match(processor.expr)) { | ||
var raw = node.raws.value && node.raws.value.raw ? node.raws.value.raw : node.value | ||
var state = context.util.saveComments(raw) | ||
var pair = directive.action(node.prop, state.value, context) | ||
var pair = processor.action(node.prop, state.value, context) | ||
state.value = pair.value | ||
@@ -125,0 +125,0 @@ pair.value = context.util.restoreComments(state) |
@@ -112,2 +112,5 @@ 'use strict' | ||
}, | ||
flipLength: function (value) { | ||
return config.useCalc ? 'calc(100% - ' + value + ')' : value | ||
}, | ||
save: function (what, who, replacement, restorer, exclude) { | ||
@@ -114,0 +117,0 @@ var state = { |
{ | ||
"author": "Mohammad Younes", | ||
"name": "rtlcss", | ||
"version": "2.4.1", | ||
"version": "2.5.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/", |
@@ -125,7 +125,21 @@ module.exports = [ | ||
'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 }', | ||
'expected': 'div { background-position: calc(100% - 10px) 0; transform-origin:calc(100% - 0.5rem) 0; }', | ||
'input': 'div { background-position: 10px 0; transform-origin:0.5rem 0; }', | ||
'reversable': false, | ||
'options': { 'useCalc': true } | ||
}, | ||
{ | ||
'should': 'Should flip background-position-x when expressed in units (useCalc:true)', | ||
'expected': 'div { background-position-x: calc(100% - 10px); }', | ||
'input': 'div { background-position-x: 10px; }', | ||
'reversable': false, | ||
'options': { 'useCalc': true } | ||
}, | ||
{ | ||
'should': 'Should flip transform-origin when expressed in units (useCalc:true)', | ||
'expected': 'div { transform-origin:calc(100% - 0.5rem) 2rem; }', | ||
'input': 'div { transform-origin:0.5rem 2rem; }', | ||
'reversable': false, | ||
'options': { 'useCalc': true } | ||
} | ||
] |
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
141161
38
3297