@everymatrix/casino-filter-modal 0.0.367 → 0.0.368
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/README.md +30 -30
- package/dist/casino-filter-modal.js.map +1 -1
- package/index.html +37 -37
- package/index.js +1 -1
- package/package.json +2 -2
- package/public/reset.css +47 -47
- package/rollup.config.js +67 -67
- package/src/CasinoFilterModal.svelte +204 -204
- package/src/index.ts +4 -4
- package/stories/CasinoFilterModal.stories.js +13 -13
- package/tsconfig.json +6 -6
@@ -1,204 +1,204 @@
|
|
1
|
-
<svelte:options tag={null} />
|
2
|
-
|
3
|
-
<script lang="ts">
|
4
|
-
import { onMount } from 'svelte';
|
5
|
-
import { fade } from 'svelte/transition';
|
6
|
-
import { isMobile, checkSession } from 'rvhelper';
|
7
|
-
|
8
|
-
export let show:boolean = false;
|
9
|
-
export let duration:number = 350;
|
10
|
-
export let session:string = '';
|
11
|
-
export let userid:string = '';
|
12
|
-
export let clientstyling:string = '';
|
13
|
-
export let clientstylingurl:string = '';
|
14
|
-
export let endpoint:string = '';
|
15
|
-
export let sessioncheck:string = 'true';
|
16
|
-
|
17
|
-
let hasErrors:boolean = false;
|
18
|
-
let error:string = '';
|
19
|
-
let isLoggedIn:boolean = false;
|
20
|
-
let sessionID:string = '';
|
21
|
-
let playerID:string = '';
|
22
|
-
let userAgent:string = window.navigator.userAgent;
|
23
|
-
let isLoading:boolean = true;
|
24
|
-
let mobileView:boolean = false;
|
25
|
-
let modalElement:HTMLElement;
|
26
|
-
let customStylingContainer:HTMLElement;
|
27
|
-
let width:string;
|
28
|
-
let height:string;
|
29
|
-
|
30
|
-
const close = () => {
|
31
|
-
show = false;
|
32
|
-
|
33
|
-
window.postMessage({ type: 'FiltersModalClosed' }, window.location.href);
|
34
|
-
window.postMessage({ type: 'EnableScroll'}, window.location.href);
|
35
|
-
};
|
36
|
-
|
37
|
-
const messageHandler = (e:any) => {
|
38
|
-
if (e.data.type === 'ShowFilterModal') {
|
39
|
-
show = true;
|
40
|
-
|
41
|
-
window.postMessage({ type: 'FiltersModal', ven: e.data.ven }, window.location.href);
|
42
|
-
window.postMessage({ type: 'DisableScroll'}, window.location.href);
|
43
|
-
}
|
44
|
-
|
45
|
-
if (e.data.type === 'ApplyFilters') {
|
46
|
-
close();
|
47
|
-
|
48
|
-
setTimeout(() => {
|
49
|
-
window.postMessage({ type: 'ModalLoader' }, window.location.href);
|
50
|
-
}, 500);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
const setSession = () => {
|
55
|
-
if (sessioncheck == "true") {
|
56
|
-
checkSession(endpoint, session).then((res:any) => {
|
57
|
-
sessionID = res.Guid;
|
58
|
-
playerID = res.UserID;
|
59
|
-
isLoggedIn = true;
|
60
|
-
}, (err:any) => {
|
61
|
-
isLoggedIn = false;
|
62
|
-
console.error('err on session', err);
|
63
|
-
});
|
64
|
-
} else {
|
65
|
-
sessionID = session;
|
66
|
-
isLoggedIn = true;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
const setClientStyling = () => {
|
71
|
-
let sheet = document.createElement('style');
|
72
|
-
|
73
|
-
sheet.innerHTML = clientstyling;
|
74
|
-
|
75
|
-
if (show) {
|
76
|
-
setTimeout(() => { modalElement.appendChild(sheet); });
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
const setClientStylingURL = () => {
|
81
|
-
let cssFile:HTMLElement = document.createElement('style');
|
82
|
-
|
83
|
-
fetch(new URL(clientstylingurl))
|
84
|
-
.then((res:any) => res.text())
|
85
|
-
.then((data:any) => {
|
86
|
-
cssFile.innerHTML = data
|
87
|
-
|
88
|
-
customStylingContainer.appendChild(cssFile);
|
89
|
-
});
|
90
|
-
}
|
91
|
-
|
92
|
-
onMount(() => {
|
93
|
-
window.addEventListener('message', messageHandler, false);
|
94
|
-
|
95
|
-
if (isMobile(userAgent)) {
|
96
|
-
mobileView = true;
|
97
|
-
}
|
98
|
-
|
99
|
-
return () => {
|
100
|
-
window.removeEventListener('message', messageHandler);
|
101
|
-
}
|
102
|
-
});
|
103
|
-
|
104
|
-
$: session && userid && endpoint && setSession();
|
105
|
-
$: clientstyling && setClientStyling();
|
106
|
-
$: clientstylingurl && setClientStylingURL();
|
107
|
-
$: show && clientstylingurl && setClientStylingURL();
|
108
|
-
</script>
|
109
|
-
|
110
|
-
<div bind:this={customStylingContainer} part="CustomStylingContainer">
|
111
|
-
{#if show}
|
112
|
-
<div
|
113
|
-
transition:fade="{{ transitionDuration: duration }}"
|
114
|
-
bind:this={modalElement}
|
115
|
-
bind:clientWidth={width}
|
116
|
-
bind:clientHeight={height}
|
117
|
-
class="FilterModalWindow"
|
118
|
-
id="FilterModal"
|
119
|
-
part="FilterModalWindow">
|
120
|
-
|
121
|
-
<div class="FilterModalContainer {mobileView ? 'FilterModalMobileContainer' : ''}" part="FilterModalContainer {mobileView ? 'FilterModalMobileContainer' : ''}">
|
122
|
-
<span class="FilterModalCloseBtn" part="FilterModalCloseBtn" on:click={close} role="button">
|
123
|
-
<slot name="close">
|
124
|
-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
|
125
|
-
</slot>
|
126
|
-
</span>
|
127
|
-
|
128
|
-
<slot />
|
129
|
-
</div>
|
130
|
-
|
131
|
-
</div>
|
132
|
-
{/if}
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<style lang="scss">
|
136
|
-
|
137
|
-
:host {
|
138
|
-
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
139
|
-
}
|
140
|
-
|
141
|
-
*, *::before, *::after {
|
142
|
-
margin: 0;
|
143
|
-
padding: 0;
|
144
|
-
box-sizing: border-box;
|
145
|
-
}
|
146
|
-
|
147
|
-
.FilterModalWindow {
|
148
|
-
display: flex;
|
149
|
-
position: fixed;
|
150
|
-
align-items: center;
|
151
|
-
justify-content: center;
|
152
|
-
width: 100%;
|
153
|
-
height: 100%;
|
154
|
-
z-index: 100;
|
155
|
-
top: 0;
|
156
|
-
left: 0;
|
157
|
-
background-color: rgba(0, 0, 0, .9);
|
158
|
-
.FilterModalContainer {
|
159
|
-
width: 90%;
|
160
|
-
max-width: 880px;
|
161
|
-
padding: 60px;
|
162
|
-
border-top: 3px solid var(--emfe-w-color-secondary, #FD2839);
|
163
|
-
border-radius: 5px;
|
164
|
-
position: relative;
|
165
|
-
background: var(--emfe-w-color-white, #FFFFFF);
|
166
|
-
}
|
167
|
-
.FilterModalCloseBtn {
|
168
|
-
position: absolute;
|
169
|
-
display: flex;
|
170
|
-
align-items: center;
|
171
|
-
justify-content: center;
|
172
|
-
top: 0;
|
173
|
-
right: 0;
|
174
|
-
margin: 15px;
|
175
|
-
border-radius: 50%;
|
176
|
-
color: var(--emfe-w-color-secondary, #FD2839);
|
177
|
-
background: rgba(255, 255, 255, .1);
|
178
|
-
cursor: pointer;
|
179
|
-
transition: all 150ms ease-in-out;
|
180
|
-
|
181
|
-
svg {
|
182
|
-
width: 36px;
|
183
|
-
height: 36px;
|
184
|
-
}
|
185
|
-
|
186
|
-
&:hover {
|
187
|
-
background: rgba(255, 255, 255, .2);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
.FilterModalMobileContainer {
|
191
|
-
padding: 10px;
|
192
|
-
border-top: none;
|
193
|
-
.FilterModalCloseBtn {
|
194
|
-
margin: 10px;
|
195
|
-
svg {
|
196
|
-
width: 24px;
|
197
|
-
height: 24px;
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
</style>
|
1
|
+
<svelte:options tag={null} />
|
2
|
+
|
3
|
+
<script lang="ts">
|
4
|
+
import { onMount } from 'svelte';
|
5
|
+
import { fade } from 'svelte/transition';
|
6
|
+
import { isMobile, checkSession } from 'rvhelper';
|
7
|
+
|
8
|
+
export let show:boolean = false;
|
9
|
+
export let duration:number = 350;
|
10
|
+
export let session:string = '';
|
11
|
+
export let userid:string = '';
|
12
|
+
export let clientstyling:string = '';
|
13
|
+
export let clientstylingurl:string = '';
|
14
|
+
export let endpoint:string = '';
|
15
|
+
export let sessioncheck:string = 'true';
|
16
|
+
|
17
|
+
let hasErrors:boolean = false;
|
18
|
+
let error:string = '';
|
19
|
+
let isLoggedIn:boolean = false;
|
20
|
+
let sessionID:string = '';
|
21
|
+
let playerID:string = '';
|
22
|
+
let userAgent:string = window.navigator.userAgent;
|
23
|
+
let isLoading:boolean = true;
|
24
|
+
let mobileView:boolean = false;
|
25
|
+
let modalElement:HTMLElement;
|
26
|
+
let customStylingContainer:HTMLElement;
|
27
|
+
let width:string;
|
28
|
+
let height:string;
|
29
|
+
|
30
|
+
const close = () => {
|
31
|
+
show = false;
|
32
|
+
|
33
|
+
window.postMessage({ type: 'FiltersModalClosed' }, window.location.href);
|
34
|
+
window.postMessage({ type: 'EnableScroll'}, window.location.href);
|
35
|
+
};
|
36
|
+
|
37
|
+
const messageHandler = (e:any) => {
|
38
|
+
if (e.data.type === 'ShowFilterModal') {
|
39
|
+
show = true;
|
40
|
+
|
41
|
+
window.postMessage({ type: 'FiltersModal', ven: e.data.ven }, window.location.href);
|
42
|
+
window.postMessage({ type: 'DisableScroll'}, window.location.href);
|
43
|
+
}
|
44
|
+
|
45
|
+
if (e.data.type === 'ApplyFilters') {
|
46
|
+
close();
|
47
|
+
|
48
|
+
setTimeout(() => {
|
49
|
+
window.postMessage({ type: 'ModalLoader' }, window.location.href);
|
50
|
+
}, 500);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
const setSession = () => {
|
55
|
+
if (sessioncheck == "true") {
|
56
|
+
checkSession(endpoint, session).then((res:any) => {
|
57
|
+
sessionID = res.Guid;
|
58
|
+
playerID = res.UserID;
|
59
|
+
isLoggedIn = true;
|
60
|
+
}, (err:any) => {
|
61
|
+
isLoggedIn = false;
|
62
|
+
console.error('err on session', err);
|
63
|
+
});
|
64
|
+
} else {
|
65
|
+
sessionID = session;
|
66
|
+
isLoggedIn = true;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
const setClientStyling = () => {
|
71
|
+
let sheet = document.createElement('style');
|
72
|
+
|
73
|
+
sheet.innerHTML = clientstyling;
|
74
|
+
|
75
|
+
if (show) {
|
76
|
+
setTimeout(() => { modalElement.appendChild(sheet); });
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
const setClientStylingURL = () => {
|
81
|
+
let cssFile:HTMLElement = document.createElement('style');
|
82
|
+
|
83
|
+
fetch(new URL(clientstylingurl))
|
84
|
+
.then((res:any) => res.text())
|
85
|
+
.then((data:any) => {
|
86
|
+
cssFile.innerHTML = data
|
87
|
+
|
88
|
+
customStylingContainer.appendChild(cssFile);
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
onMount(() => {
|
93
|
+
window.addEventListener('message', messageHandler, false);
|
94
|
+
|
95
|
+
if (isMobile(userAgent)) {
|
96
|
+
mobileView = true;
|
97
|
+
}
|
98
|
+
|
99
|
+
return () => {
|
100
|
+
window.removeEventListener('message', messageHandler);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
|
104
|
+
$: session && userid && endpoint && setSession();
|
105
|
+
$: clientstyling && setClientStyling();
|
106
|
+
$: clientstylingurl && setClientStylingURL();
|
107
|
+
$: show && clientstylingurl && setClientStylingURL();
|
108
|
+
</script>
|
109
|
+
|
110
|
+
<div bind:this={customStylingContainer} part="CustomStylingContainer">
|
111
|
+
{#if show}
|
112
|
+
<div
|
113
|
+
transition:fade="{{ transitionDuration: duration }}"
|
114
|
+
bind:this={modalElement}
|
115
|
+
bind:clientWidth={width}
|
116
|
+
bind:clientHeight={height}
|
117
|
+
class="FilterModalWindow"
|
118
|
+
id="FilterModal"
|
119
|
+
part="FilterModalWindow">
|
120
|
+
|
121
|
+
<div class="FilterModalContainer {mobileView ? 'FilterModalMobileContainer' : ''}" part="FilterModalContainer {mobileView ? 'FilterModalMobileContainer' : ''}">
|
122
|
+
<span class="FilterModalCloseBtn" part="FilterModalCloseBtn" on:click={close} role="button">
|
123
|
+
<slot name="close">
|
124
|
+
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
|
125
|
+
</slot>
|
126
|
+
</span>
|
127
|
+
|
128
|
+
<slot />
|
129
|
+
</div>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
{/if}
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<style lang="scss">
|
136
|
+
|
137
|
+
:host {
|
138
|
+
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
139
|
+
}
|
140
|
+
|
141
|
+
*, *::before, *::after {
|
142
|
+
margin: 0;
|
143
|
+
padding: 0;
|
144
|
+
box-sizing: border-box;
|
145
|
+
}
|
146
|
+
|
147
|
+
.FilterModalWindow {
|
148
|
+
display: flex;
|
149
|
+
position: fixed;
|
150
|
+
align-items: center;
|
151
|
+
justify-content: center;
|
152
|
+
width: 100%;
|
153
|
+
height: 100%;
|
154
|
+
z-index: 100;
|
155
|
+
top: 0;
|
156
|
+
left: 0;
|
157
|
+
background-color: rgba(0, 0, 0, .9);
|
158
|
+
.FilterModalContainer {
|
159
|
+
width: 90%;
|
160
|
+
max-width: 880px;
|
161
|
+
padding: 60px;
|
162
|
+
border-top: 3px solid var(--emfe-w-color-secondary, #FD2839);
|
163
|
+
border-radius: 5px;
|
164
|
+
position: relative;
|
165
|
+
background: var(--emfe-w-color-white, #FFFFFF);
|
166
|
+
}
|
167
|
+
.FilterModalCloseBtn {
|
168
|
+
position: absolute;
|
169
|
+
display: flex;
|
170
|
+
align-items: center;
|
171
|
+
justify-content: center;
|
172
|
+
top: 0;
|
173
|
+
right: 0;
|
174
|
+
margin: 15px;
|
175
|
+
border-radius: 50%;
|
176
|
+
color: var(--emfe-w-color-secondary, #FD2839);
|
177
|
+
background: rgba(255, 255, 255, .1);
|
178
|
+
cursor: pointer;
|
179
|
+
transition: all 150ms ease-in-out;
|
180
|
+
|
181
|
+
svg {
|
182
|
+
width: 36px;
|
183
|
+
height: 36px;
|
184
|
+
}
|
185
|
+
|
186
|
+
&:hover {
|
187
|
+
background: rgba(255, 255, 255, .2);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
.FilterModalMobileContainer {
|
191
|
+
padding: 10px;
|
192
|
+
border-top: none;
|
193
|
+
.FilterModalCloseBtn {
|
194
|
+
margin: 10px;
|
195
|
+
svg {
|
196
|
+
width: 24px;
|
197
|
+
height: 24px;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
</style>
|
package/src/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import CasinoFilterModal from './CasinoFilterModal.svelte';
|
2
|
-
|
3
|
-
!customElements.get('casino-filter-modal') && customElements.define('casino-filter-modal', CasinoFilterModal);
|
4
|
-
export default CasinoFilterModal;
|
1
|
+
import CasinoFilterModal from './CasinoFilterModal.svelte';
|
2
|
+
|
3
|
+
!customElements.get('casino-filter-modal') && customElements.define('casino-filter-modal', CasinoFilterModal);
|
4
|
+
export default CasinoFilterModal;
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { html } from 'lit-element';
|
2
|
-
|
3
|
-
import CasinoFilterModal from '../src/CasinoFilterModal';
|
4
|
-
|
5
|
-
// This default export determines where your story goes in the story list
|
6
|
-
export default {
|
7
|
-
title: 'CasinoFilterModal',
|
8
|
-
};
|
9
|
-
|
10
|
-
// 👇 We create a “template” of how args map to rendering
|
11
|
-
const CasinoFilterModal = ({ aProperty }) => html`<casino-filter-modal></casino-filter-modal>`;
|
12
|
-
|
13
|
-
export const FirstStory = CasinoFilterModal.bind({});
|
1
|
+
import { html } from 'lit-element';
|
2
|
+
|
3
|
+
import CasinoFilterModal from '../src/CasinoFilterModal';
|
4
|
+
|
5
|
+
// This default export determines where your story goes in the story list
|
6
|
+
export default {
|
7
|
+
title: 'CasinoFilterModal',
|
8
|
+
};
|
9
|
+
|
10
|
+
// 👇 We create a “template” of how args map to rendering
|
11
|
+
const CasinoFilterModal = ({ aProperty }) => html`<casino-filter-modal></casino-filter-modal>`;
|
12
|
+
|
13
|
+
export const FirstStory = CasinoFilterModal.bind({});
|
package/tsconfig.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
{
|
2
|
-
"extends": "@tsconfig/svelte/tsconfig.json",
|
3
|
-
|
4
|
-
"include": ["src/**/*"],
|
5
|
-
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
6
|
-
}
|
1
|
+
{
|
2
|
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
3
|
+
|
4
|
+
"include": ["src/**/*"],
|
5
|
+
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
6
|
+
}
|