@everymatrix/casino-tournament-info 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 (53) hide show
  1. package/dist/casino-tournament-info/casino-tournament-info.esm.js +1 -0
  2. package/dist/casino-tournament-info/index.esm.js +0 -0
  3. package/dist/casino-tournament-info/p-cac5951c.js +1 -0
  4. package/dist/casino-tournament-info/p-d686dcae.entry.js +9 -0
  5. package/dist/cjs/casino-tournament-buttons_4.cjs.entry.js +6883 -0
  6. package/dist/cjs/casino-tournament-info.cjs.js +19 -0
  7. package/dist/cjs/index-1b45a643.js +1274 -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 +31 -0
  11. package/dist/collection/components/casino-tournament-info/casino-tournament-info.css +70 -0
  12. package/dist/collection/components/casino-tournament-info/casino-tournament-info.js +714 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +274 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/components/casino-tournament-buttons.js +6 -0
  17. package/dist/components/casino-tournament-buttons2.js +522 -0
  18. package/dist/components/casino-tournament-duration.js +6 -0
  19. package/dist/components/casino-tournament-duration2.js +203 -0
  20. package/dist/components/casino-tournament-info.d.ts +11 -0
  21. package/dist/components/casino-tournament-info.js +6135 -0
  22. package/dist/components/casino-tournament-prizes.js +6 -0
  23. package/dist/components/casino-tournament-prizes2.js +190 -0
  24. package/dist/components/index.d.ts +26 -0
  25. package/dist/components/index.js +1 -0
  26. package/dist/esm/casino-tournament-buttons_4.entry.js +6876 -0
  27. package/dist/esm/casino-tournament-info.js +17 -0
  28. package/dist/esm/index-770c7750.js +1249 -0
  29. package/dist/esm/index.js +1 -0
  30. package/dist/esm/loader.js +17 -0
  31. package/dist/esm/polyfills/core-js.js +11 -0
  32. package/dist/esm/polyfills/css-shim.js +1 -0
  33. package/dist/esm/polyfills/dom.js +79 -0
  34. package/dist/esm/polyfills/es5-html-element.js +1 -0
  35. package/dist/esm/polyfills/index.js +34 -0
  36. package/dist/esm/polyfills/system.js +6 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.js +1 -0
  39. package/dist/stencil.config.js +22 -0
  40. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-info/.stencil/packages/casino-tournament-info/stencil.config.d.ts +2 -0
  41. package/dist/types/components/casino-tournament-info/casino-tournament-info.d.ts +50 -0
  42. package/dist/types/components.d.ts +101 -0
  43. package/dist/types/index.d.ts +1 -0
  44. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  45. package/dist/types/utils/locale.utils.d.ts +1 -0
  46. package/dist/types/utils/utils.d.ts +1 -0
  47. package/loader/cdn.js +3 -0
  48. package/loader/index.cjs.js +3 -0
  49. package/loader/index.d.ts +12 -0
  50. package/loader/index.es2017.js +3 -0
  51. package/loader/index.js +4 -0
  52. package/loader/package.json +10 -0
  53. package/package.json +19 -0
@@ -0,0 +1,203 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
87
+ constructor() {
88
+ super();
89
+ this.__registerHost();
90
+ this.__attachShadow();
91
+ this.clientStyling = '';
92
+ this.clientStylingUrl = '';
93
+ this.limitStylingAppends = false;
94
+ this.setClientStyling = () => {
95
+ let sheet = document.createElement('style');
96
+ sheet.innerHTML = this.clientStyling;
97
+ this.stylingContainer.prepend(sheet);
98
+ };
99
+ this.setClientStylingURL = () => {
100
+ let cssFile = document.createElement('style');
101
+ setTimeout(() => {
102
+ cssFile.innerHTML = this.clientStylingUrl;
103
+ this.stylingContainer.prepend(cssFile);
104
+ }, 1);
105
+ };
106
+ }
107
+ getDateTimeDiff(dateString1, dateString2) {
108
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
109
+ }
110
+ getDuration() {
111
+ const dateNow = new Date();
112
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endDate);
113
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startDate);
114
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
115
+ }
116
+ formatDate(date) {
117
+ const dateOptions = { month: 'long' };
118
+ let currentDate = new Date(date);
119
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
120
+ let currentDay = currentDate.getDate();
121
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
122
+ }
123
+ getTextByDiff(diff) {
124
+ const renderText = (amount, type) => amount + ' ' + translate(type);
125
+ const renderTimeColumn = (column) => {
126
+ const columnInt = Math.floor(column);
127
+ if (columnInt < 10) {
128
+ return `0${columnInt}`;
129
+ }
130
+ else {
131
+ return `${columnInt}`;
132
+ }
133
+ };
134
+ if (diff < 1440) {
135
+ const hours = diff / 60;
136
+ const minutes = diff % 60;
137
+ const seconds = (minutes - Math.floor(minutes)) * 60;
138
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
139
+ }
140
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
141
+ }
142
+ getProgress() {
143
+ if (this.tournamentLeftDays <= 0)
144
+ return 100;
145
+ const tournamentDuration = this.getDateTimeDiff(this.startDate, this.endDate);
146
+ const step = 100 / tournamentDuration;
147
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
148
+ return width;
149
+ }
150
+ componentWillLoad() {
151
+ if (this.startDate && this.endDate) {
152
+ this.getDuration();
153
+ this.getTextByDiff(this.tournamentLeftDays);
154
+ }
155
+ }
156
+ componentDidRender() {
157
+ if (!this.limitStylingAppends && this.stylingContainer) {
158
+ if (this.clientStyling)
159
+ this.setClientStyling();
160
+ if (this.clientStylingUrl)
161
+ this.setClientStylingURL();
162
+ this.limitStylingAppends = true;
163
+ }
164
+ }
165
+ render() {
166
+ if (this.startDate && this.endDate) {
167
+ 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' ?
168
+ h("div", null, h("div", { class: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
169
+ this.tournamentUntilStartDays > 0 ?
170
+ h("div", null, h("div", { class: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
171
+ h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
172
+ h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
173
+ }
174
+ }
175
+ static get style() { return casinoTournamentDurationCss; }
176
+ }, [1, "casino-tournament-duration", {
177
+ "startDate": [1, "start-date"],
178
+ "endDate": [1, "end-date"],
179
+ "status": [1],
180
+ "language": [1],
181
+ "clientStyling": [1, "client-styling"],
182
+ "clientStylingUrl": [1, "client-styling-url"],
183
+ "tournamentUntilStartDays": [32],
184
+ "tournamentLeftDays": [32],
185
+ "showRemain": [32],
186
+ "limitStylingAppends": [32],
187
+ "stylingContainer": [32]
188
+ }]);
189
+ function defineCustomElement() {
190
+ if (typeof customElements === "undefined") {
191
+ return;
192
+ }
193
+ const components = ["casino-tournament-duration"];
194
+ components.forEach(tagName => { switch (tagName) {
195
+ case "casino-tournament-duration":
196
+ if (!customElements.get(tagName)) {
197
+ customElements.define(tagName, CasinoTournamentDuration);
198
+ }
199
+ break;
200
+ } });
201
+ }
202
+
203
+ export { CasinoTournamentDuration as C, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface CasinoTournamentInfo extends Components.CasinoTournamentInfo, HTMLElement {}
4
+ export const CasinoTournamentInfo: {
5
+ prototype: CasinoTournamentInfo;
6
+ new (): CasinoTournamentInfo;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;