@everymatrix/casino-tournament-duration 1.0.69

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.
Files changed (44) hide show
  1. package/dist/casino-tournament-duration/casino-tournament-duration.esm.js +1 -0
  2. package/dist/casino-tournament-duration/index.esm.js +0 -0
  3. package/dist/casino-tournament-duration/p-57ef1124.js +2 -0
  4. package/dist/casino-tournament-duration/p-b0ea5595.entry.js +1 -0
  5. package/dist/casino-tournament-duration/p-e1255160.js +1 -0
  6. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  7. package/dist/cjs/casino-tournament-duration.cjs.entry.js +234 -0
  8. package/dist/cjs/casino-tournament-duration.cjs.js +25 -0
  9. package/dist/cjs/index-5302010b.js +1201 -0
  10. package/dist/cjs/index.cjs.js +2 -0
  11. package/dist/cjs/loader.cjs.js +15 -0
  12. package/dist/collection/collection-manifest.json +12 -0
  13. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.css +60 -0
  14. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +276 -0
  15. package/dist/collection/components/casino-tournament-duration/index.js +1 -0
  16. package/dist/collection/index.js +1 -0
  17. package/dist/collection/utils/locale.utils.js +95 -0
  18. package/dist/collection/utils/utils.js +3 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/casino-tournament-duration.entry.js +230 -0
  21. package/dist/esm/casino-tournament-duration.js +20 -0
  22. package/dist/esm/index-2af9ace7.js +1174 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +11 -0
  25. package/dist/index.cjs.js +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/stencil.config.dev.js +17 -0
  28. package/dist/stencil.config.js +17 -0
  29. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.d.ts +2 -0
  30. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/casino-tournament-duration/.stencil/packages/stencil/casino-tournament-duration/stencil.config.dev.d.ts +2 -0
  31. package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +47 -0
  32. package/dist/types/components/casino-tournament-duration/index.d.ts +1 -0
  33. package/dist/types/components.d.ts +93 -0
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  36. package/dist/types/utils/locale.utils.d.ts +2 -0
  37. package/dist/types/utils/utils.d.ts +1 -0
  38. package/loader/cdn.js +1 -0
  39. package/loader/index.cjs.js +1 -0
  40. package/loader/index.d.ts +24 -0
  41. package/loader/index.es2017.js +1 -0
  42. package/loader/index.js +2 -0
  43. package/loader/package.json +11 -0
  44. package/package.json +26 -0
@@ -0,0 +1,230 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-2af9ace7.js';
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
+ const CasinoTournamentDurationStyle0 = casinoTournamentDurationCss;
101
+
102
+ const CasinoTournamentDuration = class {
103
+ constructor(hostRef) {
104
+ registerInstance(this, hostRef);
105
+ this.startTime = undefined;
106
+ this.endTime = undefined;
107
+ this.status = undefined;
108
+ this.language = undefined;
109
+ this.clientStyling = '';
110
+ this.clientStylingUrl = '';
111
+ this.translationData = undefined;
112
+ this.tournamentUntilStartDays = undefined;
113
+ this.tournamentLeftDays = undefined;
114
+ this.showRemain = undefined;
115
+ this.limitStylingAppends = false;
116
+ this.durationInterval = undefined;
117
+ }
118
+ watchLanguage(newValue, oldValue) {
119
+ if (newValue && newValue != oldValue) {
120
+ this.getDuration();
121
+ }
122
+ }
123
+ getDateTimeDiff(dateString1, dateString2) {
124
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
125
+ }
126
+ getDuration() {
127
+ const dateNow = new Date();
128
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
129
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
130
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
131
+ }
132
+ formatDate(date) {
133
+ const dateOptions = { month: 'long' };
134
+ let currentDate = new Date(date);
135
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
136
+ let currentDay = currentDate.getDate();
137
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
138
+ }
139
+ getTextByDiff(diff) {
140
+ const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
141
+ const renderTimeColumn = (column) => {
142
+ const columnInt = Math.floor(column);
143
+ if (columnInt < 10) {
144
+ return `0${columnInt}`;
145
+ }
146
+ else {
147
+ return `${columnInt}`;
148
+ }
149
+ };
150
+ if (diff < 1440) {
151
+ const hours = diff / 60;
152
+ const minutes = diff % 60;
153
+ const seconds = (minutes - Math.floor(minutes)) * 60;
154
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
155
+ }
156
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
157
+ }
158
+ getProgress() {
159
+ if (this.tournamentLeftDays <= 0)
160
+ return 100;
161
+ const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
162
+ const step = 100 / tournamentDuration;
163
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
164
+ return width;
165
+ }
166
+ componentWillLoad() {
167
+ if (this.translationData) {
168
+ getTranslations(JSON.parse(this.translationData));
169
+ }
170
+ if (this.startTime && this.endTime) {
171
+ this.getDuration();
172
+ this.getTextByDiff(this.tournamentLeftDays);
173
+ }
174
+ if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
175
+ this.durationInterval = window.setInterval(() => {
176
+ if (this.startTime && this.endTime) {
177
+ this.getDuration();
178
+ }
179
+ }, 1000);
180
+ }
181
+ else {
182
+ clearInterval(this.durationInterval);
183
+ }
184
+ }
185
+ componentDidRender() {
186
+ if (!this.limitStylingAppends && this.host) {
187
+ if (this.clientStyling)
188
+ this.setClientStyling();
189
+ if (this.clientStylingUrl)
190
+ this.setClientStylingURL();
191
+ this.limitStylingAppends = true;
192
+ }
193
+ }
194
+ setClientStyling() {
195
+ const sheet = new CSSStyleSheet();
196
+ // @ts-ignore
197
+ sheet.replace(this.clientStyling);
198
+ // @ts-ignore
199
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
200
+ }
201
+ setClientStylingURL() {
202
+ let url = new URL(this.clientStylingUrl);
203
+ fetch(url.href)
204
+ .then((res) => res.text())
205
+ .then((data) => {
206
+ const sheet = new CSSStyleSheet();
207
+ // @ts-ignore
208
+ sheet.replace(data);
209
+ // @ts-ignore
210
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
211
+ });
212
+ }
213
+ render() {
214
+ if (this.startTime && this.endTime) {
215
+ return h("div", { key: 'd0051545a243161e89e126fd26b9ea9d2e09f8ab', class: "TournamentDurationWrap" }, h("div", { key: 'b585f0137268f0185dfd15e563a0075bfe617d5b', class: "TournamentDuration" }, h("div", { key: '9cc3670780d9f8c40b77ac978cdadb0e0afdcacb', class: "TournamentDates" }, h("div", { key: '85e4f3b1de4f36efd8d13b090f8f9013976d8685', class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)), h("div", { key: '688a84ce16a4d26359637b80837a9c5f50fc24c3', class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))), h("div", { key: '149c0431ac2d8f9b5058a2a269b50e01d23ed26f', class: "ProgressBarWrapper" }, h("div", { key: '85523f37f511f9184260f8575ec08e914f535858', class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
216
+ h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
217
+ this.tournamentUntilStartDays > 0 ?
218
+ h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
219
+ h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
220
+ h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
221
+ }
222
+ }
223
+ get host() { return getElement(this); }
224
+ static get watchers() { return {
225
+ "language": ["watchLanguage"]
226
+ }; }
227
+ };
228
+ CasinoTournamentDuration.style = CasinoTournamentDurationStyle0;
229
+
230
+ export { CasinoTournamentDuration as casino_tournament_duration };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-2af9ace7.js';
2
+ export { s as setNonce } from './index-2af9ace7.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ /*
6
+ Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ var patchBrowser = () => {
9
+ const importMeta = import.meta.url;
10
+ const opts = {};
11
+ if (importMeta !== "") {
12
+ opts.resourcesUrl = new URL(".", importMeta).href;
13
+ }
14
+ return promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(async (options) => {
18
+ await globalScripts();
19
+ return bootstrapLazy([["casino-tournament-duration",[[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]},null,{"language":["watchLanguage"]}]]]], options);
20
+ });