@everymatrix/casino-engagement-suite-tournament 1.77.4 → 1.77.6
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/casino-engagement-suite-tournament/casino-engagement-suite-progress-bar_8.entry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,g as i,c as s,H as n}from"./index-487913af.js";import{c as r,D as a,i as o,r as h,t as l,L as d,g as c,a as g,f as m}from"./casino-engagement-suite-tournament-12623c2a.js";export{C as casino_engagement_suite_tournament}from"./casino-engagement-suite-tournament-12623c2a.js";import"@everymatrix/ui-image";const u=class{constructor(t){e(this,t),this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))},this.value=0,this.disabled=!1,this.hidePercent=!1,this.indeterminate=!1,this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}getProgressBarClasses(){return{ProgressBar:!0,Completed:100===this.value,Disabled:this.disabled,HidePercent:this.hidePercent||this.indeterminate}}getProgressBarLineTemplate(){return t("div",this.indeterminate?{class:"ProgressBarLine Indeterminate",part:"ProgressBarLine Indeterminate"}:{class:"ProgressBarLine",part:"ProgressBarLine",style:{width:this.value+"%"}})}render(){return t("div",{key:"ecce3a26a92d2e090c1db84bdc1bdbeb505080ed",class:this.getProgressBarClasses(),part:"ProgressBar"},t("div",{key:"649fe1103d222200f2a1ad3b5967e37da1f1ab3d",class:"ProgressBarInfo",part:"ProgressBarInfo"},t("slot",{key:"49dc180eedd823f0027f75099813fb9d91bcd938",name:"Title"},t("div",{key:"e6e59da3fe7bbcb37e118e7fd23a8ff35587aca5"})),t("slot",{key:"3dc8e5fd1dbc8c268b9c76e393b751cb53605e7e",name:"Percent"},t("div",{key:"6a9e880f3ee3c4f26e8577c69be5db5f8e2d10ad",class:"ProgressBarPercent",part:"ProgressBarPercent"},this.value,"%"))),t("div",{key:"141106e77caad7b04bb199f911e87c0c6f0adc2d",class:"ProgressBarBackground",part:"ProgressBarBackground"},this.getProgressBarLineTemplate()))}get host(){return i(this)}};function b(e,t){if(e){const i=document.createElement("style");i.innerHTML=t,e.appendChild(i)}}function k(e,t){const i=new URL(t);fetch(i.href).then((e=>e.text())).then((t=>{const i=document.createElement("style");i.innerHTML=t,e&&e.appendChild(i)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}u.style=":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:var(--emw--font-size-small, 14px);line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-gray-300, #666178);border-radius:var(--emw--border-radius-small, 4px);position:relative;overflow:hidden}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:var(--emw--border-radius-small, 4px);background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));transition:width ease-out 0.3s}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-x-small, 12px);line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-gray-300, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";const w=class{constructor(t){e(this,t),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(e,t){if(window.emMessageBus){const i=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{i.innerHTML=t,e&&e.appendChild(i)}))}}(this.el,`${this.mbSource}.Style`):(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&k(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&b(this.el,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&this.clientStylingUrl&&k(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&k(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const s=(t=this.translationUrl,i=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{i[e]=i[e]||{},Object.keys(t[e]).forEach((s=>{if(!i.en[s])return;const n=i.en[s];"object"==typeof t[e][s]?(i[e][s]=i[e][s]||Object.assign({},n),Object.keys(t[e][s]).forEach((n=>{i[e][s][n]=t[e][s][n]}))):i[e][s]=t[e][s]||Object.assign({},n)}))})),e(!0)})).catch((t=>{console.error("Failed to load translations:",t),e(!1)}))})));e.push(s)}var t,i;return await Promise.all(e)}render(){return t("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},t("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return i(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};w.style=":host{display:block}";const f=class{constructor(t){e(this,t),this.clickToTournamentDetail=s(this,"clickToTournamentDetail",7),this.tournament=void 0,this.isNew=void 0,this.tid=void 0,this.language="en"}goToDetail(){this.clickToTournamentDetail.emit(this.tournament)}onTournamentUpdateEvent(e){const{detail:t}=e;t.id===this.tournament.id&&(this.tournament=Object.assign({},t))}render(){const e=this.tournament;return t("div",{key:"836c6720a7be8c1a97f43245908fc2b6d535c50e",class:r("LeaderboardsItem",e.isPlayerAcknowledged?" GradientRounded Hollow":"",e.isUnjoined?"Unjoined":""),onClick:this.goToDetail.bind(this)},t("div",{key:"a6b131a60c7484dd33f963b769b7db47438460f1",class:"LeaderboardsItemContainer"},t("tournament-item-title",{key:"0e229e79322889c168a7ec4f35bd0ae0fde61a96",tournament:e,language:this.language}),t("tournament-timer",{key:"6f486b88ae367bef631779bfc92b995516bfd8c0",tournament:e})),t("div",{key:"00e40f6bc6102da356f1d781506ceba4c7ae340e",class:"LeaderboardLabels"},this.isNew&&t("div",{key:"5aa6fced7c55d5bb7911c2590611008389f51042",class:"LeaderboardLabel"},t("span",{key:"b89b5825d0902545ea44105ce9f3b8a8a2c98676"},"new"))))}},v=class{constructor(t){e(this,t),this.unjoinTournamentConfirmEvent=s(this,"unjoinTournamentConfirmEvent",7),this.joinTournamentEvent=s(this,"joinTournamentEvent",7),this.tournament=void 0,this.language="en",this.isButtonDisabed=!1}onTournamentChanged(e){this.isButtonDisabed=!0===e.isActionJoinPending}onClickItemJoin(){this.isButtonDisabed||(this.isButtonDisabed=!this.tournament.isPlayerAcknowledged,this.tournament.isPlayerAcknowledged?this.unjoinTournamentConfirmEvent.emit({type:a.unjoin,tournament:this.tournament}):this.joinTournamentEvent.emit(this.tournament))}componentDidLoad(){this.isButtonDisabed=!0===this.tournament.isActionJoinPending}render(){return t("div",{key:"3123b0ffd6335833a5938b13e4c620ded693da38",class:"TitleContainer"},t("div",{key:"88977f242dd5cce6265c679ae55dc1dfdecd7fd0",class:"Title"},this.tournament.nameOrTitle),!o(this.tournament)&&t("div",{key:"bf2aad175409e687ed2bd42350a7f8585d86c112"},h({statedClasses:{isHollow:this.tournament.isPlayerAcknowledged,isPending:this.isButtonDisabed},onClick:e=>{e.stopPropagation(),this.onClickItemJoin()},innerHTML:l(this.tournament.isPlayerAcknowledged?"Unjoin":"Join",this.language)})))}static get watchers(){return{tournament:["onTournamentChanged"]}}},p=class{constructor(t){e(this,t),this.tournament=void 0,this.isDetail=!1,this.timeHolder=void 0,this.timeClock=!0,this.lastTimeDiff=void 0,this.lastProgress=void 0}containerPageChangeHandler(e){this.timeClock=e.detail.page===d.list&&!this.isDetail||e.detail.page===d.item&&this.isDetail}componentWillLoad(){this.lastProgress=c(this.tournament.startTime,this.tournament.endTime),this.lastTimeDiff=g(new Date,this.tournament.endTime,this.lastProgress)}setTimeInterval(){this.timeHolder=setInterval((()=>{const e=c(this.tournament.startTime,this.tournament.endTime),t=g(new Date,this.tournament.endTime,e);!this.timeClock||o(this.tournament)||t==this.lastTimeDiff&&e==this.lastProgress||(this.lastProgress=e,this.lastTimeDiff=t)}),2e3)}connectedCallback(){this.setTimeInterval()}disconnectedCallback(){clearInterval(this.timeHolder)}render(){return t("section",{key:"11426165a8f384d97f2b0158f7435f80ac0965a2",class:"TimeContainer"},t("div",{key:"b86c8a42a73b358fcc855a853cb322d1d314471a",class:"Time"},"Running"===this.tournament.state?t("div",{class:"Running"},t("div",null,this.lastTimeDiff),t("div",null,h({statedClasses:{isHollow:!0,isPending:!!this.tournament.isActionJoinPending},innerHTML:`${this.lastProgress}%`}))):[t("div",{class:"NotRunning"},m(this.tournament.startTime)),t("div",null,m(this.tournament.endTime))]),t("casino-engagement-suite-progress-bar",{key:"7f98e88679f30d0a0737d94ee806b1d92800b6a3",indeterminate:!1,value:Number(this.lastProgress>=100?100:this.lastProgress),"hide-percent":!0}))}},y=class{constructor(t){e(this,t),this.hasStarted=!1,this.src=void 0,this.width=void 0,this.height=void 0,this.alt=void 0,this.styles=void 0,this.detectDistance="200px",this.loading="lazy",this.imgLoaded=!1}onSrcChange(){"eager"!==this.loading&&(this.imgLoaded=!1,this.hasStarted=!1,"undefined"!=typeof window&&"IntersectionObserver"in window||this.beginLoad())}onLoadingChange(e,t){e!==t&&(this.cleanupObserver(),this.detachImgHandlers(),"eager"===e?(this.imgEl&&this.src&&(this.imgEl.src=this.src),this.hasStarted=!0):(this.imgLoaded=!1,this.hasStarted=!1,this.setupObserver()))}componentDidLoad(){"eager"!==this.loading&&this.setupObserver()}disconnectedCallback(){this.cleanupObserver(),this.detachImgHandlers()}canUseIO(){return"undefined"!=typeof window&&"IntersectionObserver"in window}setupObserver(){"eager"!==this.loading&&(this.canUseIO()?(this.io=new IntersectionObserver((e=>{var t;for(const i of e)if(i.isIntersecting){this.beginLoad(),null===(t=this.io)||void 0===t||t.unobserve(i.target),this.cleanupObserver();break}}),{root:null,rootMargin:this.detectDistance,threshold:0}),this.io.observe(this.el)):this.beginLoad())}cleanupObserver(){var e;null===(e=this.io)||void 0===e||e.disconnect(),this.io=void 0}wireOnceHandlers(){this.imgEl&&(this.detachImgHandlers(),this._onLoad=()=>{var e;this.currentSrc&&(null===(e=this.imgEl)||void 0===e?void 0:e.currentSrc)&&!this.imgEl.currentSrc.includes(this.currentSrc)||(this.imgLoaded=!0)},this._onError=()=>{console.error("Load image failed:",this.src)},this.imgEl.addEventListener("load",this._onLoad,{once:!0}),this.imgEl.addEventListener("error",this._onError,{once:!0}))}detachImgHandlers(){this.imgEl&&(this._onLoad&&this.imgEl.removeEventListener("load",this._onLoad),this._onError&&this.imgEl.removeEventListener("error",this._onError),this._onLoad=void 0,this._onError=void 0)}beginLoad(){this.hasStarted||this.imgEl&&this.src&&(this.hasStarted=!0,this.wireOnceHandlers(),this.imgEl.complete&&this.imgEl.naturalWidth>0?this.imgLoaded=!0:(this.currentSrc=this.src,this.imgEl.src=this.src,this.imgEl.complete&&this.imgEl.naturalWidth>0&&(this.imgLoaded=!0)))}get showSkeleton(){return"eager"!==this.loading&&!this.imgLoaded}renderEager(){return t(n,{class:"HostContainer"},t("img",{src:this.src,decoding:"async",style:this.styles,class:"UiContainer Visible",alt:this.alt,width:this.width,height:this.height,loading:"eager"}))}renderLazy(){return t(n,{class:"HostContainer","aria-busy":this.imgLoaded?"false":"true"},this.showSkeleton&&t("ui-skeleton",{class:"UiContainer",structure:"image",width:"100%",height:"100%"}),t("img",{ref:e=>this.imgEl=e,src:void 0,decoding:"async",style:this.styles,class:"UiContainer "+(this.imgLoaded?"Visible":"Hidden"),alt:this.alt,width:this.width,height:this.height,loading:"lazy"}))}render(){return"eager"===this.loading?this.renderEager():this.renderLazy()}get el(){return i(this)}static get watchers(){return{src:["onSrcChange"],loading:["onLoadingChange"]}}};y.style=".HostContainer{display:block}.UiContainer{height:100%;width:100%;border-radius:inherit;object-fit:inherit}.UiContainer .Image{border-radius:inherit}.Hidden{opacity:0;transition:opacity 0.5s ease-in-out}.Visible{opacity:1;border-radius:var(--emw--border-radius-medium, 10px);transition:opacity 0.5s ease-in-out}";const x=class{constructor(t){e(this,t),this.stylingValue={width:this.handleStylingProps(this.width),height:this.handleStylingProps(this.height),borderRadius:this.handleStylingProps(this.borderRadius),marginBottom:this.handleStylingProps(this.marginBottom),marginTop:this.handleStylingProps(this.marginTop),marginLeft:this.handleStylingProps(this.marginLeft),marginRight:this.handleStylingProps(this.marginRight),size:this.handleStylingProps(this.size)},this.structure=void 0,this.width="unset",this.height="unset",this.borderRadius="unset",this.marginBottom="unset",this.marginTop="unset",this.marginLeft="unset",this.marginRight="unset",this.animation=!0,this.rows=0,this.size="100%"}handleStructureChange(e,t){t!==e&&this.handleStructure(e)}handleStylingProps(e){switch(typeof e){case"number":return 0===e?0:`${e}px`;case"undefined":default:return"unset";case"string":return["auto","unset","none","inherit","initial"].includes(e)||e.endsWith("px")||e.endsWith("%")?e:"unset"}}handleStructure(e){switch(e){case"logo":return this.renderLogo();case"image":return this.renderImage();case"title":return this.renderTitle();case"text":return this.renderText();case"rectangle":return this.renderRectangle();case"circle":return this.renderCircle();default:return null}}renderLogo(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Logo "+(this.animation?"Skeleton":"")}))}renderImage(){return t("div",{class:"Image "+(this.animation?"Skeleton":"")})}renderTitle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Title "+(this.animation?"Skeleton":"")}))}renderText(){return t("div",{class:"SkeletonContainer"},Array.from({length:this.rows>0?this.rows:1}).map(((e,i)=>t("div",{key:i,class:"Text "+(this.animation?"Skeleton":"")}))))}renderRectangle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Rectangle "+(this.animation?"Skeleton":"")}))}renderCircle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Circle "+(this.animation?"Skeleton":"")}))}render(){let e="";switch(this.structure){case"logo":e=`\n :host {\n --emw-skeleton-logo-width: ${this.stylingValue.width};\n --emw-skeleton-logo-height: ${this.stylingValue.height};\n --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"image":e=`\n :host {\n --emw-skeleton-image-width: ${this.stylingValue.width};\n --emw-skeleton-image-height: ${this.stylingValue.height};\n --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"title":e=`\n :host {\n --emw-skeleton-title-width: ${this.stylingValue.width};\n --emw-skeleton-title-height: ${this.stylingValue.height};\n --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"text":e=`\n :host {\n --emw-skeleton-text-width: ${this.stylingValue.width};\n --emw-skeleton-text-height: ${this.stylingValue.height};\n --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"rectangle":e=`\n :host {\n --emw-skeleton-rectangle-width: ${this.stylingValue.width};\n --emw-skeleton-rectangle-height: ${this.stylingValue.height};\n --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"circle":e=`\n :host {\n --emw-skeleton-circle-size: ${this.stylingValue.size};\n }\n `;break;default:e=""}return t(n,{key:"e6b885bfd985ce7663d990756fe9101e25eb97f0"},t("style",{key:"06ae24c7bb74f4dacfc12ae58085333f9dc89da5"},e),this.handleStructure(this.structure))}static get watchers(){return{structure:["handleStructureChange"]}}};x.style=":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";export{u as casino_engagement_suite_progress_bar,w as general_styling_wrapper,f as tournament_item,v as tournament_item_title,p as tournament_timer,y as ui_image,x as ui_skeleton}
|
|
1
|
+
import{r as e,h as t,g as i,c as s,H as n}from"./index-487913af.js";import{c as r,D as a,i as o,r as h,t as l,L as d,g as c,a as g,f as m}from"./casino-engagement-suite-tournament-12623c2a.js";export{C as casino_engagement_suite_tournament}from"./casino-engagement-suite-tournament-12623c2a.js";import"@everymatrix/ui-image";const u=class{constructor(t){e(this,t),this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.host.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.host.prepend(t)}),1)})).catch((e=>{console.log("Error ",e)}))},this.value=0,this.disabled=!1,this.hidePercent=!1,this.indeterminate=!1,this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}getProgressBarClasses(){return{ProgressBar:!0,Completed:100===this.value,Disabled:this.disabled,HidePercent:this.hidePercent||this.indeterminate}}getProgressBarLineTemplate(){return t("div",this.indeterminate?{class:"ProgressBarLine Indeterminate",part:"ProgressBarLine Indeterminate"}:{class:"ProgressBarLine",part:"ProgressBarLine",style:{width:this.value+"%"}})}render(){return t("div",{key:"ecce3a26a92d2e090c1db84bdc1bdbeb505080ed",class:this.getProgressBarClasses(),part:"ProgressBar"},t("div",{key:"649fe1103d222200f2a1ad3b5967e37da1f1ab3d",class:"ProgressBarInfo",part:"ProgressBarInfo"},t("slot",{key:"49dc180eedd823f0027f75099813fb9d91bcd938",name:"Title"},t("div",{key:"e6e59da3fe7bbcb37e118e7fd23a8ff35587aca5"})),t("slot",{key:"3dc8e5fd1dbc8c268b9c76e393b751cb53605e7e",name:"Percent"},t("div",{key:"6a9e880f3ee3c4f26e8577c69be5db5f8e2d10ad",class:"ProgressBarPercent",part:"ProgressBarPercent"},this.value,"%"))),t("div",{key:"141106e77caad7b04bb199f911e87c0c6f0adc2d",class:"ProgressBarBackground",part:"ProgressBarBackground"},this.getProgressBarLineTemplate()))}get host(){return i(this)}};function b(e,t){if(e){const i=document.createElement("style");i.innerHTML=t,e.appendChild(i)}}function k(e,t){const i=new URL(t);fetch(i.href).then((e=>e.text())).then((t=>{const i=document.createElement("style");i.innerHTML=t,e&&e.appendChild(i)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}u.style=":host{display:block;font-family:inherit}:host(.Desktop) .ProgressBarPercent{font-size:var(--emw--font-size-small, 14px);line-height:14px}@keyframes indeterminate{0%{left:-200%;right:100%}60%{left:110%;right:-10%}to{left:110%;right:-10%}}.ProgressBarBackground{height:8px;background-color:var(--emw--color-gray-300, #666178);border-radius:var(--emw--border-radius-small, 4px);position:relative;overflow:hidden}.ProgressBarLine{position:absolute;left:0;top:0;bottom:0;border-radius:var(--emw--border-radius-small, 4px);background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));transition:width ease-out 0.3s}.ProgressBarLine.Indeterminate{animation:indeterminate 1s linear infinite}.ProgressBarInfo{margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}.ProgressBarPercent{font-weight:var(--emw--font-weight-bold, 700);font-size:var(--emw--font-size-x-small, 12px);line-height:12px}.HidePercent .ProgressBarPercent{display:none}.ProgressBar:not(.Disabled) .ProgressBarPercent{background:var(--emw--engagement-suite-gradient-button, linear-gradient(98.25deg, #FF9400 22.48%, #FEF746 131.02%, #FFE24A 131.9%));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}.ProgressBar.Disabled .ProgressBarPercent{color:var(--emw--color-gray-300, #666178)}.ProgressBar.Disabled .ProgressBarLine{background:var(--emw--color-background-secondary, #474668)}";const w=class{constructor(t){e(this,t),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(e,t){if(window.emMessageBus){const i=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{i.innerHTML=t,e&&e.appendChild(i)}))}}(this.el,`${this.mbSource}.Style`):(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&k(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(e,t){e!=t&&b(this.el,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&this.clientStylingUrl&&k(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&b(this.el,this.clientStyling),this.clientStylingUrl&&k(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const e=[];if(this.translationUrl){const s=(t=this.translationUrl,i=this.targetTranslations,new Promise((e=>{fetch(t).then((e=>e.json())).then((t=>{Object.keys(t).forEach((e=>{i[e]=i[e]||{},Object.keys(t[e]).forEach((s=>{if(!i.en[s])return;const n=i.en[s];"object"==typeof t[e][s]?(i[e][s]=i[e][s]||Object.assign({},n),Object.keys(t[e][s]).forEach((n=>{i[e][s][n]=t[e][s][n]}))):i[e][s]=t[e][s]||Object.assign({},n)}))})),e(!0)})).catch((t=>{console.error("Failed to load translations:",t),e(!1)}))})));e.push(s)}var t,i;return await Promise.all(e)}render(){return t("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},t("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return i(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};w.style=":host{display:block}";const f=class{constructor(t){e(this,t),this.clickToTournamentDetail=s(this,"clickToTournamentDetail",7),this.tournament=void 0,this.isNew=void 0,this.tid=void 0,this.language="en"}goToDetail(){this.clickToTournamentDetail.emit(this.tournament)}onTournamentUpdateEvent(e){const{detail:t}=e;t.id===this.tournament.id&&(this.tournament=Object.assign({},t))}render(){const e=this.tournament;return t("div",{key:"836c6720a7be8c1a97f43245908fc2b6d535c50e",class:r("LeaderboardsItem",e.isPlayerAcknowledged?" GradientRounded Hollow":"",e.isUnjoined?"Unjoined":""),onClick:this.goToDetail.bind(this)},t("div",{key:"a6b131a60c7484dd33f963b769b7db47438460f1",class:"LeaderboardsItemContainer"},t("tournament-item-title",{key:"0e229e79322889c168a7ec4f35bd0ae0fde61a96",tournament:e,language:this.language}),t("tournament-timer",{key:"6f486b88ae367bef631779bfc92b995516bfd8c0",tournament:e})),t("div",{key:"00e40f6bc6102da356f1d781506ceba4c7ae340e",class:"LeaderboardLabels"},this.isNew&&t("div",{key:"5aa6fced7c55d5bb7911c2590611008389f51042",class:"LeaderboardLabel"},t("span",{key:"b89b5825d0902545ea44105ce9f3b8a8a2c98676"},"new"))))}},v=class{constructor(t){e(this,t),this.unjoinTournamentConfirmEvent=s(this,"unjoinTournamentConfirmEvent",7),this.joinTournamentEvent=s(this,"joinTournamentEvent",7),this.tournament=void 0,this.language="en",this.isButtonDisabed=!1}onTournamentChanged(e){this.isButtonDisabed=!0===e.isActionJoinPending}onClickItemJoin(){this.isButtonDisabed||(this.isButtonDisabed=!this.tournament.isPlayerAcknowledged,this.tournament.isPlayerAcknowledged?this.unjoinTournamentConfirmEvent.emit({type:a.unjoin,tournament:this.tournament}):this.joinTournamentEvent.emit(this.tournament))}componentDidLoad(){this.isButtonDisabed=!0===this.tournament.isActionJoinPending}render(){return t("div",{key:"3123b0ffd6335833a5938b13e4c620ded693da38",class:"TitleContainer"},t("div",{key:"88977f242dd5cce6265c679ae55dc1dfdecd7fd0",class:"Title"},this.tournament.nameOrTitle),!o(this.tournament)&&t("div",{key:"bf2aad175409e687ed2bd42350a7f8585d86c112"},h({statedClasses:{isHollow:this.tournament.isPlayerAcknowledged,isPending:this.isButtonDisabed},onClick:e=>{e.stopPropagation(),this.onClickItemJoin()},innerHTML:l(this.tournament.isPlayerAcknowledged?"Unjoin":"Join",this.language)})))}static get watchers(){return{tournament:["onTournamentChanged"]}}},p=class{constructor(t){e(this,t),this.tournament=void 0,this.isDetail=!1,this.timeHolder=void 0,this.timeClock=!0,this.lastTimeDiff=void 0,this.lastProgress=void 0}containerPageChangeHandler(e){this.timeClock=e.detail.page===d.list&&!this.isDetail||e.detail.page===d.item&&this.isDetail}componentWillLoad(){this.lastProgress=c(this.tournament.startTime,this.tournament.endTime),this.lastTimeDiff=g(new Date,this.tournament.endTime,this.lastProgress)}setTimeInterval(){this.timeHolder=setInterval((()=>{const e=c(this.tournament.startTime,this.tournament.endTime),t=g(new Date,this.tournament.endTime,e);!this.timeClock||o(this.tournament)||t==this.lastTimeDiff&&e==this.lastProgress||(this.lastProgress=e,this.lastTimeDiff=t)}),2e3)}connectedCallback(){this.setTimeInterval()}disconnectedCallback(){clearInterval(this.timeHolder)}render(){return t("section",{key:"11426165a8f384d97f2b0158f7435f80ac0965a2",class:"TimeContainer"},t("div",{key:"b86c8a42a73b358fcc855a853cb322d1d314471a",class:"Time"},"Running"===this.tournament.state?t("div",{class:"Running"},t("div",null,this.lastTimeDiff),t("div",null,h({statedClasses:{isHollow:!0,isPending:!!this.tournament.isActionJoinPending},innerHTML:`${this.lastProgress}%`}))):[t("div",{class:"NotRunning"},m(this.tournament.startTime)),t("div",null,m(this.tournament.endTime))]),t("casino-engagement-suite-progress-bar",{key:"7f98e88679f30d0a0737d94ee806b1d92800b6a3",indeterminate:!1,value:Number(this.lastProgress>=100?100:this.lastProgress),"hide-percent":!0}))}},y=class{constructor(t){e(this,t),this.hasStarted=!1,this._onLoad=()=>{this.imgLoaded=!0},this.src=void 0,this.width=void 0,this.height=void 0,this.alt=void 0,this.styles=void 0,this.detectDistance="200px",this.loading="lazy",this.imgLoaded=!1}onSrcChange(){"eager"!==this.loading&&(this.imgLoaded=!1,this.hasStarted=!1,"undefined"!=typeof window&&"IntersectionObserver"in window||this.beginLoad())}onLoadingChange(e,t){e!==t&&(this.cleanupObserver(),"eager"===e?(this.imgEl&&this.src&&(this.imgEl.src=this.src),this.hasStarted=!0):(this.imgLoaded=!1,this.hasStarted=!1,this.setupObserver()))}componentDidLoad(){"eager"!==this.loading&&this.setupObserver()}disconnectedCallback(){this.cleanupObserver(),this.imgEl&&(this.imgEl.src="")}canUseIO(){return"undefined"!=typeof window&&"IntersectionObserver"in window}setupObserver(){"eager"!==this.loading&&(this.canUseIO()?(this.io=new IntersectionObserver((e=>{var t;for(const i of e)if(i.isIntersecting){this.beginLoad(),null===(t=this.io)||void 0===t||t.unobserve(i.target),this.cleanupObserver();break}}),{root:null,rootMargin:this.detectDistance,threshold:0}),this.io.observe(this.el)):this.beginLoad())}cleanupObserver(){var e;null===(e=this.io)||void 0===e||e.disconnect(),this.io=void 0}beginLoad(){this.hasStarted||this.imgEl&&this.src&&(this.hasStarted=!0,this.imgEl.src=this.src,this.imgEl.complete&&this.imgEl.naturalWidth>0&&(this.imgLoaded=!0))}get showSkeleton(){return"eager"!==this.loading&&!this.imgLoaded}renderEager(){return t(n,{class:"HostContainer"},t("img",{src:this.src,decoding:"async",style:this.styles,class:"UiContainer Visible",alt:this.alt,width:this.width,height:this.height,loading:"eager"}))}renderLazy(){return t(n,{class:"HostContainer","aria-busy":this.imgLoaded?"false":"true"},this.showSkeleton&&t("ui-skeleton",{class:"UiContainer",structure:"image",width:"100%",height:"100%"}),t("img",{ref:e=>this.imgEl=e,src:void 0,decoding:"async",style:this.styles,onLoad:this._onLoad,class:"UiContainer "+(this.imgLoaded?"Visible":"Hidden"),alt:this.alt,width:this.width,height:this.height,loading:"lazy"}))}render(){return"eager"===this.loading?this.renderEager():this.renderLazy()}get el(){return i(this)}static get watchers(){return{src:["onSrcChange"],loading:["onLoadingChange"]}}};y.style=".HostContainer{display:block}.UiContainer{height:100%;width:100%;border-radius:inherit;object-fit:inherit}.UiContainer .Image{border-radius:inherit}.Hidden{opacity:0;transition:opacity 0.5s ease-in-out}.Visible{opacity:1;border-radius:var(--emw--border-radius-medium, 10px);transition:opacity 0.5s ease-in-out}";const x=class{constructor(t){e(this,t),this.stylingValue={width:this.handleStylingProps(this.width),height:this.handleStylingProps(this.height),borderRadius:this.handleStylingProps(this.borderRadius),marginBottom:this.handleStylingProps(this.marginBottom),marginTop:this.handleStylingProps(this.marginTop),marginLeft:this.handleStylingProps(this.marginLeft),marginRight:this.handleStylingProps(this.marginRight),size:this.handleStylingProps(this.size)},this.structure=void 0,this.width="unset",this.height="unset",this.borderRadius="unset",this.marginBottom="unset",this.marginTop="unset",this.marginLeft="unset",this.marginRight="unset",this.animation=!0,this.rows=0,this.size="100%"}handleStructureChange(e,t){t!==e&&this.handleStructure(e)}handleStylingProps(e){switch(typeof e){case"number":return 0===e?0:`${e}px`;case"undefined":default:return"unset";case"string":return["auto","unset","none","inherit","initial"].includes(e)||e.endsWith("px")||e.endsWith("%")?e:"unset"}}handleStructure(e){switch(e){case"logo":return this.renderLogo();case"image":return this.renderImage();case"title":return this.renderTitle();case"text":return this.renderText();case"rectangle":return this.renderRectangle();case"circle":return this.renderCircle();default:return null}}renderLogo(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Logo "+(this.animation?"Skeleton":"")}))}renderImage(){return t("div",{class:"Image "+(this.animation?"Skeleton":"")})}renderTitle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Title "+(this.animation?"Skeleton":"")}))}renderText(){return t("div",{class:"SkeletonContainer"},Array.from({length:this.rows>0?this.rows:1}).map(((e,i)=>t("div",{key:i,class:"Text "+(this.animation?"Skeleton":"")}))))}renderRectangle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Rectangle "+(this.animation?"Skeleton":"")}))}renderCircle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"Circle "+(this.animation?"Skeleton":"")}))}render(){let e="";switch(this.structure){case"logo":e=`\n :host {\n --emw-skeleton-logo-width: ${this.stylingValue.width};\n --emw-skeleton-logo-height: ${this.stylingValue.height};\n --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"image":e=`\n :host {\n --emw-skeleton-image-width: ${this.stylingValue.width};\n --emw-skeleton-image-height: ${this.stylingValue.height};\n --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"title":e=`\n :host {\n --emw-skeleton-title-width: ${this.stylingValue.width};\n --emw-skeleton-title-height: ${this.stylingValue.height};\n --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"text":e=`\n :host {\n --emw-skeleton-text-width: ${this.stylingValue.width};\n --emw-skeleton-text-height: ${this.stylingValue.height};\n --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"rectangle":e=`\n :host {\n --emw-skeleton-rectangle-width: ${this.stylingValue.width};\n --emw-skeleton-rectangle-height: ${this.stylingValue.height};\n --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"circle":e=`\n :host {\n --emw-skeleton-circle-size: ${this.stylingValue.size};\n }\n `;break;default:e=""}return t(n,{key:"e6b885bfd985ce7663d990756fe9101e25eb97f0"},t("style",{key:"06ae24c7bb74f4dacfc12ae58085333f9dc89da5"},e),this.handleStructure(this.structure))}static get watchers(){return{structure:["handleStructureChange"]}}};x.style=":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.Rectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.Circle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.Text{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.Text:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.Title{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.Image{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.Logo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";export{u as casino_engagement_suite_progress_bar,w as general_styling_wrapper,f as tournament_item,v as tournament_item_title,p as tournament_timer,y as ui_image,x as ui_skeleton}
|
|
@@ -357,6 +357,9 @@ const UiImage = class {
|
|
|
357
357
|
constructor(hostRef) {
|
|
358
358
|
index.registerInstance(this, hostRef);
|
|
359
359
|
this.hasStarted = false;
|
|
360
|
+
this._onLoad = () => {
|
|
361
|
+
this.imgLoaded = true;
|
|
362
|
+
};
|
|
360
363
|
this.src = undefined;
|
|
361
364
|
this.width = undefined;
|
|
362
365
|
this.height = undefined;
|
|
@@ -379,7 +382,6 @@ const UiImage = class {
|
|
|
379
382
|
if (newVal === oldVal)
|
|
380
383
|
return;
|
|
381
384
|
this.cleanupObserver();
|
|
382
|
-
this.detachImgHandlers();
|
|
383
385
|
if (newVal === 'eager') {
|
|
384
386
|
if (this.imgEl && this.src) {
|
|
385
387
|
this.imgEl.src = this.src;
|
|
@@ -399,7 +401,8 @@ const UiImage = class {
|
|
|
399
401
|
}
|
|
400
402
|
disconnectedCallback() {
|
|
401
403
|
this.cleanupObserver();
|
|
402
|
-
this.
|
|
404
|
+
if (this.imgEl)
|
|
405
|
+
this.imgEl.src = '';
|
|
403
406
|
}
|
|
404
407
|
canUseIO() {
|
|
405
408
|
return typeof window !== 'undefined' && 'IntersectionObserver' in window;
|
|
@@ -429,32 +432,6 @@ const UiImage = class {
|
|
|
429
432
|
(_a = this.io) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
430
433
|
this.io = undefined;
|
|
431
434
|
}
|
|
432
|
-
wireOnceHandlers() {
|
|
433
|
-
if (!this.imgEl)
|
|
434
|
-
return;
|
|
435
|
-
this.detachImgHandlers();
|
|
436
|
-
this._onLoad = () => {
|
|
437
|
-
var _a;
|
|
438
|
-
if (this.currentSrc && ((_a = this.imgEl) === null || _a === void 0 ? void 0 : _a.currentSrc) && !this.imgEl.currentSrc.includes(this.currentSrc))
|
|
439
|
-
return;
|
|
440
|
-
this.imgLoaded = true;
|
|
441
|
-
};
|
|
442
|
-
this._onError = () => {
|
|
443
|
-
console.error('Load image failed:', this.src);
|
|
444
|
-
};
|
|
445
|
-
this.imgEl.addEventListener('load', this._onLoad, { once: true });
|
|
446
|
-
this.imgEl.addEventListener('error', this._onError, { once: true });
|
|
447
|
-
}
|
|
448
|
-
detachImgHandlers() {
|
|
449
|
-
if (!this.imgEl)
|
|
450
|
-
return;
|
|
451
|
-
if (this._onLoad)
|
|
452
|
-
this.imgEl.removeEventListener('load', this._onLoad);
|
|
453
|
-
if (this._onError)
|
|
454
|
-
this.imgEl.removeEventListener('error', this._onError);
|
|
455
|
-
this._onLoad = undefined;
|
|
456
|
-
this._onError = undefined;
|
|
457
|
-
}
|
|
458
435
|
beginLoad() {
|
|
459
436
|
if (this.hasStarted)
|
|
460
437
|
return;
|
|
@@ -463,12 +440,6 @@ const UiImage = class {
|
|
|
463
440
|
if (!this.src)
|
|
464
441
|
return;
|
|
465
442
|
this.hasStarted = true;
|
|
466
|
-
this.wireOnceHandlers();
|
|
467
|
-
if (this.imgEl.complete && this.imgEl.naturalWidth > 0) {
|
|
468
|
-
this.imgLoaded = true;
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
this.currentSrc = this.src;
|
|
472
443
|
this.imgEl.src = this.src;
|
|
473
444
|
if (this.imgEl.complete && this.imgEl.naturalWidth > 0) {
|
|
474
445
|
this.imgLoaded = true;
|
|
@@ -481,7 +452,7 @@ const UiImage = class {
|
|
|
481
452
|
return (index.h(index.Host, { class: "HostContainer" }, index.h("img", { src: this.src, decoding: "async", style: this.styles, class: "UiContainer Visible", alt: this.alt, width: this.width, height: this.height, loading: "eager" })));
|
|
482
453
|
}
|
|
483
454
|
renderLazy() {
|
|
484
|
-
return (index.h(index.Host, { class: "HostContainer", "aria-busy": !this.imgLoaded ? 'true' : 'false' }, this.showSkeleton && (index.h("ui-skeleton", { class: "UiContainer", structure: "image", width: "100%", height: "100%" })), index.h("img", { ref: (el) => (this.imgEl = el), src: undefined, decoding: "async", style: this.styles, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
|
|
455
|
+
return (index.h(index.Host, { class: "HostContainer", "aria-busy": !this.imgLoaded ? 'true' : 'false' }, this.showSkeleton && (index.h("ui-skeleton", { class: "UiContainer", structure: "image", width: "100%", height: "100%" })), index.h("img", { ref: (el) => (this.imgEl = el), src: undefined, decoding: "async", style: this.styles, onLoad: this._onLoad, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
|
|
485
456
|
}
|
|
486
457
|
render() {
|
|
487
458
|
return this.loading === 'eager' ? this.renderEager() : this.renderLazy();
|
|
@@ -354,6 +354,9 @@ const UiImage = class {
|
|
|
354
354
|
constructor(hostRef) {
|
|
355
355
|
registerInstance(this, hostRef);
|
|
356
356
|
this.hasStarted = false;
|
|
357
|
+
this._onLoad = () => {
|
|
358
|
+
this.imgLoaded = true;
|
|
359
|
+
};
|
|
357
360
|
this.src = undefined;
|
|
358
361
|
this.width = undefined;
|
|
359
362
|
this.height = undefined;
|
|
@@ -376,7 +379,6 @@ const UiImage = class {
|
|
|
376
379
|
if (newVal === oldVal)
|
|
377
380
|
return;
|
|
378
381
|
this.cleanupObserver();
|
|
379
|
-
this.detachImgHandlers();
|
|
380
382
|
if (newVal === 'eager') {
|
|
381
383
|
if (this.imgEl && this.src) {
|
|
382
384
|
this.imgEl.src = this.src;
|
|
@@ -396,7 +398,8 @@ const UiImage = class {
|
|
|
396
398
|
}
|
|
397
399
|
disconnectedCallback() {
|
|
398
400
|
this.cleanupObserver();
|
|
399
|
-
this.
|
|
401
|
+
if (this.imgEl)
|
|
402
|
+
this.imgEl.src = '';
|
|
400
403
|
}
|
|
401
404
|
canUseIO() {
|
|
402
405
|
return typeof window !== 'undefined' && 'IntersectionObserver' in window;
|
|
@@ -426,32 +429,6 @@ const UiImage = class {
|
|
|
426
429
|
(_a = this.io) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
427
430
|
this.io = undefined;
|
|
428
431
|
}
|
|
429
|
-
wireOnceHandlers() {
|
|
430
|
-
if (!this.imgEl)
|
|
431
|
-
return;
|
|
432
|
-
this.detachImgHandlers();
|
|
433
|
-
this._onLoad = () => {
|
|
434
|
-
var _a;
|
|
435
|
-
if (this.currentSrc && ((_a = this.imgEl) === null || _a === void 0 ? void 0 : _a.currentSrc) && !this.imgEl.currentSrc.includes(this.currentSrc))
|
|
436
|
-
return;
|
|
437
|
-
this.imgLoaded = true;
|
|
438
|
-
};
|
|
439
|
-
this._onError = () => {
|
|
440
|
-
console.error('Load image failed:', this.src);
|
|
441
|
-
};
|
|
442
|
-
this.imgEl.addEventListener('load', this._onLoad, { once: true });
|
|
443
|
-
this.imgEl.addEventListener('error', this._onError, { once: true });
|
|
444
|
-
}
|
|
445
|
-
detachImgHandlers() {
|
|
446
|
-
if (!this.imgEl)
|
|
447
|
-
return;
|
|
448
|
-
if (this._onLoad)
|
|
449
|
-
this.imgEl.removeEventListener('load', this._onLoad);
|
|
450
|
-
if (this._onError)
|
|
451
|
-
this.imgEl.removeEventListener('error', this._onError);
|
|
452
|
-
this._onLoad = undefined;
|
|
453
|
-
this._onError = undefined;
|
|
454
|
-
}
|
|
455
432
|
beginLoad() {
|
|
456
433
|
if (this.hasStarted)
|
|
457
434
|
return;
|
|
@@ -460,12 +437,6 @@ const UiImage = class {
|
|
|
460
437
|
if (!this.src)
|
|
461
438
|
return;
|
|
462
439
|
this.hasStarted = true;
|
|
463
|
-
this.wireOnceHandlers();
|
|
464
|
-
if (this.imgEl.complete && this.imgEl.naturalWidth > 0) {
|
|
465
|
-
this.imgLoaded = true;
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
this.currentSrc = this.src;
|
|
469
440
|
this.imgEl.src = this.src;
|
|
470
441
|
if (this.imgEl.complete && this.imgEl.naturalWidth > 0) {
|
|
471
442
|
this.imgLoaded = true;
|
|
@@ -478,7 +449,7 @@ const UiImage = class {
|
|
|
478
449
|
return (h(Host, { class: "HostContainer" }, h("img", { src: this.src, decoding: "async", style: this.styles, class: "UiContainer Visible", alt: this.alt, width: this.width, height: this.height, loading: "eager" })));
|
|
479
450
|
}
|
|
480
451
|
renderLazy() {
|
|
481
|
-
return (h(Host, { class: "HostContainer", "aria-busy": !this.imgLoaded ? 'true' : 'false' }, this.showSkeleton && (h("ui-skeleton", { class: "UiContainer", structure: "image", width: "100%", height: "100%" })), h("img", { ref: (el) => (this.imgEl = el), src: undefined, decoding: "async", style: this.styles, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
|
|
452
|
+
return (h(Host, { class: "HostContainer", "aria-busy": !this.imgLoaded ? 'true' : 'false' }, this.showSkeleton && (h("ui-skeleton", { class: "UiContainer", structure: "image", width: "100%", height: "100%" })), h("img", { ref: (el) => (this.imgEl = el), src: undefined, decoding: "async", style: this.styles, onLoad: this._onLoad, class: `UiContainer ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" })));
|
|
482
453
|
}
|
|
483
454
|
render() {
|
|
484
455
|
return this.loading === 'eager' ? this.renderEager() : this.renderLazy();
|