@pb33f/cowboy-components 0.5.0 → 0.5.1
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.
|
@@ -375,8 +375,9 @@ let SpecEditor = class SpecEditor extends LitElement {
|
|
|
375
375
|
}
|
|
376
376
|
const uri = link.fullDefinition.split("#/");
|
|
377
377
|
if (uri.length == 2) {
|
|
378
|
-
if (uri[0] !== '/')
|
|
378
|
+
if (uri[0] !== '/' && uri[0] !== '') {
|
|
379
379
|
linkMeta.push({ value: `File: **${uri[0]}**` });
|
|
380
|
+
}
|
|
380
381
|
}
|
|
381
382
|
else {
|
|
382
383
|
linkMeta.push({ value: `Location: **${link.fullDefinition}**` });
|
|
@@ -2994,7 +2994,7 @@ Please report this to https://github.com/markedjs/marked.`,p){const m="<p>An err
|
|
|
2994
2994
|
${Pmt(this.container)}>
|
|
2995
2995
|
</div>
|
|
2996
2996
|
${this.showBreadcrumb?this.breadcumb:null}
|
|
2997
|
-
`}getFile(){return this.children.length>0?this.children[0]:null}getCode(){if(this.code)return this.code;const b=this.getFile();if(b)return b.innerHTML.trim()}getTheme(){return this.theme?this.theme:this.isDark()?"vs-dark":"vs-light"}switchLanguage(b){if(this.editor){const p=this.editor.getModel();p&&yc.editor.setModelLanguage(p,b)}}isDark(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}setValue(b,p=!1){var f;p&&(this.firstboot=p),(f=this.editor)==null||f.setValue(b)}getValue(){var b;return(b=this.editor)==null?void 0:b.getValue()}clearDecorations(){var b;this.linkDecorations.clear(),(b=this.editor)==null||b.deltaDecorations([],[])}clearAllMarkers(){yc.editor.removeAllMarkers("owner-"+this.id)}setMarkers(b){yc.editor.removeAllMarkers("owner-"+this.id),yc.editor.setModelMarkers(this.model,"owner-"+this.id,b)}toggleMinimap(){var b;this.minimapVisible=!this.minimapVisible,(b=this.editor)==null||b.updateOptions({minimap:{enabled:this.minimapVisible}})}firstUpdated(){Kmt();const b=yc.Uri.parse("inmemory://doc-"+this.id),p=this.getCode();this.model=yc.editor.createModel(p,"yaml",b),this.editor=yc.editor.create(this.container.value,{model:this.model,language:"json",theme:"pb33f",glyphMargin:!0,readOnly:this.readOnly,automaticLayout:!0,fontFamily:"BerkeleyMono-Regular",fontSize:14,minimap:{enabled:this.minimapVisible},hover:{enabled:!0,delay:100,above:!1,sticky:!0}}),yc.languages.registerLinkProvider("yaml",{provideLinks:this.provideLinks.bind(this)}),yc.editor.registerLinkOpener({open:this.open.bind(this)}),yc.languages.registerHoverProvider("yaml",{provideHover:(f,v)=>{const m=this.links.find(M=>new yc.Range(M.line,M.startColumn,M.line,M.endColumn).containsPosition(v));let C=new Array;if(m){C=[{value:`#### **→ ${m.fullDefinition.split("/").pop()}**`},{value:`XPath: _${m.definition}_`}],m.isPolymorphic&&C.push({value:"`Polymorphic Pointer`"}),m.jsonPath&&C.push({value:`JSON Pointer: __${m.jsonPath}__`});const H=m.fullDefinition.split("#/");H.length==2?H[0]!=="/"&&C.push({value:`File: **${H[0]}**`}):C.push({value:`Location: **${m.fullDefinition}**`}),m.targetLine&&m.targetColumn&&C.push({value:`Target: Line [**${m.targetLine}]**, Column **[${m.targetColumn}]**`})}return m?{range:new yc.Range(m.line,m.startColumn,m.line,m.endColumn),contents:C}:null}}),this.linkDecorations=this.editor.createDecorationsCollection(),this.model.onDidChangeContent(()=>{this.firstboot?this.firstboot=!1:this.dispatchEvent(new CustomEvent(eQ,{bubbles:!0,composed:!0,detail:{content:this.editor.getValue(),id:this.id}}))}),this.editor.onMouseDown(f=>{var v,m;this.dispatchEvent(new CustomEvent(wve,{bubbles:!0,composed:!0,detail:{line:(v=f.target.position)==null?void 0:v.lineNumber,column:(m=f.target.position)==null?void 0:m.column}}))}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{yc.editor.setTheme(this.getTheme())})}open(b){return b.scheme=="doctor"&&this.dispatchEvent(new CustomEvent(lQ,{bubbles:!0,composed:!0,detail:{jsonPath:b.authority}})),Promise.resolve(!0)}applyLinkDecorations(){if(this.editor){this.linkDecorations.clear();const b=this.links.map(f=>{let v="ref",m="ref-margin",C={value:"Reference (_JSON Pointer_) to: **"+f.fullDefinition+"**"},M=Hmt;return f.isPolymorphic&&(v="ref-poly",m="ref-poly-margin",C={value:"Polymorphic Reference (_JSON Pointer_) to: **"+f.fullDefinition+"**"},M=Umt),{range:new yc.Range(f.line,f.startColumn,f.line,f.endColumn),options:{inlineClassName:v,glyphMarginClassName:m,glyphMarginHoverMessage:C,minimap:{color:M,position:yc.editor.MinimapPosition.Inline}}}}),p=this.linkDecorations.set(b);this.decorationIdToLinkTarget.clear(),p.forEach((f,v)=>{const m=this.links[v].jsonPath+"||"+this.links[v].targetLine+":"+this.links[v].targetColumn+"||"+this.links[v].fullDefinition+"||"+this.links[v].rolodexIdHash;this.decorationIdToLinkTarget.set(f,m)})}}provideLinks(b,p){return{links:this.links.map(v=>{const m=new yc.Range(v.line,v.startColumn,v.line,v.endColumn),C=v.jsonPath+"||"+v.targetLine+":"+v.targetColumn+"||"+v.fullDefinition+"||"+v.rolodexIdHash;return{range:m,url:yc.Uri.parse(`doctor://${encodeURIComponent(C)}`)}})}}};kd.styles=[Fmt],vm([z.property({type:Boolean,attribute:"readonly"})],kd.prototype,"readOnly",2),vm([z.property()],kd.prototype,"theme",2),vm([z.property()],kd.prototype,"language",2),vm([z.property()],kd.prototype,"code",2),vm([z.state()],kd.prototype,"links",2),vm([z.property()],kd.prototype,"minimapVisible",2),vm([z.property()],kd.prototype,"currentPath",2),vm([z.property()],kd.prototype,"id",2),vm([z.state()],kd.prototype,"showBreadcrumb",2),kd=vm([z.customElement("pb33f-editor")],kd);const zx="bags",Wmt="saddlebag";let Ymt=class{constructor(p){Hr(this,"_bags");Hr(this,"_stateful");Hr(this,"_db");this._bags=new Map,this._stateful=p}loadStatefulBags(){return new Promise(p=>{const f=indexedDB.open(Wmt,1);f.onupgradeneeded=()=>{this._db=f.result,this._db.createObjectStore(zx)},f.onsuccess=()=>{if(this._db=f.result,this._db){const v=this._db.transaction(zx).objectStore(zx).openCursor();v.onsuccess=m=>{let C=m.target.result;if(C){let M=C.primaryKey,H=C.value;const q=this.createBag(M);q.populate(H),this._bags.set(M,q),C.continue()}else p({db:this._db})}}}})}get db(){return this._db?this._db:null}createBag(p){const f=Vmt(p,this._stateful);return f.db=this._db,this._bags.set(p,f),f}getBag(p){return this._bags.has(p)?this._bags.get(p):this.createBag(p)}resetBags(){this._bags.forEach(p=>{p.reset()})}},vQ;function u3e(b){return vQ||(vQ=new Ymt(b)),vQ}function Vmt(b,p){return new Qmt(b,p)}class yQ{constructor(p,f){Hr(this,"_allChangesBit");Hr(this,"_key");Hr(this,"_subFunction");Hr(this,"_allChangesFunction");Hr(this,"_populatedFunction");Hr(this,"_bag");this._bag=p,this._allChangesBit=f,this._key="",this._subFunction=void 0,this._allChangesFunction=void 0,this._populatedFunction=void 0}set allChangeFunction(p){this._allChangesFunction=p}set populatedFunction(p){this._populatedFunction=p}set subscriptionFunction(p){this._subFunction=p}set key(p){this._key=p}unsubscribe(){switch(this._allChangesBit){case 0:const p=this._bag._subscriptions.get(this._key);p&&this._bag._subscriptions.set(this._key,p.filter(f=>f!==this._subFunction));break;case 1:this._bag._allChangesSubscriptions=this._bag._allChangesSubscriptions.filter(f=>f!==this._allChangesFunction);break;case 2:this._bag._storePopulatedSubscriptions=this._bag._storePopulatedSubscriptions.filter(f=>f!==this._populatedFunction)}}}let Qmt=class{constructor(p,f){Hr(this,"_id");Hr(this,"_stateful");Hr(this,"_values");Hr(this,"_db");Hr(this,"_subscriptions");Hr(this,"_allChangesSubscriptions");Hr(this,"_storePopulatedSubscriptions");this._values=new Map,this._subscriptions=new Map,this._allChangesSubscriptions=[],this._storePopulatedSubscriptions=[],this._stateful=f||!1,this._id=p}set(p,f){this._values.set(p,structuredClone(f)),this.alertSubscribers(p,f),this._stateful&&this._db&&this._db.transaction([zx],"readwrite").objectStore(zx).put(this._values,this._id)}get id(){return this._id}set db(p){this._db=p}reset(){this._values.forEach((p,f)=>{this.alertSubscribers(f,void 0)}),this._values=new Map,this._stateful&&this._db&&this._db.transaction([zx],"readwrite").objectStore(zx).delete(this._id)}alertSubscribers(p,f){var v;this._subscriptions.has(p)&&((v=this._subscriptions.get(p))==null||v.forEach(m=>m(f))),this._allChangesSubscriptions.length>0&&this._allChangesSubscriptions.forEach(m=>m(p,f))}get(p){return this._values.get(p)}populate(p){p&&p.size>0&&(this._values=structuredClone(p),this._storePopulatedSubscriptions.length>0&&this._storePopulatedSubscriptions.forEach(f=>f(p)))}export(){return this._values}subscribe(p,f){if(!this._subscriptions.has(p))this._subscriptions.set(p,[f]);else{const m=this._subscriptions.get(p);m&&this._subscriptions.set(p,[...m,f])}const v=new yQ(this,0);return v.key=p,v.subscriptionFunction=f,v}onAllChanges(p){this._allChangesSubscriptions.push(p);const f=new yQ(this,1);return f.allChangeFunction=p,f}onPopulated(p){this._storePopulatedSubscriptions.push(p);const f=new yQ(this,2);return f.populatedFunction=p,f}};class NO{static buildDefaultHeaders(p){const f={};return NO.addBrokerHeader(f,p),NO.addJSONHeader(f),f}static addBrokerHeader(p,f){f&&(p["x-pb33f-broker"]=f)}static addJSONHeader(p){p["Content-Type"]="application/json"}}const O0=class O0{static compareProblems(p,f){return p.startLineNumber<f.startLineNumber?-1:p.startLineNumber>f.startLineNumber?1:p.startColumn<f.startColumn?-1:p.startColumn>f.startColumn?1:p.jsonPath<f.jsonPath?-1:0}static async lintFile(p,f,v,m){return new Promise(async(C,M)=>{try{const H=NO.buildDefaultHeaders(f);let q;v?q=await fetch(O0.doctorEndpoint+"/lint-lsp?url="+encodeURIComponent(v),{method:"GET",credentials:"include",headers:H}):m?q=await fetch(O0.doctorEndpoint+"/lint-lsp?currentPath="+encodeURIComponent(m),{method:"POST",credentials:"include",headers:H,body:p}):q=await fetch(O0.doctorEndpoint+"/lint-lsp",{method:"POST",credentials:"include",headers:H,body:p});const ce=await q.json();if(!ce){M([]);return}if(ce!=null&&ce.type&&(ce!=null&&ce.title)&&(ce!=null&&ce.status)){M(ce);return}const Y=ce,me=[];if(Y&&Array.isArray(Y))for(let ve=0;ve<Y.length;ve++){const De=Y[ve];me.push(new f2(De.category,De.jsonPath,De.endColumn,De.endLineNumber,De.message,De.severity,De.startColumn,De.startLineNumber,De.source,De.id,De.sourceLocation))}if(Y&&!Array.isArray(Y)){const ve=Y;me.push(new f2(ve.category,ve.jsonPath,ve.endColumn,ve.endLineNumber,ve.message,ve.severity,ve.startColumn,ve.startLineNumber,ve.source,ve.id,ve.sourceLocation))}me.sort(O0.compareProblems),C(me)}catch{M({detail:"the pb33f platform is unresponsive"})}})}static async fetchAllHowToFix(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/rules/howtofix",{method:"GET",credentials:"include"})).json();m.title&&m.status&&m.error&&f(m),p(m)}catch{f({tile:"platform error",detail:"the pb33f platform is unresponsive, please try again later."})}})}static async fetchStatistics(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/lint-statistics",{method:"GET",credentials:"include"})).json();m.type&&m.title&&m.status&&f(m),p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}static async startSession(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/start-session",{method:"GET",credentials:"include"})).json();m.type&&m.title&&m.status&&f(m),p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}static async bootstrapEditor(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/bootstrap/train-travel",{method:"GET",credentials:"include"})).text();p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}};O0.doctorEndpoint="https://doctor.pb33f.io";let k3=O0;const Zmt=I.css`
|
|
2997
|
+
`}getFile(){return this.children.length>0?this.children[0]:null}getCode(){if(this.code)return this.code;const b=this.getFile();if(b)return b.innerHTML.trim()}getTheme(){return this.theme?this.theme:this.isDark()?"vs-dark":"vs-light"}switchLanguage(b){if(this.editor){const p=this.editor.getModel();p&&yc.editor.setModelLanguage(p,b)}}isDark(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}setValue(b,p=!1){var f;p&&(this.firstboot=p),(f=this.editor)==null||f.setValue(b)}getValue(){var b;return(b=this.editor)==null?void 0:b.getValue()}clearDecorations(){var b;this.linkDecorations.clear(),(b=this.editor)==null||b.deltaDecorations([],[])}clearAllMarkers(){yc.editor.removeAllMarkers("owner-"+this.id)}setMarkers(b){yc.editor.removeAllMarkers("owner-"+this.id),yc.editor.setModelMarkers(this.model,"owner-"+this.id,b)}toggleMinimap(){var b;this.minimapVisible=!this.minimapVisible,(b=this.editor)==null||b.updateOptions({minimap:{enabled:this.minimapVisible}})}firstUpdated(){Kmt();const b=yc.Uri.parse("inmemory://doc-"+this.id),p=this.getCode();this.model=yc.editor.createModel(p,"yaml",b),this.editor=yc.editor.create(this.container.value,{model:this.model,language:"json",theme:"pb33f",glyphMargin:!0,readOnly:this.readOnly,automaticLayout:!0,fontFamily:"BerkeleyMono-Regular",fontSize:14,minimap:{enabled:this.minimapVisible},hover:{enabled:!0,delay:100,above:!1,sticky:!0}}),yc.languages.registerLinkProvider("yaml",{provideLinks:this.provideLinks.bind(this)}),yc.editor.registerLinkOpener({open:this.open.bind(this)}),yc.languages.registerHoverProvider("yaml",{provideHover:(f,v)=>{const m=this.links.find(M=>new yc.Range(M.line,M.startColumn,M.line,M.endColumn).containsPosition(v));let C=new Array;if(m){C=[{value:`#### **→ ${m.fullDefinition.split("/").pop()}**`},{value:`XPath: _${m.definition}_`}],m.isPolymorphic&&C.push({value:"`Polymorphic Pointer`"}),m.jsonPath&&C.push({value:`JSON Pointer: __${m.jsonPath}__`});const H=m.fullDefinition.split("#/");H.length==2?H[0]!=="/"&&H[0]!==""&&C.push({value:`File: **${H[0]}**`}):C.push({value:`Location: **${m.fullDefinition}**`}),m.targetLine&&m.targetColumn&&C.push({value:`Target: Line [**${m.targetLine}]**, Column **[${m.targetColumn}]**`})}return m?{range:new yc.Range(m.line,m.startColumn,m.line,m.endColumn),contents:C}:null}}),this.linkDecorations=this.editor.createDecorationsCollection(),this.model.onDidChangeContent(()=>{this.firstboot?this.firstboot=!1:this.dispatchEvent(new CustomEvent(eQ,{bubbles:!0,composed:!0,detail:{content:this.editor.getValue(),id:this.id}}))}),this.editor.onMouseDown(f=>{var v,m;this.dispatchEvent(new CustomEvent(wve,{bubbles:!0,composed:!0,detail:{line:(v=f.target.position)==null?void 0:v.lineNumber,column:(m=f.target.position)==null?void 0:m.column}}))}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{yc.editor.setTheme(this.getTheme())})}open(b){return b.scheme=="doctor"&&this.dispatchEvent(new CustomEvent(lQ,{bubbles:!0,composed:!0,detail:{jsonPath:b.authority}})),Promise.resolve(!0)}applyLinkDecorations(){if(this.editor){this.linkDecorations.clear();const b=this.links.map(f=>{let v="ref",m="ref-margin",C={value:"Reference (_JSON Pointer_) to: **"+f.fullDefinition+"**"},M=Hmt;return f.isPolymorphic&&(v="ref-poly",m="ref-poly-margin",C={value:"Polymorphic Reference (_JSON Pointer_) to: **"+f.fullDefinition+"**"},M=Umt),{range:new yc.Range(f.line,f.startColumn,f.line,f.endColumn),options:{inlineClassName:v,glyphMarginClassName:m,glyphMarginHoverMessage:C,minimap:{color:M,position:yc.editor.MinimapPosition.Inline}}}}),p=this.linkDecorations.set(b);this.decorationIdToLinkTarget.clear(),p.forEach((f,v)=>{const m=this.links[v].jsonPath+"||"+this.links[v].targetLine+":"+this.links[v].targetColumn+"||"+this.links[v].fullDefinition+"||"+this.links[v].rolodexIdHash;this.decorationIdToLinkTarget.set(f,m)})}}provideLinks(b,p){return{links:this.links.map(v=>{const m=new yc.Range(v.line,v.startColumn,v.line,v.endColumn),C=v.jsonPath+"||"+v.targetLine+":"+v.targetColumn+"||"+v.fullDefinition+"||"+v.rolodexIdHash;return{range:m,url:yc.Uri.parse(`doctor://${encodeURIComponent(C)}`)}})}}};kd.styles=[Fmt],vm([z.property({type:Boolean,attribute:"readonly"})],kd.prototype,"readOnly",2),vm([z.property()],kd.prototype,"theme",2),vm([z.property()],kd.prototype,"language",2),vm([z.property()],kd.prototype,"code",2),vm([z.state()],kd.prototype,"links",2),vm([z.property()],kd.prototype,"minimapVisible",2),vm([z.property()],kd.prototype,"currentPath",2),vm([z.property()],kd.prototype,"id",2),vm([z.state()],kd.prototype,"showBreadcrumb",2),kd=vm([z.customElement("pb33f-editor")],kd);const zx="bags",Wmt="saddlebag";let Ymt=class{constructor(p){Hr(this,"_bags");Hr(this,"_stateful");Hr(this,"_db");this._bags=new Map,this._stateful=p}loadStatefulBags(){return new Promise(p=>{const f=indexedDB.open(Wmt,1);f.onupgradeneeded=()=>{this._db=f.result,this._db.createObjectStore(zx)},f.onsuccess=()=>{if(this._db=f.result,this._db){const v=this._db.transaction(zx).objectStore(zx).openCursor();v.onsuccess=m=>{let C=m.target.result;if(C){let M=C.primaryKey,H=C.value;const q=this.createBag(M);q.populate(H),this._bags.set(M,q),C.continue()}else p({db:this._db})}}}})}get db(){return this._db?this._db:null}createBag(p){const f=Vmt(p,this._stateful);return f.db=this._db,this._bags.set(p,f),f}getBag(p){return this._bags.has(p)?this._bags.get(p):this.createBag(p)}resetBags(){this._bags.forEach(p=>{p.reset()})}},vQ;function u3e(b){return vQ||(vQ=new Ymt(b)),vQ}function Vmt(b,p){return new Qmt(b,p)}class yQ{constructor(p,f){Hr(this,"_allChangesBit");Hr(this,"_key");Hr(this,"_subFunction");Hr(this,"_allChangesFunction");Hr(this,"_populatedFunction");Hr(this,"_bag");this._bag=p,this._allChangesBit=f,this._key="",this._subFunction=void 0,this._allChangesFunction=void 0,this._populatedFunction=void 0}set allChangeFunction(p){this._allChangesFunction=p}set populatedFunction(p){this._populatedFunction=p}set subscriptionFunction(p){this._subFunction=p}set key(p){this._key=p}unsubscribe(){switch(this._allChangesBit){case 0:const p=this._bag._subscriptions.get(this._key);p&&this._bag._subscriptions.set(this._key,p.filter(f=>f!==this._subFunction));break;case 1:this._bag._allChangesSubscriptions=this._bag._allChangesSubscriptions.filter(f=>f!==this._allChangesFunction);break;case 2:this._bag._storePopulatedSubscriptions=this._bag._storePopulatedSubscriptions.filter(f=>f!==this._populatedFunction)}}}let Qmt=class{constructor(p,f){Hr(this,"_id");Hr(this,"_stateful");Hr(this,"_values");Hr(this,"_db");Hr(this,"_subscriptions");Hr(this,"_allChangesSubscriptions");Hr(this,"_storePopulatedSubscriptions");this._values=new Map,this._subscriptions=new Map,this._allChangesSubscriptions=[],this._storePopulatedSubscriptions=[],this._stateful=f||!1,this._id=p}set(p,f){this._values.set(p,structuredClone(f)),this.alertSubscribers(p,f),this._stateful&&this._db&&this._db.transaction([zx],"readwrite").objectStore(zx).put(this._values,this._id)}get id(){return this._id}set db(p){this._db=p}reset(){this._values.forEach((p,f)=>{this.alertSubscribers(f,void 0)}),this._values=new Map,this._stateful&&this._db&&this._db.transaction([zx],"readwrite").objectStore(zx).delete(this._id)}alertSubscribers(p,f){var v;this._subscriptions.has(p)&&((v=this._subscriptions.get(p))==null||v.forEach(m=>m(f))),this._allChangesSubscriptions.length>0&&this._allChangesSubscriptions.forEach(m=>m(p,f))}get(p){return this._values.get(p)}populate(p){p&&p.size>0&&(this._values=structuredClone(p),this._storePopulatedSubscriptions.length>0&&this._storePopulatedSubscriptions.forEach(f=>f(p)))}export(){return this._values}subscribe(p,f){if(!this._subscriptions.has(p))this._subscriptions.set(p,[f]);else{const m=this._subscriptions.get(p);m&&this._subscriptions.set(p,[...m,f])}const v=new yQ(this,0);return v.key=p,v.subscriptionFunction=f,v}onAllChanges(p){this._allChangesSubscriptions.push(p);const f=new yQ(this,1);return f.allChangeFunction=p,f}onPopulated(p){this._storePopulatedSubscriptions.push(p);const f=new yQ(this,2);return f.populatedFunction=p,f}};class NO{static buildDefaultHeaders(p){const f={};return NO.addBrokerHeader(f,p),NO.addJSONHeader(f),f}static addBrokerHeader(p,f){f&&(p["x-pb33f-broker"]=f)}static addJSONHeader(p){p["Content-Type"]="application/json"}}const O0=class O0{static compareProblems(p,f){return p.startLineNumber<f.startLineNumber?-1:p.startLineNumber>f.startLineNumber?1:p.startColumn<f.startColumn?-1:p.startColumn>f.startColumn?1:p.jsonPath<f.jsonPath?-1:0}static async lintFile(p,f,v,m){return new Promise(async(C,M)=>{try{const H=NO.buildDefaultHeaders(f);let q;v?q=await fetch(O0.doctorEndpoint+"/lint-lsp?url="+encodeURIComponent(v),{method:"GET",credentials:"include",headers:H}):m?q=await fetch(O0.doctorEndpoint+"/lint-lsp?currentPath="+encodeURIComponent(m),{method:"POST",credentials:"include",headers:H,body:p}):q=await fetch(O0.doctorEndpoint+"/lint-lsp",{method:"POST",credentials:"include",headers:H,body:p});const ce=await q.json();if(!ce){M([]);return}if(ce!=null&&ce.type&&(ce!=null&&ce.title)&&(ce!=null&&ce.status)){M(ce);return}const Y=ce,me=[];if(Y&&Array.isArray(Y))for(let ve=0;ve<Y.length;ve++){const De=Y[ve];me.push(new f2(De.category,De.jsonPath,De.endColumn,De.endLineNumber,De.message,De.severity,De.startColumn,De.startLineNumber,De.source,De.id,De.sourceLocation))}if(Y&&!Array.isArray(Y)){const ve=Y;me.push(new f2(ve.category,ve.jsonPath,ve.endColumn,ve.endLineNumber,ve.message,ve.severity,ve.startColumn,ve.startLineNumber,ve.source,ve.id,ve.sourceLocation))}me.sort(O0.compareProblems),C(me)}catch{M({detail:"the pb33f platform is unresponsive"})}})}static async fetchAllHowToFix(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/rules/howtofix",{method:"GET",credentials:"include"})).json();m.title&&m.status&&m.error&&f(m),p(m)}catch{f({tile:"platform error",detail:"the pb33f platform is unresponsive, please try again later."})}})}static async fetchStatistics(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/lint-statistics",{method:"GET",credentials:"include"})).json();m.type&&m.title&&m.status&&f(m),p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}static async startSession(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/start-session",{method:"GET",credentials:"include"})).json();m.type&&m.title&&m.status&&f(m),p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}static async bootstrapEditor(){return new Promise(async(p,f)=>{try{const m=await(await fetch(O0.doctorEndpoint+"/bootstrap/train-travel",{method:"GET",credentials:"include"})).text();p(m)}catch{f({detail:"the pb33f platform is unresponsive"})}})}};O0.doctorEndpoint="https://doctor.pb33f.io";let k3=O0;const Zmt=I.css`
|
|
2998
2998
|
|
|
2999
2999
|
label {
|
|
3000
3000
|
font-size: 0.8rem;
|
|
@@ -5173,6 +5173,7 @@ Please report this to https://github.com/markedjs/marked.`,p){const m="<p>An err
|
|
|
5173
5173
|
position: absolute;
|
|
5174
5174
|
top: 3px;
|
|
5175
5175
|
right: 25px;
|
|
5176
|
+
z-index: 1;
|
|
5176
5177
|
}
|
|
5177
5178
|
|
|
5178
5179
|
.spinner-draw-closed {
|
package/package.json
CHANGED