@everymatrix/casino-tournament-slider 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 (49) 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-3af7237d.entry.js +1 -0
  4. package/dist/casino-tournament-slider/p-7bade785.js +1 -0
  5. package/dist/cjs/casino-tournament-slider.cjs.js +19 -0
  6. package/dist/cjs/casino-tournament-slider_2.cjs.entry.js +293 -0
  7. package/dist/cjs/index-f60eba31.js +1263 -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 +19 -0
  11. package/dist/collection/components/casino-tournament-slider/casino-tournament-slider.css +62 -0
  12. package/dist/collection/components/casino-tournament-slider/casino-tournament-slider.js +328 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +36 -0
  15. package/dist/collection/utils/utils.js +3 -0
  16. package/dist/components/casino-tournament-slider.d.ts +11 -0
  17. package/dist/components/casino-tournament-slider.js +169 -0
  18. package/dist/components/general-slider.js +6 -0
  19. package/dist/components/general-slider2.js +189 -0
  20. package/dist/components/index.d.ts +26 -0
  21. package/dist/components/index.js +1 -0
  22. package/dist/esm/casino-tournament-slider.js +17 -0
  23. package/dist/esm/casino-tournament-slider_2.entry.js +288 -0
  24. package/dist/esm/index-c48feefa.js +1237 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/loader.js +17 -0
  27. package/dist/esm/polyfills/core-js.js +11 -0
  28. package/dist/esm/polyfills/css-shim.js +1 -0
  29. package/dist/esm/polyfills/dom.js +79 -0
  30. package/dist/esm/polyfills/es5-html-element.js +1 -0
  31. package/dist/esm/polyfills/index.js +34 -0
  32. package/dist/esm/polyfills/system.js +6 -0
  33. package/dist/index.cjs.js +1 -0
  34. package/dist/index.js +1 -0
  35. package/dist/stencil.config.js +22 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-slider/.stencil/packages/casino-tournament-slider/stencil.config.d.ts +2 -0
  37. package/dist/types/components/casino-tournament-slider/casino-tournament-slider.d.ts +30 -0
  38. package/dist/types/components.d.ts +61 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  41. package/dist/types/utils/locale.utils.d.ts +1 -0
  42. package/dist/types/utils/utils.d.ts +1 -0
  43. package/loader/cdn.js +3 -0
  44. package/loader/index.cjs.js +3 -0
  45. package/loader/index.d.ts +12 -0
  46. package/loader/index.es2017.js +3 -0
  47. package/loader/index.js +4 -0
  48. package/loader/package.json +10 -0
  49. package/package.json +19 -0
@@ -0,0 +1,189 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+
3
+ 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:#0072ED;opacity:0.2;cursor:pointer;float:right}.PageButton.active{width:45px;opacity:1}";
4
+
5
+ const GeneralSlider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.showStatus = false;
11
+ this.slideNumber = 3;
12
+ this.slideShow = 3;
13
+ this.showArrow = true;
14
+ this.showButton = false;
15
+ this.autoSlide = false;
16
+ this.loopTime = 1;
17
+ this.autoItemHeight = false;
18
+ this.currentSlideNumber = 0;
19
+ this.slidesCount = 0;
20
+ this.slideWidth = 0;
21
+ this.currentPage = 0;
22
+ this.controls = {
23
+ Prev: null,
24
+ Next: null
25
+ };
26
+ this.xDown = null;
27
+ this.yDown = null;
28
+ }
29
+ slide(next) {
30
+ let slideTo = 0;
31
+ if (next) {
32
+ slideTo = this.currentSlideNumber + this.slideNumber;
33
+ }
34
+ else {
35
+ slideTo = this.currentSlideNumber - this.slideNumber;
36
+ }
37
+ if (slideTo < 0 || slideTo >= this.slidesCount)
38
+ return;
39
+ this.currentSlideNumber = slideTo;
40
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
41
+ this.updateListStyle();
42
+ }
43
+ slideTo(page) {
44
+ this.currentSlideNumber = page * this.slideNumber;
45
+ this.currentPage = page;
46
+ this.updateListStyle();
47
+ }
48
+ updateControls() {
49
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
50
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
51
+ }
52
+ switchControl(type, enabled) {
53
+ if (this.controls[type]) {
54
+ this.controls[type].disabled = !enabled;
55
+ }
56
+ }
57
+ componentWillLoad() {
58
+ this.slides = this.el.querySelectorAll('li');
59
+ this.slidesCount = this.slides.length;
60
+ if (!this.slideNumber)
61
+ this.slideNumber = 1;
62
+ if (!this.slideShow)
63
+ this.slideShow = 1;
64
+ }
65
+ componentDidLoad() {
66
+ this.sliderList = this.el.shadowRoot.querySelector('ul');
67
+ this.slideWidth = this.slides[0].offsetWidth;
68
+ for (let type in this.controls) {
69
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
70
+ }
71
+ this.updateControls();
72
+ if (this.autoSlide) {
73
+ this.setSlideAutoInterval();
74
+ }
75
+ }
76
+ componentDidRender() {
77
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
78
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
79
+ this.updateListStyle();
80
+ }
81
+ updateListStyle() {
82
+ if (!this.autoItemHeight)
83
+ return;
84
+ const sliderlist = this.el.querySelectorAll('li');
85
+ sliderlist.forEach((li, index) => {
86
+ li.classList.add('hide');
87
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
88
+ li.classList.remove('hide');
89
+ }
90
+ });
91
+ }
92
+ disconnectedCallback() {
93
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
94
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
95
+ }
96
+ handleTouchStart(evt) {
97
+ const firstTouch = this.getTouches(evt)[0];
98
+ this.xDown = firstTouch.clientX;
99
+ this.yDown = firstTouch.clientY;
100
+ clearInterval(this.sliderInterval);
101
+ }
102
+ getTouches(evt) {
103
+ return evt.touches || evt.originalEvent.touches;
104
+ }
105
+ handleTouchMove(evt) {
106
+ if (!this.xDown || !this.yDown)
107
+ return;
108
+ let xUp = evt.touches[0].clientX;
109
+ let yUp = evt.touches[0].clientY;
110
+ let xDiff = this.xDown - xUp;
111
+ let yDiff = this.yDown - yUp;
112
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
113
+ if (xDiff > 0) {
114
+ this.slide(true);
115
+ }
116
+ else {
117
+ this.slide(false);
118
+ }
119
+ }
120
+ this.xDown = null;
121
+ this.yDown = null;
122
+ if (this.autoSlide) {
123
+ this.setSlideAutoInterval();
124
+ }
125
+ }
126
+ ;
127
+ setSlideAutoInterval() {
128
+ if (this.loopTime == 0) {
129
+ return;
130
+ }
131
+ clearInterval(this.sliderInterval);
132
+ this.sliderInterval = setInterval(() => {
133
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
134
+ this.slideTo(this.currentPage + 1);
135
+ }
136
+ else {
137
+ this.slideTo(0);
138
+ }
139
+ }, Number(this.loopTime) * 1000);
140
+ }
141
+ componentDidUpdate() {
142
+ this.sliderList.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
143
+ this.updateControls();
144
+ }
145
+ switchLoopStatus(isMouseMoveEnter) {
146
+ if (!this.autoSlide)
147
+ return;
148
+ if (this.loopTime > 0) {
149
+ if (isMouseMoveEnter) {
150
+ clearInterval(this.sliderInterval);
151
+ }
152
+ else {
153
+ this.setSlideAutoInterval();
154
+ }
155
+ }
156
+ }
157
+ render() {
158
+ return (h("div", { class: "GeneralSlider" }, h("div", { class: "Slider" }, this.showArrow &&
159
+ h("div", null, h("button", { 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", { 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", { class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, h("slot", null))), this.showButton && this.slidesCount > 0 &&
160
+ h("div", { 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")))));
161
+ }
162
+ get el() { return this; }
163
+ static get style() { return generalSliderCss; }
164
+ }, [1, "general-slider", {
165
+ "showStatus": [4, "show-status"],
166
+ "slideNumber": [2, "slide-number"],
167
+ "slideShow": [2, "slide-show"],
168
+ "showArrow": [4, "show-arrow"],
169
+ "showButton": [4, "show-button"],
170
+ "autoSlide": [4, "auto-slide"],
171
+ "loopTime": [2, "loop-time"],
172
+ "autoItemHeight": [4, "auto-item-height"],
173
+ "currentSlideNumber": [32]
174
+ }]);
175
+ function defineCustomElement() {
176
+ if (typeof customElements === "undefined") {
177
+ return;
178
+ }
179
+ const components = ["general-slider"];
180
+ components.forEach(tagName => { switch (tagName) {
181
+ case "general-slider":
182
+ if (!customElements.get(tagName)) {
183
+ customElements.define(tagName, GeneralSlider);
184
+ }
185
+ break;
186
+ } });
187
+ }
188
+
189
+ export { GeneralSlider as G, defineCustomElement as d };
@@ -0,0 +1,26 @@
1
+ /* CasinoTournamentSlider 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';
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-c48feefa.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
15
+ patchBrowser().then(options => {
16
+ return bootstrapLazy([["casino-tournament-slider_2",[[1,"casino-tournament-slider",{"useEvent":[1,"use-event"],"endpoint":[1],"tournamentId":[1,"tournament-id"],"session":[1],"language":[1],"gamesLimit":[2,"games-limit"],"offset":[2],"slideNumber":[2,"slide-number"],"slideShow":[2,"slide-show"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"showTitle":[4,"show-title"],"limitStylingAppends":[32],"stylingContainer":[32],"games":[32],"hover":[32],"hoverIndex":[32]},[[8,"getTournamentInfoCompleted","todoCompletedHandler"]]],[1,"general-slider",{"showStatus":[4,"show-status"],"slideNumber":[2,"slide-number"],"slideShow":[2,"slide-show"],"showArrow":[4,"show-arrow"],"showButton":[4,"show-button"],"autoSlide":[4,"auto-slide"],"loopTime":[2,"loop-time"],"autoItemHeight":[4,"auto-item-height"],"currentSlideNumber":[32]}]]]], options);
17
+ });
@@ -0,0 +1,288 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-c48feefa.js';
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
+ playNow: 'Play now',
8
+ sliderTitle: 'Participanting games'
9
+ },
10
+ 'zh-hk': {
11
+ playNow: '现在播放',
12
+ },
13
+ fr: {
14
+ playNow: 'Joue maintenant',
15
+ },
16
+ ro: {
17
+ playNow: 'Joaca acum',
18
+ },
19
+ hu: {
20
+ playNow: 'Játsszon most',
21
+ },
22
+ tr: {
23
+ playNow: 'Şimdi oyna',
24
+ },
25
+ el: {
26
+ playNow: 'Παίξε τώρα',
27
+ },
28
+ es: {
29
+ playNow: 'Jugar Ya',
30
+ },
31
+ pt: {
32
+ playNow: 'Jogue agora',
33
+ },
34
+ };
35
+ const translate = (key, customLang) => {
36
+ const lang = customLang;
37
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
38
+ };
39
+
40
+ 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}";
41
+
42
+ const CasinoTournamentSlider = class {
43
+ constructor(hostRef) {
44
+ registerInstance(this, hostRef);
45
+ this.gamesLimit = 30;
46
+ this.offset = 0;
47
+ this.slideNumber = 3;
48
+ this.slideShow = 3;
49
+ this.clientStyling = '';
50
+ this.clientStylingUrl = '';
51
+ this.showTitle = false;
52
+ this.limitStylingAppends = false;
53
+ this.enter = (index) => {
54
+ this.hover = true;
55
+ this.hoverIndex = index;
56
+ };
57
+ this.leave = () => {
58
+ this.hover = false;
59
+ this.hoverIndex = -1;
60
+ };
61
+ this.gameClicked = (item) => {
62
+ window.postMessage({ type: 'TournamentGameAction', gameId: item.id, name: item.name }, window.location.href);
63
+ };
64
+ this.setClientStyling = () => {
65
+ let sheet = document.createElement('style');
66
+ sheet.innerHTML = this.clientStyling;
67
+ this.stylingContainer.prepend(sheet);
68
+ };
69
+ this.setClientStylingURL = () => {
70
+ let cssFile = document.createElement('style');
71
+ setTimeout(() => {
72
+ cssFile.innerHTML = this.clientStylingUrl;
73
+ this.stylingContainer.prepend(cssFile);
74
+ }, 1);
75
+ };
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 + `/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.stylingContainer) {
110
+ if (this.clientStyling)
111
+ this.setClientStyling();
112
+ if (this.clientStylingUrl)
113
+ this.setClientStylingURL();
114
+ this.limitStylingAppends = true;
115
+ }
116
+ }
117
+ render() {
118
+ return h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "TournamentSlider" }, this.showTitle && this.games &&
119
+ h("div", { class: "SliderTitle" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "25", viewBox: "0 0 21 25", fill: "none" }, h("path", { 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", { class: "Title" }, translate('sliderTitle', this.language))), h("div", { class: "Items" }, this.games &&
120
+ h("general-slider", { "slide-number": this.slideNumber, "slide-show": this.slideShow }, this.games && this.games.map((game, i) => {
121
+ 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 }));
122
+ })))));
123
+ }
124
+ };
125
+ CasinoTournamentSlider.style = casinoTournamentSliderCss;
126
+
127
+ 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:#0072ED;opacity:0.2;cursor:pointer;float:right}.PageButton.active{width:45px;opacity:1}";
128
+
129
+ const GeneralSlider = class {
130
+ constructor(hostRef) {
131
+ registerInstance(this, hostRef);
132
+ this.showStatus = false;
133
+ this.slideNumber = 3;
134
+ this.slideShow = 3;
135
+ this.showArrow = true;
136
+ this.showButton = false;
137
+ this.autoSlide = false;
138
+ this.loopTime = 1;
139
+ this.autoItemHeight = false;
140
+ this.currentSlideNumber = 0;
141
+ this.slidesCount = 0;
142
+ this.slideWidth = 0;
143
+ this.currentPage = 0;
144
+ this.controls = {
145
+ Prev: null,
146
+ Next: null
147
+ };
148
+ this.xDown = null;
149
+ this.yDown = null;
150
+ }
151
+ slide(next) {
152
+ let slideTo = 0;
153
+ if (next) {
154
+ slideTo = this.currentSlideNumber + this.slideNumber;
155
+ }
156
+ else {
157
+ slideTo = this.currentSlideNumber - this.slideNumber;
158
+ }
159
+ if (slideTo < 0 || slideTo >= this.slidesCount)
160
+ return;
161
+ this.currentSlideNumber = slideTo;
162
+ this.currentPage = this.currentSlideNumber / this.slideNumber;
163
+ this.updateListStyle();
164
+ }
165
+ slideTo(page) {
166
+ this.currentSlideNumber = page * this.slideNumber;
167
+ this.currentPage = page;
168
+ this.updateListStyle();
169
+ }
170
+ updateControls() {
171
+ this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
172
+ this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
173
+ }
174
+ switchControl(type, enabled) {
175
+ if (this.controls[type]) {
176
+ this.controls[type].disabled = !enabled;
177
+ }
178
+ }
179
+ componentWillLoad() {
180
+ this.slides = this.el.querySelectorAll('li');
181
+ this.slidesCount = this.slides.length;
182
+ if (!this.slideNumber)
183
+ this.slideNumber = 1;
184
+ if (!this.slideShow)
185
+ this.slideShow = 1;
186
+ }
187
+ componentDidLoad() {
188
+ this.sliderList = this.el.shadowRoot.querySelector('ul');
189
+ this.slideWidth = this.slides[0].offsetWidth;
190
+ for (let type in this.controls) {
191
+ this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
192
+ }
193
+ this.updateControls();
194
+ if (this.autoSlide) {
195
+ this.setSlideAutoInterval();
196
+ }
197
+ }
198
+ componentDidRender() {
199
+ this.el.addEventListener('touchstart', this.handleTouchStart.bind(this), { passive: true });
200
+ this.el.addEventListener('touchmove', this.handleTouchMove.bind(this), { passive: true });
201
+ this.updateListStyle();
202
+ }
203
+ updateListStyle() {
204
+ if (!this.autoItemHeight)
205
+ return;
206
+ const sliderlist = this.el.querySelectorAll('li');
207
+ sliderlist.forEach((li, index) => {
208
+ li.classList.add('hide');
209
+ if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
210
+ li.classList.remove('hide');
211
+ }
212
+ });
213
+ }
214
+ disconnectedCallback() {
215
+ this.el.removeEventListener('touchstart', this.handleTouchStart);
216
+ this.el.removeEventListener('touchmove', this.handleTouchMove);
217
+ }
218
+ handleTouchStart(evt) {
219
+ const firstTouch = this.getTouches(evt)[0];
220
+ this.xDown = firstTouch.clientX;
221
+ this.yDown = firstTouch.clientY;
222
+ clearInterval(this.sliderInterval);
223
+ }
224
+ getTouches(evt) {
225
+ return evt.touches || evt.originalEvent.touches;
226
+ }
227
+ handleTouchMove(evt) {
228
+ if (!this.xDown || !this.yDown)
229
+ return;
230
+ let xUp = evt.touches[0].clientX;
231
+ let yUp = evt.touches[0].clientY;
232
+ let xDiff = this.xDown - xUp;
233
+ let yDiff = this.yDown - yUp;
234
+ if (Math.abs(xDiff) > Math.abs(yDiff)) {
235
+ if (xDiff > 0) {
236
+ this.slide(true);
237
+ }
238
+ else {
239
+ this.slide(false);
240
+ }
241
+ }
242
+ this.xDown = null;
243
+ this.yDown = null;
244
+ if (this.autoSlide) {
245
+ this.setSlideAutoInterval();
246
+ }
247
+ }
248
+ ;
249
+ setSlideAutoInterval() {
250
+ if (this.loopTime == 0) {
251
+ return;
252
+ }
253
+ clearInterval(this.sliderInterval);
254
+ this.sliderInterval = setInterval(() => {
255
+ if (this.currentPage + 1 < this.slidesCount / this.slideNumber) {
256
+ this.slideTo(this.currentPage + 1);
257
+ }
258
+ else {
259
+ this.slideTo(0);
260
+ }
261
+ }, Number(this.loopTime) * 1000);
262
+ }
263
+ componentDidUpdate() {
264
+ this.sliderList.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
265
+ this.updateControls();
266
+ }
267
+ switchLoopStatus(isMouseMoveEnter) {
268
+ if (!this.autoSlide)
269
+ return;
270
+ if (this.loopTime > 0) {
271
+ if (isMouseMoveEnter) {
272
+ clearInterval(this.sliderInterval);
273
+ }
274
+ else {
275
+ this.setSlideAutoInterval();
276
+ }
277
+ }
278
+ }
279
+ render() {
280
+ return (h("div", { class: "GeneralSlider" }, h("div", { class: "Slider" }, this.showArrow &&
281
+ h("div", null, h("button", { 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", { 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", { class: `SliderList Col-${this.slideShow}`, part: "SliderList", onMouseEnter: this.switchLoopStatus.bind(this, true), onMouseLeave: this.switchLoopStatus.bind(this, false) }, h("slot", null))), this.showButton && this.slidesCount > 0 &&
282
+ h("div", { 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")))));
283
+ }
284
+ get el() { return getElement(this); }
285
+ };
286
+ GeneralSlider.style = generalSliderCss;
287
+
288
+ export { CasinoTournamentSlider as casino_tournament_slider, GeneralSlider as general_slider };