GoScrobble/web/node_modules/jss-plugin-global/dist/jss-plugin-global.min.js

2 lines
2.2 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jssPluginGlobal={},t.jss)}(this,(function(t,e){"use strict";function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t}).apply(this,arguments)}var n="@global",r="@global ",i=function(){function t(t,r,i){for(var o in this.type="global",this.at=n,this.rules=void 0,this.options=void 0,this.key=void 0,this.isProcessed=!1,this.key=t,this.options=i,this.rules=new e.RuleList(s({},i,{parent:this})),r)this.rules.add(o,r[o]);this.rules.process()}var r=t.prototype;return r.getRule=function(t){return this.rules.get(t)},r.addRule=function(t,e,s){var n=this.rules.add(t,e,s);return n&&this.options.jss.plugins.onProcessRule(n),n},r.indexOf=function(t){return this.rules.indexOf(t)},r.toString=function(){return this.rules.toString()},t}(),o=function(){function t(t,e,i){this.type="global",this.at=n,this.options=void 0,this.rule=void 0,this.isProcessed=!1,this.key=void 0,this.key=t,this.options=i;var o=t.substr(r.length);this.rule=i.jss.createRule(o,e,s({},i,{parent:this}))}return t.prototype.toString=function(t){return this.rule?this.rule.toString(t):""},t}(),u=/\s*,\s*/g;function l(t,e){for(var s=t.split(u),n="",r=0;r<s.length;r++)n+=e+" "+s[r].trim(),s[r+1]&&(n+=", ");return n}t.default=function(){return{onCreateRule:function(t,e,s){if(!t)return null;if(t===n)return new i(t,e,s);if("@"===t[0]&&t.substr(0,r.length)===r)return new o(t,e,s);var u=s.parent;return u&&("global"===u.type||u.options.parent&&"global"===u.options.parent.type)&&(s.scoped=!1),!1===s.scoped&&(s.selector=t),null},onProcessRule:function(t,e){"style"===t.type&&e&&(function(t,e){var r=t.options,i=t.style,o=i?i[n]:null;if(o){for(var u in o)e.addRule(u,o[u],s({},r,{selector:l(u,t.selector)}));delete i[n]}}(t,e),function(t,e){var r=t.options,i=t.style;for(var o in i)if("@"===o[0]&&o.substr(0,n.length)===n){var u=l(o.substr(n.length),t.selector);e.addRule(u,i[o],s({},r,{selector:u})),delete i[o]}}(t,e))}}},Object.defineProperty(t,"__esModule",{value:!0})}));