@briklab/lib 1.0.10 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/stylesheet/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var
|
|
2
|
-
`:case"\f":if(
|
|
3
|
-
`:case"\f":break;default:s+=" ";break}break;case'"':if(
|
|
4
|
-
`;return i};
|
|
5
|
-
`:case"\f":t==="after-import"?t="url":r+=s;break;case"@":!t&&i.indexOf("@import",e)===e&&(t="after-import",e+=6,r="");break;case"u":if(t==="url"&&i.indexOf("url(",e)===e){if(
|
|
1
|
+
var gt=Object.create;var Ke=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var wt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of bt(e))!xt.call(i,n)&&n!==t&&Ke(i,n,{get:()=>e[n],enumerable:!(r=mt(e,n))||r.enumerable});return i};var _t=(i,e,t)=>(t=i!=null?gt(vt(i)):{},wt(e||!i||!i.__esModule?Ke(t,"default",{value:i,enumerable:!0}):t,i));var _e=h(Ge=>{var Ne={};Ne.StyleSheet=function(){this.parentStyleSheet=null};Ge.StyleSheet=Ne.StyleSheet});var d=h(je=>{var f={};f.CSSRule=function(){this.parentRule=null,this.parentStyleSheet=null};f.CSSRule.UNKNOWN_RULE=0;f.CSSRule.STYLE_RULE=1;f.CSSRule.CHARSET_RULE=2;f.CSSRule.IMPORT_RULE=3;f.CSSRule.MEDIA_RULE=4;f.CSSRule.FONT_FACE_RULE=5;f.CSSRule.PAGE_RULE=6;f.CSSRule.KEYFRAMES_RULE=7;f.CSSRule.KEYFRAME_RULE=8;f.CSSRule.MARGIN_RULE=9;f.CSSRule.NAMESPACE_RULE=10;f.CSSRule.COUNTER_STYLE_RULE=11;f.CSSRule.SUPPORTS_RULE=12;f.CSSRule.DOCUMENT_RULE=13;f.CSSRule.FONT_FEATURE_VALUES_RULE=14;f.CSSRule.VIEWPORT_RULE=15;f.CSSRule.REGION_STYLE_RULE=16;f.CSSRule.prototype={constructor:f.CSSRule};je.CSSRule=f.CSSRule});var Q=h(We=>{var g={CSSStyleDeclaration:V().CSSStyleDeclaration,CSSRule:d().CSSRule};g.CSSStyleRule=function(){g.CSSRule.call(this),this.selectorText="",this.style=new g.CSSStyleDeclaration,this.style.parentRule=this};g.CSSStyleRule.prototype=new g.CSSRule;g.CSSStyleRule.prototype.constructor=g.CSSStyleRule;g.CSSStyleRule.prototype.type=1;Object.defineProperty(g.CSSStyleRule.prototype,"cssText",{get:function(){var i;return this.selectorText?i=this.selectorText+" {"+this.style.cssText+"}":i="",i},set:function(i){var e=g.CSSStyleRule.parse(i);this.style=e.style,this.selectorText=e.selectorText}});g.CSSStyleRule.parse=function(i){for(var e=0,t="selector",r,n=e,s="",l={selector:!0,value:!0},o=new g.CSSStyleRule,S,u="",a;a=i.charAt(e);e++)switch(a){case" ":case" ":case"\r":case`
|
|
2
|
+
`:case"\f":if(l[t])switch(i.charAt(e-1)){case" ":case" ":case"\r":case`
|
|
3
|
+
`:case"\f":break;default:s+=" ";break}break;case'"':if(n=e+1,r=i.indexOf('"',n)+1,!r)throw'" is missing';s+=i.slice(e,r),e=r-1;break;case"'":if(n=e+1,r=i.indexOf("'",n)+1,!r)throw"' is missing";s+=i.slice(e,r),e=r-1;break;case"/":if(i.charAt(e+1)==="*"){if(e+=2,r=i.indexOf("*/",e),r===-1)throw new SyntaxError("Missing */");e=r+1}else s+=a;break;case"{":t==="selector"&&(o.selectorText=s.trim(),s="",t="name");break;case":":t==="name"?(S=s.trim(),s="",t="value"):s+=a;break;case"!":t==="value"&&i.indexOf("!important",e)===e?(u="important",e+=9):s+=a;break;case";":t==="value"?(o.style.setProperty(S,s.trim(),u),u="",s="",t="name"):s+=a;break;case"}":if(t==="value")o.style.setProperty(S,s.trim(),u),u="",s="";else{if(t==="name")break;s+=a}t="selector";break;default:s+=a;break}return o};We.CSSStyleRule=g.CSSStyleRule});var ee=h(Be=>{var b={StyleSheet:_e().StyleSheet,CSSStyleRule:Q().CSSStyleRule};b.CSSStyleSheet=function(){b.StyleSheet.call(this),this.cssRules=[]};b.CSSStyleSheet.prototype=new b.StyleSheet;b.CSSStyleSheet.prototype.constructor=b.CSSStyleSheet;b.CSSStyleSheet.prototype.insertRule=function(i,e){if(e<0||e>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var t=b.parse(i).cssRules[0];return t.parentStyleSheet=this,this.cssRules.splice(e,0,t),e};b.CSSStyleSheet.prototype.deleteRule=function(i){if(i<0||i>=this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");this.cssRules.splice(i,1)};b.CSSStyleSheet.prototype.toString=function(){for(var i="",e=this.cssRules,t=0;t<e.length;t++)i+=e[t].cssText+`
|
|
4
|
+
`;return i};Be.CSSStyleSheet=b.CSSStyleSheet;b.parse=le().parse});var ae=h(Je=>{var oe={};oe.MediaList=function(){this.length=0};oe.MediaList.prototype={constructor:oe.MediaList,get mediaText(){return Array.prototype.join.call(this,", ")},set mediaText(i){for(var e=i.split(","),t=this.length=e.length,r=0;r<t;r++)this[r]=e[r].trim()},appendMedium:function(i){Array.prototype.indexOf.call(this,i)===-1&&(this[this.length]=i,this.length++)},deleteMedium:function(i){var e=Array.prototype.indexOf.call(this,i);e!==-1&&Array.prototype.splice.call(this,e,1)}};Je.MediaList=oe.MediaList});var ke=h(Ye=>{var w={CSSRule:d().CSSRule,CSSStyleSheet:ee().CSSStyleSheet,MediaList:ae().MediaList};w.CSSImportRule=function(){w.CSSRule.call(this),this.href="",this.media=new w.MediaList,this.styleSheet=new w.CSSStyleSheet};w.CSSImportRule.prototype=new w.CSSRule;w.CSSImportRule.prototype.constructor=w.CSSImportRule;w.CSSImportRule.prototype.type=3;Object.defineProperty(w.CSSImportRule.prototype,"cssText",{get:function(){var i=this.media.mediaText;return"@import url("+this.href+")"+(i?" "+i:"")+";"},set:function(i){for(var e=0,t="",r="",n,s;s=i.charAt(e);e++)switch(s){case" ":case" ":case"\r":case`
|
|
5
|
+
`:case"\f":t==="after-import"?t="url":r+=s;break;case"@":!t&&i.indexOf("@import",e)===e&&(t="after-import",e+=6,r="");break;case"u":if(t==="url"&&i.indexOf("url(",e)===e){if(n=i.indexOf(")",e+1),n===-1)throw e+': ")" not found';e+=4;var l=i.slice(e,n);l[0]===l[l.length-1]&&(l[0]==='"'||l[0]==="'")&&(l=l.slice(1,-1)),this.href=l,e=n,t="media"}break;case'"':if(t==="url"){if(n=i.indexOf('"',e+1),!n)throw e+`: '"' not found`;this.href=i.slice(e+1,n),e=n,t="media"}break;case"'":if(t==="url"){if(n=i.indexOf("'",e+1),!n)throw e+`: "'" not found`;this.href=i.slice(e+1,n),e=n,t="media"}break;case";":t==="media"&&r&&(this.media.mediaText=r.trim());break;default:t==="media"&&(r+=s);break}}});Ye.CSSImportRule=w.CSSImportRule});var U=h(Ze=>{var k={CSSRule:d().CSSRule};k.CSSGroupingRule=function(){k.CSSRule.call(this),this.cssRules=[]};k.CSSGroupingRule.prototype=new k.CSSRule;k.CSSGroupingRule.prototype.constructor=k.CSSGroupingRule;k.CSSGroupingRule.prototype.insertRule=function(e,t){if(t<0||t>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var r=k.parse(e).cssRules[0];return r.parentRule=this,this.cssRules.splice(t,0,r),t};k.CSSGroupingRule.prototype.deleteRule=function(e){if(e<0||e>=this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");this.cssRules.splice(e,1)[0].parentRule=null};Ze.CSSGroupingRule=k.CSSGroupingRule});var N=h(Xe=>{var $={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule};$.CSSConditionRule=function(){$.CSSGroupingRule.call(this),this.cssRules=[]};$.CSSConditionRule.prototype=new $.CSSGroupingRule;$.CSSConditionRule.prototype.constructor=$.CSSConditionRule;$.CSSConditionRule.prototype.conditionText="";$.CSSConditionRule.prototype.cssText="";Xe.CSSConditionRule=$.CSSConditionRule});var Se=h(ze=>{var T={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule,MediaList:ae().MediaList};T.CSSMediaRule=function(){T.CSSConditionRule.call(this),this.media=new T.MediaList};T.CSSMediaRule.prototype=new T.CSSConditionRule;T.CSSMediaRule.prototype.constructor=T.CSSMediaRule;T.CSSMediaRule.prototype.type=4;Object.defineProperties(T.CSSMediaRule.prototype,{conditionText:{get:function(){return this.media.mediaText},set:function(i){this.media.mediaText=i},configurable:!0,enumerable:!0},cssText:{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@media "+this.media.mediaText+" {"+i.join("")+"}"},configurable:!0,enumerable:!0}});ze.CSSMediaRule=T.CSSMediaRule});var ue=h(Qe=>{var q={CSSRule:d().CSSRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule};q.CSSSupportsRule=function(){q.CSSConditionRule.call(this)};q.CSSSupportsRule.prototype=new q.CSSConditionRule;q.CSSSupportsRule.prototype.constructor=q.CSSSupportsRule;q.CSSSupportsRule.prototype.type=12;Object.defineProperty(q.CSSSupportsRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@supports "+this.conditionText+" {"+i.join("")+"}"}});Qe.CSSSupportsRule=q.CSSSupportsRule});var Te=h(et=>{var M={CSSStyleDeclaration:V().CSSStyleDeclaration,CSSRule:d().CSSRule};M.CSSFontFaceRule=function(){M.CSSRule.call(this),this.style=new M.CSSStyleDeclaration,this.style.parentRule=this};M.CSSFontFaceRule.prototype=new M.CSSRule;M.CSSFontFaceRule.prototype.constructor=M.CSSFontFaceRule;M.CSSFontFaceRule.prototype.type=5;Object.defineProperty(M.CSSFontFaceRule.prototype,"cssText",{get:function(){return"@font-face {"+this.style.cssText+"}"}});et.CSSFontFaceRule=M.CSSFontFaceRule});var Me=h(tt=>{var P={CSSRule:d().CSSRule};P.CSSHostRule=function(){P.CSSRule.call(this),this.cssRules=[]};P.CSSHostRule.prototype=new P.CSSRule;P.CSSHostRule.prototype.constructor=P.CSSHostRule;P.CSSHostRule.prototype.type=1001;Object.defineProperty(P.CSSHostRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@host {"+i.join("")+"}"}});tt.CSSHostRule=P.CSSHostRule});var ce=h(rt=>{var E={CSSRule:d().CSSRule,CSSStyleDeclaration:V().CSSStyleDeclaration};E.CSSKeyframeRule=function(){E.CSSRule.call(this),this.keyText="",this.style=new E.CSSStyleDeclaration,this.style.parentRule=this};E.CSSKeyframeRule.prototype=new E.CSSRule;E.CSSKeyframeRule.prototype.constructor=E.CSSKeyframeRule;E.CSSKeyframeRule.prototype.type=8;Object.defineProperty(E.CSSKeyframeRule.prototype,"cssText",{get:function(){return this.keyText+" {"+this.style.cssText+"} "}});rt.CSSKeyframeRule=E.CSSKeyframeRule});var he=h(it=>{var L={CSSRule:d().CSSRule};L.CSSKeyframesRule=function(){L.CSSRule.call(this),this.name="",this.cssRules=[]};L.CSSKeyframesRule.prototype=new L.CSSRule;L.CSSKeyframesRule.prototype.constructor=L.CSSKeyframesRule;L.CSSKeyframesRule.prototype.type=7;Object.defineProperty(L.CSSKeyframesRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(" "+this.cssRules[e].cssText);return"@"+(this._vendorPrefix||"")+"keyframes "+this.name+` {
|
|
6
6
|
`+i.join(`
|
|
7
7
|
`)+`
|
|
8
|
-
}`}});
|
|
9
|
-
`:t==="*"&&(
|
|
10
|
-
`,e+1);return S<
|
|
11
|
-
`),He
|
|
12
|
-
`:case"\f":o[r]&&(s+=y);break;case'"':
|
|
8
|
+
}`}});it.CSSKeyframesRule=L.CSSKeyframesRule});var Ee=h(st=>{var pe={};pe.CSSValue=function(){};pe.CSSValue.prototype={constructor:pe.CSSValue,set cssText(i){var e=this._getConstructorName();throw new Error('DOMException: property "cssText" of "'+e+'" is readonly and can not be replaced with "'+i+'"!')},get cssText(){var i=this._getConstructorName();throw new Error('getter "cssText" of "'+i+'" is not implemented!')},_getConstructorName:function(){var i=this.constructor.toString(),e=i.match(/function\s([^\(]+)/),t=e[1];return t}};st.CSSValue=pe.CSSValue});var Ie=h(nt=>{var _={CSSValue:Ee().CSSValue};_.CSSValueExpression=function(e,t){this._token=e,this._idx=t};_.CSSValueExpression.prototype=new _.CSSValue;_.CSSValueExpression.prototype.constructor=_.CSSValueExpression;_.CSSValueExpression.prototype.parse=function(){for(var i=this._token,e=this._idx,t="",r="",n="",s,l=[];;++e){if(t=i.charAt(e),t===""){n="css expression error: unfinished expression!";break}switch(t){case"(":l.push(t),r+=t;break;case")":l.pop(t),r+=t;break;case"/":(s=this._parseJSComment(i,e))?s.error?n="css expression error: unfinished comment in expression!":e=s.idx:(s=this._parseJSRexExp(i,e))?(e=s.idx,r+=s.text):r+=t;break;case"'":case'"':s=this._parseJSString(i,e,t),s?(e=s.idx,r+=s.text):r+=t;break;default:r+=t;break}if(n||l.length===0)break}var o;return n?o={error:n}:o={idx:e,expression:r},o};_.CSSValueExpression.prototype._parseJSComment=function(i,e){var t=i.charAt(e+1),r;if(t==="/"||t==="*"){var n=e,s,l;if(t==="/"?l=`
|
|
9
|
+
`:t==="*"&&(l="*/"),s=i.indexOf(l,n+1+1),s!==-1)return s=s+l.length-1,r=i.substring(e,s+1),{idx:s,text:r};var o="css expression error: unfinished comment in expression!";return{error:o}}else return!1};_.CSSValueExpression.prototype._parseJSString=function(i,e,t){var r=this._findMatchedIdx(i,e,t),n;return r===-1?!1:(n=i.substring(e,r+t.length),{idx:r,text:n})};_.CSSValueExpression.prototype._parseJSRexExp=function(i,e){var t=i.substring(0,e).replace(/\s+$/,""),r=[/^$/,/\($/,/\[$/,/\!$/,/\+$/,/\-$/,/\*$/,/\/\s+/,/\%$/,/\=$/,/\>$/,/<$/,/\&$/,/\|$/,/\^$/,/\~$/,/\?$/,/\,$/,/delete$/,/in$/,/instanceof$/,/new$/,/typeof$/,/void$/],n=r.some(function(l){return l.test(t)});if(n){var s="/";return this._parseJSString(i,e,s)}else return!1};_.CSSValueExpression.prototype._findMatchedIdx=function(i,e,t){for(var r=e,n,s=-1;;)if(n=i.indexOf(t,r+1),n===-1){n=s;break}else{var l=i.substring(e+1,n),o=l.match(/\\+$/);if(!o||o[0]%2===0)break;r=n}var S=i.indexOf(`
|
|
10
|
+
`,e+1);return S<n&&(n=s),n};nt.CSSValueExpression=_.CSSValueExpression});var Oe=h(lt=>{var fe={};fe.MatcherList=function(){this.length=0};fe.MatcherList.prototype={constructor:fe.MatcherList,get matcherText(){return Array.prototype.join.call(this,", ")},set matcherText(i){for(var e=i.split(","),t=this.length=e.length,r=0;r<t;r++)this[r]=e[r].trim()},appendMatcher:function(i){Array.prototype.indexOf.call(this,i)===-1&&(this[this.length]=i,this.length++)},deleteMatcher:function(i){var e=Array.prototype.indexOf.call(this,i);e!==-1&&Array.prototype.splice.call(this,e,1)}};lt.MatcherList=fe.MatcherList});var $e=h(ot=>{var I={CSSRule:d().CSSRule,MatcherList:Oe().MatcherList};I.CSSDocumentRule=function(){I.CSSRule.call(this),this.matcher=new I.MatcherList,this.cssRules=[]};I.CSSDocumentRule.prototype=new I.CSSRule;I.CSSDocumentRule.prototype.constructor=I.CSSDocumentRule;I.CSSDocumentRule.prototype.type=10;Object.defineProperty(I.CSSDocumentRule.prototype,"cssText",{get:function(){for(var i=[],e=0,t=this.cssRules.length;e<t;e++)i.push(this.cssRules[e].cssText);return"@-moz-document "+this.matcher.matcherText+" {"+i.join("")+"}"}});ot.CSSDocumentRule=I.CSSDocumentRule});var le=h(at=>{var c={};c.parse=function(e){for(var t=0,r="before-selector",n,s="",l=0,o={selector:!0,value:!0,"value-parenthesis":!0,atRule:!0,"importRule-begin":!0,importRule:!0,atBlock:!0,conditionBlock:!0,"documentRule-begin":!0},S=new c.CSSStyleSheet,u=S,a,x=[],D=!1,Ae,ve,W="",R,B,J,Y,Z,H,K,re,Fe=/@(-(?:\w+-)+)?keyframes/g,X=function(dt){var He=e.substring(0,t).split(`
|
|
11
|
+
`),Ve=He.length,Ue=He.pop().length+1,ne=new Error(dt+" (line "+Ve+", char "+Ue+")");throw ne.line=Ve,ne.char=Ue,ne.styleSheet=S,ne},y;y=e.charAt(t);t++)switch(y){case" ":case" ":case"\r":case`
|
|
12
|
+
`:case"\f":o[r]&&(s+=y);break;case'"':n=t+1;do n=e.indexOf('"',n)+1,n||X('Unmatched "');while(e[n-2]==="\\");switch(s+=e.slice(t,n),t=n-1,r){case"before-value":r="value";break;case"importRule-begin":r="importRule";break}break;case"'":n=t+1;do n=e.indexOf("'",n)+1,n||X("Unmatched '");while(e[n-2]==="\\");switch(s+=e.slice(t,n),t=n-1,r){case"before-value":r="value";break;case"importRule-begin":r="importRule";break}break;case"/":e.charAt(t+1)==="*"?(t+=2,n=e.indexOf("*/",t),n===-1?X("Missing */"):t=n+1):s+=y,r==="importRule-begin"&&(s+=" ",r="importRule");break;case"@":if(e.indexOf("@-moz-document",t)===t){r="documentRule-begin",K=new c.CSSDocumentRule,K.__starts=t,t+=13,s="";break}else if(e.indexOf("@media",t)===t){r="atBlock",B=new c.CSSMediaRule,B.__starts=t,t+=5,s="";break}else if(e.indexOf("@supports",t)===t){r="conditionBlock",J=new c.CSSSupportsRule,J.__starts=t,t+=8,s="";break}else if(e.indexOf("@host",t)===t){r="hostRule-begin",t+=4,re=new c.CSSHostRule,re.__starts=t,s="";break}else if(e.indexOf("@import",t)===t){r="importRule-begin",t+=6,s+="@import";break}else if(e.indexOf("@font-face",t)===t){r="fontFaceRule-begin",t+=9,Z=new c.CSSFontFaceRule,Z.__starts=t,s="";break}else{Fe.lastIndex=t;var ie=Fe.exec(e);if(ie&&ie.index===t){r="keyframesRule-begin",H=new c.CSSKeyframesRule,H.__starts=t,H._vendorPrefix=ie[1],t+=ie[0].length-1,s="";break}else r==="selector"&&(r="atRule")}s+=y;break;case"{":r==="selector"||r==="atRule"?(R.selectorText=s.trim(),R.style.__starts=t,s="",r="before-name"):r==="atBlock"?(B.media.mediaText=s.trim(),a&&x.push(a),u=a=B,B.parentStyleSheet=S,s="",r="before-selector"):r==="conditionBlock"?(J.conditionText=s.trim(),a&&x.push(a),u=a=J,J.parentStyleSheet=S,s="",r="before-selector"):r==="hostRule-begin"?(a&&x.push(a),u=a=re,re.parentStyleSheet=S,s="",r="before-selector"):r==="fontFaceRule-begin"?(a&&(Z.parentRule=a),Z.parentStyleSheet=S,R=Z,s="",r="before-name"):r==="keyframesRule-begin"?(H.name=s.trim(),a&&(x.push(a),H.parentRule=a),H.parentStyleSheet=S,u=a=H,s="",r="keyframeRule-begin"):r==="keyframeRule-begin"?(R=new c.CSSKeyframeRule,R.keyText=s.trim(),R.__starts=t,s="",r="before-name"):r==="documentRule-begin"&&(K.matcher.matcherText=s.trim(),a&&(x.push(a),K.parentRule=a),u=a=K,K.parentStyleSheet=S,s="",r="before-selector");break;case":":r==="name"?(ve=s.trim(),s="",r="before-value"):s+=y;break;case"(":if(r==="value")if(s.trim()==="expression"){var se=new c.CSSValueExpression(e,t).parse();se.error?X(se.error):(s+=se.expression,t=se.idx)}else r="value-parenthesis",l=1,s+=y;else r==="value-parenthesis"&&l++,s+=y;break;case")":r==="value-parenthesis"&&(l--,l===0&&(r="value")),s+=y;break;case"!":r==="value"&&e.indexOf("!important",t)===t?(W="important",t+=9):s+=y;break;case";":switch(r){case"value":R.style.setProperty(ve,s.trim(),W),W="",s="",r="before-name";break;case"atRule":s="",r="before-selector";break;case"importRule":Y=new c.CSSImportRule,Y.parentStyleSheet=Y.styleSheet.parentStyleSheet=S,Y.cssText=s+y,S.cssRules.push(Y),s="",r="before-selector";break;default:s+=y;break}break;case"}":switch(r){case"value":R.style.setProperty(ve,s.trim(),W),W="";case"before-name":case"name":R.__ends=t+1,a&&(R.parentRule=a),R.parentStyleSheet=S,u.cssRules.push(R),s="",u.constructor===c.CSSKeyframesRule?r="keyframeRule-begin":r="before-selector";break;case"keyframeRule-begin":case"before-selector":case"selector":for(a||X("Unexpected }"),D=x.length>0;x.length>0;){if(a=x.pop(),a.constructor.name==="CSSMediaRule"||a.constructor.name==="CSSSupportsRule"){Ae=u,u=a,u.cssRules.push(Ae);break}x.length===0&&(D=!1)}D||(u.__ends=t+1,S.cssRules.push(u),u=S,a=null),s="",r="before-selector";break}break;default:switch(r){case"before-selector":r="selector",R=new c.CSSStyleRule,R.__starts=t;break;case"before-name":r="name";break;case"before-value":r="value";break;case"importRule-begin":r="importRule";break}s+=y;break}return S};at.parse=c.parse;c.CSSStyleSheet=ee().CSSStyleSheet;c.CSSStyleRule=Q().CSSStyleRule;c.CSSImportRule=ke().CSSImportRule;c.CSSGroupingRule=U().CSSGroupingRule;c.CSSMediaRule=Se().CSSMediaRule;c.CSSConditionRule=N().CSSConditionRule;c.CSSSupportsRule=ue().CSSSupportsRule;c.CSSFontFaceRule=Te().CSSFontFaceRule;c.CSSHostRule=Me().CSSHostRule;c.CSSStyleDeclaration=V().CSSStyleDeclaration;c.CSSKeyframeRule=ce().CSSKeyframeRule;c.CSSKeyframesRule=he().CSSKeyframesRule;c.CSSValueExpression=Ie().CSSValueExpression;c.CSSDocumentRule=$e().CSSDocumentRule});var V=h(St=>{var G={};G.CSSStyleDeclaration=function(){this.length=0,this.parentRule=null,this._importants={}};G.CSSStyleDeclaration.prototype={constructor:G.CSSStyleDeclaration,getPropertyValue:function(i){return this[i]||""},setProperty:function(i,e,t){if(this[i]){var r=Array.prototype.indexOf.call(this,i);r<0&&(this[this.length]=i,this.length++)}else this[this.length]=i,this.length++;this[i]=e+"",this._importants[i]=t},removeProperty:function(i){if(!(i in this))return"";var e=Array.prototype.indexOf.call(this,i);if(e<0)return"";var t=this[i];return this[i]="",Array.prototype.splice.call(this,e,1),t},getPropertyCSSValue:function(){},getPropertyPriority:function(i){return this._importants[i]||""},getPropertyShorthand:function(){},isPropertyImplicit:function(){},get cssText(){for(var i=[],e=0,t=this.length;e<t;++e){var r=this[e],n=this.getPropertyValue(r),s=this.getPropertyPriority(r);s&&(s=" !"+s),i[e]=r+": "+n+s+";"}return i.join(" ")},set cssText(i){var e,t;for(e=this.length;e--;)t=this[e],this[t]="";Array.prototype.splice.call(this,0,this.length),this._importants={};var r=G.parse("#bogus{"+i+"}").cssRules[0].style,n=r.length;for(e=0;e<n;++e)t=r[e],this.setProperty(r[e],r.getPropertyValue(t),r.getPropertyPriority(t))}};St.CSSStyleDeclaration=G.CSSStyleDeclaration;G.parse=le().parse});var ct=h(ut=>{var Ce={CSSStyleSheet:ee().CSSStyleSheet,CSSRule:d().CSSRule,CSSStyleRule:Q().CSSStyleRule,CSSGroupingRule:U().CSSGroupingRule,CSSConditionRule:N().CSSConditionRule,CSSMediaRule:Se().CSSMediaRule,CSSSupportsRule:ue().CSSSupportsRule,CSSStyleDeclaration:V().CSSStyleDeclaration,CSSKeyframeRule:ce().CSSKeyframeRule,CSSKeyframesRule:he().CSSKeyframesRule};Ce.clone=function i(e){var t=new Ce.CSSStyleSheet,r=e.cssRules;if(!r)return t;for(var n=0,s=r.length;n<s;n++){var l=r[n],o=t.cssRules[n]=new l.constructor,S=l.style;if(S){for(var u=o.style=new Ce.CSSStyleDeclaration,a=0,x=S.length;a<x;a++){var D=u[a]=S[a];u[D]=S[D],u._importants[D]=S.getPropertyPriority(D)}u.length=S.length}l.hasOwnProperty("keyText")&&(o.keyText=l.keyText),l.hasOwnProperty("selectorText")&&(o.selectorText=l.selectorText),l.hasOwnProperty("mediaText")&&(o.mediaText=l.mediaText),l.hasOwnProperty("conditionText")&&(o.conditionText=l.conditionText),l.hasOwnProperty("cssRules")&&(o.cssRules=i(l).cssRules)}return t};ut.clone=Ce.clone});var ht=h(p=>{"use strict";p.CSSStyleDeclaration=V().CSSStyleDeclaration;p.CSSRule=d().CSSRule;p.CSSGroupingRule=U().CSSGroupingRule;p.CSSConditionRule=N().CSSConditionRule;p.CSSStyleRule=Q().CSSStyleRule;p.MediaList=ae().MediaList;p.CSSMediaRule=Se().CSSMediaRule;p.CSSSupportsRule=ue().CSSSupportsRule;p.CSSImportRule=ke().CSSImportRule;p.CSSFontFaceRule=Te().CSSFontFaceRule;p.CSSHostRule=Me().CSSHostRule;p.StyleSheet=_e().StyleSheet;p.CSSStyleSheet=ee().CSSStyleSheet;p.CSSKeyframesRule=he().CSSKeyframesRule;p.CSSKeyframeRule=ce().CSSKeyframeRule;p.MatcherList=Oe().MatcherList;p.CSSDocumentRule=$e().CSSDocumentRule;p.CSSValue=Ee().CSSValue;p.CSSValueExpression=Ie().CSSValueExpression;p.parse=le().parse;p.clone=ct().clone});var xe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},z,we=class{constructor(){z.set(this,{Array:e=>Array.isArray(e),"string[]":e=>Array.isArray(e)&&e.every(t=>typeof t=="string")})}for(e){return Array.isArray(e)||(console.warn(`[JSTC.for] @briklab/lib/jstc: Invalid first argument!
|
|
13
13
|
Hint: The first argument must be a array.
|
|
14
|
-
Using [givenValue] as fallback`),
|
|
14
|
+
Using [givenValue] as fallback`),e=[e]),{check:t=>{if(Array.isArray(t)||(console.warn(`[JSTC.for().check] @briklab/lib/jstc: Invalid first argument!
|
|
15
15
|
Hint: The first argument must be a valid array!
|
|
16
|
-
Using [givenValue] as fallback`),
|
|
16
|
+
Using [givenValue] as fallback`),t=[t]),e.length<t.length)return!1;for(let r=0;r<t.length;r++){let n=e[r],s=t[r],l=Array.isArray(s)?s:[s],o=!1;for(let S of l){let u=typeof S=="string"?S.split("|"):[S];for(let a of u)if(typeof a=="function"){if(n instanceof a){o=!0;break}}else if(typeof a=="string"&&xe(this,z,"f")[a]){if(xe(this,z,"f")[a](n)){o=!0;break}}else if(typeof n===a){o=!0;break}if(o)break}if(!o)return!1}return!0}}}addCustomHandler(e,t){typeof e=="string"&&typeof t=="function"||(console.warn(`[JSTC.addCustomHandler] @briklab/lib/jstc: Invalid Arguments!
|
|
17
17
|
Hint: The first argument must be a string, and the second argument must be a function
|
|
18
|
-
Using String(argument1) and ()=>false as fallbacks`),
|
|
18
|
+
Using String(argument1) and ()=>false as fallbacks`),e=String(e),t=()=>!1),xe(this,z,"f")[e]=t}};z=new WeakMap;var kt=new we,O=kt;var De=_t(ht(),1);var m=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},C,qe,Re,ye,ft,Pe,Le,pt={red:"#ff0000",blue:"#0000ff",green:"#00ff00",yellow:"#ffff00",orange:"#ffa500",black:"#000000",white:"#ffffff",gray:"#808080"},j=class i{constructor(e){if(C.add(this),this.r=0,this.g=0,this.b=0,this.a=1,typeof e=="string")m(this,C,"m",ft).call(this,e);else if("r"in e&&"g"in e&&"b"in e)this.r=m(this,C,"m",Re).call(this,e.r),this.g=m(this,C,"m",Re).call(this,e.g),this.b=m(this,C,"m",Re).call(this,e.b),this.a=e.a??1;else if("h"in e&&"s"in e&&"l"in e){let{r:t,g:r,b:n}=m(this,C,"m",Pe).call(this,e.h,e.s,e.l);this.r=t,this.g=r,this.b=n,this.a=e.a??1}else console.warn(`[Color.constructor] Invalid first argument!
|
|
19
19
|
Hint: The first argument must be a valid color array
|
|
20
|
-
Using black as fallback.`)}hex(){return`#${m(this,C,"m",ye).call(this,this.r)}${m(this,C,"m",ye).call(this,this.g)}${m(this,C,"m",ye).call(this,this.b)}`}rgb(){return`rgb(${this.r}, ${this.g}, ${this.b})`}rgba(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}hsl(){let{h:e,s:t,l:r}=m(this,C,"m",
|
|
20
|
+
Using black as fallback.`)}hex(){return`#${m(this,C,"m",ye).call(this,this.r)}${m(this,C,"m",ye).call(this,this.g)}${m(this,C,"m",ye).call(this,this.b)}`}rgb(){return`rgb(${this.r}, ${this.g}, ${this.b})`}rgba(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`}hsl(){let{h:e,s:t,l:r}=m(this,C,"m",Le).call(this,this.r,this.g,this.b);return`hsl(${e}, ${t}%, ${r}%)`}hsla(){let{h:e,s:t,l:r}=m(this,C,"m",Le).call(this,this.r,this.g,this.b);return`hsla(${e}, ${t}%, ${r}%, ${this.a})`}css(){return this.a===1?this.hex():this.rgba()}ansiTruecolor(){return`\x1B[38;2;${this.r};${this.g};${this.b}m`}ansiTruecolorBg(){return`\x1B[48;2;${this.r};${this.g};${this.b}m`}ansi256(){return`\x1B[38;5;${m(this,C,"m",qe).call(this,this.r,this.g,this.b)}m`}ansi256Bg(){return`\x1B[48;5;${m(this,C,"m",qe).call(this,this.r,this.g,this.b)}m`}wrapAnsi(e,t={}){let r=!!t.use256,n=t.background?r?this.ansi256Bg():this.ansiTruecolorBg():r?this.ansi256():this.ansiTruecolor();return`${`${t.bold?i.BOLD:""}${t.underline?i.UNDERLINE:""}`}${n}${e}${i.RESET}`}};C=new WeakSet,qe=function(e,t,r){if(e===t&&t===r)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;let n=S=>Math.round(S/255*5),s=n(e),l=n(t),o=n(r);return 16+36*s+6*l+o},Re=function(e){return Math.max(0,Math.min(255,e))},ye=function(e){return e.toString(16).padStart(2,"0")},ft=function(e){if(e=e.trim().toLowerCase(),pt[e]&&(e=pt[e]),e.startsWith("#")){let t=e.slice(1);t.length===3?(this.r=parseInt(t[0]+t[0],16),this.g=parseInt(t[1]+t[1],16),this.b=parseInt(t[2]+t[2],16)):t.length===6?(this.r=parseInt(t.slice(0,2),16),this.g=parseInt(t.slice(2,4),16),this.b=parseInt(t.slice(4,6),16)):console.warn(`[Color class] @briklab/lib/color: Invalid hex!
|
|
21
21
|
Hint: You must pass a valid hex color string!
|
|
22
|
-
Using black as fallback.`)}else if(e.startsWith("rgb")){let t=e.match(/[\d.]+/g)?.map(Number);t&&t.length>=3&&([this.r,this.g,this.b]=t,this.a=t[3]??1)}else if(e.startsWith("hsl")){let t=e.match(/[\d.]+/g)?.map(Number);if(t&&t.length>=3){let{r,g:
|
|
22
|
+
Using black as fallback.`)}else if(e.startsWith("rgb")){let t=e.match(/[\d.]+/g)?.map(Number);t&&t.length>=3&&([this.r,this.g,this.b]=t,this.a=t[3]??1)}else if(e.startsWith("hsl")){let t=e.match(/[\d.]+/g)?.map(Number);if(t&&t.length>=3){let{r,g:n,b:s}=m(this,C,"m",Pe).call(this,t[0],t[1],t[2]);this.r=r,this.g=n,this.b=s,this.a=t[3]??1}}else console.warn(`[Color class] @briklab/lib/color: Unknown color string "${e}"!
|
|
23
23
|
Hint: The argument must be a valid color string!
|
|
24
|
-
Using black as fallback.`)},
|
|
24
|
+
Using black as fallback.`)},Pe=function(e,t,r){t/=100,r/=100;let n=o=>(o+e/30)%12,s=t*Math.min(r,1-r),l=o=>r-s*Math.max(-1,Math.min(n(o)-3,Math.min(9-n(o),1)));return{r:Math.round(l(0)*255),g:Math.round(l(8)*255),b:Math.round(l(4)*255)}},Le=function(e,t,r){e/=255,t/=255,r/=255;let n=Math.max(e,t,r),s=Math.min(e,t,r),l=0,o=0,S=(n+s)/2;if(n!==s){let u=n-s;switch(o=S>.5?u/(2-n-s):u/(n+s),n){case e:l=(t-r)/u+(t<r?6:0);break;case t:l=(r-e)/u+2;break;case r:l=(e-t)/u+4;break}l*=60}return{h:Math.round(l),s:Math.round(o*100),l:Math.round(S*100)}};j.RESET="\x1B[0m";j.BOLD="\x1B[1m";j.UNDERLINE="\x1B[4m";var te=j;var de=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},v=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},me,ge,Ct,yt,A,F,be=class{constructor(e){me.add(this),ge.set(this,void 0),A.set(this,void 0),O.for([e]).check(["object|undefined"])||(console.warn(`[InlineStyle class] @briklab/lib/stylesheet: Invalid first argument!
|
|
25
25
|
Hint: The first argument must be a valid style object or not be given!
|
|
26
|
-
Using {"imeMode":givenValue} as fallback`),e={imeMode:`${e}`}),de(this,A,e,"f"),de(this,ge,new
|
|
26
|
+
Using {"imeMode":givenValue} as fallback`),e={imeMode:`${e}`}),de(this,A,e,"f"),de(this,ge,new De.CSSStyleDeclaration,"f")}generate(){let e=v(this,ge,"f"),t=v(this,A,"f"),r=Object.keys(t),n=Object.values(t);for(let s=0;s<r.length;s++){let l=r[s],o=n[s];if(o==null){console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Skipping property "${l}" with ${String(o)} value. Hint: avoid null/undefined style values.`);continue}typeof o!="string"&&(console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Non-string style value for "${l}" (type=${typeof o}). Coercing to string.`),o=String(o)),e.setProperty(l,o)}return e.cssText}get text(){return this.generate()}get ansi(){let e=v(this,A,"f")||{},t=[];(e["font-weight"]==="bold"||e.fontWeight==="bold")&&t.push(te.BOLD),(e["text-decoration"]||e.textDecoration||"").includes("underline")&&t.push(te.UNDERLINE);let r=e.color||e.color;if(r)try{let s=new te(String(r));t.push(s.ansiTruecolor())}catch{console.warn(`[InlineStyle.ansi] @briklab/lib/stylesheet: Invalid color value "${String(r)}" \u2014 ignoring. Hint: use a valid hex, rgb(), hsl() or named color.`)}let n=e["background-color"]||e.backgroundColor;if(n)try{let s=new te(String(n));t.push(s.ansiTruecolorBg())}catch{console.warn(`[InlineStyle.ansi] @briklab/lib/stylesheet: Invalid background-color value "${String(n)}" \u2014 ignoring. Hint: use a valid hex, rgb(), hsl() or named color.`)}return t.join("")}addStyleWithObject(e){return O.for([e]).check(["object"])?(de(this,A,{...v(this,A,"f"),...e},"f"),this.generate(),this):(console.warn(`[InlineStyle.addStyleWithObject] @briklab/lib/stylesheet: Invalid first argument!
|
|
27
27
|
Hint: expected a plain object with CSS properties. Received: ${String(e)}
|
|
28
28
|
Returned with no operations.`),this)}addStyleWithInlineCSS(e){if(!O.for([e]).check(["string"]))return console.warn(`[InlineStyle.addStyleWithInlineCSS] @briklab/lib/stylesheet: Invalid first argument!
|
|
29
29
|
Hint: The first argument must be a valid inline css string!
|
|
30
|
-
Returned with no operations.`),this;let t=new
|
|
30
|
+
Returned with no operations.`),this;let t=new De.CSSStyleDeclaration;t.cssText=v(this,me,"m",yt).call(this,e);let r={};for(let n=0;n<t.length;n++){let s=t[n],l=t.getPropertyValue(s);r[s]=l}return this.addStyleWithObject(r),this}removeStyle(e){if(!O.for([e]).check(["string[]|string"]))return console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Invalid first argument!
|
|
31
31
|
Hint: expected a string or array of strings. Returned with no operations. Received: ${String(e)}`),this;typeof e=="string"&&(e=[e]);for(let t=0;t<e.length;t++){let r=e[t];if(typeof r!="string"){console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Ignoring non-string style name at index ${t}: ${String(r)}`);continue}delete v(this,A,"f")[r]}return this}applyTo(e){return O.for([e]).check(["object"])?!e||typeof e.style!="object"?(console.warn("[InlineStyle.applyTo] @briklab/lib/stylesheet: Given object does not look like an HTMLElement (missing .style). No operation was performed."),this):(e.style.cssText=this.generate(),this):(console.warn(`[InlineStyle.applyTo] @briklab/lib/stylesheet: Invalid first argument!
|
|
32
|
-
Hint: expected an HTMLElement. No operation was performed.`),this)}};ge=new WeakMap,A=new WeakMap,me=new WeakSet,
|
|
32
|
+
Hint: expected an HTMLElement. No operation was performed.`),this)}};ge=new WeakMap,A=new WeakMap,me=new WeakSet,Ct=function(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)},yt=function(e){let t=String(e).split(";"),r="";for(let n=0;n<t.length;n++){let s=t[n].trim();if(!s)continue;let l=s.split(":");if(l.length<2){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping malformed rule: "${s}". Hint: expected "property: value" pairs separated by ";"`);continue}let o=l[0].trim(),S=l.slice(1).join(":").trim();if(!o||!S){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping empty property or value in rule: "${s}".`);continue}r+=`${v(this,me,"m",Ct).call(this,o)}:${S};`}return r};var er=be,Rt=class{constructor(){F.set(this,void 0),de(this,F,{},"f")}set(e,t){return O.for([e,t]).check(["string","object"])?t instanceof be?(v(this,F,"f")[e]=t,this):(console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Provided style is not an InlineStyle instance!
|
|
33
33
|
Hint: create the style with new InlineStyle({...}). Received: ${String(t)}. Returned with no operations.`),this):(console.warn(`[StyleSheet.set] @briklab/lib/stylesheet: Invalid arguments!
|
|
34
34
|
Hint: call .set("ruleName", new InlineStyle({...})). Received name=${String(e)}, style=${String(t)}. Returned with no operations.`),this)}get(e){if(!O.for([e]).check(["string"])){console.warn(`[StyleSheet.get] @briklab/lib/stylesheet: Invalid argument!
|
|
35
35
|
Hint: name must be a string. Received: ${String(e)}. Returned undefined.`);return}return v(this,F,"f")[e]}remove(e){return O.for([e]).check(["string"])?(delete v(this,F,"f")[e],this):(console.warn(`[StyleSheet.remove] @briklab/lib/stylesheet: Invalid argument!
|
|
36
36
|
Hint: name must be a string. Received: ${String(e)}. No-op.`),this)}generate(){let e="";for(let t in v(this,F,"f")){let r=v(this,F,"f")[t];r&&(e+=`${t} { ${r.text} }
|
|
37
|
-
`)}return e.trim()}toString(){return this.generate()}};F=new WeakMap;export{
|
|
37
|
+
`)}return e.trim()}toString(){return this.generate()}};F=new WeakMap;export{Rt as StyleSheet,er as default};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|