@everymatrix/casino-tournament-duration 1.16.1

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 (47) 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-05f4af89.entry.js +1 -0
  4. package/dist/casino-tournament-duration/p-efeaf265.js +1 -0
  5. package/dist/cjs/casino-tournament-duration.cjs.entry.js +180 -0
  6. package/dist/cjs/casino-tournament-duration.cjs.js +19 -0
  7. package/dist/cjs/index-8e0377fe.js +1138 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.css +60 -0
  12. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +228 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +80 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/components/casino-tournament-duration.d.ts +11 -0
  17. package/dist/components/casino-tournament-duration.js +206 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/casino-tournament-duration.entry.js +176 -0
  21. package/dist/esm/casino-tournament-duration.js +17 -0
  22. package/dist/esm/index-a10d1dd0.js +1113 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. 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
  35. package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +23 -0
  36. package/dist/types/components.d.ts +49 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +1 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +19 -0
@@ -0,0 +1,176 @@
1
+ import { r as registerInstance, h } from './index-a10d1dd0.js';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'zh-hk', 'fr', 'hu', 'tr', 'el', 'es', 'pt'];
5
+ const TRANSLATIONS = {
6
+ en: {
7
+ finished: 'Finished',
8
+ starting: 'Starting in ',
9
+ left: 'left',
10
+ minutes: 'minutes',
11
+ hours: 'hours',
12
+ days: 'days',
13
+ },
14
+ 'zh-hk': {
15
+ finished: '完成的',
16
+ starting: '開始於',
17
+ left: '剩下',
18
+ minutes: '分鐘',
19
+ hours: '小時',
20
+ days: '天',
21
+ },
22
+ fr: {
23
+ finished: 'Fini',
24
+ starting: 'Début dans ',
25
+ left: 'restant',
26
+ minutes: 'minutes',
27
+ hours: 'heures',
28
+ days: 'jours',
29
+ },
30
+ ro: {
31
+ finished: 'Finalizat',
32
+ starting: 'Începe în',
33
+ left: 'rămase',
34
+ minutes: 'minute',
35
+ hours: 'ore',
36
+ days: 'zile',
37
+ },
38
+ tr: {
39
+ finished: 'Sona ermiş',
40
+ starting: 'Başlamasına ',
41
+ left: 'kaldı',
42
+ minutes: 'dakika',
43
+ hours: 'saat',
44
+ days: 'gün',
45
+ },
46
+ el: {
47
+ finished: 'Ολοκληρωμένα',
48
+ starting: 'Αρχίζει σε ',
49
+ left: 'απομένουν',
50
+ minutes: 'λεπτά',
51
+ hours: 'ώρες',
52
+ days: 'ημέρες',
53
+ },
54
+ es: {
55
+ finished: 'Finalizado',
56
+ starting: 'Iniciando en ',
57
+ left: 'izquierda',
58
+ minutes: 'minutos',
59
+ hours: 'horas',
60
+ days: 'días',
61
+ },
62
+ hu: {
63
+ finished: 'Befejezve',
64
+ starting: 'Kezdésig',
65
+ left: 'bal',
66
+ minutes: 'perc',
67
+ hours: 'óra',
68
+ days: 'nap',
69
+ },
70
+ pt: {
71
+ finished: 'Finalizado',
72
+ starting: 'Começando em',
73
+ left: 'Abandonou',
74
+ minutes: 'Minutos',
75
+ hours: 'Horas',
76
+ days: 'Dias',
77
+ }
78
+ };
79
+ const translate = (key, customLang) => {
80
+ const lang = customLang;
81
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
82
+ };
83
+
84
+ 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)}";
85
+
86
+ const CasinoTournamentDuration = class {
87
+ constructor(hostRef) {
88
+ registerInstance(this, hostRef);
89
+ this.clientStyling = '';
90
+ this.clientStylingUrl = '';
91
+ this.limitStylingAppends = false;
92
+ this.setClientStyling = () => {
93
+ let sheet = document.createElement('style');
94
+ sheet.innerHTML = this.clientStyling;
95
+ this.stylingContainer.prepend(sheet);
96
+ };
97
+ this.setClientStylingURL = () => {
98
+ let cssFile = document.createElement('style');
99
+ setTimeout(() => {
100
+ cssFile.innerHTML = this.clientStylingUrl;
101
+ this.stylingContainer.prepend(cssFile);
102
+ }, 1);
103
+ };
104
+ }
105
+ getDateTimeDiff(dateString1, dateString2) {
106
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
107
+ }
108
+ getDuration() {
109
+ const dateNow = new Date();
110
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endDate);
111
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startDate);
112
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
113
+ }
114
+ formatDate(date) {
115
+ const dateOptions = { month: 'long' };
116
+ let currentDate = new Date(date);
117
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
118
+ let currentDay = currentDate.getDate();
119
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
120
+ }
121
+ getTextByDiff(diff) {
122
+ const renderText = (amount, type) => amount + ' ' + translate(type);
123
+ const renderTimeColumn = (column) => {
124
+ const columnInt = Math.floor(column);
125
+ if (columnInt < 10) {
126
+ return `0${columnInt}`;
127
+ }
128
+ else {
129
+ return `${columnInt}`;
130
+ }
131
+ };
132
+ if (diff < 1440) {
133
+ const hours = diff / 60;
134
+ const minutes = diff % 60;
135
+ const seconds = (minutes - Math.floor(minutes)) * 60;
136
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
137
+ }
138
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
139
+ }
140
+ getProgress() {
141
+ if (this.tournamentLeftDays <= 0)
142
+ return 100;
143
+ const tournamentDuration = this.getDateTimeDiff(this.startDate, this.endDate);
144
+ const step = 100 / tournamentDuration;
145
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
146
+ return width;
147
+ }
148
+ componentWillLoad() {
149
+ if (this.startDate && this.endDate) {
150
+ this.getDuration();
151
+ this.getTextByDiff(this.tournamentLeftDays);
152
+ }
153
+ }
154
+ componentDidRender() {
155
+ if (!this.limitStylingAppends && this.stylingContainer) {
156
+ if (this.clientStyling)
157
+ this.setClientStyling();
158
+ if (this.clientStylingUrl)
159
+ this.setClientStylingURL();
160
+ this.limitStylingAppends = true;
161
+ }
162
+ }
163
+ render() {
164
+ if (this.startDate && this.endDate) {
165
+ return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentDuration" }, h("div", { class: "TournamentDates" }, h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startDate)), h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endDate))), h("div", { class: "ProgressBarWrapper" }, h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
166
+ h("div", null, h("div", { class: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
167
+ this.tournamentUntilStartDays > 0 ?
168
+ h("div", null, h("div", { class: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
169
+ h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
170
+ h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
171
+ }
172
+ }
173
+ };
174
+ CasinoTournamentDuration.style = casinoTournamentDurationCss;
175
+
176
+ export { CasinoTournamentDuration as casino_tournament_duration };
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-a10d1dd0.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
15
+ patchBrowser().then(options => {
16
+ return bootstrapLazy([["casino-tournament-duration",[[1,"casino-tournament-duration",{"startDate":[1,"start-date"],"endDate":[1,"end-date"],"status":[1],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"tournamentUntilStartDays":[32],"tournamentLeftDays":[32],"showRemain":[32],"limitStylingAppends":[32],"stylingContainer":[32]}]]]], options);
17
+ });