@everymatrix/casino-tournament-duration 1.33.5 → 1.34.2
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-tournament-duration/casino-tournament-duration.esm.js +1 -1
- package/dist/casino-tournament-duration/p-183a9160.entry.js +1 -0
- package/dist/casino-tournament-duration/{p-0fd13b12.js → p-5f4837aa.js} +1 -1
- package/dist/cjs/casino-tournament-duration.cjs.entry.js +10 -2
- package/dist/cjs/casino-tournament-duration.cjs.js +1 -1
- package/dist/cjs/{index-5642eca0.js → index-764d2bff.js} +32 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +11 -2
- package/dist/components/casino-tournament-duration.js +9 -1
- package/dist/esm/casino-tournament-duration.entry.js +10 -2
- package/dist/esm/casino-tournament-duration.js +1 -1
- package/dist/esm/{index-53cc9b80.js → index-4075dde6.js} +32 -0
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +1 -0
- package/package.json +1 -1
- package/dist/casino-tournament-duration/p-a7d04af2.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as n}from"./p-
|
|
1
|
+
import{p as t,b as n}from"./p-5f4837aa.js";(()=>{const n=import.meta.url,a={};return""!==n&&(a.resourcesUrl=new URL(".",n).href),t(a)})().then((t=>n([["p-183a9160",[[1,"casino-tournament-duration",{startTime:[1,"start-time"],endTime:[1,"end-time"],status:[1],language:[1],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],translationData:[520,"translation-data"],tournamentUntilStartDays:[32],tournamentLeftDays:[32],showRemain:[32],limitStylingAppends:[32],durationInterval:[32]}]]]],t)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,g as s}from"./p-5f4837aa.js";const e={en:{finished:"Finished",starting:"Starting in ",left:"left",minutes:"minutes",hours:"hours",days:"days"},hr:{finished:"Gotovo",starting:"Počinje u ",left:"lijevo",minutes:"minute",hours:"sati",days:"dani"},"zh-hk":{finished:"完成的",starting:"開始於",left:"剩下",minutes:"分鐘",hours:"小時",days:"天"},fr:{finished:"Fini",starting:"Début dans ",left:"restant",minutes:"minutes",hours:"heures",days:"jours"},ro:{finished:"Finalizat",starting:"Începe în",left:"rămase",minutes:"minute",hours:"ore",days:"zile"},tr:{finished:"Sona ermiş",starting:"Başlamasına ",left:"kaldı",minutes:"dakika",hours:"saat",days:"gün"},el:{finished:"Ολοκληρωμένα",starting:"Αρχίζει σε ",left:"απομένουν",minutes:"λεπτά",hours:"ώρες",days:"ημέρες"},es:{finished:"Finalizado",starting:"Iniciando en ",left:"izquierda",minutes:"minutos",hours:"horas",days:"días"},hu:{finished:"Befejezve",starting:"Kezdésig",left:"bal",minutes:"perc",hours:"óra",days:"nap"},pt:{finished:"Finalizado",starting:"Começando em",left:"Abandonou",minutes:"Minutos",hours:"Horas",days:"Dias"}},r=(t,i)=>{var s,r;return(null===(s=e[i])||void 0===s?void 0:s[t])||(null===(r=e.en)||void 0===r?void 0:r[t])},a=class{constructor(i){t(this,i),this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1}watchLanguage(t,i){t&&t!=i&&this.getDuration()}getDateTimeDiff(t,i){return(new Date(i).getTime()-new Date(t).getTime())/6e4}getDuration(){const t=new Date;this.tournamentLeftDays=this.getDateTimeDiff(t,this.endTime),this.tournamentUntilStartDays=this.getDateTimeDiff(t,this.startTime),this.showRemain=this.getTextByDiff(this.tournamentLeftDays)}formatDate(t){let i=new Date(t),s=new Intl.DateTimeFormat(this.language,{month:"long"}).format(i);return`${i.getDate()} ${s}, ${i.toLocaleString("en-GB",{hour:"numeric",minute:"numeric"})}, ${i.getUTCFullYear()}`}getTextByDiff(t){if(t<1440){const i=t%60;return[t/60,i,60*(i-Math.floor(i))].map((t=>(t=>{const i=Math.floor(t);return i<10?`0${i}`:`${i}`})(t))).join(":")}return(t=>t+" "+r("days",this.language))(Math.ceil(t/1440))}getProgress(){if(this.tournamentLeftDays<=0)return 100;const t=this.getDateTimeDiff(this.startTime,this.endTime);return Math.floor(100/t*(t-this.tournamentLeftDays))}componentWillLoad(){var t;this.translationData&&(t=JSON.parse(this.translationData),Object.keys(t).forEach((i=>{for(let s in t[i])e[i][s]=t[i][s]}))),this.startTime&&this.endTime&&(this.getDuration(),this.getTextByDiff(this.tournamentLeftDays)),this.tournamentLeftDays<1440&&this.tournamentLeftDays>0?this.durationInterval=window.setInterval((()=>{this.startTime&&this.endTime&&this.getDuration()}),1e3):clearInterval(this.durationInterval)}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}setClientStyling(){const t=new CSSStyleSheet;t.replace(this.clientStyling),this.host.shadowRoot.adoptedStyleSheets=[...this.host.shadowRoot.adoptedStyleSheets,t]}setClientStylingURL(){let t=new URL(this.clientStylingUrl);fetch(t.href).then((t=>t.text())).then((t=>{const i=new CSSStyleSheet;i.replace(t),this.host.shadowRoot.adoptedStyleSheets=[...this.host.shadowRoot.adoptedStyleSheets,i]}))}render(){if(this.startTime&&this.endTime)return i("div",{class:"TournamentDurationWrap"},i("div",{class:"TournamentDuration"},i("div",{class:"TournamentDates"},i("div",{class:"StartDate",part:"StartDate"},this.formatDate(this.startTime)),i("div",{class:"EndDate",part:"EndDate"},this.formatDate(this.endTime))),i("div",{class:"ProgressBarWrapper"},i("div",{class:"ProgressBar",part:"ProgressBar"},"Finished"==this.status||"Closing"==this.status||"Closed"==this.status?i("div",null,i("div",{class:"ProgressBarFillEnd",part:"ProgressBarFillEnd"}),i("div",{class:"Finished",part:"Finished"},r("finished",this.language))):this.tournamentUntilStartDays>0?i("div",null,i("div",{class:"ProgressBarFillStarting",part:"ProgressBarFillStarting"}),i("div",{class:"Remaining",part:"Remaining"},r("starting",this.language)," ",this.getTextByDiff(this.tournamentUntilStartDays))):i("div",null,i("div",{class:"ProgressBarFill",part:"ProgressBarFill",style:{width:`${this.getProgress()}%`}}),this.tournamentLeftDays>0&&i("div",{class:"Remaining",part:"Remaining"},this.showRemain," ",r("left",this.language)))))))}get host(){return s(this)}static get watchers(){return{language:["watchLanguage"]}}};a.style=":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";export{a as casino_tournament_duration}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),c=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?
|
|
1
|
+
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),c=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?h(null,l):l),o=s)};if(i(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const c=h(e,null);return c.u=t,r.length>0&&(c.$=r),c},h=(e,t)=>({t:0,h:e,i:t,m:null,$:null,u:null}),y={},d=(e,t,n,l,s,o)=>{if(n!==l){let r=H(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=p(n),o=p(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else{const i=f(l);if((r||i&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&o||s)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},m=/\s/,p=e=>e?e.split(m):[],b=(e,t,n,l)=>{const s=11===t.m.nodeType&&t.m.host?t.m.host:t.m,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||d(s,l,o[l],void 0,n,t.t);for(l in r)d(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,i=n.$[l],c=0;if(null!==i.i)o=i.m=s.createTextNode(i.i);else if(o=i.m=s.createElement(i.h),b(null,i,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),i.$)for(c=0;c<i.$.length;++c)r=w(t,i,c),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let i,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=w(null,l,o),i&&(s[o].m=i,c.insertBefore(i,n)))},g=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.m.remove()},j=(e,t)=>e.h===t.h,M=(e,t)=>{const n=t.m=e.m,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,i=t.length-1,c=t[0],u=t[i],a=l.length-1,f=l[0],$=l[a];for(;o<=i&&r<=a;)null==c?c=t[++o]:null==u?u=t[--i]:null==f?f=l[++r]:null==$?$=l[--a]:j(c,f)?(M(c,f),c=t[++o],f=l[++r]):j(u,$)?(M(u,$),u=t[--i],$=l[--a]):j(c,$)?(M(c,$),e.insertBefore(c.m,u.m.nextSibling),c=t[++o],$=l[--a]):j(u,f)?(M(u,f),e.insertBefore(u.m,c.m),u=t[--i],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&c.m.parentNode.insertBefore(s,c.m));o>i?S(e,null==l[a+1]?null:l[a+1].m,n,l,r,a):r>a&&g(t,o,i)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},v=e=>q(e).p,k=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},C=(e,t)=>{if(e.t|=16,!(4&e.t))return k(e,e.g),Y((()=>O(e,t)));e.t|=512},O=(e,t)=>{const n=e.j;let l;return t&&(l=N(n,"componentWillLoad")),R(l,(()=>P(e,n,t)))},P=async(e,t,n)=>{const l=e.p,o=l["s-rc"];n&&(e=>{const t=e.M,n=e.p,l=t.t,o=((e,t)=>{let n=u(t),l=B.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=c.get(e=e.head||e);o||c.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);x(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>E(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},x=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.p,o=n.M,r=n.v||h(null,null),i=(e=>e&&e.h===y)(l)?l:$(null,null,l);t=s.tagName,o.k&&(i.u=i.u||{},o.k.map((([e,t])=>i.u[t]=s[e]))),i.h=null,i.t|=4,n.v=i,i.m=r.m=s.shadowRoot||s,e=s["s-sc"],M(r,i)})(n,l)}catch(e){V(e,n.p)}return null},E=e=>{const t=e.p,n=e.g;N(e.j,"componentDidRender"),64&e.t||(e.t|=64,T(t),e.C(t),n||L()),e.S&&(e.S(),e.S=void 0),512&e.t&&X((()=>C(e,!1))),e.t&=-517},L=()=>{T(s.documentElement),X((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"casino-tournament-duration"}});return e.dispatchEvent(t),t})(l)))},N=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){V(e)}},R=(e,t)=>e&&e.then?e.then(t):t(),T=e=>e.classList.add("hydrated"),W=(e,t,n)=>{if(t.O){e.watchers&&(t.P=e.watchers);const l=Object.entries(t.O),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>q(this).L.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=q(e),o=s.p,r=s.L.get(t),i=s.t,c=s.j;if(n=((e,t)=>null==e||f(e)?e:1&t?e+"":e)(n,l.O[t][0]),(!(8&i)||void 0===r)&&n!==r&&(!Number.isNaN(r)||!Number.isNaN(n))&&(s.L.set(t,n),c)){if(l.P&&128&i){const e=l.P[t];e&&e.map((e=>{try{c[e](n,r,t)}catch(e){V(e,o)}}))}2==(18&i)&&C(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.k.push([e,s]),s}))}}return e},A=(e,t={})=>{const n=[],r=t.exclude||[],c=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),h=[];let y,d=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],O:t[2],N:t[3]};l.O=t[2],l.k=[],l.P={};const s=l.o,a=class extends HTMLElement{constructor(e){super(e),F(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),d?h.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=q(e),n=t.M,l=()=>{};if(!(1&t.t)){t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){k(t,t.g=n);break}}n.O&&Object.entries(n.O).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.P=s.watchers,W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,t.t|=128,e()}if(s.style){let e=s.style;const t=u(n);if(!B.has(t)){const l=()=>{};((e,t,n)=>{let l=B.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,B.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.g,r=()=>C(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return q(this).R}};l.T=e[0],r.includes(s)||c.get(s)||(n.push(s),c.define(s,W(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),d=!1,h.length?h.map((e=>e.connectedCallback())):o.jmp((()=>y=setTimeout(L,30)))},U=new WeakMap,q=e=>U.get(e),D=(e,t)=>U.set(t.j=e,t),F=(e,t)=>{const n={t:0,p:e,M:t,L:new Map};return n.R=new Promise((e=>n.C=e)),e["s-p"]=[],e["s-rc"]=[],U.set(e,n)},H=(e,t)=>t in e,V=(e,t)=>(0,console.error)(e,t),_=new Map,z=e=>{const t=e.o.replace(/-/g,"_"),n=e.T,l=_.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(_.set(n,e),e[t])),V)},B=new Map,G=[],I=[],J=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?X(Q):o.raf(Q))},K=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){V(e)}e.length=0},Q=()=>{K(G),K(I),(n=G.length>0)&&o.raf(Q)},X=e=>r().then(e),Y=J(I,!0);export{A as b,v as g,$ as h,r as p,D as r}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-764d2bff.js');
|
|
6
6
|
|
|
7
7
|
const DEFAULT_LANGUAGE = 'en';
|
|
8
8
|
const TRANSLATIONS = {
|
|
@@ -115,6 +115,11 @@ const CasinoTournamentDuration = class {
|
|
|
115
115
|
this.clientStylingUrl = '';
|
|
116
116
|
this.limitStylingAppends = false;
|
|
117
117
|
}
|
|
118
|
+
watchLanguage(newValue, oldValue) {
|
|
119
|
+
if (newValue && newValue != oldValue) {
|
|
120
|
+
this.getDuration();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
118
123
|
getDateTimeDiff(dateString1, dateString2) {
|
|
119
124
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
120
125
|
}
|
|
@@ -132,7 +137,7 @@ const CasinoTournamentDuration = class {
|
|
|
132
137
|
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
133
138
|
}
|
|
134
139
|
getTextByDiff(diff) {
|
|
135
|
-
const renderText = (amount, type) => amount + ' ' + translate(type);
|
|
140
|
+
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
136
141
|
const renderTimeColumn = (column) => {
|
|
137
142
|
const columnInt = Math.floor(column);
|
|
138
143
|
if (columnInt < 10) {
|
|
@@ -216,6 +221,9 @@ const CasinoTournamentDuration = class {
|
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
get host() { return index.getElement(this); }
|
|
224
|
+
static get watchers() { return {
|
|
225
|
+
"language": ["watchLanguage"]
|
|
226
|
+
}; }
|
|
219
227
|
};
|
|
220
228
|
CasinoTournamentDuration.style = casinoTournamentDurationCss;
|
|
221
229
|
|
|
@@ -727,6 +727,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
727
727
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
728
728
|
// check our new property value against our internal value
|
|
729
729
|
const hostRef = getHostRef(ref);
|
|
730
|
+
const elm = hostRef.$hostElement$ ;
|
|
730
731
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
731
732
|
const flags = hostRef.$flags$;
|
|
732
733
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -739,6 +740,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
739
740
|
// set our new value!
|
|
740
741
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
741
742
|
if (instance) {
|
|
743
|
+
// get an array of method names of watch functions to call
|
|
744
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
745
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
746
|
+
if (watchMethods) {
|
|
747
|
+
// this instance is watching for when this property changed
|
|
748
|
+
watchMethods.map((watchMethodName) => {
|
|
749
|
+
try {
|
|
750
|
+
// fire off each of the watch methods that are watching this property
|
|
751
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
752
|
+
}
|
|
753
|
+
catch (e) {
|
|
754
|
+
consoleError(e, elm);
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
742
759
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
743
760
|
// looks like this value actually changed, so we've got work to do!
|
|
744
761
|
// but only if we've already rendered, otherwise just chill out
|
|
@@ -751,6 +768,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
751
768
|
};
|
|
752
769
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
753
770
|
if (cmpMeta.$members$) {
|
|
771
|
+
if (Cstr.watchers) {
|
|
772
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
773
|
+
}
|
|
754
774
|
// It's better to have a const than two Object.entries()
|
|
755
775
|
const members = Object.entries(cmpMeta.$members$);
|
|
756
776
|
const prototype = Cstr.prototype;
|
|
@@ -858,6 +878,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
858
878
|
endLoad();
|
|
859
879
|
}
|
|
860
880
|
if (!Cstr.isProxied) {
|
|
881
|
+
// we've never proxied this Constructor before
|
|
882
|
+
// let's add the getters/setters to its prototype before
|
|
883
|
+
// the first time we create an instance of the implementation
|
|
884
|
+
{
|
|
885
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
886
|
+
}
|
|
861
887
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
862
888
|
Cstr.isProxied = true;
|
|
863
889
|
}
|
|
@@ -881,6 +907,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
881
907
|
{
|
|
882
908
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
883
909
|
}
|
|
910
|
+
{
|
|
911
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
912
|
+
}
|
|
884
913
|
endNewInstance();
|
|
885
914
|
}
|
|
886
915
|
if (Cstr.style) {
|
|
@@ -983,6 +1012,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
983
1012
|
{
|
|
984
1013
|
cmpMeta.$attrsToReflect$ = [];
|
|
985
1014
|
}
|
|
1015
|
+
{
|
|
1016
|
+
cmpMeta.$watchers$ = {};
|
|
1017
|
+
}
|
|
986
1018
|
const tagName = cmpMeta.$tagName$;
|
|
987
1019
|
const HostElement = class extends HTMLElement {
|
|
988
1020
|
// StencilLazyHost
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Prop, h, State, Element } from '@stencil/core';
|
|
1
|
+
import { Component, Prop, h, State, Element, Watch } from '@stencil/core';
|
|
2
2
|
import { translate, getTranslations } from '../../utils/locale.utils';
|
|
3
3
|
export class CasinoTournamentDuration {
|
|
4
4
|
constructor() {
|
|
@@ -12,6 +12,11 @@ export class CasinoTournamentDuration {
|
|
|
12
12
|
this.clientStylingUrl = '';
|
|
13
13
|
this.limitStylingAppends = false;
|
|
14
14
|
}
|
|
15
|
+
watchLanguage(newValue, oldValue) {
|
|
16
|
+
if (newValue && newValue != oldValue) {
|
|
17
|
+
this.getDuration();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
15
20
|
getDateTimeDiff(dateString1, dateString2) {
|
|
16
21
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
17
22
|
}
|
|
@@ -29,7 +34,7 @@ export class CasinoTournamentDuration {
|
|
|
29
34
|
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
30
35
|
}
|
|
31
36
|
getTextByDiff(diff) {
|
|
32
|
-
const renderText = (amount, type) => amount + ' ' + translate(type);
|
|
37
|
+
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
33
38
|
const renderTimeColumn = (column) => {
|
|
34
39
|
const columnInt = Math.floor(column);
|
|
35
40
|
if (columnInt < 10) {
|
|
@@ -269,4 +274,8 @@ export class CasinoTournamentDuration {
|
|
|
269
274
|
"durationInterval": {}
|
|
270
275
|
}; }
|
|
271
276
|
static get elementRef() { return "host"; }
|
|
277
|
+
static get watchers() { return [{
|
|
278
|
+
"propName": "language",
|
|
279
|
+
"methodName": "watchLanguage"
|
|
280
|
+
}]; }
|
|
272
281
|
}
|
|
@@ -113,6 +113,11 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
113
113
|
this.clientStylingUrl = '';
|
|
114
114
|
this.limitStylingAppends = false;
|
|
115
115
|
}
|
|
116
|
+
watchLanguage(newValue, oldValue) {
|
|
117
|
+
if (newValue && newValue != oldValue) {
|
|
118
|
+
this.getDuration();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
116
121
|
getDateTimeDiff(dateString1, dateString2) {
|
|
117
122
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
118
123
|
}
|
|
@@ -130,7 +135,7 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
130
135
|
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
131
136
|
}
|
|
132
137
|
getTextByDiff(diff) {
|
|
133
|
-
const renderText = (amount, type) => amount + ' ' + translate(type);
|
|
138
|
+
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
134
139
|
const renderTimeColumn = (column) => {
|
|
135
140
|
const columnInt = Math.floor(column);
|
|
136
141
|
if (columnInt < 10) {
|
|
@@ -214,6 +219,9 @@ const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extend
|
|
|
214
219
|
}
|
|
215
220
|
}
|
|
216
221
|
get host() { return this; }
|
|
222
|
+
static get watchers() { return {
|
|
223
|
+
"language": ["watchLanguage"]
|
|
224
|
+
}; }
|
|
217
225
|
static get style() { return casinoTournamentDurationCss; }
|
|
218
226
|
}, [1, "casino-tournament-duration", {
|
|
219
227
|
"startTime": [1, "start-time"],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-4075dde6.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
4
|
const TRANSLATIONS = {
|
|
@@ -111,6 +111,11 @@ const CasinoTournamentDuration = class {
|
|
|
111
111
|
this.clientStylingUrl = '';
|
|
112
112
|
this.limitStylingAppends = false;
|
|
113
113
|
}
|
|
114
|
+
watchLanguage(newValue, oldValue) {
|
|
115
|
+
if (newValue && newValue != oldValue) {
|
|
116
|
+
this.getDuration();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
114
119
|
getDateTimeDiff(dateString1, dateString2) {
|
|
115
120
|
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
116
121
|
}
|
|
@@ -128,7 +133,7 @@ const CasinoTournamentDuration = class {
|
|
|
128
133
|
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
129
134
|
}
|
|
130
135
|
getTextByDiff(diff) {
|
|
131
|
-
const renderText = (amount, type) => amount + ' ' + translate(type);
|
|
136
|
+
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
132
137
|
const renderTimeColumn = (column) => {
|
|
133
138
|
const columnInt = Math.floor(column);
|
|
134
139
|
if (columnInt < 10) {
|
|
@@ -212,6 +217,9 @@ const CasinoTournamentDuration = class {
|
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
get host() { return getElement(this); }
|
|
220
|
+
static get watchers() { return {
|
|
221
|
+
"language": ["watchLanguage"]
|
|
222
|
+
}; }
|
|
215
223
|
};
|
|
216
224
|
CasinoTournamentDuration.style = casinoTournamentDurationCss;
|
|
217
225
|
|
|
@@ -705,6 +705,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
705
705
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
706
706
|
// check our new property value against our internal value
|
|
707
707
|
const hostRef = getHostRef(ref);
|
|
708
|
+
const elm = hostRef.$hostElement$ ;
|
|
708
709
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
709
710
|
const flags = hostRef.$flags$;
|
|
710
711
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -717,6 +718,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
717
718
|
// set our new value!
|
|
718
719
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
719
720
|
if (instance) {
|
|
721
|
+
// get an array of method names of watch functions to call
|
|
722
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
723
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
724
|
+
if (watchMethods) {
|
|
725
|
+
// this instance is watching for when this property changed
|
|
726
|
+
watchMethods.map((watchMethodName) => {
|
|
727
|
+
try {
|
|
728
|
+
// fire off each of the watch methods that are watching this property
|
|
729
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
730
|
+
}
|
|
731
|
+
catch (e) {
|
|
732
|
+
consoleError(e, elm);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
720
737
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
721
738
|
// looks like this value actually changed, so we've got work to do!
|
|
722
739
|
// but only if we've already rendered, otherwise just chill out
|
|
@@ -729,6 +746,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
729
746
|
};
|
|
730
747
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
731
748
|
if (cmpMeta.$members$) {
|
|
749
|
+
if (Cstr.watchers) {
|
|
750
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
751
|
+
}
|
|
732
752
|
// It's better to have a const than two Object.entries()
|
|
733
753
|
const members = Object.entries(cmpMeta.$members$);
|
|
734
754
|
const prototype = Cstr.prototype;
|
|
@@ -836,6 +856,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
836
856
|
endLoad();
|
|
837
857
|
}
|
|
838
858
|
if (!Cstr.isProxied) {
|
|
859
|
+
// we've never proxied this Constructor before
|
|
860
|
+
// let's add the getters/setters to its prototype before
|
|
861
|
+
// the first time we create an instance of the implementation
|
|
862
|
+
{
|
|
863
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
864
|
+
}
|
|
839
865
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
840
866
|
Cstr.isProxied = true;
|
|
841
867
|
}
|
|
@@ -859,6 +885,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
859
885
|
{
|
|
860
886
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
861
887
|
}
|
|
888
|
+
{
|
|
889
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
890
|
+
}
|
|
862
891
|
endNewInstance();
|
|
863
892
|
}
|
|
864
893
|
if (Cstr.style) {
|
|
@@ -961,6 +990,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
961
990
|
{
|
|
962
991
|
cmpMeta.$attrsToReflect$ = [];
|
|
963
992
|
}
|
|
993
|
+
{
|
|
994
|
+
cmpMeta.$watchers$ = {};
|
|
995
|
+
}
|
|
964
996
|
const tagName = cmpMeta.$tagName$;
|
|
965
997
|
const HostElement = class extends HTMLElement {
|
|
966
998
|
// StencilLazyHost
|
package/dist/esm/loader.js
CHANGED
|
@@ -33,6 +33,7 @@ export declare class CasinoTournamentDuration {
|
|
|
33
33
|
limitStylingAppends: boolean;
|
|
34
34
|
durationInterval: number;
|
|
35
35
|
host: HTMLElement;
|
|
36
|
+
watchLanguage(newValue: string, oldValue: string): void;
|
|
36
37
|
getDateTimeDiff(dateString1: any, dateString2: string): number;
|
|
37
38
|
getDuration(): void;
|
|
38
39
|
formatDate(date: string): string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,g as s}from"./p-0fd13b12.js";const e={en:{finished:"Finished",starting:"Starting in ",left:"left",minutes:"minutes",hours:"hours",days:"days"},hr:{finished:"Gotovo",starting:"Počinje u ",left:"lijevo",minutes:"minute",hours:"sati",days:"dani"},"zh-hk":{finished:"完成的",starting:"開始於",left:"剩下",minutes:"分鐘",hours:"小時",days:"天"},fr:{finished:"Fini",starting:"Début dans ",left:"restant",minutes:"minutes",hours:"heures",days:"jours"},ro:{finished:"Finalizat",starting:"Începe în",left:"rămase",minutes:"minute",hours:"ore",days:"zile"},tr:{finished:"Sona ermiş",starting:"Başlamasına ",left:"kaldı",minutes:"dakika",hours:"saat",days:"gün"},el:{finished:"Ολοκληρωμένα",starting:"Αρχίζει σε ",left:"απομένουν",minutes:"λεπτά",hours:"ώρες",days:"ημέρες"},es:{finished:"Finalizado",starting:"Iniciando en ",left:"izquierda",minutes:"minutos",hours:"horas",days:"días"},hu:{finished:"Befejezve",starting:"Kezdésig",left:"bal",minutes:"perc",hours:"óra",days:"nap"},pt:{finished:"Finalizado",starting:"Começando em",left:"Abandonou",minutes:"Minutos",hours:"Horas",days:"Dias"}},r=(t,i)=>{var s,r;return(null===(s=e[i])||void 0===s?void 0:s[t])||(null===(r=e.en)||void 0===r?void 0:r[t])},n=class{constructor(i){t(this,i),this.clientStyling="",this.clientStylingUrl="",this.limitStylingAppends=!1}getDateTimeDiff(t,i){return(new Date(i).getTime()-new Date(t).getTime())/6e4}getDuration(){const t=new Date;this.tournamentLeftDays=this.getDateTimeDiff(t,this.endTime),this.tournamentUntilStartDays=this.getDateTimeDiff(t,this.startTime),this.showRemain=this.getTextByDiff(this.tournamentLeftDays)}formatDate(t){let i=new Date(t),s=new Intl.DateTimeFormat(this.language,{month:"long"}).format(i);return`${i.getDate()} ${s}, ${i.toLocaleString("en-GB",{hour:"numeric",minute:"numeric"})}, ${i.getUTCFullYear()}`}getTextByDiff(t){if(t<1440){const i=t%60;return[t/60,i,60*(i-Math.floor(i))].map((t=>(t=>{const i=Math.floor(t);return i<10?`0${i}`:`${i}`})(t))).join(":")}return Math.ceil(t/1440)+" "+r("days")}getProgress(){if(this.tournamentLeftDays<=0)return 100;const t=this.getDateTimeDiff(this.startTime,this.endTime);return Math.floor(100/t*(t-this.tournamentLeftDays))}componentWillLoad(){var t;this.translationData&&(t=JSON.parse(this.translationData),Object.keys(t).forEach((i=>{for(let s in t[i])e[i][s]=t[i][s]}))),this.startTime&&this.endTime&&(this.getDuration(),this.getTextByDiff(this.tournamentLeftDays)),this.tournamentLeftDays<1440&&this.tournamentLeftDays>0?this.durationInterval=window.setInterval((()=>{this.startTime&&this.endTime&&this.getDuration()}),1e3):clearInterval(this.durationInterval)}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}setClientStyling(){const t=new CSSStyleSheet;t.replace(this.clientStyling),this.host.shadowRoot.adoptedStyleSheets=[...this.host.shadowRoot.adoptedStyleSheets,t]}setClientStylingURL(){let t=new URL(this.clientStylingUrl);fetch(t.href).then((t=>t.text())).then((t=>{const i=new CSSStyleSheet;i.replace(t),this.host.shadowRoot.adoptedStyleSheets=[...this.host.shadowRoot.adoptedStyleSheets,i]}))}render(){if(this.startTime&&this.endTime)return i("div",{class:"TournamentDurationWrap"},i("div",{class:"TournamentDuration"},i("div",{class:"TournamentDates"},i("div",{class:"StartDate",part:"StartDate"},this.formatDate(this.startTime)),i("div",{class:"EndDate",part:"EndDate"},this.formatDate(this.endTime))),i("div",{class:"ProgressBarWrapper"},i("div",{class:"ProgressBar",part:"ProgressBar"},"Finished"==this.status||"Closing"==this.status||"Closed"==this.status?i("div",null,i("div",{class:"ProgressBarFillEnd",part:"ProgressBarFillEnd"}),i("div",{class:"Finished",part:"Finished"},r("finished",this.language))):this.tournamentUntilStartDays>0?i("div",null,i("div",{class:"ProgressBarFillStarting",part:"ProgressBarFillStarting"}),i("div",{class:"Remaining",part:"Remaining"},r("starting",this.language)," ",this.getTextByDiff(this.tournamentUntilStartDays))):i("div",null,i("div",{class:"ProgressBarFill",part:"ProgressBarFill",style:{width:`${this.getProgress()}%`}}),this.tournamentLeftDays>0&&i("div",{class:"Remaining",part:"Remaining"},this.showRemain," ",r("left",this.language)))))))}get host(){return s(this)}};n.style=":host{display:block}.TournamentDates{display:flex;justify-content:space-between}.StartDate{font-size:10px;font-weight:700;color:var(--emfe-w-color-gray-300, #58586B)}.EndDate{font-size:10px;font-weight:700;align-content:flex-end;color:var(--emfe-w-color-gray-300, #58586B)}.ProgressBar{margin:5px 0;height:8px;background:var(--emfe-w-color-white, #FFFFFF)}.ProgressBarInactive{margin:5px 20px 10px 20px;height:8px;background:var(--emfe-w-color-gray-100, #E6E6E6)}.ProgressBarFill{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillEnd{background-color:var(--emfe-w-color-green, #48952a);height:8px}.ProgressBarFillStarting{background-color:var(--emfe-w-color-gray-300, #58586B);height:8px}.Remaining,.Finished{font-size:10px;font-weight:700;padding-top:6px;text-align:right;text-transform:uppercase}.Finished{color:var(--emfe-w-color-green, #48952a)}";export{n as casino_tournament_duration}
|