Socket
Socket
Sign inDemoInstall

rtl-css-js

Package Overview
Dependencies
0
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.4 to 1.5.0

core.d.ts

20

dist/rtl-css-js.cjs.js

@@ -382,4 +382,22 @@ 'use strict';

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
// this will be an object of properties that map to their corresponding rtl property (their doppelganger)
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius']]);
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius'],
// kebab-case versions
['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']]);

@@ -386,0 +404,0 @@ var propsToIgnore = ['content'];

@@ -384,2 +384,18 @@ 'use strict';

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
exports.propertyValueConverters = propertyValueConverters;

@@ -386,0 +402,0 @@ exports.arrayToObject = arrayToObject;

@@ -380,2 +380,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
export { propertyValueConverters, arrayToObject, calculateNewBackgroundPosition, calculateNewTranslate, flipSign, handleQuartetValues, includes, isNullOrUndefined, isNumber, isObject, isString, getValuesAsList };

@@ -386,2 +386,18 @@ (function (global, factory) {

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
exports.propertyValueConverters = propertyValueConverters;

@@ -388,0 +404,0 @@ exports.arrayToObject = arrayToObject;

2

dist/rtl-css-js.core.umd.min.js

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.rtlCSSJSCore={})}(this,function(e){"use strict";function r(e){return"number"==typeof e}function t(e,r){return-1!==e.indexOf(r)}function n(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function o(e,r,t,o){return r+n(t)+o}function a(e){var r=e.indexOf(".");if(-1===r)e=100-parseFloat(e)+"%";else{var t=e.length-r-2;e=(e=100-parseFloat(e)).toFixed(t)+"%"}return e}function i(e){return e.replace(/ +/g," ").split(" ").map(function(e){return e.trim()}).filter(Boolean).reduce(function(e,r){var t=e.list,n=e.state,o=(r.match(/\(/g)||[]).length,a=(r.match(/\)/g)||[]).length;return n.parensDepth>0?t[t.length-1]=t[t.length-1]+" "+r:t.push(r),n.parensDepth+=o-a,{list:t,state:n}},{list:[],state:{parensDepth:0}}).list}function u(e){var r=i(e);if(r.length<=3||r.length>4)return e;var t=s(r,4),n=t[0],o=t[1],a=t[2];return[n,t[3],a,o].join(" ")}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c={padding:function(e){var t=e.value;return r(t)?t:u(t)},textShadow:function(e){return e.value.replace(/(-*)([.|\d]+)/,function(e,r,t){return"0"===t?e:""+(""===r?"-":"")+t})},borderColor:function(e){return u(e.value)},borderRadius:function(e){var n=e.value;if(r(n))return n;if(t(n,"/")){var o=n.split("/"),a=s(o,2),u=a[0],l=a[1];return c.borderRadius({value:u.trim()})+" / "+c.borderRadius({value:l.trim()})}var f=i(n);switch(f.length){case 2:return f.reverse().join(" ");case 4:var d=s(f,4),g=d[0],p=d[1],v=d[2];return[p,g,d[3],v].join(" ");default:return n}},background:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgImgDirectionRegex,a=e.bgPosDirectionRegex,i=r.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return r=r.replace(i,c.backgroundPosition({value:i,valuesToConvert:t,isRtl:n,bgPosDirectionRegex:a})),c.backgroundImage({value:r,valuesToConvert:t,bgImgDirectionRegex:o})},backgroundImage:function(e){var r=e.value,n=e.valuesToConvert,o=e.bgImgDirectionRegex;return t(r,"url(")||t(r,"linear-gradient(")?r.replace(o,function(e,r,t){return e.replace(t,n[t])}):r},backgroundPosition:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgPosDirectionRegex;return r.replace(n?/^((-|\d|\.)+%)/:null,function(e,r){return a(r)}).replace(o,function(e){return t[e]})},backgroundPositionX:function(e){var t=e.value,n=e.valuesToConvert,o=e.isRtl,a=e.bgPosDirectionRegex;return r(t)?t:c.backgroundPosition({value:t,valuesToConvert:n,isRtl:o,bgPosDirectionRegex:a})},transform:function(e){var r=e.value,t="(?:(?:(?:\\[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]|"+t+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+t+")*)?)|(?:inherit|auto))",a=new RegExp("(translateX\\s*\\(\\s*)"+n+"(\\s*\\))","gi"),i=new RegExp("(translate\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,1}\\s*\\))","gi"),u=new RegExp("(translate3d\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,2}\\s*\\))","gi");return r.replace(a,o).replace(i,o).replace(u,o)}};c.margin=c.padding,c.borderWidth=c.padding,c.boxShadow=c.textShadow,c.webkitBoxShadow=c.textShadow,c.mozBoxShadow=c.textShadow,c.borderStyle=c.borderColor,c.webkitTransform=c.transform,c.mozTransform=c.transform,e.propertyValueConverters=c,e.arrayToObject=function(e){return e.reduce(function(e,r){var t=s(r,2),n=t[0],o=t[1];return e[n]=o,e[o]=n,e},{})},e.calculateNewBackgroundPosition=a,e.calculateNewTranslate=o,e.flipSign=n,e.handleQuartetValues=u,e.includes=t,e.isNullOrUndefined=function(e){return null===e||void 0===e},e.isNumber=r,e.isObject=function(e){return e&&"object"===(void 0===e?"undefined":l(e))},e.isString=function(e){return"string"==typeof e},e.getValuesAsList=i,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.rtlCSSJSCore={})}(this,function(e){"use strict";function r(e){return"number"==typeof e}function t(e,r){return-1!==e.indexOf(r)}function n(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function o(e,r,t,o){return r+n(t)+o}function a(e){var r=e.indexOf(".");if(-1===r)e=100-parseFloat(e)+"%";else{var t=e.length-r-2;e=(e=100-parseFloat(e)).toFixed(t)+"%"}return e}function i(e){return e.replace(/ +/g," ").split(" ").map(function(e){return e.trim()}).filter(Boolean).reduce(function(e,r){var t=e.list,n=e.state,o=(r.match(/\(/g)||[]).length,a=(r.match(/\)/g)||[]).length;return n.parensDepth>0?t[t.length-1]=t[t.length-1]+" "+r:t.push(r),n.parensDepth+=o-a,{list:t,state:n}},{list:[],state:{parensDepth:0}}).list}function u(e){var r=i(e);if(r.length<=3||r.length>4)return e;var t=l(r,4),n=t[0],o=t[1],a=t[2];return[n,t[3],a,o].join(" ")}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(){function e(e,r){var t=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw a}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c={padding:function(e){var t=e.value;return r(t)?t:u(t)},textShadow:function(e){return e.value.replace(/(-*)([.|\d]+)/,function(e,r,t){return"0"===t?e:""+(""===r?"-":"")+t})},borderColor:function(e){return u(e.value)},borderRadius:function(e){var n=e.value;if(r(n))return n;if(t(n,"/")){var o=n.split("/"),a=l(o,2),u=a[0],s=a[1];return c.borderRadius({value:u.trim()})+" / "+c.borderRadius({value:s.trim()})}var d=i(n);switch(d.length){case 2:return d.reverse().join(" ");case 4:var f=l(d,4),g=f[0],b=f[1],p=f[2];return[b,g,f[3],p].join(" ");default:return n}},background:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgImgDirectionRegex,a=e.bgPosDirectionRegex,i=r.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return r=r.replace(i,c.backgroundPosition({value:i,valuesToConvert:t,isRtl:n,bgPosDirectionRegex:a})),c.backgroundImage({value:r,valuesToConvert:t,bgImgDirectionRegex:o})},backgroundImage:function(e){var r=e.value,n=e.valuesToConvert,o=e.bgImgDirectionRegex;return t(r,"url(")||t(r,"linear-gradient(")?r.replace(o,function(e,r,t){return e.replace(t,n[t])}):r},backgroundPosition:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgPosDirectionRegex;return r.replace(n?/^((-|\d|\.)+%)/:null,function(e,r){return a(r)}).replace(o,function(e){return t[e]})},backgroundPositionX:function(e){var t=e.value,n=e.valuesToConvert,o=e.isRtl,a=e.bgPosDirectionRegex;return r(t)?t:c.backgroundPosition({value:t,valuesToConvert:n,isRtl:o,bgPosDirectionRegex:a})},transform:function(e){var r=e.value,t="(?:(?:(?:\\[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]|"+t+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+t+")*)?)|(?:inherit|auto))",a=new RegExp("(translateX\\s*\\(\\s*)"+n+"(\\s*\\))","gi"),i=new RegExp("(translate\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,1}\\s*\\))","gi"),u=new RegExp("(translate3d\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,2}\\s*\\))","gi");return r.replace(a,o).replace(i,o).replace(u,o)}};c.margin=c.padding,c.borderWidth=c.padding,c.boxShadow=c.textShadow,c.webkitBoxShadow=c.textShadow,c.mozBoxShadow=c.textShadow,c.borderStyle=c.borderColor,c.webkitTransform=c.transform,c.mozTransform=c.transform,c["text-shadow"]=c.textShadow,c["border-color"]=c.borderColor,c["border-radius"]=c.borderRadius,c["background-image"]=c.backgroundImage,c["background-position"]=c.backgroundPosition,c["background-position-x"]=c.backgroundPositionX,c["border-width"]=c.padding,c["box-shadow"]=c.textShadow,c["-webkit-box-shadow"]=c.textShadow,c["-moz-box-shadow"]=c.textShadow,c["border-style"]=c.borderColor,c["-webkit-transform"]=c.transform,c["-moz-transform"]=c.transform,e.propertyValueConverters=c,e.arrayToObject=function(e){return e.reduce(function(e,r){var t=l(r,2),n=t[0],o=t[1];return e[n]=o,e[o]=n,e},{})},e.calculateNewBackgroundPosition=a,e.calculateNewTranslate=o,e.flipSign=n,e.handleQuartetValues=u,e.includes=t,e.isNullOrUndefined=function(e){return null===e||void 0===e},e.isNumber=r,e.isObject=function(e){return e&&"object"===(void 0===e?"undefined":s(e))},e.isString=function(e){return"string"==typeof e},e.getValuesAsList=i,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -380,4 +380,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
// this will be an object of properties that map to their corresponding rtl property (their doppelganger)
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius']]);
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius'],
// kebab-case versions
['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']]);

@@ -384,0 +402,0 @@ var propsToIgnore = ['content'];

@@ -386,4 +386,22 @@ (function (global, factory) {

// kebab-case versions
propertyValueConverters['text-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-color'] = propertyValueConverters.borderColor;
propertyValueConverters['border-radius'] = propertyValueConverters.borderRadius;
propertyValueConverters['background-image'] = propertyValueConverters.backgroundImage;
propertyValueConverters['background-position'] = propertyValueConverters.backgroundPosition;
propertyValueConverters['background-position-x'] = propertyValueConverters.backgroundPositionX;
propertyValueConverters['border-width'] = propertyValueConverters.padding;
propertyValueConverters['box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-webkit-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['-moz-box-shadow'] = propertyValueConverters.textShadow;
propertyValueConverters['border-style'] = propertyValueConverters.borderColor;
propertyValueConverters['-webkit-transform'] = propertyValueConverters.transform;
propertyValueConverters['-moz-transform'] = propertyValueConverters.transform;
// this will be an object of properties that map to their corresponding rtl property (their doppelganger)
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius']]);
var propertiesToConvert = arrayToObject([['paddingLeft', 'paddingRight'], ['marginLeft', 'marginRight'], ['left', 'right'], ['borderLeft', 'borderRight'], ['borderLeftColor', 'borderRightColor'], ['borderLeftStyle', 'borderRightStyle'], ['borderLeftWidth', 'borderRightWidth'], ['borderTopLeftRadius', 'borderTopRightRadius'], ['borderBottomLeftRadius', 'borderBottomRightRadius'],
// kebab-case versions
['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']]);

@@ -390,0 +408,0 @@ var propsToIgnore = ['content'];

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.rtlCSSJS=r()}(this,function(){"use strict";function e(e){return e.reduce(function(e,r){var t=b(r,2),n=t[0],o=t[1];return e[n]=o,e[o]=n,e},{})}function r(e){return"number"==typeof e}function t(e){return null===e||void 0===e}function n(e){return e&&"object"===(void 0===e?"undefined":p(e))}function o(e){return"string"==typeof e}function i(e,r){return-1!==e.indexOf(r)}function u(e){return 0===parseFloat(e)?e:"-"===e[0]?e.slice(1):"-"+e}function a(e,r,t,n){return r+u(t)+n}function l(e){var r=e.indexOf(".");if(-1===r)e=100-parseFloat(e)+"%";else{var t=e.length-r-2;e=(e=100-parseFloat(e)).toFixed(t)+"%"}return e}function s(e){return e.replace(/ +/g," ").split(" ").map(function(e){return e.trim()}).filter(Boolean).reduce(function(e,r){var t=e.list,n=e.state,o=(r.match(/\(/g)||[]).length,i=(r.match(/\)/g)||[]).length;return n.parensDepth>0?t[t.length-1]=t[t.length-1]+" "+r:t.push(r),n.parensDepth+=o-i,{list:t,state:n}},{list:[],state:{parensDepth:0}}).list}function f(e){var r=s(e);if(r.length<=3||r.length>4)return e;var t=b(r,4),n=t[0],o=t[1],i=t[2];return[n,t[3],i,o].join(" ")}function c(e){return Object.keys(e).reduce(function(r,t){var n=e[t];if(o(n)&&(n=n.trim()),i(R,t))return r[t]=n,r;var u=d(t,n),a=u.key,l=u.value;return r[a]=l,r},{})}function d(e,r){var t=/\/\*\s?@noflip\s?\*\//.test(r),n=t?e:g(e);return{key:n,value:t?r:v(n,r)}}function g(e){return m[e]||e}function v(e,o){if(t(o))return o;if(n(o))return c(o);var i=r(o),u=i?o:o.replace(/ !important.*?$/,""),a=!i&&u.length!==o.length,l=h[e],s=void 0;return s=l?l({value:u,valuesToConvert:y,isRtl:!0,bgImgDirectionRegex:x,bgPosDirectionRegex:w}):y[u]||u,a?s+" !important":s}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b=function(){function e(e,r){var t=[],n=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(n=(u=a.next()).done)&&(t.push(u.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h={padding:function(e){var t=e.value;return r(t)?t:f(t)},textShadow:function(e){return e.value.replace(/(-*)([.|\d]+)/,function(e,r,t){return"0"===t?e:""+(""===r?"-":"")+t})},borderColor:function(e){return f(e.value)},borderRadius:function(e){var t=e.value;if(r(t))return t;if(i(t,"/")){var n=t.split("/"),o=b(n,2),u=o[0],a=o[1];return h.borderRadius({value:u.trim()})+" / "+h.borderRadius({value:a.trim()})}var l=s(t);switch(l.length){case 2:return l.reverse().join(" ");case 4:var f=b(l,4),c=f[0],d=f[1],g=f[2];return[d,c,f[3],g].join(" ");default:return t}},background:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgImgDirectionRegex,i=e.bgPosDirectionRegex,u=r.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return r=r.replace(u,h.backgroundPosition({value:u,valuesToConvert:t,isRtl:n,bgPosDirectionRegex:i})),h.backgroundImage({value:r,valuesToConvert:t,bgImgDirectionRegex:o})},backgroundImage:function(e){var r=e.value,t=e.valuesToConvert,n=e.bgImgDirectionRegex;return i(r,"url(")||i(r,"linear-gradient(")?r.replace(n,function(e,r,n){return e.replace(n,t[n])}):r},backgroundPosition:function(e){var r=e.value,t=e.valuesToConvert,n=e.isRtl,o=e.bgPosDirectionRegex;return r.replace(n?/^((-|\d|\.)+%)/:null,function(e,r){return l(r)}).replace(o,function(e){return t[e]})},backgroundPositionX:function(e){var t=e.value,n=e.valuesToConvert,o=e.isRtl,i=e.bgPosDirectionRegex;return r(t)?t:h.backgroundPosition({value:t,valuesToConvert:n,isRtl:o,bgPosDirectionRegex:i})},transform:function(e){var r=e.value,t="(?:(?:(?:\\[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]|"+t+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+t+")*)?)|(?: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"),u=new RegExp("(translate3d\\s*\\(\\s*)"+n+"((?:\\s*,\\s*"+n+"){0,2}\\s*\\))","gi");return r.replace(o,a).replace(i,a).replace(u,a)}};h.margin=h.padding,h.borderWidth=h.padding,h.boxShadow=h.textShadow,h.webkitBoxShadow=h.textShadow,h.mozBoxShadow=h.textShadow,h.borderStyle=h.borderColor,h.webkitTransform=h.transform,h.mozTransform=h.transform;var m=e([["paddingLeft","paddingRight"],["marginLeft","marginRight"],["left","right"],["borderLeft","borderRight"],["borderLeftColor","borderRightColor"],["borderLeftStyle","borderRightStyle"],["borderLeftWidth","borderRightWidth"],["borderTopLeftRadius","borderTopRightRadius"],["borderBottomLeftRadius","borderBottomRightRadius"]]),R=["content"],y=e([["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"),w=new RegExp("(left)|(right)");return c});
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):r.rtlCSSJS=e()}(this,function(){"use strict";function r(r){return r.reduce(function(r,e){var t=p(e,2),o=t[0],n=t[1];return r[o]=n,r[n]=o,r},{})}function e(r){return"number"==typeof r}function t(r){return null===r||void 0===r}function o(r){return r&&"object"===(void 0===r?"undefined":h(r))}function n(r){return"string"==typeof r}function i(r,e){return-1!==r.indexOf(e)}function a(r){return 0===parseFloat(r)?r:"-"===r[0]?r.slice(1):"-"+r}function u(r,e,t,o){return e+a(t)+o}function d(r){var e=r.indexOf(".");if(-1===e)r=100-parseFloat(r)+"%";else{var t=r.length-e-2;r=(r=100-parseFloat(r)).toFixed(t)+"%"}return r}function l(r){return r.replace(/ +/g," ").split(" ").map(function(r){return r.trim()}).filter(Boolean).reduce(function(r,e){var t=r.list,o=r.state,n=(e.match(/\(/g)||[]).length,i=(e.match(/\)/g)||[]).length;return o.parensDepth>0?t[t.length-1]=t[t.length-1]+" "+e:t.push(e),o.parensDepth+=n-i,{list:t,state:o}},{list:[],state:{parensDepth:0}}).list}function s(r){var e=l(r);if(e.length<=3||e.length>4)return r;var t=p(e,4),o=t[0],n=t[1],i=t[2];return[o,t[3],i,n].join(" ")}function f(r){return Object.keys(r).reduce(function(e,t){var o=r[t];if(n(o)&&(o=o.trim()),i(x,t))return e[t]=o,e;var a=c(t,o),u=a.key,d=a.value;return e[u]=d,e},{})}function c(r,e){var t=/\/\*\s?@noflip\s?\*\//.test(e),o=t?r:g(r);return{key:o,value:t?e:b(o,e)}}function g(r){return m[r]||r}function b(r,n){if(t(n))return n;if(o(n))return f(n);var i=e(n),a=i?n:n.replace(/ !important.*?$/,""),u=!i&&a.length!==n.length,d=v[r],l=void 0;return l=d?d({value:a,valuesToConvert:R,isRtl:!0,bgImgDirectionRegex:y,bgPosDirectionRegex:w}):R[a]||a,u?l+" !important":l}var h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},p=function(){function r(r,e){var t=[],o=!0,n=!1,i=void 0;try{for(var a,u=r[Symbol.iterator]();!(o=(a=u.next()).done)&&(t.push(a.value),!e||t.length!==e);o=!0);}catch(r){n=!0,i=r}finally{try{!o&&u.return&&u.return()}finally{if(n)throw i}}return t}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),v={padding:function(r){var t=r.value;return e(t)?t:s(t)},textShadow:function(r){return r.value.replace(/(-*)([.|\d]+)/,function(r,e,t){return"0"===t?r:""+(""===e?"-":"")+t})},borderColor:function(r){return s(r.value)},borderRadius:function(r){var t=r.value;if(e(t))return t;if(i(t,"/")){var o=t.split("/"),n=p(o,2),a=n[0],u=n[1];return v.borderRadius({value:a.trim()})+" / "+v.borderRadius({value:u.trim()})}var d=l(t);switch(d.length){case 2:return d.reverse().join(" ");case 4:var s=p(d,4),f=s[0],c=s[1],g=s[2];return[c,f,s[3],g].join(" ");default:return t}},background:function(r){var e=r.value,t=r.valuesToConvert,o=r.isRtl,n=r.bgImgDirectionRegex,i=r.bgPosDirectionRegex,a=e.replace(/(url\(.*?\))|(rgba?\(.*?\))|(hsl\(.*?\))|(#[a-fA-F0-9]+)|((^| )(\D)+( |$))/g,"").trim();return e=e.replace(a,v.backgroundPosition({value:a,valuesToConvert:t,isRtl:o,bgPosDirectionRegex:i})),v.backgroundImage({value:e,valuesToConvert:t,bgImgDirectionRegex:n})},backgroundImage:function(r){var e=r.value,t=r.valuesToConvert,o=r.bgImgDirectionRegex;return i(e,"url(")||i(e,"linear-gradient(")?e.replace(o,function(r,e,o){return r.replace(o,t[o])}):e},backgroundPosition:function(r){var e=r.value,t=r.valuesToConvert,o=r.isRtl,n=r.bgPosDirectionRegex;return e.replace(o?/^((-|\d|\.)+%)/:null,function(r,e){return d(e)}).replace(n,function(r){return t[r]})},backgroundPositionX:function(r){var t=r.value,o=r.valuesToConvert,n=r.isRtl,i=r.bgPosDirectionRegex;return e(t)?t:v.backgroundPosition({value:t,valuesToConvert:o,isRtl:n,bgPosDirectionRegex:i})},transform:function(r){var e=r.value,t="(?:(?:(?:\\[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]|"+t+")(?:[_a-z0-9-]|[^\\u0020-\\u007e]|"+t+")*)?)|(?: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");return e.replace(n,u).replace(i,u).replace(a,u)}};v.margin=v.padding,v.borderWidth=v.padding,v.boxShadow=v.textShadow,v.webkitBoxShadow=v.textShadow,v.mozBoxShadow=v.textShadow,v.borderStyle=v.borderColor,v.webkitTransform=v.transform,v.mozTransform=v.transform,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["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;var m=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"]]),x=["content"],R=r([["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"),w=new RegExp("(left)|(right)");return f});
{
"name": "rtl-css-js",
"version": "1.4.4",
"version": "1.5.0",
"description": "Right To Left conversion for CSS in JS objects",

@@ -8,2 +8,3 @@ "main": "dist/rtl-css-js.cjs.js",

"module": "dist/rtl-css-js.esm.js",
"types": "types.d.ts",
"scripts": {

@@ -22,4 +23,7 @@ "add-contributor": "kcd-scripts contributors add",

"dist",
"types.d.ts",
"core.js",
"core.esm.js"
"core.d.ts",
"core.esm.js",
"core.esm.d.ts"
],

@@ -26,0 +30,0 @@ "keywords": [

@@ -12,3 +12,3 @@ # rtl-css-js

[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]

@@ -78,2 +78,12 @@ [![Donate][donate-badge]][donate]

### kebab-case
This library support kebab-case properties too.
```javascript
const rtlCSSJS = require('rtl-css-js')
const styles = rtlCSSJS({'padding-right': 23})
console.log(styles) // logs {'padding-left': 23}
```
### core

@@ -118,4 +128,4 @@

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Tests") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars.githubusercontent.com/u/63876?v=3" width="100px;"/><br /><sub>Ahmed El Gabri</sub>](https://gabri.me)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Code") [📖](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Documentation") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1383861?v=4" width="100px;"/><br /><sub>Maja Wichrowska</sub>](https://github.com/majapw)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Tests") | [<img src="https://avatars2.githubusercontent.com/u/6600720?v=4" width="100px;"/><br /><sub>Yaniv</sub>](https://github.com/yzimet)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Tests") | [<img src="https://avatars2.githubusercontent.com/u/5658514?v=4" width="100px;"/><br /><sub>Jonathan Pollak</sub>](https://github.com/TxHawks)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Tests") |
| :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Tests") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars.githubusercontent.com/u/63876?v=3" width="100px;"/><br /><sub>Ahmed El Gabri</sub>](https://gabri.me)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Code") [📖](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Documentation") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1383861?v=4" width="100px;"/><br /><sub>Maja Wichrowska</sub>](https://github.com/majapw)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Tests") | [<img src="https://avatars2.githubusercontent.com/u/6600720?v=4" width="100px;"/><br /><sub>Yaniv</sub>](https://github.com/yzimet)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Tests") | [<img src="https://avatars2.githubusercontent.com/u/5658514?v=4" width="100px;"/><br /><sub>Jonathan Pollak</sub>](https://github.com/TxHawks)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Tests") | [<img src="https://avatars1.githubusercontent.com/u/8528759?v=4" width="100px;"/><br /><sub>Ali Taheri Moghaddar</sub>](https://github.com/alitaheri)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=alitaheri "Code") [📖](https://github.com/kentcdodds/rtl-css-js/commits?author=alitaheri "Documentation") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=alitaheri "Tests") |
| :---: | :---: | :---: | :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

@@ -122,0 +132,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc