Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rtl-css-js

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtl-css-js - npm Package Compare versions

Comparing version 1.14.5 to 1.15.0

dist/cjs/convert-9a463d97.js

3

dist/cjs/core.js

@@ -5,3 +5,3 @@ 'use strict';

var convert = require('./convert-54cd9008.js');
var convert = require('./convert-9a463d97.js');

@@ -33,2 +33,3 @@

exports.propsToIgnore = convert.propsToIgnore;
exports.splitShadow = convert.splitShadow;
exports.valuesToConvert = convert.valuesToConvert;
'use strict';
var convert = require('./convert-54cd9008.js');
var convert = require('./convert-9a463d97.js');

@@ -5,0 +5,0 @@

@@ -1,1 +0,1 @@

export { f as arrayToObject, h as calculateNewBackgroundPosition, j as calculateNewTranslate, i as canConvertValue, o as containsCssVar, c as convert, d as convertProperty, k as flipSign, j as flipTransformSign, g as getPropertyDoppelganger, e as getValueDoppelganger, w as getValuesAsList, l as handleQuartetValues, m as includes, n as isBoolean, q as isFunction, s as isNullOrUndefined, r as isNumber, t as isObject, u as isString, a as propertiesToConvert, p as propertyValueConverters, b as propsToIgnore, v as valuesToConvert } from './convert-4d96668c.js';
export { f as arrayToObject, h as calculateNewBackgroundPosition, j as calculateNewTranslate, i as canConvertValue, o as containsCssVar, c as convert, d as convertProperty, k as flipSign, j as flipTransformSign, g as getPropertyDoppelganger, e as getValueDoppelganger, w as getValuesAsList, l as handleQuartetValues, m as includes, n as isBoolean, q as isFunction, s as isNullOrUndefined, r as isNumber, t as isObject, u as isString, a as propertiesToConvert, p as propertyValueConverters, b as propsToIgnore, x as splitShadow, v as valuesToConvert } from './convert-053e536c.js';

@@ -1,2 +0,2 @@

import { c as convert } from './convert-4d96668c.js';
import { c as convert } from './convert-053e536c.js';

@@ -3,0 +3,0 @@

@@ -173,3 +173,41 @@ (function (global, factory) {

}
/**
* Splits a shadow style into its separate shadows using the comma delimiter, but creating an exception
* for comma separated values in parentheses often used for rgba colours.
* @param {String} value
* @returns {Array} array of all box shadow values in the string
*/
function splitShadow(value) {
var shadows = [];
var start = 0;
var end = 0;
var rgba = false;
while (end < value.length) {
if (!rgba && value[end] === ',') {
shadows.push(value.substring(start, end).trim());
end++;
start = end;
} else if (value[end] === "(") {
rgba = true;
end++;
} else if (value[end] === ')') {
rgba = false;
end++;
} else {
end++;
}
} // push the last shadow value if there is one
// istanbul ignore next
if (start != end) {
shadows.push(value.substring(start, end + 1));
}
return shadows;
}
var propertyValueConverters = {

@@ -187,11 +225,14 @@ padding: function padding(_ref) {

var value = _ref2.value;
// intentionally leaving off the `g` flag here because we only want to change the first number (which is the offset-x)
return value.replace(/(-*)([.|\d]+)/, function (match, negative, number) {
if (number === '0') {
return match;
}
var flippedShadows = splitShadow(value).map(function (shadow) {
// intentionally leaving off the `g` flag here because we only want to change the first number (which is the offset-x)
return shadow.replace(/(-*)([.|\d]+)/, function (match, negative, number) {
if (number === '0') {
return match;
}
var doubleNegative = negative === '' ? '-' : '';
return "" + doubleNegative + number;
var doubleNegative = negative === '' ? '-' : '';
return "" + doubleNegative + number;
});
});
return flippedShadows.join(',');
},

@@ -530,2 +571,3 @@ borderColor: function borderColor(_ref3) {

exports.propsToIgnore = propsToIgnore;
exports.splitShadow = splitShadow;
exports.valuesToConvert = valuesToConvert;

@@ -532,0 +574,0 @@

@@ -1,2 +0,2 @@

!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).rtlCSSJSCore={})}(this,(function(r){"use strict";function t(r){return r.reduce((function(r,t){var e=t[0],o=t[1];return r[e]=o,r[o]=e,r}),{})}function e(r){return"string"==typeof r&&r.match(/var\(.*\)/g)}function o(r){return"boolean"==typeof r}function n(r){return"function"==typeof r}function i(r){return"number"==typeof r}function a(r){return null==r}function s(r){return r&&"object"==typeof r}function u(r){return"string"==typeof r}function l(r,t){return-1!==r.indexOf(t)}function g(r){return 0===parseFloat(r)?r:"-"===r[0]?r.slice(1):"-"+r}function d(r,t,e,o){return t+g(e)+o}function f(r){var t=r.indexOf(".");if(-1===t)r=100-parseFloat(r)+"%";else{var e=r.length-t-2;r=(r=100-parseFloat(r)).toFixed(e)+"%"}return r}function c(r){return r.replace(/ +/g," ").split(" ").map((function(r){return r.trim()})).filter(Boolean).reduce((function(r,t){var e=r.list,o=r.state,n=(t.match(/\(/g)||[]).length,i=(t.match(/\)/g)||[]).length;return o.parensDepth>0?e[e.length-1]=e[e.length-1]+" "+t:e.push(t),o.parensDepth+=n-i,{list:e,state:o}}),{list:[],state:{parensDepth:0}}).list}function p(r){var t=c(r);if(t.length<=3||t.length>4)return r;var e=t[0],o=t[1],n=t[2];return[e,t[3],n,o].join(" ")}function b(r){return!o(r)&&!a(r)&&!e(r)}var m={padding:function(r){var t=r.value;return i(t)?t:p(t)},textShadow:function(r){return r.value.replace(/(-*)([.|\d]+)/,(function(r,t,e){return"0"===e?r:""+(""===t?"-":"")+e}))},borderColor:function(r){return p(r.value)},borderRadius:function(r){var t=r.value;if(i(t))return t;if(l(t,"/")){var e=t.split("/"),o=e[0],n=e[1];return m.borderRadius({value:o.trim()})+" / "+m.borderRadius({value:n.trim()})}var a=c(t);switch(a.length){case 2:return a.reverse().join(" ");case 4:var s=a[0],u=a[1],g=a[2];return[u,s,a[3],g].join(" ");default:return t}},background:function(r){var t=r.value,e=r.valuesToConvert,o=r.isRtl,n=r.bgImgDirectionRegex,a=r.bgPosDirectionRegex;if(i(t))return t;var s=t.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return t=t.replace(s,m.backgroundPosition({value:s,valuesToConvert:e,isRtl:o,bgPosDirectionRegex:a})),m.backgroundImage({value:t,valuesToConvert:e,bgImgDirectionRegex:n})},backgroundImage:function(r){var t=r.value,e=r.valuesToConvert,o=r.bgImgDirectionRegex;return l(t,"url(")||l(t,"linear-gradient(")?t.replace(o,(function(r,t,o){return r.replace(o,e[o])})):t},backgroundPosition:function(r){var t=r.value,e=r.valuesToConvert,o=r.isRtl,n=r.bgPosDirectionRegex;return t.replace(o?/^((-|\d|\.)+%)/:null,(function(r,t){return f(t)})).replace(n,(function(r){return e[r]}))},backgroundPositionX:function(r){var t=r.value,e=r.valuesToConvert,o=r.isRtl,n=r.bgPosDirectionRegex;return i(t)?t:m.backgroundPosition({value:t,valuesToConvert:e,isRtl:o,bgPosDirectionRegex:n})},transition:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){var t=r.split(" ");return t[0]=e[t[0]]||t[0],t.join(" ")})).join(", ")},transitionProperty:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){return e[r]||r})).join(", ")},transform:function(r){var t=r.value,e="(?:(?:(?:\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",o="((?:-?(?:[0-9]*\\.[0-9]+|[0-9]+)(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|-?(?:[_a-z]|[^\\u0020-\\u007e]|"+e+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+e+")*)?)|(?:inherit|auto))",n=new RegExp("(translateX\\s*\\(\\s*)"+o+"(\\s*\\))","gi"),i=new RegExp("(translate\\s*\\(\\s*)"+o+"((?:\\s*,\\s*"+o+"){0,1}\\s*\\))","gi"),a=new RegExp("(translate3d\\s*\\(\\s*)"+o+"((?:\\s*,\\s*"+o+"){0,2}\\s*\\))","gi"),s=new RegExp("(rotate[ZY]?\\s*\\(\\s*)"+o+"(\\s*\\))","gi");return t.replace(n,d).replace(i,d).replace(a,d).replace(s,d)}};m.objectPosition=m.backgroundPosition,m.margin=m.padding,m.borderWidth=m.padding,m.boxShadow=m.textShadow,m.webkitBoxShadow=m.boxShadow,m.mozBoxShadow=m.boxShadow,m.WebkitBoxShadow=m.boxShadow,m.MozBoxShadow=m.boxShadow,m.borderStyle=m.borderColor,m.webkitTransform=m.transform,m.mozTransform=m.transform,m.WebkitTransform=m.transform,m.MozTransform=m.transform,m.transformOrigin=m.backgroundPosition,m.webkitTransformOrigin=m.transformOrigin,m.mozTransformOrigin=m.transformOrigin,m.WebkitTransformOrigin=m.transformOrigin,m.MozTransformOrigin=m.transformOrigin,m.webkitTransition=m.transition,m.mozTransition=m.transition,m.WebkitTransition=m.transition,m.MozTransition=m.transition,m.webkitTransitionProperty=m.transitionProperty,m.mozTransitionProperty=m.transitionProperty,m.WebkitTransitionProperty=m.transitionProperty,m.MozTransitionProperty=m.transitionProperty,m["text-shadow"]=m.textShadow,m["border-color"]=m.borderColor,m["border-radius"]=m.borderRadius,m["background-image"]=m.backgroundImage,m["background-position"]=m.backgroundPosition,m["background-position-x"]=m.backgroundPositionX,m["object-position"]=m.objectPosition,m["border-width"]=m.padding,m["box-shadow"]=m.textShadow,m["-webkit-box-shadow"]=m.textShadow,m["-moz-box-shadow"]=m.textShadow,m["border-style"]=m.borderColor,m["-webkit-transform"]=m.transform,m["-moz-transform"]=m.transform,m["transform-origin"]=m.transformOrigin,m["-webkit-transform-origin"]=m.transformOrigin,m["-moz-transform-origin"]=m.transformOrigin,m["-webkit-transition"]=m.transition,m["-moz-transition"]=m.transition,m["transition-property"]=m.transitionProperty,m["-webkit-transition-property"]=m.transitionProperty,m["-moz-transition-property"]=m.transitionProperty;var v=t([["paddingLeft","paddingRight"],["marginLeft","marginRight"],["left","right"],["borderLeft","borderRight"],["borderLeftColor","borderRightColor"],["borderLeftStyle","borderRightStyle"],["borderLeftWidth","borderRightWidth"],["borderTopLeftRadius","borderTopRightRadius"],["borderBottomLeftRadius","borderBottomRightRadius"],["padding-left","padding-right"],["margin-left","margin-right"],["border-left","border-right"],["border-left-color","border-right-color"],["border-left-style","border-right-style"],["border-left-width","border-right-width"],["border-top-left-radius","border-top-right-radius"],["border-bottom-left-radius","border-bottom-right-radius"]]),h=["content"],w=t([["ltr","rtl"],["left","right"],["w-resize","e-resize"],["sw-resize","se-resize"],["nw-resize","ne-resize"]]),x=new RegExp("(^|\\W|_)((ltr)|(rtl)|(left)|(right))(\\W|_|$)","g"),y=new RegExp("(left)|(right)");function R(r){return Object.keys(r).reduce((function(t,e){var o=r[e];if(u(o)&&(o=o.trim()),l(h,e))return t[e]=o,t;var n=k(e,o),i=n.key,a=n.value;return t[i]=a,t}),Array.isArray(r)?[]:{})}function k(r,t){var e=/\/\*\s?@noflip\s?\*\//.test(t),o=e?r:T(r);return{key:o,value:e?t:P(o,t)}}function T(r){return v[r]||r}function P(r,t){if(!b(t))return t;if(s(t))return R(t);var e,o=i(t),a=n(t),u=o||a?t:t.replace(/ !important.*?$/,""),l=!o&&u.length!==t.length,g=m[r];return e=g?g({value:u,valuesToConvert:w,propertiesToConvert:v,isRtl:!0,bgImgDirectionRegex:x,bgPosDirectionRegex:y}):w[u]||u,l?e+" !important":e}r.arrayToObject=t,r.calculateNewBackgroundPosition=f,r.calculateNewTranslate=d,r.canConvertValue=b,r.containsCssVar=e,r.convert=R,r.convertProperty=k,r.flipSign=g,r.flipTransformSign=d,r.getPropertyDoppelganger=T,r.getValueDoppelganger=P,r.getValuesAsList=c,r.handleQuartetValues=p,r.includes=l,r.isBoolean=o,r.isFunction=n,r.isNullOrUndefined=a,r.isNumber=i,r.isObject=s,r.isString=u,r.propertiesToConvert=v,r.propertyValueConverters=m,r.propsToIgnore=h,r.valuesToConvert=w,Object.defineProperty(r,"__esModule",{value:!0})}));
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).rtlCSSJSCore={})}(this,(function(r){"use strict";function t(r){return r.reduce((function(r,t){var e=t[0],n=t[1];return r[e]=n,r[n]=e,r}),{})}function e(r){return"string"==typeof r&&r.match(/var\(.*\)/g)}function n(r){return"boolean"==typeof r}function o(r){return"function"==typeof r}function i(r){return"number"==typeof r}function a(r){return null==r}function s(r){return r&&"object"==typeof r}function u(r){return"string"==typeof r}function l(r,t){return-1!==r.indexOf(t)}function g(r){return 0===parseFloat(r)?r:"-"===r[0]?r.slice(1):"-"+r}function d(r,t,e,n){return t+g(e)+n}function f(r){var t=r.indexOf(".");if(-1===t)r=100-parseFloat(r)+"%";else{var e=r.length-t-2;r=(r=100-parseFloat(r)).toFixed(e)+"%"}return r}function c(r){return r.replace(/ +/g," ").split(" ").map((function(r){return r.trim()})).filter(Boolean).reduce((function(r,t){var e=r.list,n=r.state,o=(t.match(/\(/g)||[]).length,i=(t.match(/\)/g)||[]).length;return n.parensDepth>0?e[e.length-1]=e[e.length-1]+" "+t:e.push(t),n.parensDepth+=o-i,{list:e,state:n}}),{list:[],state:{parensDepth:0}}).list}function p(r){var t=c(r);if(t.length<=3||t.length>4)return r;var e=t[0],n=t[1],o=t[2];return[e,t[3],o,n].join(" ")}function b(r){return!n(r)&&!a(r)&&!e(r)}function m(r){for(var t=[],e=0,n=0,o=!1;n<r.length;)o||","!==r[n]?"("===r[n]?(o=!0,n++):")"===r[n]?(o=!1,n++):n++:(t.push(r.substring(e,n).trim()),e=++n);return e!=n&&t.push(r.substring(e,n+1)),t}var v={padding:function(r){var t=r.value;return i(t)?t:p(t)},textShadow:function(r){return m(r.value).map((function(r){return r.replace(/(-*)([.|\d]+)/,(function(r,t,e){return"0"===e?r:""+(""===t?"-":"")+e}))})).join(",")},borderColor:function(r){return p(r.value)},borderRadius:function(r){var t=r.value;if(i(t))return t;if(l(t,"/")){var e=t.split("/"),n=e[0],o=e[1];return v.borderRadius({value:n.trim()})+" / "+v.borderRadius({value:o.trim()})}var a=c(t);switch(a.length){case 2:return a.reverse().join(" ");case 4:var s=a[0],u=a[1],g=a[2];return[u,s,a[3],g].join(" ");default:return t}},background:function(r){var t=r.value,e=r.valuesToConvert,n=r.isRtl,o=r.bgImgDirectionRegex,a=r.bgPosDirectionRegex;if(i(t))return t;var s=t.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return t=t.replace(s,v.backgroundPosition({value:s,valuesToConvert:e,isRtl:n,bgPosDirectionRegex:a})),v.backgroundImage({value:t,valuesToConvert:e,bgImgDirectionRegex:o})},backgroundImage:function(r){var t=r.value,e=r.valuesToConvert,n=r.bgImgDirectionRegex;return l(t,"url(")||l(t,"linear-gradient(")?t.replace(n,(function(r,t,n){return r.replace(n,e[n])})):t},backgroundPosition:function(r){var t=r.value,e=r.valuesToConvert,n=r.isRtl,o=r.bgPosDirectionRegex;return t.replace(n?/^((-|\d|\.)+%)/:null,(function(r,t){return f(t)})).replace(o,(function(r){return e[r]}))},backgroundPositionX:function(r){var t=r.value,e=r.valuesToConvert,n=r.isRtl,o=r.bgPosDirectionRegex;return i(t)?t:v.backgroundPosition({value:t,valuesToConvert:e,isRtl:n,bgPosDirectionRegex:o})},transition:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){var t=r.split(" ");return t[0]=e[t[0]]||t[0],t.join(" ")})).join(", ")},transitionProperty:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){return e[r]||r})).join(", ")},transform:function(r){var t=r.value,e="(?:(?:(?:\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",n="((?:-?(?:[0-9]*\\.[0-9]+|[0-9]+)(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|-?(?:[_a-z]|[^\\u0020-\\u007e]|"+e+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+e+")*)?)|(?:inherit|auto))",o=new RegExp("(translateX\\s*\\(\\s*)"+n+"(\\s*\\))","gi"),i=new RegExp("(translate\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,1}\\s*\\))","gi"),a=new RegExp("(translate3d\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,2}\\s*\\))","gi"),s=new RegExp("(rotate[ZY]?\\s*\\(\\s*)"+n+"(\\s*\\))","gi");return t.replace(o,d).replace(i,d).replace(a,d).replace(s,d)}};v.objectPosition=v.backgroundPosition,v.margin=v.padding,v.borderWidth=v.padding,v.boxShadow=v.textShadow,v.webkitBoxShadow=v.boxShadow,v.mozBoxShadow=v.boxShadow,v.WebkitBoxShadow=v.boxShadow,v.MozBoxShadow=v.boxShadow,v.borderStyle=v.borderColor,v.webkitTransform=v.transform,v.mozTransform=v.transform,v.WebkitTransform=v.transform,v.MozTransform=v.transform,v.transformOrigin=v.backgroundPosition,v.webkitTransformOrigin=v.transformOrigin,v.mozTransformOrigin=v.transformOrigin,v.WebkitTransformOrigin=v.transformOrigin,v.MozTransformOrigin=v.transformOrigin,v.webkitTransition=v.transition,v.mozTransition=v.transition,v.WebkitTransition=v.transition,v.MozTransition=v.transition,v.webkitTransitionProperty=v.transitionProperty,v.mozTransitionProperty=v.transitionProperty,v.WebkitTransitionProperty=v.transitionProperty,v.MozTransitionProperty=v.transitionProperty,v["text-shadow"]=v.textShadow,v["border-color"]=v.borderColor,v["border-radius"]=v.borderRadius,v["background-image"]=v.backgroundImage,v["background-position"]=v.backgroundPosition,v["background-position-x"]=v.backgroundPositionX,v["object-position"]=v.objectPosition,v["border-width"]=v.padding,v["box-shadow"]=v.textShadow,v["-webkit-box-shadow"]=v.textShadow,v["-moz-box-shadow"]=v.textShadow,v["border-style"]=v.borderColor,v["-webkit-transform"]=v.transform,v["-moz-transform"]=v.transform,v["transform-origin"]=v.transformOrigin,v["-webkit-transform-origin"]=v.transformOrigin,v["-moz-transform-origin"]=v.transformOrigin,v["-webkit-transition"]=v.transition,v["-moz-transition"]=v.transition,v["transition-property"]=v.transitionProperty,v["-webkit-transition-property"]=v.transitionProperty,v["-moz-transition-property"]=v.transitionProperty;var h=t([["paddingLeft","paddingRight"],["marginLeft","marginRight"],["left","right"],["borderLeft","borderRight"],["borderLeftColor","borderRightColor"],["borderLeftStyle","borderRightStyle"],["borderLeftWidth","borderRightWidth"],["borderTopLeftRadius","borderTopRightRadius"],["borderBottomLeftRadius","borderBottomRightRadius"],["padding-left","padding-right"],["margin-left","margin-right"],["border-left","border-right"],["border-left-color","border-right-color"],["border-left-style","border-right-style"],["border-left-width","border-right-width"],["border-top-left-radius","border-top-right-radius"],["border-bottom-left-radius","border-bottom-right-radius"]]),w=["content"],x=t([["ltr","rtl"],["left","right"],["w-resize","e-resize"],["sw-resize","se-resize"],["nw-resize","ne-resize"]]),y=new RegExp("(^|\\W|_)((ltr)|(rtl)|(left)|(right))(\\W|_|$)","g"),R=new RegExp("(left)|(right)");function k(r){return Object.keys(r).reduce((function(t,e){var n=r[e];if(u(n)&&(n=n.trim()),l(w,e))return t[e]=n,t;var o=T(e,n),i=o.key,a=o.value;return t[i]=a,t}),Array.isArray(r)?[]:{})}function T(r,t){var e=/\/\*\s?@noflip\s?\*\//.test(t),n=e?r:P(r);return{key:n,value:e?t:z(n,t)}}function P(r){return h[r]||r}function z(r,t){if(!b(t))return t;if(s(t))return k(t);var e,n=i(t),a=o(t),u=n||a?t:t.replace(/ !important.*?$/,""),l=!n&&u.length!==t.length,g=v[r];return e=g?g({value:u,valuesToConvert:x,propertiesToConvert:h,isRtl:!0,bgImgDirectionRegex:y,bgPosDirectionRegex:R}):x[u]||u,l?e+" !important":e}r.arrayToObject=t,r.calculateNewBackgroundPosition=f,r.calculateNewTranslate=d,r.canConvertValue=b,r.containsCssVar=e,r.convert=k,r.convertProperty=T,r.flipSign=g,r.flipTransformSign=d,r.getPropertyDoppelganger=P,r.getValueDoppelganger=z,r.getValuesAsList=c,r.handleQuartetValues=p,r.includes=l,r.isBoolean=n,r.isFunction=o,r.isNullOrUndefined=a,r.isNumber=i,r.isObject=s,r.isString=u,r.propertiesToConvert=h,r.propertyValueConverters=v,r.propsToIgnore=w,r.splitShadow=m,r.valuesToConvert=x,Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=rtl-css-js.core.umd.min.js.map

@@ -173,3 +173,41 @@ (function (global, factory) {

}
/**
* Splits a shadow style into its separate shadows using the comma delimiter, but creating an exception
* for comma separated values in parentheses often used for rgba colours.
* @param {String} value
* @returns {Array} array of all box shadow values in the string
*/
function splitShadow(value) {
var shadows = [];
var start = 0;
var end = 0;
var rgba = false;
while (end < value.length) {
if (!rgba && value[end] === ',') {
shadows.push(value.substring(start, end).trim());
end++;
start = end;
} else if (value[end] === "(") {
rgba = true;
end++;
} else if (value[end] === ')') {
rgba = false;
end++;
} else {
end++;
}
} // push the last shadow value if there is one
// istanbul ignore next
if (start != end) {
shadows.push(value.substring(start, end + 1));
}
return shadows;
}
var propertyValueConverters = {

@@ -187,11 +225,14 @@ padding: function padding(_ref) {

var value = _ref2.value;
// intentionally leaving off the `g` flag here because we only want to change the first number (which is the offset-x)
return value.replace(/(-*)([.|\d]+)/, function (match, negative, number) {
if (number === '0') {
return match;
}
var flippedShadows = splitShadow(value).map(function (shadow) {
// intentionally leaving off the `g` flag here because we only want to change the first number (which is the offset-x)
return shadow.replace(/(-*)([.|\d]+)/, function (match, negative, number) {
if (number === '0') {
return match;
}
var doubleNegative = negative === '' ? '-' : '';
return "" + doubleNegative + number;
var doubleNegative = negative === '' ? '-' : '';
return "" + doubleNegative + number;
});
});
return flippedShadows.join(',');
},

@@ -198,0 +239,0 @@ borderColor: function borderColor(_ref3) {

@@ -1,2 +0,2 @@

!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r=r||self).RtlCssJs=t()}(this,(function(){"use strict";function r(r){return r.reduce((function(r,t){var e=t[0],o=t[1];return r[e]=o,r[o]=e,r}),{})}function t(r){return"number"==typeof r}function e(r,t){return-1!==r.indexOf(t)}function o(r,t,e,o){return t+(n=e,0===parseFloat(n)?n:"-"===n[0]?n.slice(1):"-"+n)+o;var n}function n(r){return r.replace(/ +/g," ").split(" ").map((function(r){return r.trim()})).filter(Boolean).reduce((function(r,t){var e=r.list,o=r.state,n=(t.match(/\(/g)||[]).length,i=(t.match(/\)/g)||[]).length;return o.parensDepth>0?e[e.length-1]=e[e.length-1]+" "+t:e.push(t),o.parensDepth+=n-i,{list:e,state:o}}),{list:[],state:{parensDepth:0}}).list}function i(r){var t=n(r);if(t.length<=3||t.length>4)return r;var e=t[0],o=t[1],i=t[2];return[e,t[3],i,o].join(" ")}var a={padding:function(r){var e=r.value;return t(e)?e:i(e)},textShadow:function(r){return r.value.replace(/(-*)([.|\d]+)/,(function(r,t,e){return"0"===e?r:""+(""===t?"-":"")+e}))},borderColor:function(r){return i(r.value)},borderRadius:function(r){var o=r.value;if(t(o))return o;if(e(o,"/")){var i=o.split("/"),s=i[0],u=i[1];return a.borderRadius({value:s.trim()})+" / "+a.borderRadius({value:u.trim()})}var d=n(o);switch(d.length){case 2:return d.reverse().join(" ");case 4:var g=d[0],l=d[1],f=d[2];return[l,g,d[3],f].join(" ");default:return o}},background:function(r){var e=r.value,o=r.valuesToConvert,n=r.isRtl,i=r.bgImgDirectionRegex,s=r.bgPosDirectionRegex;if(t(e))return e;var u=e.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return e=e.replace(u,a.backgroundPosition({value:u,valuesToConvert:o,isRtl:n,bgPosDirectionRegex:s})),a.backgroundImage({value:e,valuesToConvert:o,bgImgDirectionRegex:i})},backgroundImage:function(r){var t=r.value,o=r.valuesToConvert,n=r.bgImgDirectionRegex;return e(t,"url(")||e(t,"linear-gradient(")?t.replace(n,(function(r,t,e){return r.replace(e,o[e])})):t},backgroundPosition:function(r){var t=r.value,e=r.valuesToConvert,o=r.isRtl,n=r.bgPosDirectionRegex;return t.replace(o?/^((-|\d|\.)+%)/:null,(function(r,t){return function(r){var t=r.indexOf(".");if(-1===t)r=100-parseFloat(r)+"%";else{var e=r.length-t-2;r=(r=100-parseFloat(r)).toFixed(e)+"%"}return r}(t)})).replace(n,(function(r){return e[r]}))},backgroundPositionX:function(r){var e=r.value,o=r.valuesToConvert,n=r.isRtl,i=r.bgPosDirectionRegex;return t(e)?e:a.backgroundPosition({value:e,valuesToConvert:o,isRtl:n,bgPosDirectionRegex:i})},transition:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){var t=r.split(" ");return t[0]=e[t[0]]||t[0],t.join(" ")})).join(", ")},transitionProperty:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){return e[r]||r})).join(", ")},transform:function(r){var t=r.value,e="(?:(?:(?:\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",n="((?:-?(?:[0-9]*\\.[0-9]+|[0-9]+)(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|-?(?:[_a-z]|[^\\u0020-\\u007e]|"+e+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+e+")*)?)|(?:inherit|auto))",i=new RegExp("(translateX\\s*\\(\\s*)"+n+"(\\s*\\))","gi"),a=new RegExp("(translate\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,1}\\s*\\))","gi"),s=new RegExp("(translate3d\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,2}\\s*\\))","gi"),u=new RegExp("(rotate[ZY]?\\s*\\(\\s*)"+n+"(\\s*\\))","gi");return t.replace(i,o).replace(a,o).replace(s,o).replace(u,o)}};a.objectPosition=a.backgroundPosition,a.margin=a.padding,a.borderWidth=a.padding,a.boxShadow=a.textShadow,a.webkitBoxShadow=a.boxShadow,a.mozBoxShadow=a.boxShadow,a.WebkitBoxShadow=a.boxShadow,a.MozBoxShadow=a.boxShadow,a.borderStyle=a.borderColor,a.webkitTransform=a.transform,a.mozTransform=a.transform,a.WebkitTransform=a.transform,a.MozTransform=a.transform,a.transformOrigin=a.backgroundPosition,a.webkitTransformOrigin=a.transformOrigin,a.mozTransformOrigin=a.transformOrigin,a.WebkitTransformOrigin=a.transformOrigin,a.MozTransformOrigin=a.transformOrigin,a.webkitTransition=a.transition,a.mozTransition=a.transition,a.WebkitTransition=a.transition,a.MozTransition=a.transition,a.webkitTransitionProperty=a.transitionProperty,a.mozTransitionProperty=a.transitionProperty,a.WebkitTransitionProperty=a.transitionProperty,a.MozTransitionProperty=a.transitionProperty,a["text-shadow"]=a.textShadow,a["border-color"]=a.borderColor,a["border-radius"]=a.borderRadius,a["background-image"]=a.backgroundImage,a["background-position"]=a.backgroundPosition,a["background-position-x"]=a.backgroundPositionX,a["object-position"]=a.objectPosition,a["border-width"]=a.padding,a["box-shadow"]=a.textShadow,a["-webkit-box-shadow"]=a.textShadow,a["-moz-box-shadow"]=a.textShadow,a["border-style"]=a.borderColor,a["-webkit-transform"]=a.transform,a["-moz-transform"]=a.transform,a["transform-origin"]=a.transformOrigin,a["-webkit-transform-origin"]=a.transformOrigin,a["-moz-transform-origin"]=a.transformOrigin,a["-webkit-transition"]=a.transition,a["-moz-transition"]=a.transition,a["transition-property"]=a.transitionProperty,a["-webkit-transition-property"]=a.transitionProperty,a["-moz-transition-property"]=a.transitionProperty;var s=r([["paddingLeft","paddingRight"],["marginLeft","marginRight"],["left","right"],["borderLeft","borderRight"],["borderLeftColor","borderRightColor"],["borderLeftStyle","borderRightStyle"],["borderLeftWidth","borderRightWidth"],["borderTopLeftRadius","borderTopRightRadius"],["borderBottomLeftRadius","borderBottomRightRadius"],["padding-left","padding-right"],["margin-left","margin-right"],["border-left","border-right"],["border-left-color","border-right-color"],["border-left-style","border-right-style"],["border-left-width","border-right-width"],["border-top-left-radius","border-top-right-radius"],["border-bottom-left-radius","border-bottom-right-radius"]]),u=["content"],d=r([["ltr","rtl"],["left","right"],["w-resize","e-resize"],["sw-resize","se-resize"],["nw-resize","ne-resize"]]),g=new RegExp("(^|\\W|_)((ltr)|(rtl)|(left)|(right))(\\W|_|$)","g"),l=new RegExp("(left)|(right)");function f(r){return Object.keys(r).reduce((function(o,n){var i=r[n];if("string"==typeof i&&(i=i.trim()),e(u,n))return o[n]=i,o;var c=function(r,e){var o=/\/\*\s?@noflip\s?\*\//.test(e),n=o?r:(u=r,s[u]||u),i=o?e:function(r,e){if(!function(r){return!(t=r,"boolean"==typeof t||function(r){return null==r}(r)||function(r){return"string"==typeof r&&r.match(/var\(.*\)/g)}(r));var t}(e))return e;if(function(r){return r&&"object"==typeof r}(e))return f(e);var o,n=t(e),i=function(r){return"function"==typeof r}(e),u=n||i?e:e.replace(/ !important.*?$/,""),c=!n&&u.length!==e.length,b=a[r];o=b?b({value:u,valuesToConvert:d,propertiesToConvert:s,isRtl:!0,bgImgDirectionRegex:g,bgPosDirectionRegex:l}):d[u]||u;if(c)return o+" !important";return o}(n,e);var u;return{key:n,value:i}}(n,i),b=c.key,p=c.value;return o[b]=p,o}),Array.isArray(r)?[]:{})}return f}));
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(r=r||self).RtlCssJs=t()}(this,(function(){"use strict";function r(r){return r.reduce((function(r,t){var e=t[0],n=t[1];return r[e]=n,r[n]=e,r}),{})}function t(r){return"number"==typeof r}function e(r,t){return-1!==r.indexOf(t)}function n(r,t,e,n){return t+(o=e,0===parseFloat(o)?o:"-"===o[0]?o.slice(1):"-"+o)+n;var o}function o(r){return r.replace(/ +/g," ").split(" ").map((function(r){return r.trim()})).filter(Boolean).reduce((function(r,t){var e=r.list,n=r.state,o=(t.match(/\(/g)||[]).length,i=(t.match(/\)/g)||[]).length;return n.parensDepth>0?e[e.length-1]=e[e.length-1]+" "+t:e.push(t),n.parensDepth+=o-i,{list:e,state:n}}),{list:[],state:{parensDepth:0}}).list}function i(r){var t=o(r);if(t.length<=3||t.length>4)return r;var e=t[0],n=t[1],i=t[2];return[e,t[3],i,n].join(" ")}var a={padding:function(r){var e=r.value;return t(e)?e:i(e)},textShadow:function(r){return function(r){for(var t=[],e=0,n=0,o=!1;n<r.length;)o||","!==r[n]?"("===r[n]?(o=!0,n++):")"===r[n]?(o=!1,n++):n++:(t.push(r.substring(e,n).trim()),e=++n);return e!=n&&t.push(r.substring(e,n+1)),t}(r.value).map((function(r){return r.replace(/(-*)([.|\d]+)/,(function(r,t,e){return"0"===e?r:""+(""===t?"-":"")+e}))})).join(",")},borderColor:function(r){return i(r.value)},borderRadius:function(r){var n=r.value;if(t(n))return n;if(e(n,"/")){var i=n.split("/"),s=i[0],u=i[1];return a.borderRadius({value:s.trim()})+" / "+a.borderRadius({value:u.trim()})}var d=o(n);switch(d.length){case 2:return d.reverse().join(" ");case 4:var g=d[0],f=d[1],l=d[2];return[f,g,d[3],l].join(" ");default:return n}},background:function(r){var e=r.value,n=r.valuesToConvert,o=r.isRtl,i=r.bgImgDirectionRegex,s=r.bgPosDirectionRegex;if(t(e))return e;var u=e.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return e=e.replace(u,a.backgroundPosition({value:u,valuesToConvert:n,isRtl:o,bgPosDirectionRegex:s})),a.backgroundImage({value:e,valuesToConvert:n,bgImgDirectionRegex:i})},backgroundImage:function(r){var t=r.value,n=r.valuesToConvert,o=r.bgImgDirectionRegex;return e(t,"url(")||e(t,"linear-gradient(")?t.replace(o,(function(r,t,e){return r.replace(e,n[e])})):t},backgroundPosition:function(r){var t=r.value,e=r.valuesToConvert,n=r.isRtl,o=r.bgPosDirectionRegex;return t.replace(n?/^((-|\d|\.)+%)/:null,(function(r,t){return function(r){var t=r.indexOf(".");if(-1===t)r=100-parseFloat(r)+"%";else{var e=r.length-t-2;r=(r=100-parseFloat(r)).toFixed(e)+"%"}return r}(t)})).replace(o,(function(r){return e[r]}))},backgroundPositionX:function(r){var e=r.value,n=r.valuesToConvert,o=r.isRtl,i=r.bgPosDirectionRegex;return t(e)?e:a.backgroundPosition({value:e,valuesToConvert:n,isRtl:o,bgPosDirectionRegex:i})},transition:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){var t=r.split(" ");return t[0]=e[t[0]]||t[0],t.join(" ")})).join(", ")},transitionProperty:function(r){var t=r.value,e=r.propertiesToConvert;return t.split(/,\s*/g).map((function(r){return e[r]||r})).join(", ")},transform:function(r){var t=r.value,e="(?:(?:(?:\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)|\\\\[^\\r\\n\\f0-9a-f])",o="((?:-?(?:[0-9]*\\.[0-9]+|[0-9]+)(?:\\s*(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)|-?(?:[_a-z]|[^\\u0020-\\u007e]|"+e+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+e+")*)?)|(?:inherit|auto))",i=new RegExp("(translateX\\s*\\(\\s*)"+o+"(\\s*\\))","gi"),a=new RegExp("(translate\\s*\\(\\s*)"+o+"((?:\\s*,\\s*"+o+"){0,1}\\s*\\))","gi"),s=new RegExp("(translate3d\\s*\\(\\s*)"+o+"((?:\\s*,\\s*"+o+"){0,2}\\s*\\))","gi"),u=new RegExp("(rotate[ZY]?\\s*\\(\\s*)"+o+"(\\s*\\))","gi");return t.replace(i,n).replace(a,n).replace(s,n).replace(u,n)}};a.objectPosition=a.backgroundPosition,a.margin=a.padding,a.borderWidth=a.padding,a.boxShadow=a.textShadow,a.webkitBoxShadow=a.boxShadow,a.mozBoxShadow=a.boxShadow,a.WebkitBoxShadow=a.boxShadow,a.MozBoxShadow=a.boxShadow,a.borderStyle=a.borderColor,a.webkitTransform=a.transform,a.mozTransform=a.transform,a.WebkitTransform=a.transform,a.MozTransform=a.transform,a.transformOrigin=a.backgroundPosition,a.webkitTransformOrigin=a.transformOrigin,a.mozTransformOrigin=a.transformOrigin,a.WebkitTransformOrigin=a.transformOrigin,a.MozTransformOrigin=a.transformOrigin,a.webkitTransition=a.transition,a.mozTransition=a.transition,a.WebkitTransition=a.transition,a.MozTransition=a.transition,a.webkitTransitionProperty=a.transitionProperty,a.mozTransitionProperty=a.transitionProperty,a.WebkitTransitionProperty=a.transitionProperty,a.MozTransitionProperty=a.transitionProperty,a["text-shadow"]=a.textShadow,a["border-color"]=a.borderColor,a["border-radius"]=a.borderRadius,a["background-image"]=a.backgroundImage,a["background-position"]=a.backgroundPosition,a["background-position-x"]=a.backgroundPositionX,a["object-position"]=a.objectPosition,a["border-width"]=a.padding,a["box-shadow"]=a.textShadow,a["-webkit-box-shadow"]=a.textShadow,a["-moz-box-shadow"]=a.textShadow,a["border-style"]=a.borderColor,a["-webkit-transform"]=a.transform,a["-moz-transform"]=a.transform,a["transform-origin"]=a.transformOrigin,a["-webkit-transform-origin"]=a.transformOrigin,a["-moz-transform-origin"]=a.transformOrigin,a["-webkit-transition"]=a.transition,a["-moz-transition"]=a.transition,a["transition-property"]=a.transitionProperty,a["-webkit-transition-property"]=a.transitionProperty,a["-moz-transition-property"]=a.transitionProperty;var s=r([["paddingLeft","paddingRight"],["marginLeft","marginRight"],["left","right"],["borderLeft","borderRight"],["borderLeftColor","borderRightColor"],["borderLeftStyle","borderRightStyle"],["borderLeftWidth","borderRightWidth"],["borderTopLeftRadius","borderTopRightRadius"],["borderBottomLeftRadius","borderBottomRightRadius"],["padding-left","padding-right"],["margin-left","margin-right"],["border-left","border-right"],["border-left-color","border-right-color"],["border-left-style","border-right-style"],["border-left-width","border-right-width"],["border-top-left-radius","border-top-right-radius"],["border-bottom-left-radius","border-bottom-right-radius"]]),u=["content"],d=r([["ltr","rtl"],["left","right"],["w-resize","e-resize"],["sw-resize","se-resize"],["nw-resize","ne-resize"]]),g=new RegExp("(^|\\W|_)((ltr)|(rtl)|(left)|(right))(\\W|_|$)","g"),f=new RegExp("(left)|(right)");function l(r){return Object.keys(r).reduce((function(n,o){var i=r[o];if("string"==typeof i&&(i=i.trim()),e(u,o))return n[o]=i,n;var c=function(r,e){var n=/\/\*\s?@noflip\s?\*\//.test(e),o=n?r:(u=r,s[u]||u),i=n?e:function(r,e){if(!function(r){return!(t=r,"boolean"==typeof t||function(r){return null==r}(r)||function(r){return"string"==typeof r&&r.match(/var\(.*\)/g)}(r));var t}(e))return e;if(function(r){return r&&"object"==typeof r}(e))return l(e);var n,o=t(e),i=function(r){return"function"==typeof r}(e),u=o||i?e:e.replace(/ !important.*?$/,""),c=!o&&u.length!==e.length,b=a[r];n=b?b({value:u,valuesToConvert:d,propertiesToConvert:s,isRtl:!0,bgImgDirectionRegex:g,bgPosDirectionRegex:f}):d[u]||u;if(c)return n+" !important";return n}(o,e);var u;return{key:o,value:i}}(o,i),b=c.key,p=c.value;return n[b]=p,n}),Array.isArray(r)?[]:{})}return l}));
//# sourceMappingURL=rtl-css-js.umd.min.js.map
{
"name": "rtl-css-js",
"version": "1.14.5",
"version": "1.15.0",
"description": "Right To Left conversion for CSS in JS objects",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc