UNPKG

@stencil/core

Version:

A Compiler for Web Components and Progressive Web Apps

1 lines 1.79 kB
import{r as s,h as t}from"./p-c001178f.js";class e{constructor(t){s(this,t),this.appSrcUrl="",this.imagesUrl="/data/images/",this.buildsUrl="/data/builds/"}async componentWillLoad(){let s="master";this.match&&this.match.params.buildId&&(s=this.match.params.buildId.substr(0,7));let t=`${this.buildsUrl}${s}.json`;"master"===s&&(t+=`?ts=${Date.now()}`);const e=await fetch(t);e.ok&&(this.build=await e.json(),document.title=`${this.build.id} Preview: ${this.build.message}`)}render(){const s=[];return this.build&&this.build.screenshots.forEach(t=>{const e=t.testPath.split("/");e.pop();const i=`/data/tests/${this.build.id}/${e.join("/")}/`;if(!s.some(s=>s.url===i)){const e={desc:t.desc.split(",")[0],url:i};s.push(e)}}),s.sort((s,t)=>s.desc.toLowerCase()<t.desc.toLowerCase()?-1:s.desc.toLowerCase()>t.desc.toLowerCase()?1:0),[t("compare-header",{appSrcUrl:this.appSrcUrl}),t("section",{class:"scroll-y"},t("section",{class:"content"},this.build?t("h1",null,t("a",{href:this.build.url},this.build.message)):null,s.map(s=>t("div",null,t("a",{href:s.url},s.desc)))))]}static get style(){return"screenshot-preview{display:block}screenshot-preview .scroll-y{width:100%}screenshot-preview h1{color:var(--analysis-data-color);font-size:16px;margin:0}screenshot-preview .content{padding:80px 20px 140px 20px}screenshot-preview a{display:block;padding:8px;color:var(--analysis-data-color);text-decoration:none}screenshot-preview a:hover{text-decoration:underline}screenshot-preview compare-header{left:0;padding:0;width:100%;height:auto;padding-top:env(safe-area-inset-top)}screenshot-preview compare-header compare-filter{display:none}\@media (max-width:480px){screenshot-preview a{padding:12px;font-size:18px}screenshot-preview a:hover{text-decoration:none}}"}}export{e as screenshot_preview};