rtl-css-js
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -104,2 +104,6 @@ 'use strict'; | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -474,4 +478,4 @@ return typeof val === 'number'; | ||
function getValueDoppelganger(key, originalValue) { | ||
/* eslint complexity:[2, 7] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue)) { | ||
/* eslint complexity:[2, 8] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) { | ||
return originalValue; | ||
@@ -478,0 +482,0 @@ } |
@@ -106,2 +106,6 @@ 'use strict'; | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -408,2 +412,3 @@ return typeof val === 'number'; | ||
exports.includes = includes; | ||
exports.isBoolean = isBoolean; | ||
exports.isNullOrUndefined = isNullOrUndefined; | ||
@@ -410,0 +415,0 @@ exports.isNumber = isNumber; |
@@ -102,2 +102,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -397,2 +401,2 @@ return typeof val === 'number'; | ||
export { propertyValueConverters, arrayToObject, calculateNewBackgroundPosition, calculateNewTranslate, flipSign, handleQuartetValues, includes, isNullOrUndefined, isNumber, isObject, isString, getValuesAsList }; | ||
export { propertyValueConverters, arrayToObject, calculateNewBackgroundPosition, calculateNewTranslate, flipSign, handleQuartetValues, includes, isBoolean, isNullOrUndefined, isNumber, isObject, isString, getValuesAsList }; |
@@ -108,2 +108,6 @@ (function (global, factory) { | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -410,2 +414,3 @@ return typeof val === 'number'; | ||
exports.includes = includes; | ||
exports.isBoolean = isBoolean; | ||
exports.isNullOrUndefined = isNullOrUndefined; | ||
@@ -412,0 +417,0 @@ exports.isNumber = isNumber; |
@@ -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=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})}); | ||
!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.isBoolean=function(e){return"boolean"==typeof e},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})}); |
@@ -102,2 +102,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -472,4 +476,4 @@ return typeof val === 'number'; | ||
function getValueDoppelganger(key, originalValue) { | ||
/* eslint complexity:[2, 7] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue)) { | ||
/* eslint complexity:[2, 8] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) { | ||
return originalValue; | ||
@@ -476,0 +480,0 @@ } |
@@ -108,2 +108,6 @@ (function (global, factory) { | ||
function isBoolean(val) { | ||
return typeof val === 'boolean'; | ||
} | ||
function isNumber(val) { | ||
@@ -478,4 +482,4 @@ return typeof val === 'number'; | ||
function getValueDoppelganger(key, originalValue) { | ||
/* eslint complexity:[2, 7] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue)) { | ||
/* eslint complexity:[2, 8] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up | ||
if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) { | ||
return originalValue; | ||
@@ -482,0 +486,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!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}); | ||
!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=v(e,2),o=t[0],n=t[1];return r[o]=n,r[n]=o,r},{})}function e(r){return"boolean"==typeof r}function t(r){return"number"==typeof r}function o(r){return null===r||void 0===r}function n(r){return r&&"object"===(void 0===r?"undefined":p(r))}function i(r){return"string"==typeof r}function a(r,e){return-1!==r.indexOf(e)}function u(r){return 0===parseFloat(r)?r:"-"===r[0]?r.slice(1):"-"+r}function d(r,e,t,o){return e+u(t)+o}function l(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 s(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 f(r){var e=s(r);if(e.length<=3||e.length>4)return r;var t=v(e,4),o=t[0],n=t[1],i=t[2];return[o,t[3],i,n].join(" ")}function c(r){return Object.keys(r).reduce(function(e,t){var o=r[t];if(i(o)&&(o=o.trim()),a(y,t))return e[t]=o,e;var n=g(t,o),u=n.key,d=n.value;return e[u]=d,e},{})}function g(r,e){var t=/\/\*\s?@noflip\s?\*\//.test(e),o=t?r:b(r);return{key:o,value:t?e:h(o,e)}}function b(r){return x[r]||r}function h(r,i){if(o(i)||e(i))return i;if(n(i))return c(i);var a=t(i),u=a?i:i.replace(/ !important.*?$/,""),d=!a&&u.length!==i.length,l=m[r],s=void 0;return s=l?l({value:u,valuesToConvert:R,isRtl:!0,bgImgDirectionRegex:w,bgPosDirectionRegex:S}):R[u]||u,d?s+" !important":s}var p="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},v=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")}}(),m={padding:function(r){var e=r.value;return t(e)?e:f(e)},textShadow:function(r){return r.value.replace(/(-*)([.|\d]+)/,function(r,e,t){return"0"===t?r:""+(""===e?"-":"")+t})},borderColor:function(r){return f(r.value)},borderRadius:function(r){var e=r.value;if(t(e))return e;if(a(e,"/")){var o=e.split("/"),n=v(o,2),i=n[0],u=n[1];return m.borderRadius({value:i.trim()})+" / "+m.borderRadius({value:u.trim()})}var d=s(e);switch(d.length){case 2:return d.reverse().join(" ");case 4:var l=v(d,4),f=l[0],c=l[1],g=l[2];return[c,f,l[3],g].join(" ");default:return e}},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,m.backgroundPosition({value:a,valuesToConvert:t,isRtl:o,bgPosDirectionRegex:i})),m.backgroundImage({value:e,valuesToConvert:t,bgImgDirectionRegex:n})},backgroundImage:function(r){var e=r.value,t=r.valuesToConvert,o=r.bgImgDirectionRegex;return a(e,"url(")||a(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 l(e)}).replace(n,function(r){return t[r]})},backgroundPositionX:function(r){var e=r.value,o=r.valuesToConvert,n=r.isRtl,i=r.bgPosDirectionRegex;return t(e)?e:m.backgroundPosition({value:e,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,d).replace(i,d).replace(a,d)}};m.margin=m.padding,m.borderWidth=m.padding,m.boxShadow=m.textShadow,m.webkitBoxShadow=m.textShadow,m.mozBoxShadow=m.textShadow,m.borderStyle=m.borderColor,m.webkitTransform=m.transform,m.mozTransform=m.transform,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["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;var x=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"]]),y=["content"],R=r([["ltr","rtl"],["left","right"],["w-resize","e-resize"],["sw-resize","se-resize"],["nw-resize","ne-resize"]]),w=new RegExp("(^|\\W|_)((ltr)|(rtl)|(left)|(right))(\\W|_|$)","g"),S=new RegExp("(left)|(right)");return c}); |
{ | ||
"name": "rtl-css-js", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Right To Left conversion for CSS in JS objects", | ||
@@ -5,0 +5,0 @@ "main": "dist/rtl-css-js.cjs.js", |
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
123101
2396