@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/cli-john/index.d.ts
CHANGED
|
@@ -142,10 +142,10 @@ declare class UtilitiesClass {
|
|
|
142
142
|
addTag(name: string, config?: Partial<(typeof this.tags)["error"]>): this;
|
|
143
143
|
/** Set style for a tag */
|
|
144
144
|
setTagStyle(tagName: string, style: InlineStyle): this;
|
|
145
|
-
log(tagName: string,
|
|
146
|
-
error(msg:
|
|
147
|
-
warning(msg:
|
|
148
|
-
info(msg:
|
|
145
|
+
log(tagName: string, ...messages: any[]): void;
|
|
146
|
+
error(...msg: any[]): this;
|
|
147
|
+
warning(...msg: any[]): this;
|
|
148
|
+
info(...msg: any[]): this;
|
|
149
149
|
}
|
|
150
150
|
export declare const Utilities: UtilitiesClass;
|
|
151
151
|
export {};
|
package/dist/cli-john/index.js
CHANGED
|
@@ -1,58 +1,52 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Lt=Object.create;var rt=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Ht=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Pt(e))!Ft.call(i,n)&&n!==t&&rt(i,n,{get:()=>e[n],enumerable:!(r=qt(e,n))||r.enumerable});return i};var Ut=(i,e,t)=>(t=i!=null?Lt(At(i)):{},Ht(e||!i||!i.__esModule?rt(t,"default",{value:i,enumerable:!0}):t,i));var Le=h(st=>{var it={};it.StyleSheet=function(){this.parentStyleSheet=null};st.StyleSheet=it.StyleSheet});var m=h(nt=>{var d={};d.CSSRule=function(){this.parentRule=null,this.parentStyleSheet=null};d.CSSRule.UNKNOWN_RULE=0;d.CSSRule.STYLE_RULE=1;d.CSSRule.CHARSET_RULE=2;d.CSSRule.IMPORT_RULE=3;d.CSSRule.MEDIA_RULE=4;d.CSSRule.FONT_FACE_RULE=5;d.CSSRule.PAGE_RULE=6;d.CSSRule.KEYFRAMES_RULE=7;d.CSSRule.KEYFRAME_RULE=8;d.CSSRule.MARGIN_RULE=9;d.CSSRule.NAMESPACE_RULE=10;d.CSSRule.COUNTER_STYLE_RULE=11;d.CSSRule.SUPPORTS_RULE=12;d.CSSRule.DOCUMENT_RULE=13;d.CSSRule.FONT_FEATURE_VALUES_RULE=14;d.CSSRule.VIEWPORT_RULE=15;d.CSSRule.REGION_STYLE_RULE=16;d.CSSRule.prototype={constructor:d.CSSRule};nt.CSSRule=d.CSSRule});var ne=h(ot=>{var b={CSSStyleDeclaration:j().CSSStyleDeclaration,CSSRule:m().CSSRule};b.CSSStyleRule=function(){b.CSSRule.call(this),this.selectorText="",this.style=new b.CSSStyleDeclaration,this.style.parentRule=this};b.CSSStyleRule.prototype=new b.CSSRule;b.CSSStyleRule.prototype.constructor=b.CSSStyleRule;b.CSSStyleRule.prototype.type=1;Object.defineProperty(b.CSSStyleRule.prototype,"cssText",{get:function(){var i;return this.selectorText?i=this.selectorText+" {"+this.style.cssText+"}":i="",i},set:function(i){var e=b.CSSStyleRule.parse(i);this.style=e.style,this.selectorText=e.selectorText}});b.CSSStyleRule.parse=function(i){for(var e=0,t="selector",r,n=e,s="",o={selector:!0,value:!0},l=new b.CSSStyleRule,u,S="",a;a=i.charAt(e);e++)switch(a){case" ":case" ":case"\r":case`
|
|
2
2
|
`:case"\f":if(o[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+=
|
|
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(n=i.indexOf(")",e+1),n===-1)throw e+': ")" not found';e+=4;var o=i.slice(e,n);o[0]===o[o.length-1]&&(o[0]==='"'||o[0]==="'")&&(o=o.slice(1,-1)),this.href=o,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}}});
|
|
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"&&(l.selectorText=s.trim(),s="",t="name");break;case":":t==="name"?(u=s.trim(),s="",t="value"):s+=a;break;case"!":t==="value"&&i.indexOf("!important",e)===e?(S="important",e+=9):s+=a;break;case";":t==="value"?(l.style.setProperty(u,s.trim(),S),S="",s="",t="name"):s+=a;break;case"}":if(t==="value")l.style.setProperty(u,s.trim(),S),S="",s="";else{if(t==="name")break;s+=a}t="selector";break;default:s+=a;break}return l};ot.CSSStyleRule=b.CSSStyleRule});var oe=h(lt=>{var w={StyleSheet:Le().StyleSheet,CSSStyleRule:ne().CSSStyleRule};w.CSSStyleSheet=function(){w.StyleSheet.call(this),this.cssRules=[]};w.CSSStyleSheet.prototype=new w.StyleSheet;w.CSSStyleSheet.prototype.constructor=w.CSSStyleSheet;w.CSSStyleSheet.prototype.insertRule=function(i,e){if(e<0||e>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var t=w.parse(i).cssRules[0];return t.parentStyleSheet=this,this.cssRules.splice(e,0,t),e};w.CSSStyleSheet.prototype.deleteRule=function(i){if(i<0||i>=this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");this.cssRules.splice(i,1)};w.CSSStyleSheet.prototype.toString=function(){for(var i="",e=this.cssRules,t=0;t<e.length;t++)i+=e[t].cssText+`
|
|
4
|
+
`;return i};lt.CSSStyleSheet=w.CSSStyleSheet;w.parse=he().parse});var pe=h(at=>{var fe={};fe.MediaList=function(){this.length=0};fe.MediaList.prototype={constructor:fe.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)}};at.MediaList=fe.MediaList});var qe=h(ut=>{var T={CSSRule:m().CSSRule,CSSStyleSheet:oe().CSSStyleSheet,MediaList:pe().MediaList};T.CSSImportRule=function(){T.CSSRule.call(this),this.href="",this.media=new T.MediaList,this.styleSheet=new T.CSSStyleSheet};T.CSSImportRule.prototype=new T.CSSRule;T.CSSImportRule.prototype.constructor=T.CSSImportRule;T.CSSImportRule.prototype.type=3;Object.defineProperty(T.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 o=i.slice(e,n);o[0]===o[o.length-1]&&(o[0]==='"'||o[0]==="'")&&(o=o.slice(1,-1)),this.href=o,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}}});ut.CSSImportRule=T.CSSImportRule});var V=h(St=>{var I={CSSRule:m().CSSRule};I.CSSGroupingRule=function(){I.CSSRule.call(this),this.cssRules=[]};I.CSSGroupingRule.prototype=new I.CSSRule;I.CSSGroupingRule.prototype.constructor=I.CSSGroupingRule;I.CSSGroupingRule.prototype.insertRule=function(e,t){if(t<0||t>this.cssRules.length)throw new RangeError("INDEX_SIZE_ERR");var r=I.parse(e).cssRules[0];return r.parentRule=this,this.cssRules.splice(t,0,r),t};I.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};St.CSSGroupingRule=I.CSSGroupingRule});var W=h(ct=>{var L={CSSRule:m().CSSRule,CSSGroupingRule:V().CSSGroupingRule};L.CSSConditionRule=function(){L.CSSGroupingRule.call(this),this.cssRules=[]};L.CSSConditionRule.prototype=new L.CSSGroupingRule;L.CSSConditionRule.prototype.constructor=L.CSSConditionRule;L.CSSConditionRule.prototype.conditionText="";L.CSSConditionRule.prototype.cssText="";ct.CSSConditionRule=L.CSSConditionRule});var de=h(ht=>{var E={CSSRule:m().CSSRule,CSSGroupingRule:V().CSSGroupingRule,CSSConditionRule:W().CSSConditionRule,MediaList:pe().MediaList};E.CSSMediaRule=function(){E.CSSConditionRule.call(this),this.media=new E.MediaList};E.CSSMediaRule.prototype=new E.CSSConditionRule;E.CSSMediaRule.prototype.constructor=E.CSSMediaRule;E.CSSMediaRule.prototype.type=4;Object.defineProperties(E.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}});ht.CSSMediaRule=E.CSSMediaRule});var Ce=h(ft=>{var q={CSSRule:m().CSSRule,CSSGroupingRule:V().CSSGroupingRule,CSSConditionRule:W().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("")+"}"}});ft.CSSSupportsRule=q.CSSSupportsRule});var Pe=h(pt=>{var M={CSSStyleDeclaration:j().CSSStyleDeclaration,CSSRule:m().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+"}"}});pt.CSSFontFaceRule=M.CSSFontFaceRule});var Ae=h(dt=>{var P={CSSRule:m().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("")+"}"}});dt.CSSHostRule=P.CSSHostRule});var ge=h(Ct=>{var $={CSSRule:m().CSSRule,CSSStyleDeclaration:j().CSSStyleDeclaration};$.CSSKeyframeRule=function(){$.CSSRule.call(this),this.keyText="",this.style=new $.CSSStyleDeclaration,this.style.parentRule=this};$.CSSKeyframeRule.prototype=new $.CSSRule;$.CSSKeyframeRule.prototype.constructor=$.CSSKeyframeRule;$.CSSKeyframeRule.prototype.type=8;Object.defineProperty($.CSSKeyframeRule.prototype,"cssText",{get:function(){return this.keyText+" {"+this.style.cssText+"} "}});Ct.CSSKeyframeRule=$.CSSKeyframeRule});var ye=h(gt=>{var A={CSSRule:m().CSSRule};A.CSSKeyframesRule=function(){A.CSSRule.call(this),this.name="",this.cssRules=[]};A.CSSKeyframesRule.prototype=new A.CSSRule;A.CSSKeyframesRule.prototype.constructor=A.CSSKeyframesRule;A.CSSKeyframesRule.prototype.type=7;Object.defineProperty(A.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
|
-
}`}});gt.CSSKeyframesRule=A.CSSKeyframesRule});var
|
|
9
|
-
`:t==="*"&&(o="*/"),s=i.indexOf(o,n+1+1),s!==-1)return s=s+o.length-1,r=i.substring(e,s+1),{idx:s,text:r};var
|
|
10
|
-
`,e+1);return
|
|
11
|
-
`),Qe
|
|
12
|
-
`:case"\f":
|
|
8
|
+
}`}});gt.CSSKeyframesRule=A.CSSKeyframesRule});var Fe=h(yt=>{var Re={};Re.CSSValue=function(){};Re.CSSValue.prototype={constructor:Re.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}};yt.CSSValue=Re.CSSValue});var He=h(Rt=>{var k={CSSValue:Fe().CSSValue};k.CSSValueExpression=function(e,t){this._token=e,this._idx=t};k.CSSValueExpression.prototype=new k.CSSValue;k.CSSValueExpression.prototype.constructor=k.CSSValueExpression;k.CSSValueExpression.prototype.parse=function(){for(var i=this._token,e=this._idx,t="",r="",n="",s,o=[];;++e){if(t=i.charAt(e),t===""){n="css expression error: unfinished expression!";break}switch(t){case"(":o.push(t),r+=t;break;case")":o.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||o.length===0)break}var l;return n?l={error:n}:l={idx:e,expression:r},l};k.CSSValueExpression.prototype._parseJSComment=function(i,e){var t=i.charAt(e+1),r;if(t==="/"||t==="*"){var n=e,s,o;if(t==="/"?o=`
|
|
9
|
+
`:t==="*"&&(o="*/"),s=i.indexOf(o,n+1+1),s!==-1)return s=s+o.length-1,r=i.substring(e,s+1),{idx:s,text:r};var l="css expression error: unfinished comment in expression!";return{error:l}}else return!1};k.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})};k.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(o){return o.test(t)});if(n){var s="/";return this._parseJSString(i,e,s)}else return!1};k.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 o=i.substring(e+1,n),l=o.match(/\\+$/);if(!l||l[0]%2===0)break;r=n}var u=i.indexOf(`
|
|
10
|
+
`,e+1);return u<n&&(n=s),n};Rt.CSSValueExpression=k.CSSValueExpression});var Ue=h(mt=>{var me={};me.MatcherList=function(){this.length=0};me.MatcherList.prototype={constructor:me.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)}};mt.MatcherList=me.MatcherList});var De=h(bt=>{var O={CSSRule:m().CSSRule,MatcherList:Ue().MatcherList};O.CSSDocumentRule=function(){O.CSSRule.call(this),this.matcher=new O.MatcherList,this.cssRules=[]};O.CSSDocumentRule.prototype=new O.CSSRule;O.CSSDocumentRule.prototype.constructor=O.CSSDocumentRule;O.CSSDocumentRule.prototype.type=10;Object.defineProperty(O.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("")+"}"}});bt.CSSDocumentRule=O.CSSDocumentRule});var he=h(vt=>{var c={};c.parse=function(e){for(var t=0,r="before-selector",n,s="",o=0,l={selector:!0,value:!0,"value-parenthesis":!0,atRule:!0,"importRule-begin":!0,importRule:!0,atBlock:!0,conditionBlock:!0,"documentRule-begin":!0},u=new c.CSSStyleSheet,S=u,a,_=[],F=!1,Xe,Me,z="",y,Q,ee,te,re,D,K,ae,ze=/@(-(?:\w+-)+)?keyframes/g,ie=function(Ot){var Qe=e.substring(0,t).split(`
|
|
11
|
+
`),et=Qe.length,tt=Qe.pop().length+1,ce=new Error(Ot+" (line "+et+", char "+tt+")");throw ce.line=et,ce.char=tt,ce.styleSheet=u,ce},R;R=e.charAt(t);t++)switch(R){case" ":case" ":case"\r":case`
|
|
12
|
+
`:case"\f":l[r]&&(s+=R);break;case'"':n=t+1;do n=e.indexOf('"',n)+1,n||ie('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||ie("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?ie("Missing */"):t=n+1):s+=R,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",Q=new c.CSSMediaRule,Q.__starts=t,t+=5,s="";break}else if(e.indexOf("@supports",t)===t){r="conditionBlock",ee=new c.CSSSupportsRule,ee.__starts=t,t+=8,s="";break}else if(e.indexOf("@host",t)===t){r="hostRule-begin",t+=4,ae=new c.CSSHostRule,ae.__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,re=new c.CSSFontFaceRule,re.__starts=t,s="";break}else{ze.lastIndex=t;var ue=ze.exec(e);if(ue&&ue.index===t){r="keyframesRule-begin",D=new c.CSSKeyframesRule,D.__starts=t,D._vendorPrefix=ue[1],t+=ue[0].length-1,s="";break}else r==="selector"&&(r="atRule")}s+=R;break;case"{":r==="selector"||r==="atRule"?(y.selectorText=s.trim(),y.style.__starts=t,s="",r="before-name"):r==="atBlock"?(Q.media.mediaText=s.trim(),a&&_.push(a),S=a=Q,Q.parentStyleSheet=u,s="",r="before-selector"):r==="conditionBlock"?(ee.conditionText=s.trim(),a&&_.push(a),S=a=ee,ee.parentStyleSheet=u,s="",r="before-selector"):r==="hostRule-begin"?(a&&_.push(a),S=a=ae,ae.parentStyleSheet=u,s="",r="before-selector"):r==="fontFaceRule-begin"?(a&&(re.parentRule=a),re.parentStyleSheet=u,y=re,s="",r="before-name"):r==="keyframesRule-begin"?(D.name=s.trim(),a&&(_.push(a),D.parentRule=a),D.parentStyleSheet=u,S=a=D,s="",r="keyframeRule-begin"):r==="keyframeRule-begin"?(y=new c.CSSKeyframeRule,y.keyText=s.trim(),y.__starts=t,s="",r="before-name"):r==="documentRule-begin"&&(K.matcher.matcherText=s.trim(),a&&(_.push(a),K.parentRule=a),S=a=K,K.parentStyleSheet=u,s="",r="before-selector");break;case":":r==="name"?(Me=s.trim(),s="",r="before-value"):s+=R;break;case"(":if(r==="value")if(s.trim()==="expression"){var Se=new c.CSSValueExpression(e,t).parse();Se.error?ie(Se.error):(s+=Se.expression,t=Se.idx)}else r="value-parenthesis",o=1,s+=R;else r==="value-parenthesis"&&o++,s+=R;break;case")":r==="value-parenthesis"&&(o--,o===0&&(r="value")),s+=R;break;case"!":r==="value"&&e.indexOf("!important",t)===t?(z="important",t+=9):s+=R;break;case";":switch(r){case"value":y.style.setProperty(Me,s.trim(),z),z="",s="",r="before-name";break;case"atRule":s="",r="before-selector";break;case"importRule":te=new c.CSSImportRule,te.parentStyleSheet=te.styleSheet.parentStyleSheet=u,te.cssText=s+R,u.cssRules.push(te),s="",r="before-selector";break;default:s+=R;break}break;case"}":switch(r){case"value":y.style.setProperty(Me,s.trim(),z),z="";case"before-name":case"name":y.__ends=t+1,a&&(y.parentRule=a),y.parentStyleSheet=u,S.cssRules.push(y),s="",S.constructor===c.CSSKeyframesRule?r="keyframeRule-begin":r="before-selector";break;case"keyframeRule-begin":case"before-selector":case"selector":for(a||ie("Unexpected }"),F=_.length>0;_.length>0;){if(a=_.pop(),a.constructor.name==="CSSMediaRule"||a.constructor.name==="CSSSupportsRule"){Xe=S,S=a,S.cssRules.push(Xe);break}_.length===0&&(F=!1)}F||(S.__ends=t+1,u.cssRules.push(S),S=u,a=null),s="",r="before-selector";break}break;default:switch(r){case"before-selector":r="selector",y=new c.CSSStyleRule,y.__starts=t;break;case"before-name":r="name";break;case"before-value":r="value";break;case"importRule-begin":r="importRule";break}s+=R;break}return u};vt.parse=c.parse;c.CSSStyleSheet=oe().CSSStyleSheet;c.CSSStyleRule=ne().CSSStyleRule;c.CSSImportRule=qe().CSSImportRule;c.CSSGroupingRule=V().CSSGroupingRule;c.CSSMediaRule=de().CSSMediaRule;c.CSSConditionRule=W().CSSConditionRule;c.CSSSupportsRule=Ce().CSSSupportsRule;c.CSSFontFaceRule=Pe().CSSFontFaceRule;c.CSSHostRule=Ae().CSSHostRule;c.CSSStyleDeclaration=j().CSSStyleDeclaration;c.CSSKeyframeRule=ge().CSSKeyframeRule;c.CSSKeyframesRule=ye().CSSKeyframesRule;c.CSSValueExpression=He().CSSValueExpression;c.CSSDocumentRule=De().CSSDocumentRule});var j=h(wt=>{var B={};B.CSSStyleDeclaration=function(){this.length=0,this.parentRule=null,this._importants={}};B.CSSStyleDeclaration.prototype={constructor:B.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=B.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))}};wt.CSSStyleDeclaration=B.CSSStyleDeclaration;B.parse=he().parse});var _t=h(xt=>{var be={CSSStyleSheet:oe().CSSStyleSheet,CSSRule:m().CSSRule,CSSStyleRule:ne().CSSStyleRule,CSSGroupingRule:V().CSSGroupingRule,CSSConditionRule:W().CSSConditionRule,CSSMediaRule:de().CSSMediaRule,CSSSupportsRule:Ce().CSSSupportsRule,CSSStyleDeclaration:j().CSSStyleDeclaration,CSSKeyframeRule:ge().CSSKeyframeRule,CSSKeyframesRule:ye().CSSKeyframesRule};be.clone=function i(e){var t=new be.CSSStyleSheet,r=e.cssRules;if(!r)return t;for(var n=0,s=r.length;n<s;n++){var o=r[n],l=t.cssRules[n]=new o.constructor,u=o.style;if(u){for(var S=l.style=new be.CSSStyleDeclaration,a=0,_=u.length;a<_;a++){var F=S[a]=u[a];S[F]=u[F],S._importants[F]=u.getPropertyPriority(F)}S.length=u.length}o.hasOwnProperty("keyText")&&(l.keyText=o.keyText),o.hasOwnProperty("selectorText")&&(l.selectorText=o.selectorText),o.hasOwnProperty("mediaText")&&(l.mediaText=o.mediaText),o.hasOwnProperty("conditionText")&&(l.conditionText=o.conditionText),o.hasOwnProperty("cssRules")&&(l.cssRules=i(o).cssRules)}return t};xt.clone=be.clone});var Tt=h(f=>{"use strict";f.CSSStyleDeclaration=j().CSSStyleDeclaration;f.CSSRule=m().CSSRule;f.CSSGroupingRule=V().CSSGroupingRule;f.CSSConditionRule=W().CSSConditionRule;f.CSSStyleRule=ne().CSSStyleRule;f.MediaList=pe().MediaList;f.CSSMediaRule=de().CSSMediaRule;f.CSSSupportsRule=Ce().CSSSupportsRule;f.CSSImportRule=qe().CSSImportRule;f.CSSFontFaceRule=Pe().CSSFontFaceRule;f.CSSHostRule=Ae().CSSHostRule;f.StyleSheet=Le().StyleSheet;f.CSSStyleSheet=oe().CSSStyleSheet;f.CSSKeyframesRule=ye().CSSKeyframesRule;f.CSSKeyframeRule=ge().CSSKeyframeRule;f.MatcherList=Ue().MatcherList;f.CSSDocumentRule=De().CSSDocumentRule;f.CSSValue=Fe().CSSValue;f.CSSValueExpression=He().CSSValueExpression;f.parse=he().parse;f.clone=_t().clone});var $e=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)},se,Oe=class{constructor(){se.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],o=Array.isArray(s)?s:[s],l=!1;for(let u of o){let S=typeof u=="string"?u.split("|"):[u];for(let a of S)if(typeof a=="function"){if(n instanceof a){l=!0;break}}else if(typeof a=="string"&&$e(this,se,"f")[a]){if($e(this,se,"f")[a](n)){l=!0;break}}else if(typeof n===a){l=!0;break}if(l)break}if(!l)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),$e(this,se,"f")[e]=t}};se=new WeakMap;var Dt=new Oe,C=Dt;var Ge=Ut(Tt(),1);var 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)},g,je,ve,we,It,Ve,Ne,kt={red:"#ff0000",blue:"#0000ff",green:"#00ff00",yellow:"#ffff00",orange:"#ffa500",black:"#000000",white:"#ffffff",gray:"#808080"},J=class i{constructor(e){if(g.add(this),this.r=0,this.g=0,this.b=0,this.a=1,typeof e=="string")v(this,g,"m",It).call(this,e);else if("r"in e&&"g"in e&&"b"in e)this.r=v(this,g,"m",ve).call(this,e.r),this.g=v(this,g,"m",ve).call(this,e.g),this.b=v(this,g,"m",ve).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}=v(this,g,"m",Ve).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`#${v(this,
|
|
20
|
+
Using black as fallback.`)}hex(){return`#${v(this,g,"m",we).call(this,this.r)}${v(this,g,"m",we).call(this,this.g)}${v(this,g,"m",we).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}=v(this,g,"m",Ne).call(this,this.r,this.g,this.b);return`hsl(${e}, ${t}%, ${r}%)`}hsla(){let{h:e,s:t,l:r}=v(this,g,"m",Ne).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;${v(this,g,"m",je).call(this,this.r,this.g,this.b)}m`}ansi256Bg(){return`\x1B[48;5;${v(this,g,"m",je).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}`}};g=new WeakSet,je=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=u=>Math.round(u/255*5),s=n(e),o=n(t),l=n(r);return 16+36*s+6*o+l},ve=function(e){return Math.max(0,Math.min(255,e))},we=function(e){return e.toString(16).padStart(2,"0")},It=function(e){if(e=e.trim().toLowerCase(),kt[e]&&(e=kt[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:n,b:s}=v(this,
|
|
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}=v(this,g,"m",Ve).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.`)},Ve=function(e,t,r){t/=100,r/=100;let n=l=>(l+e/30)%12,s=t*Math.min(r,1-r),o=l=>r-s*Math.max(-1,Math.min(n(l)-3,Math.min(9-n(l),1)));return{r:Math.round(o(0)*255),g:Math.round(o(8)*255),b:Math.round(o(4)*255)}},Ne=function(e,t,r){e/=255,t/=255,r/=255;let n=Math.max(e,t,r),s=Math.min(e,t,r),o=0,l=0,u=(n+s)/2;if(n!==s){let S=n-s;switch(l=u>.5?S/(2-n-s):S/(n+s),n){case e:o=(t-r)/S+(t<r?6:0);break;case t:o=(r-e)/S+2;break;case r:o=(e-t)/S+4;break}o*=60}return{h:Math.round(o),s:Math.round(l*100),l:Math.round(u*100)}};J.RESET="\x1B[0m";J.BOLD="\x1B[1m";J.UNDERLINE="\x1B[4m";var N=J;var xe=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},x=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)},Te,_e,Et,Mt,H,U,ke=class{constructor(e){Te.add(this),_e.set(this,void 0),H.set(this,void 0),C.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}`}),xe(this,
|
|
26
|
+
Using {"imeMode":givenValue} as fallback`),e={imeMode:`${e}`}),xe(this,H,e,"f"),xe(this,_e,new Ge.CSSStyleDeclaration,"f")}generate(){let e=x(this,_e,"f"),t=x(this,H,"f"),r=Object.keys(t),n=Object.values(t);for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(l==null){console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Skipping property "${o}" with ${String(l)} value. Hint: avoid null/undefined style values.`);continue}typeof l!="string"&&(console.warn(`[InlineStyle.generate] @briklab/lib/stylesheet: Non-string style value for "${o}" (type=${typeof l}). Coercing to string.`),l=String(l)),e.setProperty(o,l)}return e.cssText}get text(){return this.generate()}get ansi(){let e=x(this,H,"f")||{},t=[];(e["font-weight"]==="bold"||e.fontWeight==="bold")&&t.push(N.BOLD),(e["text-decoration"]||e.textDecoration||"").includes("underline")&&t.push(N.UNDERLINE);let r=e.color||e.color;if(r)try{let s=new N(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 N(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 C.for([e]).check(["object"])?(xe(this,H,{...x(this,H,"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
|
-
Returned with no operations.`),this)}addStyleWithInlineCSS(e){if(!
|
|
28
|
+
Returned with no operations.`),this)}addStyleWithInlineCSS(e){if(!C.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
|
|
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 x(this,
|
|
32
|
-
Hint: expected an HTMLElement. No operation was performed.`),this)}};_e=new WeakMap,
|
|
30
|
+
Returned with no operations.`),this;let t=new Ge.CSSStyleDeclaration;t.cssText=x(this,Te,"m",Mt).call(this,e);let r={};for(let n=0;n<t.length;n++){let s=t[n],o=t.getPropertyValue(s);r[s]=o}return this.addStyleWithObject(r),this}removeStyle(e){if(!C.for([e]).check(["string[]|string"]))return console.warn(`[InlineStyle.removeStyle] @briklab/lib/stylesheet: Invalid first argument!
|
|
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 x(this,H,"f")[r]}return this}applyTo(e){return C.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)}};_e=new WeakMap,H=new WeakMap,Te=new WeakSet,Et=function(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)},Mt=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 o=s.split(":");if(o.length<2){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping malformed rule: "${s}". Hint: expected "property: value" pairs separated by ";"`);continue}let l=o[0].trim(),u=o.slice(1).join(":").trim();if(!l||!u){console.warn(`[InlineStyle.#convertKeysToValidCSS] @briklab/lib/stylesheet: Skipping empty property or value in rule: "${s}".`);continue}r+=`${x(this,Te,"m",Et).call(this,l)}:${u};`}return r};var Y=ke,Ie=class{constructor(){U.set(this,void 0),xe(this,U,{},"f")}set(e,t){return C.for([e,t]).check(["string","object"])?t instanceof ke?(x(this,U,"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
|
-
Hint: call .set("ruleName", new InlineStyle({...})). Received name=${String(e)}, style=${String(t)}. Returned with no operations.`),this)}get(e){if(!
|
|
35
|
-
Hint: name must be a string. Received: ${String(e)}. Returned undefined.`);return}return x(this,
|
|
36
|
-
Hint: name must be a string. Received: ${String(e)}. No-op.`),this)}generate(){let e="";for(let t in x(this,
|
|
37
|
-
`)}return e.trim()}toString(){return this.generate()}};
|
|
38
|
-
Hint: ${t}`)},
|
|
34
|
+
Hint: call .set("ruleName", new InlineStyle({...})). Received name=${String(e)}, style=${String(t)}. Returned with no operations.`),this)}get(e){if(!C.for([e]).check(["string"])){console.warn(`[StyleSheet.get] @briklab/lib/stylesheet: Invalid argument!
|
|
35
|
+
Hint: name must be a string. Received: ${String(e)}. Returned undefined.`);return}return x(this,U,"f")[e]}remove(e){return C.for([e]).check(["string"])?(delete x(this,U,"f")[e],this):(console.warn(`[StyleSheet.remove] @briklab/lib/stylesheet: Invalid argument!
|
|
36
|
+
Hint: name must be a string. Received: ${String(e)}. No-op.`),this)}generate(){let e="";for(let t in x(this,U,"f")){let r=x(this,U,"f")[t];r&&(e+=`${t} { ${r.text} }
|
|
37
|
+
`)}return e.trim()}toString(){return this.generate()}};U=new WeakMap;var p=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)},Ze=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},G,Z,le,$t,Ee,Ke,We,Be;C.addCustomHandler("NodeJS Process",i=>i&&typeof i=="object"&&typeof i.pid=="number"&&typeof i.cwd=="function"&&typeof i.exit=="function");var X=class i{constructor(e){if(G.add(this),Z.set(this,[]),le.set(this,[]),Ee.set(this,void 0),Ke.set(this,class extends Je{constructor(t){super(t),this.setName="CLI"}}),!C.for([e]).check(["NodeJS Process"]))throw p(this,G,"m",We).call(this,"Invalid First Argument!","You must pass a valid NodeJS process (imported from node:process) while constructing a CLI Class!");Ze(this,Ee,e,"f")}command(e){C.for([e]).check(["string"])||(p(this,G,"m",Be).call(this,"Invalid First Argument!","CLI.option expects a string as the first argument.","Using String(given argument) as fallback."),e=String(e));let t=new i.Command(e),r=p(this,Z,"f").findIndex(n=>n.name===e);return r!==-1?p(this,Z,"f")[r]=t:p(this,Z,"f").push(t),t}on(e,t){if(!C.for([e,t]).check(["string","function"]))throw p(this,G,"m",We).call(this,"Arguments in CLI.on are invalid!","The first argument must be a string, and the second argument must be a function.");e.toLowerCase()==="command"?p(this,le,"f").push(t):p(this,G,"m",Be).call(this,"Invalid event in CLI.on","Please enter a valid event from CLI.ValidEvents (array)")}run(){let{options:e,commandArgs:t,command:r,failed:n}=p(this,G,"m",$t).call(this);if(!n)for(let s=0;s<p(this,le,"f").length;s++)p(this,le,"f")[s]({options:e,commandArgs:t,command:r})}};Z=new WeakMap,le=new WeakMap,Ee=new WeakMap,Ke=new WeakMap,G=new WeakSet,$t=function(){let[,,...e]=p(this,Ee,"f").argv;if(e.length===0)return{options:[],command:"",commandArgs:[],failed:!0};let t=p(this,Z,"f").find(l=>l.name===e[0]);if(!t)return{options:[],command:"",commandArgs:[],failed:!0};let r=[],n=e.slice(1);for(let l=0;l<n.length;l++){let u=n[l];if(u.startsWith("--"))break;r.push(u)}let s=n.slice(r.length),o=[];for(let l=0;l<s.length;l++){let u=s[l];if(!u.startsWith("--"))continue;let S=[];for(let a=l+1;a<s.length&&!s[a].startsWith("--");a++)S.push(s[a]);o.push({option:u,arguments:S})}return{options:o,commandArgs:r,command:t,failed:!1}},We=function(e,t){return new(p(this,Ke,"f"))(`${e}
|
|
38
|
+
Hint: ${t}`)},Be=function(e,t,r){return console.warn(`[Class CLI] ${e}
|
|
39
39
|
Hint: ${t}
|
|
40
|
-
${r}`)};var
|
|
41
|
-
Hint: ${
|
|
42
|
-
${S}`)},i.Command=s})(X||(X={}));(function(i){var e;(function(t){var r;class n{get metadata(){return{name:`${p(this,r,"f")}`}}constructor(o){return r.set(this,void 0),
|
|
40
|
+
${r}`)};var Je=class i extends Error{constructor(e){super(e),this.name="[] @briklab/lib/cli-john",Error.captureStackTrace(this,i)}set setName(e){this.name=`[${e}] @briklab/lib/cli-john`}};(function(i){var e,t,r,n;i.ValidEvents=["command"];class s{constructor(l){return e.add(this),t.set(this,void 0),n.set(this,[]),Ze(this,t,l,"f"),this}get name(){return p(this,t,"f")}get metadata(){return{options:p(this,n,"f").map(u=>u.metadata),name:this.name}}option(l){C.for([l]).check(["string"])||(p(this,e,"m",r).call(this,"First argument is invalid!","The first argument must be a string","Using String(argument) as fallback"),l=String(l));let u=new i.Command.Option(l),S=p(this,n,"f").findIndex(a=>a.name===l);return S!==-1?p(this,n,"f")[S]=u:p(this,n,"f").push(u),u}}t=new WeakMap,n=new WeakMap,e=new WeakSet,r=function(l,u,S){return console.warn(`[Class CLI.Command] ${l}
|
|
41
|
+
Hint: ${u}
|
|
42
|
+
${S}`)},i.Command=s})(X||(X={}));(function(i){var e;(function(t){var r;class n{get metadata(){return{name:`${p(this,r,"f")}`}}constructor(o){return r.set(this,void 0),Ze(this,r,o,"f"),this}get name(){return p(this,r,"f")}}r=new WeakMap,t.Option=n})(e=i.Command||(i.Command={}))})(X||(X={}));C.addCustomHandler("Utilities Tag Config",i=>i&&typeof i=="object"&&typeof i.tag=="string"&&typeof i.showErrorInTag=="boolean"&&typeof i.paddingLeft=="number"&&typeof i.paddingRight=="number"&&(typeof i.styleName=="string"||i.styleName===void 0));var Ye=class{constructor(){this.styleSheet=new Ie,this.tags={},this.addTag("error",{tag:"ERROR",showErrorInTag:!1,paddingLeft:0,paddingRight:0}),this.addTag("warning",{tag:"WARNING",showErrorInTag:!0,paddingLeft:0,paddingRight:0}),this.addTag("info",{tag:"INFO",showErrorInTag:!0,paddingLeft:0,paddingRight:0}),this.setTagStyle("error",new Y({color:"red",fontWeight:"bold"})),this.setTagStyle("warning",new Y({color:"orange",fontWeight:"bold"})),this.setTagStyle("info",new Y({color:"blue"}))}addTag(e,t={}){C.for([e,t]).check(["string","object"])||(console.warn(`[UtilitiesClass.addTag] @briklab/lib/cli-john: Invalid Arguments!
|
|
43
43
|
Hint: The first argument must be a string, and the second argument must be a object.
|
|
44
|
-
Using String(argument1) and {} as fallback.`),e=String(e),t={});let r={tag:e.toUpperCase(),showErrorInTag:!1,paddingLeft:0,paddingRight:0,styleName:"",...t};return
|
|
44
|
+
Using String(argument1) and {} as fallback.`),e=String(e),t={});let r={tag:e.toUpperCase(),showErrorInTag:!1,paddingLeft:0,paddingRight:0,styleName:"",...t};return C.for([r]).check(["Utilities Tag Config"])?(this.tags[e]=r,this):(console.warn(`[UtilitiesClass.addTag] @briklab/lib/cli-john: Invalid tag config passed for "${e}"
|
|
45
45
|
Hint: The config must be in format {tag?: string, showErrorInTag?:boolean, paddingLeft?:number, paddingRight?:number, styleName?:string}`),console.warn(r),this)}setTagStyle(e,t){if((typeof e!="string"||!(t instanceof Y))&&(console.warn(`[UtilitiesClass.setTagStyle] @briklab/lib/cli-john: Invalid arguments!
|
|
46
46
|
Hint: The first argument must be a string and the second argument must be a instance of InlineStyle
|
|
47
47
|
Using String(firstArgument) and new InlineStyle({}) as fallback`),e=String(e),t=new Y({})),!this.tags[e])return console.warn(`[UtilitiesClass.setTagStyle] @briklab/lib/cli-john: Tag "${e}" does not exist!
|
|
48
|
-
Hint: Use a valid tag that you have defined or use "error"|"warn"|"info"`),this;let r=`${e} Tag Color`;return this.styleSheet.set(r,t),this.tags[e].styleName=r,this}log(e
|
|
49
|
-
Hint: The first argument must be a string
|
|
50
|
-
Using String(argument1)
|
|
51
|
-
Hint: Use a valid tag that you have defined or use "error"|"warn"|"info"`),console.log(t);return}let n=this.styleSheet.get(r.styleName),s=n?.text??"",o=" ".repeat(r.paddingLeft),
|
|
52
|
-
Hint: The first argument must be a string.
|
|
53
|
-
Using String(firstArgument) as fallback`),e=String(e)),this.log("error",e),this}warning(e){return typeof e!="string"&&(console.warn(`[UtilitiesClass.warning] Invalid First Argument!
|
|
54
|
-
Hint: The first argument must be a string.
|
|
55
|
-
Using String(firstArgument) as fallback`),e=String(e)),this.log("warning",e),this}info(e){return typeof e!="string"&&(console.warn(`[UtilitiesClass.info] Invalid First Argument!
|
|
56
|
-
Hint: The first argument must be a string.
|
|
57
|
-
Using String(firstArgument) as fallback`),e=String(e)),this.log("info",e),this}},mr=new Je;export{X as CLI,mr as Utilities};
|
|
48
|
+
Hint: Use a valid tag that you have defined or use "error"|"warn"|"info"`),this;let r=`${e} Tag Color`;return this.styleSheet.set(r,t),this.tags[e].styleName=r,this}log(e,...t){C.for([e]).check(["string"])||(console.warn(`[UtilitiesClass.log] @briklab/lib/cli-john: Invalid Arguments!
|
|
49
|
+
Hint: The first argument must be a string
|
|
50
|
+
Using String(argument1) as fallback`),e=String(e)),(!t||t.length===0)&&(t=[""]);let r=this.tags[e];if(!r){console.warn(`[UtilitiesClass.log] @briklab/lib/cli-john: Tag "${e}" does not exist!
|
|
51
|
+
Hint: Use a valid tag that you have defined or use "error"|"warn"|"info"`),console.log(...t);return}let n=this.styleSheet.get(r.styleName),s=n?.text??"",o=" ".repeat(r.paddingLeft),l=" ".repeat(r.paddingRight);if(typeof process<"u"&&typeof process.stdout<"u"&&!!process.stdout.isTTY){let S=n?.ansi??"",a=N.RESET;r.showErrorInTag?console.log("["+S+o+r.tag+l+a+"]:",...t):console.log(S+"["+o+r.tag+l+"]"+a+":",...t)}else r.showErrorInTag?console.log(`[%c${o}${r.tag}${l}%c]:`,s,...t):console.log(`%c[${o}${r.tag}${l}]%c:`,s,...t)}error(...e){return(!e||e.length===0)&&(e=[""]),this.log("error",...e),this}warning(...e){return(!e||e.length===0)&&(e=[""]),this.log("warning",...e),this}info(...e){return(!e||e.length===0)&&(e=[""]),this.log("info",...e),this}},yr=new Ye;export{X as CLI,yr as Utilities};
|
|
58
52
|
//# sourceMappingURL=index.js.map
|