@everymatrix/casino-tournament-duration 1.44.0 → 1.45.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-57ef1124.js +2 -0
- package/dist/casino-tournament-duration/p-b0ea5595.entry.js +1 -0
- package/dist/casino-tournament-duration/p-e1255160.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-tournament-duration.cjs.entry.js +205 -201
- package/dist/cjs/casino-tournament-duration.cjs.js +17 -11
- package/dist/cjs/index-5302010b.js +1201 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +263 -268
- package/dist/collection/components/casino-tournament-duration/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +88 -88
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-tournament-duration.entry.js +205 -201
- package/dist/esm/casino-tournament-duration.js +14 -11
- package/dist/esm/index-2af9ace7.js +1174 -0
- package/dist/esm/loader.js +7 -13
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +45 -45
- package/dist/types/components/casino-tournament-duration/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/casino-tournament-duration/p-183a9160.entry.js +0 -1
- package/dist/casino-tournament-duration/p-5f4837aa.js +0 -1
- package/dist/cjs/index-764d2bff.js +0 -1170
- package/dist/components/casino-tournament-duration.d.ts +0 -11
- package/dist/components/casino-tournament-duration.js +0 -257
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/index-4075dde6.js +0 -1144
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-duration/.stencil/packages/casino-tournament-duration/stencil.config.d.ts +0 -2
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface CasinoTournamentDuration extends Components.CasinoTournamentDuration, HTMLElement {}
|
|
4
|
-
export const CasinoTournamentDuration: {
|
|
5
|
-
prototype: CasinoTournamentDuration;
|
|
6
|
-
new (): CasinoTournamentDuration;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
-
const TRANSLATIONS = {
|
|
5
|
-
en: {
|
|
6
|
-
finished: 'Finished',
|
|
7
|
-
starting: 'Starting in ',
|
|
8
|
-
left: 'left',
|
|
9
|
-
minutes: 'minutes',
|
|
10
|
-
hours: 'hours',
|
|
11
|
-
days: 'days',
|
|
12
|
-
},
|
|
13
|
-
hr: {
|
|
14
|
-
finished: 'Gotovo',
|
|
15
|
-
starting: 'Počinje u ',
|
|
16
|
-
left: 'lijevo',
|
|
17
|
-
minutes: 'minute',
|
|
18
|
-
hours: 'sati',
|
|
19
|
-
days: 'dani',
|
|
20
|
-
},
|
|
21
|
-
'zh-hk': {
|
|
22
|
-
finished: '完成的',
|
|
23
|
-
starting: '開始於',
|
|
24
|
-
left: '剩下',
|
|
25
|
-
minutes: '分鐘',
|
|
26
|
-
hours: '小時',
|
|
27
|
-
days: '天',
|
|
28
|
-
},
|
|
29
|
-
fr: {
|
|
30
|
-
finished: 'Fini',
|
|
31
|
-
starting: 'Début dans ',
|
|
32
|
-
left: 'restant',
|
|
33
|
-
minutes: 'minutes',
|
|
34
|
-
hours: 'heures',
|
|
35
|
-
days: 'jours',
|
|
36
|
-
},
|
|
37
|
-
ro: {
|
|
38
|
-
finished: 'Finalizat',
|
|
39
|
-
starting: 'Începe în',
|
|
40
|
-
left: 'rămase',
|
|
41
|
-
minutes: 'minute',
|
|
42
|
-
hours: 'ore',
|
|
43
|
-
days: 'zile',
|
|
44
|
-
},
|
|
45
|
-
tr: {
|
|
46
|
-
finished: 'Sona ermiş',
|
|
47
|
-
starting: 'Başlamasına ',
|
|
48
|
-
left: 'kaldı',
|
|
49
|
-
minutes: 'dakika',
|
|
50
|
-
hours: 'saat',
|
|
51
|
-
days: 'gün',
|
|
52
|
-
},
|
|
53
|
-
el: {
|
|
54
|
-
finished: 'Ολοκληρωμένα',
|
|
55
|
-
starting: 'Αρχίζει σε ',
|
|
56
|
-
left: 'απομένουν',
|
|
57
|
-
minutes: 'λεπτά',
|
|
58
|
-
hours: 'ώρες',
|
|
59
|
-
days: 'ημέρες',
|
|
60
|
-
},
|
|
61
|
-
es: {
|
|
62
|
-
finished: 'Finalizado',
|
|
63
|
-
starting: 'Iniciando en ',
|
|
64
|
-
left: 'izquierda',
|
|
65
|
-
minutes: 'minutos',
|
|
66
|
-
hours: 'horas',
|
|
67
|
-
days: 'días',
|
|
68
|
-
},
|
|
69
|
-
hu: {
|
|
70
|
-
finished: 'Befejezve',
|
|
71
|
-
starting: 'Kezdésig',
|
|
72
|
-
left: 'bal',
|
|
73
|
-
minutes: 'perc',
|
|
74
|
-
hours: 'óra',
|
|
75
|
-
days: 'nap',
|
|
76
|
-
},
|
|
77
|
-
pt: {
|
|
78
|
-
finished: 'Finalizado',
|
|
79
|
-
starting: 'Começando em',
|
|
80
|
-
left: 'Abandonou',
|
|
81
|
-
minutes: 'Minutos',
|
|
82
|
-
hours: 'Horas',
|
|
83
|
-
days: 'Dias',
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const translate = (key, customLang) => {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
const lang = customLang;
|
|
89
|
-
return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
|
|
90
|
-
};
|
|
91
|
-
const getTranslations = (data) => {
|
|
92
|
-
Object.keys(data).forEach((item) => {
|
|
93
|
-
for (let key in data[item]) {
|
|
94
|
-
TRANSLATIONS[item][key] = data[item][key];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
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)}";
|
|
100
|
-
|
|
101
|
-
const CasinoTournamentDuration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
102
|
-
constructor() {
|
|
103
|
-
super();
|
|
104
|
-
this.__registerHost();
|
|
105
|
-
this.__attachShadow();
|
|
106
|
-
/**
|
|
107
|
-
* Client custom styling via inline styles
|
|
108
|
-
*/
|
|
109
|
-
this.clientStyling = '';
|
|
110
|
-
/**
|
|
111
|
-
* Client custom styling via url
|
|
112
|
-
*/
|
|
113
|
-
this.clientStylingUrl = '';
|
|
114
|
-
this.limitStylingAppends = false;
|
|
115
|
-
}
|
|
116
|
-
watchLanguage(newValue, oldValue) {
|
|
117
|
-
if (newValue && newValue != oldValue) {
|
|
118
|
-
this.getDuration();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
getDateTimeDiff(dateString1, dateString2) {
|
|
122
|
-
return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
|
|
123
|
-
}
|
|
124
|
-
getDuration() {
|
|
125
|
-
const dateNow = new Date();
|
|
126
|
-
this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
|
|
127
|
-
this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
|
|
128
|
-
this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
|
|
129
|
-
}
|
|
130
|
-
formatDate(date) {
|
|
131
|
-
const dateOptions = { month: 'long' };
|
|
132
|
-
let currentDate = new Date(date);
|
|
133
|
-
let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
|
|
134
|
-
let currentDay = currentDate.getDate();
|
|
135
|
-
return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
|
|
136
|
-
}
|
|
137
|
-
getTextByDiff(diff) {
|
|
138
|
-
const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
|
|
139
|
-
const renderTimeColumn = (column) => {
|
|
140
|
-
const columnInt = Math.floor(column);
|
|
141
|
-
if (columnInt < 10) {
|
|
142
|
-
return `0${columnInt}`;
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
return `${columnInt}`;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
if (diff < 1440) {
|
|
149
|
-
const hours = diff / 60;
|
|
150
|
-
const minutes = diff % 60;
|
|
151
|
-
const seconds = (minutes - Math.floor(minutes)) * 60;
|
|
152
|
-
return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
|
|
153
|
-
}
|
|
154
|
-
return renderText(Math.ceil(diff / (60 * 24)), 'days');
|
|
155
|
-
}
|
|
156
|
-
getProgress() {
|
|
157
|
-
if (this.tournamentLeftDays <= 0)
|
|
158
|
-
return 100;
|
|
159
|
-
const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
|
|
160
|
-
const step = 100 / tournamentDuration;
|
|
161
|
-
const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
|
|
162
|
-
return width;
|
|
163
|
-
}
|
|
164
|
-
componentWillLoad() {
|
|
165
|
-
if (this.translationData) {
|
|
166
|
-
getTranslations(JSON.parse(this.translationData));
|
|
167
|
-
}
|
|
168
|
-
if (this.startTime && this.endTime) {
|
|
169
|
-
this.getDuration();
|
|
170
|
-
this.getTextByDiff(this.tournamentLeftDays);
|
|
171
|
-
}
|
|
172
|
-
if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
|
|
173
|
-
this.durationInterval = window.setInterval(() => {
|
|
174
|
-
if (this.startTime && this.endTime) {
|
|
175
|
-
this.getDuration();
|
|
176
|
-
}
|
|
177
|
-
}, 1000);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
clearInterval(this.durationInterval);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
componentDidRender() {
|
|
184
|
-
if (!this.limitStylingAppends && this.host) {
|
|
185
|
-
if (this.clientStyling)
|
|
186
|
-
this.setClientStyling();
|
|
187
|
-
if (this.clientStylingUrl)
|
|
188
|
-
this.setClientStylingURL();
|
|
189
|
-
this.limitStylingAppends = true;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
setClientStyling() {
|
|
193
|
-
const sheet = new CSSStyleSheet();
|
|
194
|
-
// @ts-ignore
|
|
195
|
-
sheet.replace(this.clientStyling);
|
|
196
|
-
// @ts-ignore
|
|
197
|
-
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
198
|
-
}
|
|
199
|
-
setClientStylingURL() {
|
|
200
|
-
let url = new URL(this.clientStylingUrl);
|
|
201
|
-
fetch(url.href)
|
|
202
|
-
.then((res) => res.text())
|
|
203
|
-
.then((data) => {
|
|
204
|
-
const sheet = new CSSStyleSheet();
|
|
205
|
-
// @ts-ignore
|
|
206
|
-
sheet.replace(data);
|
|
207
|
-
// @ts-ignore
|
|
208
|
-
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
render() {
|
|
212
|
-
if (this.startTime && this.endTime) {
|
|
213
|
-
return h("div", { class: "TournamentDurationWrap" }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { class: "ProgressBarWrapper" }, h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
|
|
214
|
-
h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
|
|
215
|
-
this.tournamentUntilStartDays > 0 ?
|
|
216
|
-
h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
|
|
217
|
-
h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
|
|
218
|
-
h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
get host() { return this; }
|
|
222
|
-
static get watchers() { return {
|
|
223
|
-
"language": ["watchLanguage"]
|
|
224
|
-
}; }
|
|
225
|
-
static get style() { return casinoTournamentDurationCss; }
|
|
226
|
-
}, [1, "casino-tournament-duration", {
|
|
227
|
-
"startTime": [1, "start-time"],
|
|
228
|
-
"endTime": [1, "end-time"],
|
|
229
|
-
"status": [1],
|
|
230
|
-
"language": [1],
|
|
231
|
-
"clientStyling": [1, "client-styling"],
|
|
232
|
-
"clientStylingUrl": [1, "client-styling-url"],
|
|
233
|
-
"translationData": [520, "translation-data"],
|
|
234
|
-
"tournamentUntilStartDays": [32],
|
|
235
|
-
"tournamentLeftDays": [32],
|
|
236
|
-
"showRemain": [32],
|
|
237
|
-
"limitStylingAppends": [32],
|
|
238
|
-
"durationInterval": [32]
|
|
239
|
-
}]);
|
|
240
|
-
function defineCustomElement$1() {
|
|
241
|
-
if (typeof customElements === "undefined") {
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
const components = ["casino-tournament-duration"];
|
|
245
|
-
components.forEach(tagName => { switch (tagName) {
|
|
246
|
-
case "casino-tournament-duration":
|
|
247
|
-
if (!customElements.get(tagName)) {
|
|
248
|
-
customElements.define(tagName, CasinoTournamentDuration$1);
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
} });
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const CasinoTournamentDuration = CasinoTournamentDuration$1;
|
|
255
|
-
const defineCustomElement = defineCustomElement$1;
|
|
256
|
-
|
|
257
|
-
export { CasinoTournamentDuration, defineCustomElement };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/* CasinoTournamentDuration custom elements */
|
|
2
|
-
|
|
3
|
-
import type { Components, JSX } from "../types/components";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Used to manually set the base path where assets can be found.
|
|
7
|
-
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
-
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
-
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
-
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
-
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
-
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
-
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
-
*/
|
|
15
|
-
export declare const setAssetPath: (path: string) => void;
|
|
16
|
-
|
|
17
|
-
export interface SetPlatformOptions {
|
|
18
|
-
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
-
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
-
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
-
|
|
24
|
-
export type { Components, JSX };
|
|
25
|
-
|
|
26
|
-
export * from '../types';
|
package/dist/components/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|