@everymatrix/casino-tournament-duration 1.31.2 → 1.32.4

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +3 -2
  3. package/dist/casino-tournament-duration/casino-tournament-duration.esm.js +0 -1
  4. package/dist/casino-tournament-duration/index.esm.js +0 -0
  5. package/dist/casino-tournament-duration/p-0fd13b12.js +0 -1
  6. package/dist/casino-tournament-duration/p-a7d04af2.entry.js +0 -1
  7. package/dist/cjs/casino-tournament-duration.cjs.entry.js +0 -222
  8. package/dist/cjs/casino-tournament-duration.cjs.js +0 -19
  9. package/dist/cjs/index-5642eca0.js +0 -1138
  10. package/dist/cjs/index.cjs.js +0 -2
  11. package/dist/cjs/loader.cjs.js +0 -21
  12. package/dist/collection/collection-manifest.json +0 -12
  13. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.css +0 -60
  14. package/dist/collection/components/casino-tournament-duration/casino-tournament-duration.js +0 -272
  15. package/dist/collection/index.js +0 -1
  16. package/dist/collection/utils/locale.utils.js +0 -95
  17. package/dist/collection/utils/utils.js +0 -3
  18. package/dist/components/casino-tournament-duration.d.ts +0 -11
  19. package/dist/components/casino-tournament-duration.js +0 -249
  20. package/dist/components/index.d.ts +0 -26
  21. package/dist/components/index.js +0 -1
  22. package/dist/esm/casino-tournament-duration.entry.js +0 -218
  23. package/dist/esm/casino-tournament-duration.js +0 -17
  24. package/dist/esm/index-53cc9b80.js +0 -1112
  25. package/dist/esm/index.js +0 -1
  26. package/dist/esm/loader.js +0 -17
  27. package/dist/esm/polyfills/core-js.js +0 -11
  28. package/dist/esm/polyfills/css-shim.js +0 -1
  29. package/dist/esm/polyfills/dom.js +0 -79
  30. package/dist/esm/polyfills/es5-html-element.js +0 -1
  31. package/dist/esm/polyfills/index.js +0 -34
  32. package/dist/esm/polyfills/system.js +0 -6
  33. package/dist/index.cjs.js +0 -1
  34. package/dist/index.js +0 -1
  35. package/dist/stencil.config.js +0 -22
  36. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/casino-tournament-duration/.stencil/packages/casino-tournament-duration/stencil.config.d.ts +0 -2
  37. package/dist/types/components/casino-tournament-duration/casino-tournament-duration.d.ts +0 -46
  38. package/dist/types/components.d.ts +0 -93
  39. package/dist/types/index.d.ts +0 -1
  40. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  41. package/dist/types/utils/locale.utils.d.ts +0 -2
  42. package/dist/types/utils/utils.d.ts +0 -1
  43. package/loader/cdn.js +0 -3
  44. package/loader/index.cjs.js +0 -3
  45. package/loader/index.d.ts +0 -12
  46. package/loader/index.es2017.js +0 -3
  47. package/loader/index.js +0 -4
  48. package/loader/package.json +0 -10
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-5642eca0.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",{"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]}]]]], options);
18
- });
19
- };
20
-
21
- exports.defineCustomElements = defineCustomElements;
@@ -1,12 +0,0 @@
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
- }
@@ -1,60 +0,0 @@
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
- }
@@ -1,272 +0,0 @@
1
- import { Component, Prop, h, State, Element } from '@stencil/core';
2
- import { translate, getTranslations } from '../../utils/locale.utils';
3
- export class CasinoTournamentDuration {
4
- constructor() {
5
- /**
6
- * Client custom styling via inline styles
7
- */
8
- this.clientStyling = '';
9
- /**
10
- * Client custom styling via url
11
- */
12
- this.clientStylingUrl = '';
13
- this.limitStylingAppends = false;
14
- }
15
- getDateTimeDiff(dateString1, dateString2) {
16
- return ((new Date(dateString2)).getTime() - (new Date(dateString1)).getTime()) / (1000 * 60);
17
- }
18
- getDuration() {
19
- const dateNow = new Date();
20
- this.tournamentLeftDays = this.getDateTimeDiff(dateNow, this.endTime);
21
- this.tournamentUntilStartDays = this.getDateTimeDiff(dateNow, this.startTime);
22
- this.showRemain = this.getTextByDiff(this.tournamentLeftDays);
23
- }
24
- formatDate(date) {
25
- const dateOptions = { month: 'long' };
26
- let currentDate = new Date(date);
27
- let currentMonth = new Intl.DateTimeFormat(this.language, dateOptions).format(currentDate);
28
- let currentDay = currentDate.getDate();
29
- return `${currentDay} ${currentMonth}, ${currentDate.toLocaleString('en-GB', { hour: 'numeric', minute: 'numeric' })}, ${currentDate.getUTCFullYear()}`;
30
- }
31
- getTextByDiff(diff) {
32
- const renderText = (amount, type) => amount + ' ' + translate(type);
33
- const renderTimeColumn = (column) => {
34
- const columnInt = Math.floor(column);
35
- if (columnInt < 10) {
36
- return `0${columnInt}`;
37
- }
38
- else {
39
- return `${columnInt}`;
40
- }
41
- };
42
- if (diff < 1440) {
43
- const hours = diff / 60;
44
- const minutes = diff % 60;
45
- const seconds = (minutes - Math.floor(minutes)) * 60;
46
- return [hours, minutes, seconds].map(c => renderTimeColumn(c)).join(':');
47
- }
48
- return renderText(Math.ceil(diff / (60 * 24)), 'days');
49
- }
50
- getProgress() {
51
- if (this.tournamentLeftDays <= 0)
52
- return 100;
53
- const tournamentDuration = this.getDateTimeDiff(this.startTime, this.endTime);
54
- const step = 100 / tournamentDuration;
55
- const width = Math.floor((tournamentDuration - this.tournamentLeftDays) * step);
56
- return width;
57
- }
58
- componentWillLoad() {
59
- if (this.translationData) {
60
- getTranslations(JSON.parse(this.translationData));
61
- }
62
- if (this.startTime && this.endTime) {
63
- this.getDuration();
64
- this.getTextByDiff(this.tournamentLeftDays);
65
- }
66
- if (this.tournamentLeftDays < 1440 && this.tournamentLeftDays > 0) {
67
- this.durationInterval = window.setInterval(() => {
68
- if (this.startTime && this.endTime) {
69
- this.getDuration();
70
- }
71
- }, 1000);
72
- }
73
- else {
74
- clearInterval(this.durationInterval);
75
- }
76
- }
77
- componentDidRender() {
78
- if (!this.limitStylingAppends && this.host) {
79
- if (this.clientStyling)
80
- this.setClientStyling();
81
- if (this.clientStylingUrl)
82
- this.setClientStylingURL();
83
- this.limitStylingAppends = true;
84
- }
85
- }
86
- setClientStyling() {
87
- const sheet = new CSSStyleSheet();
88
- // @ts-ignore
89
- sheet.replace(this.clientStyling);
90
- // @ts-ignore
91
- this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
92
- }
93
- setClientStylingURL() {
94
- let url = new URL(this.clientStylingUrl);
95
- fetch(url.href)
96
- .then((res) => res.text())
97
- .then((data) => {
98
- const sheet = new CSSStyleSheet();
99
- // @ts-ignore
100
- sheet.replace(data);
101
- // @ts-ignore
102
- this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
103
- });
104
- }
105
- render() {
106
- if (this.startTime && this.endTime) {
107
- return h("div", { class: "TournamentDurationWrap" },
108
- h("div", { class: "TournamentDuration" },
109
- h("div", { class: "TournamentDates" },
110
- h("div", { class: "StartDate", part: "StartDate" }, this.formatDate(this.startTime)),
111
- h("div", { class: "EndDate", part: "EndDate" }, this.formatDate(this.endTime))),
112
- h("div", { class: "ProgressBarWrapper" },
113
- h("div", { class: "ProgressBar", part: "ProgressBar" }, this.status == 'Finished' || this.status == 'Closing' || this.status == 'Closed' ?
114
- h("div", null,
115
- h("div", { class: "ProgressBarFillEnd", part: "ProgressBarFillEnd" }),
116
- h("div", { class: "Finished", part: "Finished" }, translate('finished', this.language))) :
117
- this.tournamentUntilStartDays > 0 ?
118
- h("div", null,
119
- h("div", { class: "ProgressBarFillStarting", part: "ProgressBarFillStarting" }),
120
- h("div", { class: "Remaining", part: "Remaining" },
121
- translate('starting', this.language),
122
- " ",
123
- this.getTextByDiff(this.tournamentUntilStartDays))) :
124
- h("div", null,
125
- h("div", { class: "ProgressBarFill", part: "ProgressBarFill", style: { width: `${this.getProgress()}%` } }),
126
- this.tournamentLeftDays > 0 &&
127
- h("div", { class: "Remaining", part: "Remaining" },
128
- this.showRemain,
129
- " ",
130
- translate('left', this.language)))))));
131
- }
132
- }
133
- static get is() { return "casino-tournament-duration"; }
134
- static get encapsulation() { return "shadow"; }
135
- static get originalStyleUrls() { return {
136
- "$": ["casino-tournament-duration.scss"]
137
- }; }
138
- static get styleUrls() { return {
139
- "$": ["casino-tournament-duration.css"]
140
- }; }
141
- static get properties() { return {
142
- "startTime": {
143
- "type": "string",
144
- "mutable": false,
145
- "complexType": {
146
- "original": "string",
147
- "resolved": "string",
148
- "references": {}
149
- },
150
- "required": false,
151
- "optional": true,
152
- "docs": {
153
- "tags": [],
154
- "text": "Tournament start time"
155
- },
156
- "attribute": "start-time",
157
- "reflect": false
158
- },
159
- "endTime": {
160
- "type": "string",
161
- "mutable": false,
162
- "complexType": {
163
- "original": "string",
164
- "resolved": "string",
165
- "references": {}
166
- },
167
- "required": false,
168
- "optional": true,
169
- "docs": {
170
- "tags": [],
171
- "text": "Tournament end time"
172
- },
173
- "attribute": "end-time",
174
- "reflect": false
175
- },
176
- "status": {
177
- "type": "string",
178
- "mutable": false,
179
- "complexType": {
180
- "original": "string",
181
- "resolved": "string",
182
- "references": {}
183
- },
184
- "required": false,
185
- "optional": true,
186
- "docs": {
187
- "tags": [],
188
- "text": "Tournament status"
189
- },
190
- "attribute": "status",
191
- "reflect": false
192
- },
193
- "language": {
194
- "type": "string",
195
- "mutable": false,
196
- "complexType": {
197
- "original": "string",
198
- "resolved": "string",
199
- "references": {}
200
- },
201
- "required": true,
202
- "optional": false,
203
- "docs": {
204
- "tags": [],
205
- "text": "Widget language to show"
206
- },
207
- "attribute": "language",
208
- "reflect": false
209
- },
210
- "clientStyling": {
211
- "type": "string",
212
- "mutable": false,
213
- "complexType": {
214
- "original": "string",
215
- "resolved": "string",
216
- "references": {}
217
- },
218
- "required": false,
219
- "optional": true,
220
- "docs": {
221
- "tags": [],
222
- "text": "Client custom styling via inline styles"
223
- },
224
- "attribute": "client-styling",
225
- "reflect": false,
226
- "defaultValue": "''"
227
- },
228
- "clientStylingUrl": {
229
- "type": "string",
230
- "mutable": false,
231
- "complexType": {
232
- "original": "string",
233
- "resolved": "string",
234
- "references": {}
235
- },
236
- "required": false,
237
- "optional": true,
238
- "docs": {
239
- "tags": [],
240
- "text": "Client custom styling via url"
241
- },
242
- "attribute": "client-styling-url",
243
- "reflect": false,
244
- "defaultValue": "''"
245
- },
246
- "translationData": {
247
- "type": "any",
248
- "mutable": false,
249
- "complexType": {
250
- "original": "any",
251
- "resolved": "any",
252
- "references": {}
253
- },
254
- "required": false,
255
- "optional": true,
256
- "docs": {
257
- "tags": [],
258
- "text": "Translations via parent component"
259
- },
260
- "attribute": "translation-data",
261
- "reflect": true
262
- }
263
- }; }
264
- static get states() { return {
265
- "tournamentUntilStartDays": {},
266
- "tournamentLeftDays": {},
267
- "showRemain": {},
268
- "limitStylingAppends": {},
269
- "durationInterval": {}
270
- }; }
271
- static get elementRef() { return "host"; }
272
- }
@@ -1 +0,0 @@
1
- export * from './components';
@@ -1,95 +0,0 @@
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
- };
@@ -1,3 +0,0 @@
1
- export function format(first, middle, last) {
2
- return ((first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : ''));
3
- }
@@ -1,11 +0,0 @@
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;