@everymatrix/casino-slider 0.0.363 → 0.0.367

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.
@@ -1,310 +1,310 @@
1
- <svelte:options tag={null} />
2
-
3
- <script lang="ts">
4
- import { onMount } from 'svelte';
5
- import { getDevice } from 'rvhelper';
6
-
7
- import { _, addNewMessages, setLocale, setupI18n } from './i18n';
8
- import { CasinoSlider } from './translations';
9
-
10
- export let onclickeventname:string = 'defaultEvent';
11
- export let actionevent:string = 'defaultEvent';
12
- export let favoritesnumber:string = '0';
13
- export let location:string = '';
14
- export let clientstyling:string = '';
15
- export let clientstylingurl:string = '';
16
- export let identity:string = '';
17
- export let containermaxwidth:string = '';
18
- export let isprimarymenu:boolean = false;
19
- export let issecondarymenu:boolean = false;
20
- export let lang:string = '';
21
- export let activeindex:string;
22
-
23
- setupI18n({ withLocale: 'en', translations: {}});
24
-
25
- Object.keys(CasinoSlider).forEach((item:any) => {
26
- addNewMessages(item, CasinoSlider[item]);
27
- });
28
-
29
- let userAgent:string = window.navigator.userAgent;
30
- let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
31
-
32
- let carousel:any;
33
- let activeIndex:number;
34
- let prevIndex:number;
35
- let customStylingContainer:HTMLElement;
36
- let sliderdata:Array<any> = [];
37
-
38
- // Clicking on the slider item will trigger this method and send a postmessage on window
39
- // @TODO itemId type fix
40
- let handleClick = (item:any, index:number):void => {
41
- activeIndex = index;
42
- activeIndex = activeIndex;
43
- prevIndex = activeIndex;
44
-
45
- window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
46
- };
47
-
48
- let scrollLeft = ():void => {
49
- carousel.scrollBy({
50
- left: -250,
51
- behavior: 'smooth'
52
- });
53
- }
54
-
55
- let scrollRight = ():void => {
56
- carousel.scrollBy({
57
- left: +250,
58
- behavior: 'smooth'
59
- });
60
- }
61
-
62
- const setActiveIndex = ():void => {
63
- activeIndex = parseInt(activeindex, 10);
64
- if(!prevIndex){
65
- prevIndex = activeIndex;
66
- }
67
- }
68
-
69
- const setClientStyling = ():void => {
70
- let sheet = document.createElement('style');
71
- sheet.innerHTML = clientstyling;
72
- setTimeout(() => { customStylingContainer.appendChild(sheet); });
73
- }
74
-
75
- const setClientStylingURL = ():void => {
76
- let cssFile = document.createElement('style');
77
- let url:URL = new URL(clientstylingurl);
78
-
79
- if (clientstylingurl) {
80
- fetch(url.href)
81
- .then((res:any) => res.text())
82
- .then((data:any) => {
83
- cssFile.innerHTML = data
84
-
85
- setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
86
- });
87
- }
88
- }
89
-
90
- const messageHandler = (e:any):void => {
91
- if (e.data.type == 'SliderData' && e.data.identity == identity) {
92
- sliderdata = e.data.data;
93
- }
94
- }
95
-
96
- const setActiveLanguage = ():void => {
97
- setLocale(lang);
98
- }
99
-
100
- onMount(() => {
101
- window.addEventListener('message', messageHandler, false);
102
-
103
- return () => {
104
- window.removeEventListener('message', messageHandler);
105
- }
106
- })
107
-
108
- $: activeindex && setActiveIndex();
109
- $: clientstyling && setClientStyling();
110
- $: clientstylingurl && setClientStylingURL();
111
- $: lang && setActiveLanguage();
112
- </script>
113
-
114
- <div class="CarouselWrapper { (location === 'headerMain') ? 'CarouselWrapperHeaderMain' : '' }" part="CarouselWrapper { (location === 'headerMain') ? 'CarouselWrapperHeaderMain' : '' }" bind:this={customStylingContainer}>
115
- <div class="CarouselContainer {isMobile ? 'CarouselContainerMobile' : ''} { (location === 'headerMain') ? 'CarouselContainerHeaderMain' : '' }" part="CarouselContainer {isMobile ? 'CarouselContainerMobile' : ''} { (location === 'headerMain') ? 'CarouselContainerHeaderMain' : '' }" style="{ (location === 'headerMain') ? 'max-width: auto' : `max-width: ${containermaxwidth}px` }">
116
- <div class="CarouselLeftArrow" part="CarouselLeftArrow" on:click="{() => scrollLeft()}">
117
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
118
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
119
- </svg>
120
- </div>
121
-
122
- <ul class="CarouselItems" part="CarouselItems" bind:this={carousel}>
123
- {#if sliderdata.length > 0}
124
- {#each sliderdata as category, index (category.id)}
125
- <li class="CarouselItem {activeIndex == index || prevIndex == index ? 'active': ''}" part="CarouselItem" on:click={e => handleClick(category, index)}
126
- >
127
- {#if location === 'headerMain'}
128
- <a>{category.label}</a>
129
- {:else}
130
- {category.name} {category.id === "FAVORITES" ? "(" + favoritesnumber + ")" : ''}
131
- {/if}
132
-
133
- {#if category?.subGroups}
134
- <div class="dropdown-content">
135
- {#each category?.subGroups?.items as subCategory}
136
- <a>{subCategory?.name}</a>
137
- {/each}
138
- </div>
139
- {/if}
140
- </li>
141
- {/each}
142
- {/if}
143
- </ul>
144
-
145
- <div class="CarouselRightArrow" part="CarouselRightArrow" on:click="{() => scrollRight()}">
146
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
147
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
148
- </svg>
149
- </div>
150
- </div>
151
- </div>
152
-
153
- <style lang="scss">
154
-
155
- :host {
156
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
157
- }
158
-
159
- *, *::before, *::after {
160
- margin: 0;
161
- padding: 0;
162
- box-sizing: border-box;
163
- }
164
-
165
- .CarouselWrapper {
166
- background: var(--emfe-w-color-primary, #D0046C); /* fallback for old browsers */
167
- background: -webkit-linear-gradient(to left, var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
168
- background: linear-gradient(to left, var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
169
- &.CarouselWrapperHeaderMain {
170
- background: transparent;
171
- }
172
- }
173
-
174
- .CarouselContainer {
175
- display: flex;
176
- flex-direction: row;
177
- flex-wrap: nowrap;
178
- justify-content: space-between;
179
- width: 100%;
180
- color: var(--emfe-w-color-white, #FFFFFF);
181
- margin: 0 auto;
182
- &.CarouselContainerMobile {
183
- padding: 0;
184
- }
185
-
186
- .CarouselItems {
187
- position: relative;
188
- display: flex;
189
- flex-direction: row;
190
- flex-wrap: nowrap;
191
- align-items: center;
192
- //overflow-y: scroll;
193
- list-style-type: none;
194
- -ms-overflow-style: none;
195
- scrollbar-width: none;
196
-
197
- &::-webkit-scrollbar {
198
- display: none;
199
- }
200
-
201
- .CarouselItem {
202
- position: relative;
203
- display: flex;
204
- height: 100%;
205
- align-items: center;
206
- padding: 13px 11px;
207
- font-size: 15px;
208
- font-weight: 500;
209
- text-align: center;
210
- line-height: 26px;
211
- transition: all 150ms ease-in-out;
212
- white-space: nowrap;
213
-
214
- &:hover,
215
- &.active {
216
- background: var(--emfe-w-color-contrast, #07072A);
217
- cursor: pointer;
218
- }
219
- }
220
- }
221
-
222
- .dropdown-content {
223
- transition: all 1s ease-in;
224
- display: none;
225
- position: absolute;
226
- min-width: 100px;
227
- height: auto;
228
- top: 52px;
229
- left: 0;
230
- padding: 10px 11px;
231
- background: var(--emfe-w-color-contrast, #07072A); /* fallback for old browsers */
232
- background: -webkit-linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
233
- background: linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
234
-
235
- & a {
236
- display: block;
237
- font-weight: 400;
238
- line-height: 30px;
239
- }
240
- }
241
-
242
-
243
- .dropdown:hover .dropdown-content {
244
- transition: all 1s ease-in;
245
- display: block;
246
- opacity: 1;
247
- z-index: 999;
248
- }
249
-
250
- .CarouselLeftArrow,
251
- .CarouselRightArrow {
252
- display: flex;
253
- align-items: center;
254
- justify-content: center;
255
- width: 50%;
256
- max-width: 64px;
257
- background: rgba(255,255,255,.3);
258
-
259
- svg {
260
- width: 100%;
261
- max-width: 39px;
262
- }
263
-
264
- &:hover {
265
- cursor: pointer;
266
- }
267
- }
268
- }
269
-
270
- .CarouselContainerHeaderMain {
271
- .CarouselItems .CarouselItem {
272
- &:hover, &.active {
273
- background: transparent;
274
- a {
275
- border-bottom: 1px solid var(--emfe-w-color-primary, #D0046C);
276
- line-height: 84px;
277
- color: var(--emfe-w-color-primary, #D0046C);
278
- }
279
- }
280
- span {
281
- border-top: 1px solid transparent;
282
- padding-top: 5px;
283
- transition-duration: 0.3s;
284
- }
285
- }
286
- }
287
-
288
- .CarouselContainerHeaderMain {
289
- background: transparent;
290
- margin: 0;
291
- padding: 0;
292
- .CarouselLeftArrow, .CarouselRightArrow {
293
- background: transparent;
294
- width: unset;
295
- display: none;
296
- }
297
- .CarouselItem a {
298
- color: var(--emfe-w-color-white, #FFFFFF);
299
- text-decoration: none;
300
- }
301
- }
302
-
303
- @media only screen and (max-width: 1024px) {
304
- .CarouselContainerHeaderMain {
305
- .CarouselLeftArrow, .CarouselRightArrow {
306
- display: flex;
307
- }
308
- }
309
- }
310
- </style>
1
+ <svelte:options tag={null} />
2
+
3
+ <script lang="ts">
4
+ import { onMount } from 'svelte';
5
+ import { getDevice } from 'rvhelper';
6
+
7
+ import { _, addNewMessages, setLocale, setupI18n } from './i18n';
8
+ import { CasinoSlider } from './translations';
9
+
10
+ export let onclickeventname:string = 'defaultEvent';
11
+ export let actionevent:string = 'defaultEvent';
12
+ export let favoritesnumber:string = '0';
13
+ export let location:string = '';
14
+ export let clientstyling:string = '';
15
+ export let clientstylingurl:string = '';
16
+ export let identity:string = '';
17
+ export let containermaxwidth:string = '';
18
+ export let isprimarymenu:boolean = false;
19
+ export let issecondarymenu:boolean = false;
20
+ export let lang:string = '';
21
+ export let activeindex:string = '0';
22
+ export let showsubgroups:string = '';
23
+
24
+ setupI18n({ withLocale: 'en', translations: {}});
25
+
26
+ Object.keys(CasinoSlider).forEach((item:any) => {
27
+ addNewMessages(item, CasinoSlider[item]);
28
+ });
29
+
30
+ let userAgent:string = window.navigator.userAgent;
31
+ let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
32
+
33
+ let carousel:any;
34
+ let activeIndex:number;
35
+ let prevIndex:number;
36
+ let customStylingContainer:HTMLElement;
37
+ let sliderdata:Array<any> = [];
38
+
39
+ // Clicking on the slider item will trigger this method and send a postmessage on window
40
+ // @TODO itemId type fix
41
+ let handleClick = (item:any, index:number):void => {
42
+ activeIndex = index;
43
+ activeIndex = activeIndex;
44
+ prevIndex = activeIndex;
45
+
46
+ window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
47
+ };
48
+
49
+ let scrollLeft = ():void => {
50
+ carousel.scrollBy({
51
+ left: -250,
52
+ behavior: 'smooth'
53
+ });
54
+ }
55
+
56
+ let scrollRight = ():void => {
57
+ carousel.scrollBy({
58
+ left: +250,
59
+ behavior: 'smooth'
60
+ });
61
+ }
62
+
63
+ const setActiveIndex = ():void => {
64
+ activeIndex = parseInt(activeindex, 10);
65
+ if (!prevIndex) {
66
+ prevIndex = activeIndex;
67
+ }
68
+ }
69
+
70
+ const setClientStyling = ():void => {
71
+ let sheet = document.createElement('style');
72
+ sheet.innerHTML = clientstyling;
73
+ setTimeout(() => { customStylingContainer.appendChild(sheet); });
74
+ }
75
+
76
+ const setClientStylingURL = ():void => {
77
+ let cssFile = document.createElement('style');
78
+ let url:URL = new URL(clientstylingurl);
79
+
80
+ if (clientstylingurl) {
81
+ fetch(url.href)
82
+ .then((res:any) => res.text())
83
+ .then((data:any) => {
84
+ cssFile.innerHTML = data
85
+
86
+ setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
87
+ });
88
+ }
89
+ }
90
+
91
+ const messageHandler = (e:any):void => {
92
+ if (e.data.type == 'SliderData' && e.data.identity == identity) {
93
+ sliderdata = e.data.data;
94
+ }
95
+ }
96
+
97
+ const setActiveLanguage = ():void => {
98
+ setLocale(lang);
99
+ }
100
+
101
+ onMount(() => {
102
+ window.addEventListener('message', messageHandler, false);
103
+
104
+ return () => {
105
+ window.removeEventListener('message', messageHandler);
106
+ }
107
+ })
108
+
109
+ $: activeindex && setActiveIndex();
110
+ $: clientstyling && setClientStyling();
111
+ $: clientstylingurl && setClientStylingURL();
112
+ $: lang && setActiveLanguage();
113
+ </script>
114
+
115
+ <div class="CarouselWrapper { (location === 'headerMain') ? 'CarouselWrapperHeaderMain' : '' }" part="CarouselWrapper { (location === 'headerMain') ? 'CarouselWrapperHeaderMain' : '' }" bind:this={customStylingContainer}>
116
+ <div class="CarouselContainer {isMobile ? 'CarouselContainerMobile' : ''} { (location === 'headerMain') ? 'CarouselContainerHeaderMain' : '' }" part="CarouselContainer {isMobile ? 'CarouselContainerMobile' : ''} { (location === 'headerMain') ? 'CarouselContainerHeaderMain' : '' }" style="{ (location === 'headerMain') ? 'max-width: auto' : `max-width: ${containermaxwidth}px` }">
117
+ <div class="CarouselLeftArrow" part="CarouselLeftArrow" on:click="{() => scrollLeft()}">
118
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
119
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
120
+ </svg>
121
+ </div>
122
+
123
+ <ul class="CarouselItems" part="CarouselItems" bind:this={carousel}>
124
+ {#if sliderdata.length > 0}
125
+ {#each sliderdata as category, index (category.id)}
126
+ <li class="CarouselItem {activeIndex == index || prevIndex == index ? 'active': ''}" part="CarouselItem" on:click={e => handleClick(category, index)}
127
+ >
128
+ {#if location === 'headerMain'}
129
+ <a>{category.label}</a>
130
+ {:else}
131
+ {category.name} {category.id === "FAVORITES" ? "(" + favoritesnumber + ")" : ''}
132
+ {/if}
133
+
134
+ {#if category?.subGroups && showsubgroups == 'true'}
135
+ <div class="DropdownContent">
136
+ {#each category?.subGroups?.items as subCategory}
137
+ <a>{subCategory?.name}</a>
138
+ {/each}
139
+ </div>
140
+ {/if}
141
+ </li>
142
+ {/each}
143
+ {/if}
144
+ </ul>
145
+
146
+ <div class="CarouselRightArrow" part="CarouselRightArrow" on:click="{() => scrollRight()}">
147
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
148
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
149
+ </svg>
150
+ </div>
151
+ </div>
152
+ </div>
153
+
154
+ <style lang="scss">
155
+
156
+ :host {
157
+ font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
158
+ }
159
+
160
+ *, *::before, *::after {
161
+ margin: 0;
162
+ padding: 0;
163
+ box-sizing: border-box;
164
+ }
165
+
166
+ .CarouselWrapper {
167
+ background: var(--emfe-w-color-primary, #D0046C); /* fallback for old browsers */
168
+ background: -webkit-linear-gradient(to left, var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
169
+ background: linear-gradient(to left, var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
170
+ &.CarouselWrapperHeaderMain {
171
+ background: transparent;
172
+ }
173
+ }
174
+
175
+ .CarouselContainer {
176
+ display: flex;
177
+ flex-direction: row;
178
+ flex-wrap: nowrap;
179
+ justify-content: space-between;
180
+ width: 100%;
181
+ color: var(--emfe-w-color-white, #FFFFFF);
182
+ margin: 0 auto;
183
+ &.CarouselContainerMobile {
184
+ padding: 0;
185
+ }
186
+
187
+ .CarouselItems {
188
+ position: relative;
189
+ display: flex;
190
+ flex-direction: row;
191
+ flex-wrap: nowrap;
192
+ align-items: center;
193
+ overflow-y: scroll;
194
+ list-style-type: none;
195
+ -ms-overflow-style: none;
196
+ scrollbar-width: none;
197
+
198
+ &::-webkit-scrollbar {
199
+ display: none;
200
+ }
201
+
202
+ .CarouselItem {
203
+ position: relative;
204
+ display: flex;
205
+ height: 100%;
206
+ align-items: center;
207
+ padding: 13px 11px;
208
+ font-size: 15px;
209
+ font-weight: 500;
210
+ text-align: center;
211
+ line-height: 26px;
212
+ transition: all 150ms ease-in-out;
213
+ white-space: nowrap;
214
+
215
+ &:hover,
216
+ &.active {
217
+ background: var(--emfe-w-color-contrast, #07072A);
218
+ cursor: pointer;
219
+ }
220
+ }
221
+ }
222
+
223
+ .DropdownContent {
224
+ position: absolute;
225
+ transition: all 1s ease-in;
226
+ display: none;
227
+ min-width: 100px;
228
+ top: 52px;
229
+ left: 0;
230
+ padding: 10px 11px;
231
+ background: var(--emfe-w-color-contrast, #07072A); /* fallback for old browsers */
232
+ background: -webkit-linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
233
+ background: linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
234
+ & a {
235
+ display: block;
236
+ font-weight: 400;
237
+ line-height: 30px;
238
+ text-align: left;
239
+ }
240
+ }
241
+
242
+ .CarouselItem {
243
+ &:hover {
244
+ .DropdownContent {
245
+ display: block;
246
+ }
247
+ }
248
+ }
249
+
250
+ .CarouselLeftArrow,
251
+ .CarouselRightArrow {
252
+ display: flex;
253
+ align-items: center;
254
+ justify-content: center;
255
+ width: 50%;
256
+ max-width: 64px;
257
+ background: rgba(255,255,255,.3);
258
+
259
+ svg {
260
+ width: 100%;
261
+ max-width: 39px;
262
+ }
263
+
264
+ &:hover {
265
+ cursor: pointer;
266
+ }
267
+ }
268
+ }
269
+
270
+ .CarouselContainerHeaderMain {
271
+ .CarouselItems .CarouselItem {
272
+ &:hover, &.active {
273
+ background: transparent;
274
+ a {
275
+ border-bottom: 1px solid var(--emfe-w-color-primary, #D0046C);
276
+ line-height: 84px;
277
+ color: var(--emfe-w-color-primary, #D0046C);
278
+ }
279
+ }
280
+ span {
281
+ border-top: 1px solid transparent;
282
+ padding-top: 5px;
283
+ transition-duration: 0.3s;
284
+ }
285
+ }
286
+ }
287
+
288
+ .CarouselContainerHeaderMain {
289
+ background: transparent;
290
+ margin: 0;
291
+ padding: 0;
292
+ .CarouselLeftArrow, .CarouselRightArrow {
293
+ background: transparent;
294
+ width: unset;
295
+ display: none;
296
+ }
297
+ .CarouselItem a {
298
+ color: var(--emfe-w-color-white, #FFFFFF);
299
+ text-decoration: none;
300
+ }
301
+ }
302
+
303
+ @media only screen and (max-width: 1024px) {
304
+ .CarouselContainerHeaderMain {
305
+ .CarouselLeftArrow, .CarouselRightArrow {
306
+ display: flex;
307
+ }
308
+ }
309
+ }
310
+ </style>