3 lines
2.1 KiB
JavaScript
3 lines
2.1 KiB
JavaScript
![]() |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).StyleToObject=t()}(this,(function(){"use strict";exports.default={};var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,f=/^\s+|\s+$/g,s="";function a(e){return e?e.replace(f,s):s}var c=function(f,c){if("string"!=typeof f)throw new TypeError("First argument must be a string");if(!f)return[];c=c||{};var l=1,p=1;function h(e){var r=e.match(t);r&&(l+=r.length);var n=e.lastIndexOf("\n");p=~n?e.length-n:p+e.length}function d(){var e={line:l,column:p};return function(t){return t.position=new v(e),y(),t}}function v(e){this.start=e,this.end={line:l,column:p},this.source=c.source}function m(e){var t=new Error(c.source+":"+l+":"+p+": "+e);if(t.reason=e,t.filename=c.source,t.line=l,t.column=p,t.source=f,!c.silent)throw t}function g(e){var t=e.exec(f);if(t){var r=t[0];return h(r),f=f.slice(r.length),t}}function y(){g(r)}function x(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var e=d();if("/"==f.charAt(0)&&"*"==f.charAt(1)){for(var t=2;s!=f.charAt(t)&&("*"!=f.charAt(t)||"/"!=f.charAt(t+1));)++t;if(t+=2,s===f.charAt(t-1))return m("End of comment missing");var r=f.slice(2,t-2);return p+=2,h(r),f=f.slice(t),p+=2,e({type:"comment",comment:r})}}function A(){var t=d(),r=g(n);if(r){if(w(),!g(o))return m("property missing ':'");var f=g(u),c=t({type:"declaration",property:a(r[0].replace(e,s)),value:f?a(f[0].replace(e,s)):s});return g(i),c}}return v.prototype.content=f,y(),function(){var e,t=[];for(x(t);e=A();)!1!==e&&(t.push(e),x(t));return t}()};function l(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var o,u,i=c(e),f="function"==typeof t,s=0,a=i.length;s<a;s++)o=(r=i[s]).property,u=r.value,f?t(o,u,r):u&&(n||(n={}),n[o]=u);return n}return{get exports(){return exports.default},set exports(e){exports.default=e}}.exports=l,exports.default.default=l,exports.default}));
|
||
|
//# sourceMappingURL=style-to-object.min.js.map
|