@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,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5302010b.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ return index.bootstrapLazy([["casino-tournament-duration.cjs",[[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);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ 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": "4.20.0",
8
+ "typescriptVersion": "5.5.3"
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,276 @@
1
+ import { h } from "@stencil/core";
2
+ import { translate, getTranslations } from "../../utils/locale.utils";
3
+ export class CasinoTournamentDuration {
4
+ constructor() {
5
+ this.startTime = undefined;
6
+ this.endTime = undefined;
7
+ this.status = undefined;
8
+ this.language = undefined;
9
+ this.clientStyling = '';
10
+ this.clientStylingUrl = '';
11
+ this.translationData = undefined;
12
+ this.tournamentUntilStartDays = undefined;
13
+ this.tournamentLeftDays = undefined;
14
+ this.showRemain = undefined;
15
+ this.limitStylingAppends = false;
16
+ this.durationInterval = undefined;
17
+ }
18
+ watchLanguage(newValue, oldValue) {
19
+ if (newValue && newValue != oldValue) {
20
+ this.getDuration();
21
+ }
22
+ }
23
+ getDateTimeDiff(dateString1, dateString2) {
24
+ return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
25
+ }
26
+ getDuration() {
27
+ const dateNow = new Date();
28
+ this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
29
+ this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
30
+ this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
31
+ }
32
+ formatDate(date) {
33
+ const dateOptions = { month: 'long' };
34
+ let currentDate = new Date(date);
35
+ let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
36
+ let currentDay = currentDate.getDate();
37
+ return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
38
+ }
39
+ getTextByDiff(diff) {
40
+ const renderText = (amount, type) => amount + ' ' + translate(type, this.language);
41
+ const renderTimeColumn = (column) => {
42
+ const columnInt = Math.floor(column);
43
+ if (columnInt < 10) {
44
+ return `0${columnInt}`;
45
+ }
46
+ else {
47
+ return `${columnInt}`;
48
+ }
49
+ };
50
+ if (diff < 1440) {
51
+ const hours = diff / 60;
52
+ const minutes = diff % 60;
53
+ const seconds = (minutes - Math.floor(minutes)) * 60;
54
+ return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
55
+ }
56
+ return renderText(Math.ceil(diff / (60 * 24)), 'days');
57
+ }
58
+ getProgress() {
59
+ if (this.tournamentLeftDays <= 0)
60
+ return 100;
61
+ const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
62
+ const step = 100 / tournamentDuration;
63
+ const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
64
+ return width;
65
+ }
66
+ componentWillLoad() {
67
+ if (this.translationData) {
68
+ getTranslations(JSON.parse(this.translationData));
69
+ }
70
+ if (this.startTime && this.endTime) {
71
+ this.getDuration();
72
+ this.getTextByDiff(this.tournamentLeftDays);
73
+ }
74
+ if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
75
+ this.durationInterval = window.setInterval(() => {
76
+ if (this.startTime && this.endTime) {
77
+ this.getDuration();
78
+ }
79
+ }, 1000);
80
+ }
81
+ else {
82
+ clearInterval(this.durationInterval);
83
+ }
84
+ }
85
+ componentDidRender() {
86
+ if (!this.limitStylingAppends && this.host) {
87
+ if (this.clientStyling)
88
+ this.setClientStyling();
89
+ if (this.clientStylingUrl)
90
+ this.setClientStylingURL();
91
+ this.limitStylingAppends = true;
92
+ }
93
+ }
94
+ setClientStyling() {
95
+ const sheet = new CSSStyleSheet();
96
+ // @ts-ignore
97
+ sheet.replace(this.clientStyling);
98
+ // @ts-ignore
99
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
100
+ }
101
+ setClientStylingURL() {
102
+ let url = new URL(this.clientStylingUrl);
103
+ fetch(url.href)
104
+ .then((res) => res.text())
105
+ .then((data) => {
106
+ const sheet = new CSSStyleSheet();
107
+ // @ts-ignore
108
+ sheet.replace(data);
109
+ // @ts-ignore
110
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
111
+ });
112
+ }
113
+ render() {
114
+ if (this.startTime && this.endTime) {
115
+ 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' ?
116
+ h("div", null, h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }), h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
117
+ this.tournamentUntilStartDays > 0 ?
118
+ h("div", null, h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }), h("div", { class: "Remaining", part: "Remaining" }, translate('starting', this.language), " ", this.getTextByDiff(this.tournamentUntilStartDays))) :
119
+ h("div", null, h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }), this.tournamentLeftDays > 0 &&
120
+ h("div", { class: "Remaining", part: "Remaining" }, this.showRemain, " ", translate('left', this.language)))))));
121
+ }
122
+ }
123
+ static get is() { return "casino-tournament-duration"; }
124
+ static get encapsulation() { return "shadow"; }
125
+ static get originalStyleUrls() {
126
+ return {
127
+ "$": ["casino-tournament-duration.scss"]
128
+ };
129
+ }
130
+ static get styleUrls() {
131
+ return {
132
+ "$": ["casino-tournament-duration.css"]
133
+ };
134
+ }
135
+ static get properties() {
136
+ return {
137
+ "startTime": {
138
+ "type": "string",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "string",
142
+ "resolved": "string",
143
+ "references": {}
144
+ },
145
+ "required": false,
146
+ "optional": true,
147
+ "docs": {
148
+ "tags": [],
149
+ "text": "Tournament start time"
150
+ },
151
+ "attribute": "start-time",
152
+ "reflect": false
153
+ },
154
+ "endTime": {
155
+ "type": "string",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "string",
159
+ "resolved": "string",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": true,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "Tournament end time"
167
+ },
168
+ "attribute": "end-time",
169
+ "reflect": false
170
+ },
171
+ "status": {
172
+ "type": "string",
173
+ "mutable": false,
174
+ "complexType": {
175
+ "original": "string",
176
+ "resolved": "string",
177
+ "references": {}
178
+ },
179
+ "required": false,
180
+ "optional": true,
181
+ "docs": {
182
+ "tags": [],
183
+ "text": "Tournament status"
184
+ },
185
+ "attribute": "status",
186
+ "reflect": false
187
+ },
188
+ "language": {
189
+ "type": "string",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "string",
193
+ "resolved": "string",
194
+ "references": {}
195
+ },
196
+ "required": true,
197
+ "optional": false,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": "Widget language to show"
201
+ },
202
+ "attribute": "language",
203
+ "reflect": false
204
+ },
205
+ "clientStyling": {
206
+ "type": "string",
207
+ "mutable": false,
208
+ "complexType": {
209
+ "original": "string",
210
+ "resolved": "string",
211
+ "references": {}
212
+ },
213
+ "required": false,
214
+ "optional": true,
215
+ "docs": {
216
+ "tags": [],
217
+ "text": "Client custom styling via inline styles"
218
+ },
219
+ "attribute": "client-styling",
220
+ "reflect": false,
221
+ "defaultValue": "''"
222
+ },
223
+ "clientStylingUrl": {
224
+ "type": "string",
225
+ "mutable": false,
226
+ "complexType": {
227
+ "original": "string",
228
+ "resolved": "string",
229
+ "references": {}
230
+ },
231
+ "required": false,
232
+ "optional": true,
233
+ "docs": {
234
+ "tags": [],
235
+ "text": "Client custom styling via url"
236
+ },
237
+ "attribute": "client-styling-url",
238
+ "reflect": false,
239
+ "defaultValue": "''"
240
+ },
241
+ "translationData": {
242
+ "type": "any",
243
+ "mutable": false,
244
+ "complexType": {
245
+ "original": "any",
246
+ "resolved": "any",
247
+ "references": {}
248
+ },
249
+ "required": false,
250
+ "optional": true,
251
+ "docs": {
252
+ "tags": [],
253
+ "text": "Translations via parent component"
254
+ },
255
+ "attribute": "translation-data",
256
+ "reflect": true
257
+ }
258
+ };
259
+ }
260
+ static get states() {
261
+ return {
262
+ "tournamentUntilStartDays": {},
263
+ "tournamentLeftDays": {},
264
+ "showRemain": {},
265
+ "limitStylingAppends": {},
266
+ "durationInterval": {}
267
+ };
268
+ }
269
+ static get elementRef() { return "host"; }
270
+ static get watchers() {
271
+ return [{
272
+ "propName": "language",
273
+ "methodName": "watchLanguage"
274
+ }];
275
+ }
276
+ }
@@ -0,0 +1 @@
1
+ export { CasinoTournamentDuration } from './casino-tournament-duration';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,95 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const TRANSLATIONS = {
3
+ en: {
4
+ finished: 'Finished',
5
+ starting: 'Starting in ',
6
+ left: 'left',
7
+ minutes: 'minutes',
8
+ hours: 'hours',
9
+ days: 'days',
10
+ },
11
+ hr: {
12
+ finished: 'Gotovo',
13
+ starting: 'Počinje u ',
14
+ left: 'lijevo',
15
+ minutes: 'minute',
16
+ hours: 'sati',
17
+ days: 'dani',
18
+ },
19
+ 'zh-hk': {
20
+ finished: '完成的',
21
+ starting: '開始於',
22
+ left: '剩下',
23
+ minutes: '分鐘',
24
+ hours: '小時',
25
+ days: '天',
26
+ },
27
+ fr: {
28
+ finished: 'Fini',
29
+ starting: 'Début dans ',
30
+ left: 'restant',
31
+ minutes: 'minutes',
32
+ hours: 'heures',
33
+ days: 'jours',
34
+ },
35
+ ro: {
36
+ finished: 'Finalizat',
37
+ starting: 'Începe în',
38
+ left: 'rămase',
39
+ minutes: 'minute',
40
+ hours: 'ore',
41
+ days: 'zile',
42
+ },
43
+ tr: {
44
+ finished: 'Sona ermiş',
45
+ starting: 'Başlamasına ',
46
+ left: 'kaldı',
47
+ minutes: 'dakika',
48
+ hours: 'saat',
49
+ days: 'gün',
50
+ },
51
+ el: {
52
+ finished: 'Ολοκληρωμένα',
53
+ starting: 'Αρχίζει σε ',
54
+ left: 'απομένουν',
55
+ minutes: 'λεπτά',
56
+ hours: 'ώρες',
57
+ days: 'ημέρες',
58
+ },
59
+ es: {
60
+ finished: 'Finalizado',
61
+ starting: 'Iniciando en ',
62
+ left: 'izquierda',
63
+ minutes: 'minutos',
64
+ hours: 'horas',
65
+ days: 'días',
66
+ },
67
+ hu: {
68
+ finished: 'Befejezve',
69
+ starting: 'Kezdésig',
70
+ left: 'bal',
71
+ minutes: 'perc',
72
+ hours: 'óra',
73
+ days: 'nap',
74
+ },
75
+ pt: {
76
+ finished: 'Finalizado',
77
+ starting: 'Começando em',
78
+ left: 'Abandonou',
79
+ minutes: 'Minutos',
80
+ hours: 'Horas',
81
+ days: 'Dias',
82
+ }
83
+ };
84
+ export const translate = (key, customLang) => {
85
+ var _a, _b;
86
+ const lang = customLang;
87
+ return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
88
+ };
89
+ export const getTranslations = (data) => {
90
+ Object.keys(data).forEach((item) => {
91
+ for (let key in data[item]) {
92
+ TRANSLATIONS[item][key] = data[item][key];
93
+ }
94
+ });
95
+ };
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
+ }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };