@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,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8e0377fe.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ return index.bootstrapLazy([["casino-tournament-duration.cjs",[[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);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/casino-tournament-duration/casino-tournament-duration.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "2.15.2",
8
+ "typescriptVersion": "4.5.4"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,60 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .TournamentDates {
6
+ display: flex;
7
+ justify-content: space-between;
8
+ }
9
+
10
+ .StartDate {
11
+ font-size: 10px;
12
+ font-weight: 700;
13
+ color: var(--emfe-w-color-gray-300, #58586B);
14
+ }
15
+
16
+ .EndDate {
17
+ font-size: 10px;
18
+ font-weight: 700;
19
+ align-content: flex-end;
20
+ color: var(--emfe-w-color-gray-300, #58586B);
21
+ }
22
+
23
+ .ProgressBar {
24
+ margin: 5px 0;
25
+ height: 8px;
26
+ background: var(--emfe-w-color-white, #FFFFFF);
27
+ }
28
+
29
+ .ProgressBarInactive {
30
+ margin: 5px 20px 10px 20px;
31
+ height: 8px;
32
+ background: var(--emfe-w-color-gray-100, #E6E6E6);
33
+ }
34
+
35
+ .ProgressBarFill {
36
+ background-color: var(--emfe-w-color-green, #48952a);
37
+ height: 8px;
38
+ }
39
+
40
+ .ProgressBarFillEnd {
41
+ background-color: var(--emfe-w-color-green, #48952a);
42
+ height: 8px;
43
+ }
44
+
45
+ .ProgressBarFillStarting {
46
+ background-color: var(--emfe-w-color-gray-300, #58586B);
47
+ height: 8px;
48
+ }
49
+
50
+ .Remaining, .Finished {
51
+ font-size: 10px;
52
+ font-weight: 700;
53
+ padding-top: 6px;
54
+ text-align: right;
55
+ text-transform: uppercase;
56
+ }
57
+
58
+ .Finished {
59
+ color: var(--emfe-w-color-green, #48952a);
60
+ }
@@ -0,0 +1,228 @@
1
+ import { Component, Prop, h, State } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ export class CasinoTournamentDuration {
4
+ constructor() {
5
+ this.clientStyling = '';
6
+ this.clientStylingUrl = '';
7
+ this.limitStylingAppends = false;
8
+ this.setClientStyling = () => {
9
+ let sheet = document.createElement('style');
10
+ sheet.innerHTML = this.clientStyling;
11
+ this.stylingContainer.prepend(sheet);
12
+ };
13
+ this.setClientStylingURL = () => {
14
+ let cssFile = document.createElement('style');
15
+ setTimeout(() => {
16
+ cssFile.innerHTML = this.clientStylingUrl;
17
+ this.stylingContainer.prepend(cssFile);
18
+ }, 1);
19
+ };
20
+ }
21
+ getDateTimeDiff(dateString1, dateString2) {
22
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
23
+ }
24
+ getDuration() {
25
+ const dateNow = new Date();
26
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endDate);
27
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startDate);
28
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
29
+ }
30
+ formatDate(date) {
31
+ const dateOptions = { month: 'long' };
32
+ let currentDate = new Date(date);
33
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
34
+ let currentDay = currentDate.getDate();
35
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
36
+ }
37
+ getTextByDiff(diff) {
38
+ const renderText = (amount, type) => amount + ' ' + translate(type);
39
+ const renderTimeColumn = (column) => {
40
+ const columnInt = Math.floor(column);
41
+ if (columnInt < 10) {
42
+ return `0${columnInt}`;
43
+ }
44
+ else {
45
+ return `${columnInt}`;
46
+ }
47
+ };
48
+ if (diff < 1440) {
49
+ const hours = diff / 60;
50
+ const minutes = diff % 60;
51
+ const seconds = (minutes - Math.floor(minutes)) * 60;
52
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
53
+ }
54
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
55
+ }
56
+ getProgress() {
57
+ if (this.tournamentLeftDays <= 0)
58
+ return 100;
59
+ const tournamentDuration = this.getDateTimeDiff(this.startDate, this.endDate);
60
+ const step = 100 / tournamentDuration;
61
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
62
+ return width;
63
+ }
64
+ componentWillLoad() {
65
+ if (this.startDate && this.endDate) {
66
+ this.getDuration();
67
+ this.getTextByDiff(this.tournamentLeftDays);
68
+ }
69
+ }
70
+ componentDidRender() {
71
+ if (!this.limitStylingAppends && this.stylingContainer) {
72
+ if (this.clientStyling)
73
+ this.setClientStyling();
74
+ if (this.clientStylingUrl)
75
+ this.setClientStylingURL();
76
+ this.limitStylingAppends = true;
77
+ }
78
+ }
79
+ render() {
80
+ if (this.startDate && this.endDate) {
81
+ return h("div", { ref: el => this.stylingContainer = el },
82
+ h("div", { class: "TournamentDuration" },
83
+ h("div", { class: "TournamentDates" },
84
+ h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startDate)),
85
+ h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endDate))),
86
+ h("div", { class: "ProgressBarWrapper" },
87
+ h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
88
+ h("div", null,
89
+ h("div", { class: "ProgressBarFillEnd" }),
90
+ h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
91
+ this.tournamentUntilStartDays > 0 ?
92
+ h("div", null,
93
+ h("div", { class: "ProgressBarFillStarting" }),
94
+ h("div", { class: "Remaining", part: "Remaining" },
95
+ translate('starting', this.language),
96
+ " ",
97
+ this.getTextByDiff(this.tournamentUntilStartDays))) :
98
+ h("div", null,
99
+ h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }),
100
+ this.tournamentLeftDays > 0 &&
101
+ h("div", { class: "Remaining", part: "Remaining" },
102
+ this.showRemain,
103
+ " ",
104
+ translate('left', this.language)))))));
105
+ }
106
+ }
107
+ static get is() { return "casino-tournament-duration"; }
108
+ static get encapsulation() { return "shadow"; }
109
+ static get originalStyleUrls() { return {
110
+ "$": ["casino-tournament-duration.scss"]
111
+ }; }
112
+ static get styleUrls() { return {
113
+ "$": ["casino-tournament-duration.css"]
114
+ }; }
115
+ static get properties() { return {
116
+ "startDate": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": ""
129
+ },
130
+ "attribute": "start-date",
131
+ "reflect": false
132
+ },
133
+ "endDate": {
134
+ "type": "string",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "string",
138
+ "resolved": "string",
139
+ "references": {}
140
+ },
141
+ "required": false,
142
+ "optional": false,
143
+ "docs": {
144
+ "tags": [],
145
+ "text": ""
146
+ },
147
+ "attribute": "end-date",
148
+ "reflect": false
149
+ },
150
+ "status": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "string",
155
+ "resolved": "string",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": ""
163
+ },
164
+ "attribute": "status",
165
+ "reflect": false
166
+ },
167
+ "language": {
168
+ "type": "string",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "string",
172
+ "resolved": "string",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": false,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": ""
180
+ },
181
+ "attribute": "language",
182
+ "reflect": false
183
+ },
184
+ "clientStyling": {
185
+ "type": "string",
186
+ "mutable": false,
187
+ "complexType": {
188
+ "original": "string",
189
+ "resolved": "string",
190
+ "references": {}
191
+ },
192
+ "required": false,
193
+ "optional": false,
194
+ "docs": {
195
+ "tags": [],
196
+ "text": ""
197
+ },
198
+ "attribute": "client-styling",
199
+ "reflect": false,
200
+ "defaultValue": "''"
201
+ },
202
+ "clientStylingUrl": {
203
+ "type": "string",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "string",
207
+ "resolved": "string",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": false,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": ""
215
+ },
216
+ "attribute": "client-styling-url",
217
+ "reflect": false,
218
+ "defaultValue": "''"
219
+ }
220
+ }; }
221
+ static get states() { return {
222
+ "tournamentUntilStartDays": {},
223
+ "tournamentLeftDays": {},
224
+ "showRemain": {},
225
+ "limitStylingAppends": {},
226
+ "stylingContainer": {}
227
+ }; }
228
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,80 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'zh-hk', 'fr', 'hu', 'tr', 'el', 'es', 'pt'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ finished: 'Finished',
6
+ starting: 'Starting in ',
7
+ left: 'left',
8
+ minutes: 'minutes',
9
+ hours: 'hours',
10
+ days: 'days',
11
+ },
12
+ 'zh-hk': {
13
+ finished: '完成的',
14
+ starting: '開始於',
15
+ left: '剩下',
16
+ minutes: '分鐘',
17
+ hours: '小時',
18
+ days: '天',
19
+ },
20
+ fr: {
21
+ finished: 'Fini',
22
+ starting: 'Début dans ',
23
+ left: 'restant',
24
+ minutes: 'minutes',
25
+ hours: 'heures',
26
+ days: 'jours',
27
+ },
28
+ ro: {
29
+ finished: 'Finalizat',
30
+ starting: 'Începe în',
31
+ left: 'rămase',
32
+ minutes: 'minute',
33
+ hours: 'ore',
34
+ days: 'zile',
35
+ },
36
+ tr: {
37
+ finished: 'Sona ermiş',
38
+ starting: 'Başlamasına ',
39
+ left: 'kaldı',
40
+ minutes: 'dakika',
41
+ hours: 'saat',
42
+ days: 'gün',
43
+ },
44
+ el: {
45
+ finished: 'Ολοκληρωμένα',
46
+ starting: 'Αρχίζει σε ',
47
+ left: 'απομένουν',
48
+ minutes: 'λεπτά',
49
+ hours: 'ώρες',
50
+ days: 'ημέρες',
51
+ },
52
+ es: {
53
+ finished: 'Finalizado',
54
+ starting: 'Iniciando en ',
55
+ left: 'izquierda',
56
+ minutes: 'minutos',
57
+ hours: 'horas',
58
+ days: 'días',
59
+ },
60
+ hu: {
61
+ finished: 'Befejezve',
62
+ starting: 'Kezdésig',
63
+ left: 'bal',
64
+ minutes: 'perc',
65
+ hours: 'óra',
66
+ days: 'nap',
67
+ },
68
+ pt: {
69
+ finished: 'Finalizado',
70
+ starting: 'Começando em',
71
+ left: 'Abandonou',
72
+ minutes: 'Minutos',
73
+ hours: 'Horas',
74
+ days: 'Dias',
75
+ }
76
+ };
77
+ export const translate = (key, customLang) => {
78
+ const lang = customLang;
79
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
80
+ };
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
+ }
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,206 @@
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$1 = /*@__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$1() {
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$1);
198
+ }
199
+ break;
200
+ } });
201
+ }
202
+
203
+ const CasinoTournamentDuration = CasinoTournamentDuration$1;
204
+ const defineCustomElement = defineCustomElement$1;
205
+
206
+ export { CasinoTournamentDuration, defineCustomElement };
@@ -0,0 +1,26 @@
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';
@@ -0,0 +1 @@
1
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';