@everymatrix/casino-tournament-slider 1.44.0 → 1.45.2
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.
- package/dist/casino-tournament-slider/casino-tournament-slider.esm.js +1 -1
- package/dist/casino-tournament-slider/p-01da553f.entry.js +1 -0
- package/dist/casino-tournament-slider/p-c541e3cd.js +2 -0
- package/dist/casino-tournament-slider/p-e1255160.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/casino-tournament-slider.cjs.js +16 -10
- package/dist/cjs/casino-tournament-slider_2.cjs.entry.js +313 -330
- package/dist/cjs/index-e4a7f235.js +1279 -0
- package/dist/cjs/loader.cjs.js +6 -12
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/casino-tournament-slider/casino-tournament-slider.js +338 -328
- package/dist/collection/components/casino-tournament-slider/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +34 -34
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/casino-tournament-slider.js +13 -10
- package/dist/esm/casino-tournament-slider_2.entry.js +313 -330
- package/dist/esm/index-e38437e9.js +1252 -0
- package/dist/esm/loader.js +6 -12
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-slider/.stencil/packages/stencil/casino-tournament-slider/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/casino-tournament-slider/.stencil/packages/stencil/casino-tournament-slider/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/casino-tournament-slider/casino-tournament-slider.d.ts +28 -28
- package/dist/types/components/casino-tournament-slider/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +11 -1
- package/dist/casino-tournament-slider/p-039bfb6a.entry.js +0 -1
- package/dist/casino-tournament-slider/p-7bade785.js +0 -1
- package/dist/cjs/index-f60eba31.js +0 -1263
- package/dist/components/casino-tournament-slider.d.ts +0 -11
- package/dist/components/casino-tournament-slider.js +0 -179
- package/dist/components/general-slider.js +0 -6
- package/dist/components/general-slider2.js +0 -257
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/index-c48feefa.js +0 -1237
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/casino-tournament-slider/.stencil/packages/casino-tournament-slider/stencil.config.d.ts +0 -2
|
@@ -1,364 +1,347 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e38437e9.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE = 'en';
|
|
4
4
|
const TRANSLATIONS = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
36
|
};
|
|
37
37
|
const translate = (key, customLang) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
41
|
};
|
|
42
42
|
|
|
43
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;
|
|
44
45
|
|
|
45
46
|
const CasinoTournamentSlider = class {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
+
}
|
|
73
107
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (this.session) {
|
|
83
|
-
reqHeaders.append('X-SessionId', this.session);
|
|
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
|
+
}
|
|
84
116
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.games = res.item.games.items;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
componentWillLoad() {
|
|
95
|
-
if (!this.useEvent && this.endpoint && this.tournamentId) {
|
|
96
|
-
this.getTournamentInfo();
|
|
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];
|
|
97
123
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
});
|
|
106
135
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
setClientStylingURL() {
|
|
116
|
-
let url = new URL(this.clientStylingUrl);
|
|
117
|
-
fetch(url.href)
|
|
118
|
-
.then((res) => res.text())
|
|
119
|
-
.then((data) => {
|
|
120
|
-
const sheet = new CSSStyleSheet();
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
sheet.replace(data);
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
this.host.shadowRoot.adoptedStyleSheets = [...this.host.shadowRoot.adoptedStyleSheets, sheet];
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
render() {
|
|
128
|
-
return h("div", { class: "TournamentSliderWrap" }, h("div", { class: "TournamentSlider" }, this.showTitle && this.games &&
|
|
129
|
-
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 &&
|
|
130
|
-
h("general-slider", { "slide-number": this.slideNumber, "slide-show": this.slideShow }, this.games && this.games.map((game, i) => {
|
|
131
|
-
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 }));
|
|
132
|
-
})))));
|
|
133
|
-
}
|
|
134
|
-
get host() { return getElement(this); }
|
|
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); }
|
|
135
144
|
};
|
|
136
|
-
CasinoTournamentSlider.style =
|
|
145
|
+
CasinoTournamentSlider.style = CasinoTournamentSliderStyle0;
|
|
137
146
|
|
|
138
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;
|
|
139
149
|
|
|
140
150
|
const GeneralSlider = class {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.slideWidth = 0;
|
|
184
|
-
this.currentPage = 0;
|
|
185
|
-
this.controls = {
|
|
186
|
-
Prev: null,
|
|
187
|
-
Next: null
|
|
188
|
-
};
|
|
189
|
-
this.xDown = null;
|
|
190
|
-
this.yDown = null;
|
|
191
|
-
}
|
|
192
|
-
slide(next) {
|
|
193
|
-
let slideTo = 0;
|
|
194
|
-
if (next) {
|
|
195
|
-
slideTo = this.currentSlideNumber + this.slideNumber;
|
|
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();
|
|
196
193
|
}
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
updateControls() {
|
|
195
|
+
this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
|
|
196
|
+
this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
|
|
199
197
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.updateListStyle();
|
|
205
|
-
}
|
|
206
|
-
slideTo(page) {
|
|
207
|
-
this.currentSlideNumber = page * this.slideNumber;
|
|
208
|
-
this.currentPage = page;
|
|
209
|
-
this.updateListStyle();
|
|
210
|
-
}
|
|
211
|
-
updateControls() {
|
|
212
|
-
this.switchControl('Prev', (this.currentSlideNumber === 0) ? false : true);
|
|
213
|
-
this.switchControl('Next', (this.currentSlideNumber === this.slidesCount - this.slideShow) ? false : true);
|
|
214
|
-
}
|
|
215
|
-
switchControl(type, enabled) {
|
|
216
|
-
if (this.controls[type]) {
|
|
217
|
-
this.controls[type].disabled = !enabled;
|
|
198
|
+
switchControl(type, enabled) {
|
|
199
|
+
if (this.controls[type]) {
|
|
200
|
+
this.controls[type].disabled = !enabled;
|
|
201
|
+
}
|
|
218
202
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.slideShow = 1;
|
|
225
|
-
}
|
|
226
|
-
componentDidLoad() {
|
|
227
|
-
this.slides = this.slotEl.assignedElements();
|
|
228
|
-
this.slidesCount = this.slides.length;
|
|
229
|
-
for (let type in this.controls) {
|
|
230
|
-
this.controls[type] = this.el.shadowRoot.querySelector('.Button' + type);
|
|
203
|
+
componentWillLoad() {
|
|
204
|
+
if (!this.slideNumber)
|
|
205
|
+
this.slideNumber = 1;
|
|
206
|
+
if (!this.slideShow)
|
|
207
|
+
this.slideShow = 1;
|
|
231
208
|
}
|
|
232
|
-
|
|
233
|
-
|
|
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
|
+
}
|
|
234
225
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
this.
|
|
240
|
-
|
|
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
|
+
}
|
|
241
239
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
+
});
|
|
255
253
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return;
|
|
260
|
-
if (this.slides === null)
|
|
261
|
-
return;
|
|
262
|
-
this.slides.forEach((li, index) => {
|
|
263
|
-
if (index >= this.currentPage * this.slideNumber && index < (this.currentPage + 1) * this.slideNumber) {
|
|
264
|
-
li.classList.remove('hide');
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
li.classList.add('hide');
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
disconnectedCallback() {
|
|
272
|
-
this.el.removeEventListener('touchstart', this.handleTouchStart);
|
|
273
|
-
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
274
|
-
}
|
|
275
|
-
handleTouchStart(evt) {
|
|
276
|
-
const firstTouch = this.getTouches(evt)[0];
|
|
277
|
-
this.xDown = firstTouch.clientX;
|
|
278
|
-
this.yDown = firstTouch.clientY;
|
|
279
|
-
clearInterval(this.sliderInterval);
|
|
280
|
-
}
|
|
281
|
-
getTouches(evt) {
|
|
282
|
-
return evt.touches || evt.originalEvent.touches;
|
|
283
|
-
}
|
|
284
|
-
handleTouchMove(evt) {
|
|
285
|
-
if (!this.xDown || !this.yDown)
|
|
286
|
-
return;
|
|
287
|
-
let xUp = evt.touches[0].clientX;
|
|
288
|
-
let yUp = evt.touches[0].clientY;
|
|
289
|
-
let xDiff = this.xDown - xUp;
|
|
290
|
-
let yDiff = this.yDown - yUp;
|
|
291
|
-
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
|
292
|
-
if (xDiff > 0) {
|
|
293
|
-
this.slide(true);
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
this.slide(false);
|
|
297
|
-
}
|
|
254
|
+
disconnectedCallback() {
|
|
255
|
+
this.el.removeEventListener('touchstart', this.handleTouchStart);
|
|
256
|
+
this.el.removeEventListener('touchmove', this.handleTouchMove);
|
|
298
257
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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;
|
|
303
266
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
|
+
}
|
|
309
287
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
else {
|
|
316
|
-
this.slideTo(0);
|
|
317
|
-
}
|
|
318
|
-
}, Number(this.loopTime) * 1000);
|
|
319
|
-
}
|
|
320
|
-
componentDidUpdate() {
|
|
321
|
-
this.sliderEl.style.transform = `translateX(${this.currentSlideNumber * this.slideWidth * -1}px)`;
|
|
322
|
-
this.updateControls();
|
|
323
|
-
}
|
|
324
|
-
switchLoopStatus(isMouseMoveEnter) {
|
|
325
|
-
if (!this.autoSlide)
|
|
326
|
-
return;
|
|
327
|
-
if (this.loopTime > 0) {
|
|
328
|
-
if (isMouseMoveEnter) {
|
|
288
|
+
;
|
|
289
|
+
setSlideAutoInterval() {
|
|
290
|
+
if (this.loopTime == 0) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
329
293
|
clearInterval(this.sliderInterval);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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")))));
|
|
334
342
|
}
|
|
335
|
-
|
|
336
|
-
setClientStyling() {
|
|
337
|
-
const sheet = new CSSStyleSheet();
|
|
338
|
-
// @ts-ignore
|
|
339
|
-
sheet.replace(this.clientStyling);
|
|
340
|
-
// @ts-ignore
|
|
341
|
-
this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
|
|
342
|
-
}
|
|
343
|
-
setClientStylingURL() {
|
|
344
|
-
let url = new URL(this.clientStylingUrl);
|
|
345
|
-
fetch(url.href)
|
|
346
|
-
.then((res) => res.text())
|
|
347
|
-
.then((data) => {
|
|
348
|
-
const sheet = new CSSStyleSheet();
|
|
349
|
-
// @ts-ignore
|
|
350
|
-
sheet.replace(data);
|
|
351
|
-
// @ts-ignore
|
|
352
|
-
this.el.shadowRoot.adoptedStyleSheets = [...this.el.shadowRoot.adoptedStyleSheets, sheet];
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
render() {
|
|
356
|
-
return (h("div", { class: "GeneralSlider" }, h("div", { class: "Slider" }, this.showArrow &&
|
|
357
|
-
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), ref: (el) => this.sliderEl = el }, h("slot", { ref: (el) => this.slotEl = el }))), this.showButton && this.slidesCount > 0 &&
|
|
358
|
-
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")))));
|
|
359
|
-
}
|
|
360
|
-
get el() { return getElement(this); }
|
|
343
|
+
get el() { return getElement(this); }
|
|
361
344
|
};
|
|
362
|
-
GeneralSlider.style =
|
|
345
|
+
GeneralSlider.style = GeneralSliderStyle0;
|
|
363
346
|
|
|
364
347
|
export { CasinoTournamentSlider as casino_tournament_slider, GeneralSlider as general_slider };
|