@everymatrix/casino-tournament-slider 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-slider/casino-tournament-slider.esm.js +1 -0
  2. package/dist/casino-tournament-slider/index.esm.js +0 -0
  3. package/dist/casino-tournament-slider/p-01da553f.entry.js +1 -0
  4. package/dist/casino-tournament-slider/p-c541e3cd.js +2 -0
  5. package/dist/casino-tournament-slider/p-e1255160.js +1 -0
  6. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  7. package/dist/cjs/casino-tournament-slider.cjs.js +25 -0
  8. package/dist/cjs/casino-tournament-slider_2.cjs.entry.js +352 -0
  9. package/dist/cjs/index-e4a7f235.js +1279 -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 +19 -0
  13. package/dist/collection/components/casino-tournament-slider/casino-tournament-slider.css +62 -0
  14. package/dist/collection/components/casino-tournament-slider/casino-tournament-slider.js +345 -0
  15. package/dist/collection/components/casino-tournament-slider/index.js +1 -0
  16. package/dist/collection/index.js +1 -0
  17. package/dist/collection/utils/locale.utils.js +39 -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-slider.js +20 -0
  21. package/dist/esm/casino-tournament-slider_2.entry.js +347 -0
  22. package/dist/esm/index-e38437e9.js +1252 -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-slider/.stencil/packages/stencil/casino-tournament-slider/stencil.config.d.ts +2 -0
  30. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/casino-tournament-slider/.stencil/packages/stencil/casino-tournament-slider/stencil.config.dev.d.ts +2 -0
  31. package/dist/types/components/casino-tournament-slider/casino-tournament-slider.d.ts +30 -0
  32. package/dist/types/components/casino-tournament-slider/index.d.ts +1 -0
  33. package/dist/types/components.d.ts +61 -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 +1 -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 +29 -0
@@ -0,0 +1,347 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-e38437e9.js';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const TRANSLATIONS = {
5
+ en: {
6
+ playNow: 'Play now',
7
+ sliderTitle: 'Participanting games'
8
+ },
9
+ 'zh-hk': {
10
+ playNow: '现在播放',
11
+ },
12
+ fr: {
13
+ playNow: 'Joue maintenant',
14
+ },
15
+ ro: {
16
+ playNow: 'Joaca acum',
17
+ },
18
+ hu: {
19
+ playNow: 'Játsszon most',
20
+ },
21
+ tr: {
22
+ playNow: 'Şimdi oyna',
23
+ },
24
+ el: {
25
+ playNow: 'Παίξε τώρα',
26
+ },
27
+ es: {
28
+ playNow: 'Jugar Ya',
29
+ },
30
+ pt: {
31
+ playNow: 'Jogue agora',
32
+ },
33
+ hr: {
34
+ playNow: 'IGRAJ SADA',
35
+ }
36
+ };
37
+ const translate = (key, customLang) => {
38
+ var _a, _b;
39
+ const lang = customLang;
40
+ return ((_a = TRANSLATIONS[lang]) === null || _a === void 0 ? void 0 : _a[key]) || ((_b = TRANSLATIONS[DEFAULT_LANGUAGE]) === null || _b === void 0 ? void 0 : _b[key]);
41
+ };
42
+
43
+ const casinoTournamentSliderCss = ":host{display:block}.Item{color:white;display:flex;justify-content:center;align-items:center;font-weight:bold;font-size:10rem;user-select:none;overflow:hidden}.Item .Img{width:100%;height:100%}.PlayNowButton{position:absolute;background:var(--emfe-w-color-green, #48952a);display:block;box-sizing:border-box;padding:0.8rem 0.5rem;color:var(--emfe-w-color-white, #FFFFFF);text-transform:uppercase;text-align:center;font-weight:600;font-size:0.7rem;cursor:pointer;transition:opacity 0.4s linear;opacity:0;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ItemHover{opacity:1}.Items .Item:first-child{margin-left:0}.Items .Item:last-child{margin-right:0}.SliderTitle{display:flex;align-items:center;padding:6px 0;gap:11px}.Title{color:#fff;font-size:14px;font-weight:600}";
44
+ const CasinoTournamentSliderStyle0 = casinoTournamentSliderCss;
45
+
46
+ const CasinoTournamentSlider = class {
47
+ constructor(hostRef) {
48
+ registerInstance(this, hostRef);
49
+ this.enter = (index) => {
50
+ this.hover = true;
51
+ this.hoverIndex = index;
52
+ };
53
+ this.leave = () => {
54
+ this.hover = false;
55
+ this.hoverIndex = -1;
56
+ };
57
+ this.gameClicked = (item) => {
58
+ window.postMessage({ type: 'TournamentGameAction', gameId: item.id, name: item.name }, window.location.href);
59
+ };
60
+ this.useEvent = undefined;
61
+ this.endpoint = undefined;
62
+ this.tournamentId = undefined;
63
+ this.session = undefined;
64
+ this.language = undefined;
65
+ this.gamesLimit = 30;
66
+ this.offset = 0;
67
+ this.slideNumber = 3;
68
+ this.slideShow = 3;
69
+ this.clientStyling = '';
70
+ this.clientStylingUrl = '';
71
+ this.showTitle = false;
72
+ this.limitStylingAppends = false;
73
+ this.games = undefined;
74
+ this.hover = undefined;
75
+ this.hoverIndex = undefined;
76
+ }
77
+ todoCompletedHandler(event) {
78
+ if (event.detail && this.useEvent) {
79
+ if (!event.detail.games)
80
+ return;
81
+ this.games = event.detail.games.items;
82
+ }
83
+ }
84
+ getTournamentInfo() {
85
+ let url = new URL(this.endpoint + `/v1/tournaments/${this.tournamentId}`);
86
+ let reqHeaders = new Headers();
87
+ url.searchParams.append('expand', 'games');
88
+ url.searchParams.append('language', this.language);
89
+ url.searchParams.append('pagination', `games(limit=${this.gamesLimit},offset=${this.offset})`);
90
+ url.searchParams.append('fields', 'games(id,name,thumbnail)');
91
+ if (this.session) {
92
+ reqHeaders.append('X-SessionId', this.session);
93
+ }
94
+ let requestOptions = {
95
+ method: 'GET',
96
+ headers: reqHeaders,
97
+ };
98
+ fetch(url.href, requestOptions).then((res) => res.json())
99
+ .then((res) => {
100
+ this.games = res.item.games.items;
101
+ });
102
+ }
103
+ componentWillLoad() {
104
+ if (!this.useEvent && this.endpoint && this.tournamentId) {
105
+ this.getTournamentInfo();
106
+ }
107
+ }
108
+ componentDidRender() {
109
+ if (!this.limitStylingAppends && this.host) {
110
+ if (this.clientStyling)
111
+ this.setClientStyling();
112
+ if (this.clientStylingUrl)
113
+ this.setClientStylingURL();
114
+ this.limitStylingAppends = true;
115
+ }
116
+ }
117
+ setClientStyling() {
118
+ const sheet = new CSSStyleSheet();
119
+ // @ts-ignore
120
+ sheet.replace(this.clientStyling);
121
+ // @ts-ignore
122
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
123
+ }
124
+ setClientStylingURL() {
125
+ let url = new URL(this.clientStylingUrl);
126
+ fetch(url.href)
127
+ .then((res) => res.text())
128
+ .then((data) => {
129
+ const sheet = new CSSStyleSheet();
130
+ // @ts-ignore
131
+ sheet.replace(data);
132
+ // @ts-ignore
133
+ this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
134
+ });
135
+ }
136
+ render() {
137
+ return h("div", { key: 'f16db0fd04952457c6e637e34e3295de9f2ab00e', class: "TournamentSliderWrap" }, h("div", { key: '246d6bae2b600ebc97e8cfbdf707ae284f0cef20', class: "TournamentSlider" }, this.showTitle && this.games &&
138
+ h("div", { key: 'd9760b0b053aa103a8bb1d24e860d83225aba17b', class: "SliderTitle" }, h("svg", { key: '47e2a1441fa2eb68510eb9a775ff14e6b5221afd', xmlns: "http://www.w3.org/2000/svg", width: "21", height: "25", viewBox: "0 0 21 25", fill: "none" }, h("path", { key: '566c04c19cbd24b79fba1c87f9872e28689178e3', d: "M6.1774 22.1728C6.36493 22.2725 6.56274 22.0566 6.44793 21.8779C5.82475 20.908 5.23463 19.2759 6.17483 17.174C7.74273 13.6689 8.6968 11.8535 8.6968 11.8535C8.6968 11.8535 9.20426 13.9721 10.5799 15.8558C11.9038 17.6687 12.6285 19.9488 11.4602 21.8482C11.3506 22.0265 11.5439 22.2368 11.7302 22.1415C13.1763 21.4017 14.7983 19.9179 14.9813 16.965C15.0488 16.0627 14.9476 14.7995 14.4416 13.2054C13.791 11.185 12.9911 10.2423 12.5283 9.83741C12.3899 9.71629 12.1746 9.82363 12.1859 10.0072C12.3208 12.1872 11.5007 12.7404 11.0339 11.4937C10.8474 10.9957 10.7387 10.1344 10.7387 9.08558C10.7387 7.3394 10.2321 5.54188 9.1152 4.0812C8.82475 3.70134 8.4849 3.3464 8.09498 3.04372C7.95382 2.93411 7.74919 3.04428 7.76212 3.22252C7.84788 4.40628 7.77018 7.79884 4.79383 11.8519C2.09515 15.6115 3.14088 18.4989 3.51195 19.281C4.2214 20.7791 5.21098 21.6589 6.1774 22.1728Z", fill: "white" })), h("span", { key: '6a6e5fc1e888de1ace0b0c577cc96b98c55a65bd', class: "Title" }, translate('sliderTitle', this.language))), h("div", { key: '0d18223f0d9603ba8e94a87725bfc52592f5a120', class: "Items" }, this.games &&
139
+ h("general-slider", { key: 'd56409e9730aeae803bb2a54951d9ba0912dbf51', "slide-number": this.slideNumber, "slide-show": this.slideShow }, this.games && this.games.map((game, i) => {
140
+ return h("li", { class: "Item", onMouseEnter: () => this.enter(i), onMouseLeave: () => this.leave() }, h("span", { class: `PlayNowButton ${this.hoverIndex == i ? 'ItemHover' : ''}`, onClick: () => { this.gameClicked(game); } }, translate('playNow', this.language)), h("img", { class: "Img", src: game.thumbnail, alt: game.name, title: game.name }));
141
+ })))));
142
+ }
143
+ get host() { return getElement(this); }
144
+ };
145
+ CasinoTournamentSlider.style = CasinoTournamentSliderStyle0;
146
+
147
+ const generalSliderCss = ":host{display:block}.GeneralSlider{position:relative}.Slider{position:relative;width:100%;margin:0 auto;overflow:hidden}.SliderList{display:flex;margin:0;padding:0;list-style:none;transition:transform 0.5s ease-in-out}::slotted(li){flex:1 0 auto;width:100%;margin:auto}::slotted(li.hide){visibility:hidden;height:0;transition-delay:500ms}.Col-2 ::slotted(li){flex:2 0 auto;width:50%}.Col-3 ::slotted(li){flex:3 0 auto;width:33.3333333333%}.Col-4 ::slotted(li){flex:4 0 auto;width:25%}.Col-5 ::slotted(li){flex:5 0 auto;width:20%}.Col-6 ::slotted(li){flex:6 0 auto;width:16.6666666667%}.Col-7 ::slotted(li){flex:7 0 auto;width:14.2857142857%}.Col-8 ::slotted(li){flex:8 0 auto;width:12.5%}.Col-9 ::slotted(li){flex:9 0 auto;width:11.1111111111%}.Col-10 ::slotted(li){flex:10 0 auto;width:10%}.Col-11 ::slotted(li){flex:11 0 auto;width:9.0909090909%}.Col-12 ::slotted(li){flex:12 0 auto;width:8.3333333333%}.Button{position:absolute;z-index:1;top:calc(50% - 32px);padding:20px;font-size:20px;line-height:20px;opacity:0.5;border:none;background:var(--emfe-w-color-contrast, #07072A);color:var(--emfe-w-color-white, #FFFFFF);cursor:pointer}.Button:hover{opacity:1;transition:opacity 0.5s ease-in-out}.Button[disabled],.Button[disabled]:hover{color:var(--emfe-w-color-gray-150, #828282);opacity:0.25}.Button.ButtonNext{right:0}.PageButtons{display:flex;gap:4px;margin-top:8px}.PageButton{width:15px;height:4px;border-radius:4px;background-color:var(--emfe-w-tournament-color-primary, #0072ed);opacity:0.2;cursor:pointer;float:right}.PageButton.active{width:45px;opacity:1}";
148
+ const GeneralSliderStyle0 = generalSliderCss;
149
+
150
+ const GeneralSlider = class {
151
+ constructor(hostRef) {
152
+ registerInstance(this, hostRef);
153
+ this.slides = null;
154
+ this.slideWidth = 0;
155
+ this.currentPage = 0;
156
+ this.controls = {
157
+ Prev: null,
158
+ Next: null
159
+ };
160
+ this.xDown = null;
161
+ this.yDown = null;
162
+ this.slideNumber = 3;
163
+ this.slideShow = 3;
164
+ this.showArrow = true;
165
+ this.showButton = false;
166
+ this.autoSlide = false;
167
+ this.loopTime = 1;
168
+ this.autoItemHeight = false;
169
+ this.clientStyling = '';
170
+ this.clientStylingUrl = '';
171
+ this.currentSlideNumber = 0;
172
+ this.slidesCount = 0;
173
+ this.limitStylingAppends = false;
174
+ }
175
+ slide(next) {
176
+ let slideTo = 0;
177
+ if (next) {
178
+ slideTo = this.currentSlideNumber + this.slideNumber;
179
+ }
180
+ else {
181
+ slideTo = this.currentSlideNumber - this.slideNumber;
182
+ }
183
+ if (slideTo < 0 || slideTo >= this.slidesCount)
184
+ return;
185
+ this.currentSlideNumber = slideTo;
186
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
187
+ this.updateListStyle();
188
+ }
189
+ slideTo(page) {
190
+ this.currentSlideNumber = page * this.slideNumber;
191
+ this.currentPage = page;
192
+ this.updateListStyle();
193
+ }
194
+ updateControls() {
195
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
196
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
197
+ }
198
+ switchControl(type, enabled) {
199
+ if (this.controls[type]) {
200
+ this.controls[type].disabled = !enabled;
201
+ }
202
+ }
203
+ componentWillLoad() {
204
+ if (!this.slideNumber)
205
+ this.slideNumber = 1;
206
+ if (!this.slideShow)
207
+ this.slideShow = 1;
208
+ }
209
+ componentDidLoad() {
210
+ this.slides = this.slotEl.assignedElements();
211
+ this.slidesCount = this.slides.length;
212
+ for (let type in this.controls) {
213
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
214
+ }
215
+ if (this.autoSlide) {
216
+ this.setSlideAutoInterval();
217
+ }
218
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
219
+ if (this.clientStyling)
220
+ this.setClientStyling();
221
+ if (this.clientStylingUrl)
222
+ this.setClientStylingURL();
223
+ this.limitStylingAppends = true;
224
+ }
225
+ }
226
+ componentDidRender() {
227
+ if (this.slides)
228
+ this.slideWidth = this.slides[0].offsetWidth;
229
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
230
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
231
+ this.updateListStyle();
232
+ if (!this.limitStylingAppends && this.el.shadowRoot) {
233
+ if (this.clientStyling)
234
+ this.setClientStyling();
235
+ if (this.clientStylingUrl)
236
+ this.setClientStylingURL();
237
+ this.limitStylingAppends = true;
238
+ }
239
+ }
240
+ updateListStyle() {
241
+ if (!this.autoItemHeight)
242
+ return;
243
+ if (this.slides === null)
244
+ return;
245
+ this.slides.forEach((li, index) => {
246
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
247
+ li.classList.remove('hide');
248
+ }
249
+ else {
250
+ li.classList.add('hide');
251
+ }
252
+ });
253
+ }
254
+ disconnectedCallback() {
255
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
256
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
257
+ }
258
+ handleTouchStart(evt) {
259
+ const firstTouch = this.getTouches(evt)[0];
260
+ this.xDown = firstTouch.clientX;
261
+ this.yDown = firstTouch.clientY;
262
+ clearInterval(this.sliderInterval);
263
+ }
264
+ getTouches(evt) {
265
+ return evt.touches || evt.originalEvent.touches;
266
+ }
267
+ handleTouchMove(evt) {
268
+ if (!this.xDown || !this.yDown)
269
+ return;
270
+ let xUp = evt.touches[0].clientX;
271
+ let yUp = evt.touches[0].clientY;
272
+ let xDiff = this.xDown - xUp;
273
+ let yDiff = this.yDown - yUp;
274
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
275
+ if (xDiff > 0) {
276
+ this.slide(true);
277
+ }
278
+ else {
279
+ this.slide(false);
280
+ }
281
+ }
282
+ this.xDown = null;
283
+ this.yDown = null;
284
+ if (this.autoSlide) {
285
+ this.setSlideAutoInterval();
286
+ }
287
+ }
288
+ ;
289
+ setSlideAutoInterval() {
290
+ if (this.loopTime == 0) {
291
+ return;
292
+ }
293
+ clearInterval(this.sliderInterval);
294
+ this.sliderInterval = setInterval(() => {
295
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
296
+ this.slideTo(this.currentPage + 1);
297
+ }
298
+ else {
299
+ this.slideTo(0);
300
+ }
301
+ }, Number(this.loopTime) * 1000);
302
+ }
303
+ componentDidUpdate() {
304
+ this.sliderEl.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
305
+ this.updateControls();
306
+ }
307
+ switchLoopStatus(isMouseMoveEnter) {
308
+ if (!this.autoSlide)
309
+ return;
310
+ if (this.loopTime > 0) {
311
+ if (isMouseMoveEnter) {
312
+ clearInterval(this.sliderInterval);
313
+ }
314
+ else {
315
+ this.setSlideAutoInterval();
316
+ }
317
+ }
318
+ }
319
+ setClientStyling() {
320
+ const sheet = new CSSStyleSheet();
321
+ // @ts-ignore
322
+ sheet.replace(this.clientStyling);
323
+ // @ts-ignore
324
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
325
+ }
326
+ setClientStylingURL() {
327
+ let url = new URL(this.clientStylingUrl);
328
+ fetch(url.href)
329
+ .then((res) => res.text())
330
+ .then((data) => {
331
+ const sheet = new CSSStyleSheet();
332
+ // @ts-ignore
333
+ sheet.replace(data);
334
+ // @ts-ignore
335
+ this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
336
+ });
337
+ }
338
+ render() {
339
+ return (h("div", { key: 'b8c30bef4c9ca004256c94cb642e8acb350afea4', class: "GeneralSlider" }, h("div", { key: '27d6869ae4f675f5e14d17fae20718ec24391e1b', class: "Slider" }, this.showArrow &&
340
+ h("div", { key: '61acebc8e1a0ecf02ae6dad1ecc6f618424d05d5' }, h("button", { key: 'c593883f94b693d6dfe741b2b4ed08185db36ef2', type: "button", class: "Button ButtonNext", onClick: this.slide.bind(this, true), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, ">"), h("button", { key: '2bea5e3e9f36443e78bc25f0556dce2adb7111a0', type: "button", class: "Button ButtonPrev", onClick: this.slide.bind(this, false), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, "<")), h("ul", { key: '6643c865256f26b5d06ec78044a2b595832ecb5e', class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false), ref: (el) => this.sliderEl = el }, h("slot", { key: '48f1ad37b771f32ecc27f3065d58bc7ef1a8a021', ref: (el) => this.slotEl = el }))), this.showButton && this.slidesCount > 0 &&
341
+ h("div", { key: 'd125efa8c68a6e913664d01fb395ed6cada71f5b', class: "PageButtons", part: "PageButtons" }, [...Array(this.slidesCount / this.slideNumber)].map((_x, i) => h("div", { class: `PageButton ${this.currentPage == i ? 'active' : ''}`, title: `page${i}`, onClick: this.slideTo.bind(this, i), onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, "\u00A0")))));
342
+ }
343
+ get el() { return getElement(this); }
344
+ };
345
+ GeneralSlider.style = GeneralSliderStyle0;
346
+
347
+ export { CasinoTournamentSlider as casino_tournament_slider, GeneralSlider as general_slider };