@everymatrix/casino-tournament-duration 1.32.4 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/casino-tournament-duration/casino-tournament-duration.esm.js +1 -0
- package/dist/casino-tournament-duration/index.esm.js +0 -0
- package/dist/casino-tournament-duration/p-0fd13b12.js +1 -0
- package/dist/casino-tournament-duration/p-a7d04af2.entry.js +1 -0
- package/dist/cjs/casino-tournament-duration.cjs.entry.js +222 -0
- package/dist/cjs/casino-tournament-duration.cjs.js +19 -0
- package/dist/cjs/index-5642eca0.js +1138 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.css +60 -0
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +272 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +95 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/components/casino-tournament-duration.d.ts +11 -0
- package/dist/components/casino-tournament-duration.js +249 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/casino-tournament-duration.entry.js +218 -0
- package/dist/esm/casino-tournament-duration.js +17 -0
- package/dist/esm/index-53cc9b80.js +1112 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-duration/.stencil/packages/casino-tournament-duration/stencil.config.d.ts +2 -0
- package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +46 -0
- package/dist/types/components.d.ts +93 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,b as n}from"./p-0fd13b12.js";(()=>{const n=import.meta.url,a={};return""!==n&&(a.resourcesUrl=new URL(".",n).href),t(a)})().then((t=>n([["p-a7d04af2",[[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)));
|
|
File without changes
|
|
@@ -0,0 +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?d(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=d(e,null);return c.u=t,r.length>0&&(c.$=r),c},d=(e,t)=>({t:0,h:e,i:t,m:null,$:null,u:null}),h={},y=(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||y(s,l,o[l],void 0,n,t.t);for(l in r)y(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||d(null,null),i=(e=>e&&e.h===h)(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){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).P.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=q(e),o=s.P.get(t),r=s.t,i=s.j;n=((e,t)=>null==e||f(e)?e:1&t?e+"":e)(n,l.O[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.P.set(t,n),i&&2==(18&r)&&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"),d=[];let h,y=!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],L:t[3]};l.O=t[2],l.k=[];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),F(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.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||(W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,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).N}};l.R=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),y=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=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,P:new Map};return n.N=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.R,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}
|
|
@@ -0,0 +1 @@
|
|
|
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}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-5642eca0.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const TRANSLATIONS = {
|
|
9
|
+
en: {
|
|
10
|
+
finished: 'Finished',
|
|
11
|
+
starting: 'Starting in ',
|
|
12
|
+
left: 'left',
|
|
13
|
+
minutes: 'minutes',
|
|
14
|
+
hours: 'hours',
|
|
15
|
+
days: 'days',
|
|
16
|
+
},
|
|
17
|
+
hr: {
|
|
18
|
+
finished: 'Gotovo',
|
|
19
|
+
starting: 'Počinje u ',
|
|
20
|
+
left: 'lijevo',
|
|
21
|
+
minutes: 'minute',
|
|
22
|
+
hours: 'sati',
|
|
23
|
+
days: 'dani',
|
|
24
|
+
},
|
|
25
|
+
'zh-hk': {
|
|
26
|
+
finished: '完成的',
|
|
27
|
+
starting: '開始於',
|
|
28
|
+
left: '剩下',
|
|
29
|
+
minutes: '分鐘',
|
|
30
|
+
hours: '小時',
|
|
31
|
+
days: '天',
|
|
32
|
+
},
|
|
33
|
+
fr: {
|
|
34
|
+
finished: 'Fini',
|
|
35
|
+
starting: 'Début dans ',
|
|
36
|
+
left: 'restant',
|
|
37
|
+
minutes: 'minutes',
|
|
38
|
+
hours: 'heures',
|
|
39
|
+
days: 'jours',
|
|
40
|
+
},
|
|
41
|
+
ro: {
|
|
42
|
+
finished: 'Finalizat',
|
|
43
|
+
starting: 'Începe în',
|
|
44
|
+
left: 'rămase',
|
|
45
|
+
minutes: 'minute',
|
|
46
|
+
hours: 'ore',
|
|
47
|
+
days: 'zile',
|
|
48
|
+
},
|
|
49
|
+
tr: {
|
|
50
|
+
finished: 'Sona ermiş',
|
|
51
|
+
starting: 'Başlamasına ',
|
|
52
|
+
left: 'kaldı',
|
|
53
|
+
minutes: 'dakika',
|
|
54
|
+
hours: 'saat',
|
|
55
|
+
days: 'gün',
|
|
56
|
+
},
|
|
57
|
+
el: {
|
|
58
|
+
finished: 'Ολοκληρωμένα',
|
|
59
|
+
starting: 'Αρχίζει σε ',
|
|
60
|
+
left: 'απομένουν',
|
|
61
|
+
minutes: 'λεπτά',
|
|
62
|
+
hours: 'ώρες',
|
|
63
|
+
days: 'ημέρες',
|
|
64
|
+
},
|
|
65
|
+
es: {
|
|
66
|
+
finished: 'Finalizado',
|
|
67
|
+
starting: 'Iniciando en ',
|
|
68
|
+
left: 'izquierda',
|
|
69
|
+
minutes: 'minutos',
|
|
70
|
+
hours: 'horas',
|
|
71
|
+
days: 'días',
|
|
72
|
+
},
|
|
73
|
+
hu: {
|
|
74
|
+
finished: 'Befejezve',
|
|
75
|
+
starting: 'Kezdésig',
|
|
76
|
+
left: 'bal',
|
|
77
|
+
minutes: 'perc',
|
|
78
|
+
hours: 'óra',
|
|
79
|
+
days: 'nap',
|
|
80
|
+
},
|
|
81
|
+
pt: {
|
|
82
|
+
finished: 'Finalizado',
|
|
83
|
+
starting: 'Começando em',
|
|
84
|
+
left: 'Abandonou',
|
|
85
|
+
minutes: 'Minutos',
|
|
86
|
+
hours: 'Horas',
|
|
87
|
+
days: 'Dias',
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const translate = (key, customLang) => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
const lang = customLang;
|
|
93
|
+
return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
|
|
94
|
+
};
|
|
95
|
+
const getTranslations = (data) => {
|
|
96
|
+
Object.keys(data).forEach((item) => {
|
|
97
|
+
for (let key in data[item]) {
|
|
98
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const casinoTournamentDurationCss = ":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)}";
|
|
104
|
+
|
|
105
|
+
const CasinoTournamentDuration = class {
|
|
106
|
+
constructor(hostRef) {
|
|
107
|
+
index.registerInstance(this, hostRef);
|
|
108
|
+
/**
|
|
109
|
+
* Client custom styling via inline styles
|
|
110
|
+
*/
|
|
111
|
+
this.clientStyling = '';
|
|
112
|
+
/**
|
|
113
|
+
* Client custom styling via url
|
|
114
|
+
*/
|
|
115
|
+
this.clientStylingUrl = '';
|
|
116
|
+
this.limitStylingAppends = false;
|
|
117
|
+
}
|
|
118
|
+
getDateTimeDiff(dateString1, dateString2) {
|
|
119
|
+
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
120
|
+
}
|
|
121
|
+
getDuration() {
|
|
122
|
+
const dateNow = new Date();
|
|
123
|
+
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
124
|
+
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
125
|
+
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
126
|
+
}
|
|
127
|
+
formatDate(date) {
|
|
128
|
+
const dateOptions = { month: 'long' };
|
|
129
|
+
let currentDate = new Date(date);
|
|
130
|
+
let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
|
|
131
|
+
let currentDay = currentDate.getDate();
|
|
132
|
+
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
133
|
+
}
|
|
134
|
+
getTextByDiff(diff) {
|
|
135
|
+
const renderText = (amount, type) => amount + ' ' + translate(type);
|
|
136
|
+
const renderTimeColumn = (column) => {
|
|
137
|
+
const columnInt = Math.floor(column);
|
|
138
|
+
if (columnInt < 10) {
|
|
139
|
+
return `0${columnInt}`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return `${columnInt}`;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
if (diff < 1440) {
|
|
146
|
+
const hours = diff / 60;
|
|
147
|
+
const minutes = diff % 60;
|
|
148
|
+
const seconds = (minutes - Math.floor(minutes)) * 60;
|
|
149
|
+
return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
|
|
150
|
+
}
|
|
151
|
+
return renderText(Math.ceil(diff / (60 * 24)), 'days');
|
|
152
|
+
}
|
|
153
|
+
getProgress() {
|
|
154
|
+
if (this.tournamentLeftDays <= 0)
|
|
155
|
+
return 100;
|
|
156
|
+
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
157
|
+
const step = 100 / tournamentDuration;
|
|
158
|
+
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
159
|
+
return width;
|
|
160
|
+
}
|
|
161
|
+
componentWillLoad() {
|
|
162
|
+
if (this.translationData) {
|
|
163
|
+
getTranslations(JSON.parse(this.translationData));
|
|
164
|
+
}
|
|
165
|
+
if (this.startTime && this.endTime) {
|
|
166
|
+
this.getDuration();
|
|
167
|
+
this.getTextByDiff(this.tournamentLeftDays);
|
|
168
|
+
}
|
|
169
|
+
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
170
|
+
this.durationInterval = window.setInterval(() => {
|
|
171
|
+
if (this.startTime && this.endTime) {
|
|
172
|
+
this.getDuration();
|
|
173
|
+
}
|
|
174
|
+
}, 1000);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
clearInterval(this.durationInterval);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
componentDidRender() {
|
|
181
|
+
if (!this.limitStylingAppends && this.host) {
|
|
182
|
+
if (this.clientStyling)
|
|
183
|
+
this.setClientStyling();
|
|
184
|
+
if (this.clientStylingUrl)
|
|
185
|
+
this.setClientStylingURL();
|
|
186
|
+
this.limitStylingAppends = true;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
setClientStyling() {
|
|
190
|
+
const sheet = new CSSStyleSheet();
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
sheet.replace(this.clientStyling);
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
195
|
+
}
|
|
196
|
+
setClientStylingURL() {
|
|
197
|
+
let url = new URL(this.clientStylingUrl);
|
|
198
|
+
fetch(url.href)
|
|
199
|
+
.then((res) => res.text())
|
|
200
|
+
.then((data) => {
|
|
201
|
+
const sheet = new CSSStyleSheet();
|
|
202
|
+
// @ts-ignore
|
|
203
|
+
sheet.replace(data);
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
render() {
|
|
209
|
+
if (this.startTime && this.endTime) {
|
|
210
|
+
return index.h("div", { class: "TournamentDurationWrap" }, index.h("div", { class: "TournamentDuration" }, index.h("div", { class: "TournamentDates" }, index.h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), index.h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), index.h("div", { class: "ProgressBarWrapper" }, index.h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
211
|
+
index.h("div", null, index.h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), index.h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
212
|
+
this.tournamentUntilStartDays > 0 ?
|
|
213
|
+
index.h("div", null, index.h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), index.h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
214
|
+
index.h("div", null, index.h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
215
|
+
index.h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
get host() { return index.getElement(this); }
|
|
219
|
+
};
|
|
220
|
+
CasinoTournamentDuration.style = casinoTournamentDurationCss;
|
|
221
|
+
|
|
222
|
+
exports.casino_tournament_duration = CasinoTournamentDuration;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-5642eca0.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('casino-tournament-duration.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["casino-tournament-duration.cjs",[[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]}]]]], options);
|
|
19
|
+
});
|