fela-beautifier
Advanced tools
Comparing version 4.2.6 to 4.3.0
@@ -91,12 +91,2 @@ (function (global, factory) { | ||
babelHelpers.toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
babelHelpers; | ||
@@ -600,8 +590,10 @@ | ||
}; | ||
var beautifier = (function () { | ||
function beautifier() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return function (renderer) { | ||
return addBeautifier(renderer, babelHelpers.extends({}, defaultOptions, options)); | ||
}; | ||
}); | ||
} | ||
@@ -608,0 +600,0 @@ return beautifier; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaBeautifier=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(e,t){var n=e.renderToString.bind(e);return e.renderToString=function(){var e=n();return o(e,t)},e}var n={};n.typeof="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},n.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},n.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},n.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},n.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)};var r=e(function(e,t){!function(){function r(e,t){function n(e){return" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e}function r(e){return"'"===e||'"'===e}function o(e){return a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||"-_*.:#[]".indexOf(e)>=0}function i(){var e;for(e=b;e>0;e-=1)v+=c.indent}function f(){v=S(v),w?v+=" {":(v+="\n",i(),v+="{"),"\n"!==s&&(v+="\n"),b+=1}function u(){var e;b-=1,v=S(v),v.length>0&&x&&(e=v.charAt(v.length-1),";"!==e&&"{"!==e&&(v+=";")),v+="\n",i(),v+="}",l.push(v),v=""}var c,l,a,s,p,h,y,b,d,g,S,A=0,m=e.length,v="",w=!0,x=!1;for(c=arguments.length>1?t:{},"undefined"==typeof c.indent&&(c.indent=" "),"string"==typeof c.openbrace&&(w="end-of-line"===c.openbrace),"boolean"==typeof c.autosemicolon&&(x=c.autosemicolon),S=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")},y={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},b=0,h=y.Start,g=!1,l=[],e=e.replace(/\r\n/g,"\n");A<m;)if(a=e.charAt(A),s=e.charAt(A+1),A+=1,r(d))v+=a,a===d&&(d=null),"\\"===a&&s===d&&(v+=s,A+=1);else if(r(a))v+=a,d=a;else if(g)v+=a,"*"===a&&"/"===s&&(g=!1,v+=s,A+=1);else if("/"!==a||"*"!==s){if(h===y.Start){if(0===l.length&&n(a)&&0===v.length)continue;if(a<=" "||a.charCodeAt(0)>=128){h=y.Start,v+=a;continue}if(o(a)||"@"===a){if(p=S(v),0===p.length)l.length>0&&(v="\n\n");else if("}"===p.charAt(p.length-1)||";"===p.charAt(p.length-1))v=p+"\n\n";else for(;;){if(s=v.charAt(v.length-1)," "!==s&&9!==s.charCodeAt(0))break;v=v.substr(0,v.length-1)}v+=a,h="@"===a?y.AtRule:y.Selector;continue}}if(h!==y.AtRule)if(h!==y.Block)if(h!==y.Selector)if(h!==y.Ruleset)if(h!==y.Property)if(h!==y.Separator)if(h!==y.Expression)h===y.URL&&")"===a&&v.charAt(v.length-1!=="\\")?(v+=a,h=y.Expression):v+=a;else{if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}if(";"===a){v=S(v),v+=";\n",h=y.Ruleset;continue}if(v+=a,"("===a&&"l"===v.charAt(v.length-2)&&"r"===v.charAt(v.length-3)&&"u"===v.charAt(v.length-4)){h=y.URL;continue}}else{if(!n(a)){v+=a,h=y.Expression;continue}r(s)&&(h=y.Expression)}else{if(":"===a){v=S(v),v+=": ",h=y.Expression,n(s)&&(h=y.Separator);continue}if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}v+=a}else{if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}if("\n"===a){v=S(v),v+="\n";continue}if(!n(a)){v=S(v),v+="\n",i(),v+=a,h=y.Property;continue}v+=a}else{if("{"===a){f(),h=y.Ruleset;continue}if("}"===a){u(),h=y.Start;continue}v+=a}else{if(o(a)){if(p=S(v),0===p.length)l.length>0&&(v="\n\n");else if("}"===p.charAt(p.length-1))v=p+"\n\n";else for(;;){if(s=v.charAt(v.length-1)," "!==s&&9!==s.charCodeAt(0))break;v=v.substr(0,v.length-1)}i(),v+=a,h=y.Selector;continue}if("}"===a){u(),h=y.Start;continue}v+=a}else{if(";"===a){v+=a,h=y.Start;continue}if("{"===a){p=S(v),f(),h="@font-face"===p?y.Ruleset:y.Block;continue}v+=a}}else g=!0,v+=a,v+=s,A+=1;return v=l.join("")+v}"undefined"!=typeof t?e.exports=t=r:"object"===("undefined"==typeof window?"undefined":n.typeof(window))&&(window.cssbeautify=r)}()}),o=r&&"object"==typeof r&&"default"in r?r.default:r,i={indent:" ",openbrace:"end-of-line",autosemicolon:!1},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){return t(r,n.extends({},i,e))}};return f}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaBeautifier=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(e,t){var n=e.renderToString.bind(e);return e.renderToString=function(){var e=n();return i(e,t)},e}function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(n){return t(n,o.extends({},f,e))}}var o={};o.typeof="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},o.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),o.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},o.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},o.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},o.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};var r=e(function(e,t){!function(){function n(e,t){function n(e){return" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e}function o(e){return"'"===e||'"'===e}function r(e){return a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||"-_*.:#[]".indexOf(e)>=0}function i(){var e;for(e=b;e>0;e-=1)v+=c.indent}function f(){v=S(v),w?v+=" {":(v+="\n",i(),v+="{"),"\n"!==s&&(v+="\n"),b+=1}function u(){var e;b-=1,v=S(v),v.length>0&&x&&(e=v.charAt(v.length-1),";"!==e&&"{"!==e&&(v+=";")),v+="\n",i(),v+="}",l.push(v),v=""}var c,l,a,s,p,h,y,b,d,g,S,m=0,A=e.length,v="",w=!0,x=!1;for(c=arguments.length>1?t:{},"undefined"==typeof c.indent&&(c.indent=" "),"string"==typeof c.openbrace&&(w="end-of-line"===c.openbrace),"boolean"==typeof c.autosemicolon&&(x=c.autosemicolon),S=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")},y={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},b=0,h=y.Start,g=!1,l=[],e=e.replace(/\r\n/g,"\n");m<A;)if(a=e.charAt(m),s=e.charAt(m+1),m+=1,o(d))v+=a,a===d&&(d=null),"\\"===a&&s===d&&(v+=s,m+=1);else if(o(a))v+=a,d=a;else if(g)v+=a,"*"===a&&"/"===s&&(g=!1,v+=s,m+=1);else if("/"!==a||"*"!==s){if(h===y.Start){if(0===l.length&&n(a)&&0===v.length)continue;if(a<=" "||a.charCodeAt(0)>=128){h=y.Start,v+=a;continue}if(r(a)||"@"===a){if(p=S(v),0===p.length)l.length>0&&(v="\n\n");else if("}"===p.charAt(p.length-1)||";"===p.charAt(p.length-1))v=p+"\n\n";else for(;;){if(s=v.charAt(v.length-1)," "!==s&&9!==s.charCodeAt(0))break;v=v.substr(0,v.length-1)}v+=a,h="@"===a?y.AtRule:y.Selector;continue}}if(h!==y.AtRule)if(h!==y.Block)if(h!==y.Selector)if(h!==y.Ruleset)if(h!==y.Property)if(h!==y.Separator)if(h!==y.Expression)h===y.URL&&")"===a&&v.charAt(v.length-1!=="\\")?(v+=a,h=y.Expression):v+=a;else{if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}if(";"===a){v=S(v),v+=";\n",h=y.Ruleset;continue}if(v+=a,"("===a&&"l"===v.charAt(v.length-2)&&"r"===v.charAt(v.length-3)&&"u"===v.charAt(v.length-4)){h=y.URL;continue}}else{if(!n(a)){v+=a,h=y.Expression;continue}o(s)&&(h=y.Expression)}else{if(":"===a){v=S(v),v+=": ",h=y.Expression,n(s)&&(h=y.Separator);continue}if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}v+=a}else{if("}"===a){u(),h=y.Start,b>0&&(h=y.Block);continue}if("\n"===a){v=S(v),v+="\n";continue}if(!n(a)){v=S(v),v+="\n",i(),v+=a,h=y.Property;continue}v+=a}else{if("{"===a){f(),h=y.Ruleset;continue}if("}"===a){u(),h=y.Start;continue}v+=a}else{if(r(a)){if(p=S(v),0===p.length)l.length>0&&(v="\n\n");else if("}"===p.charAt(p.length-1))v=p+"\n\n";else for(;;){if(s=v.charAt(v.length-1)," "!==s&&9!==s.charCodeAt(0))break;v=v.substr(0,v.length-1)}i(),v+=a,h=y.Selector;continue}if("}"===a){u(),h=y.Start;continue}v+=a}else{if(";"===a){v+=a,h=y.Start;continue}if("{"===a){p=S(v),f(),h="@font-face"===p?y.Ruleset:y.Block;continue}v+=a}}else g=!0,v+=a,v+=s,m+=1;return v=l.join("")+v}"undefined"!=typeof t?e.exports=t=n:"object"===("undefined"==typeof window?"undefined":o.typeof(window))&&(window.cssbeautify=n)}()}),i=r&&"object"==typeof r&&"default"in r?r.default:r,f={indent:" ",openbrace:"end-of-line",autosemicolon:!1};return n}); |
{ | ||
"name": "fela-beautifier", | ||
"version": "4.2.6", | ||
"version": "4.3.0", | ||
"description": "Fela enhancer to beautify CSS output", | ||
@@ -30,4 +30,4 @@ "module": "index.es2015.js", | ||
"peerDependencies": { | ||
"fela": "4.2.6" | ||
"fela": "4.3.0" | ||
} | ||
} |
# fela-beautifier | ||
<img alt="npm downloads" src="https://img.shields.io/npm/dm/fela-beautifier.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.97kb-brightgreen.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.91kb-brightgreen.svg"> | ||
@@ -16,5 +16,5 @@ The beautifier enhancer is a developer tool that automatically formats the rendered CSS markup on every change. It uses [cssbeautify](https://github.com/senchalabs/cssbeautify) to achieve this. | ||
<!-- Fela (Development): Unminified version including all warnings --> | ||
<script src="https://unpkg.com/fela-beautifier@4.2.6/dist/fela-beautifier.js"></script> | ||
<script src="https://unpkg.com/fela-beautifier@4.3.0/dist/fela-beautifier.js"></script> | ||
<!-- Fela (Production): Minified version --> | ||
<script src="https://unpkg.com/fela-beautifier@4.2.6/dist/fela-beautifier.min.js"></script> | ||
<script src="https://unpkg.com/fela-beautifier@4.3.0/dist/fela-beautifier.min.js"></script> | ||
``` | ||
@@ -21,0 +21,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53615
502