@everymatrix/casino-filter-modal 1.0.3 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-filter-modal",
3
- "version": "1.0.3",
3
+ "version": "1.0.8",
4
4
  "main": "dist/casino-filter-modal.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -14,15 +14,11 @@
14
14
  export let endpoint:string = '';
15
15
  export let sessioncheck:string = 'true';
16
16
 
17
- let hasErrors:boolean = false;
18
- let error:string = '';
19
17
  let isLoggedIn:boolean = false;
20
18
  let sessionID:string = '';
21
19
  let playerID:string = '';
22
20
  let userAgent:string = window.navigator.userAgent;
23
- let isLoading:boolean = true;
24
21
  let mobileView:boolean = false;
25
- let modalElement:HTMLElement;
26
22
  let customStylingContainer:HTMLElement;
27
23
  let width:string;
28
24
  let height:string;
@@ -66,25 +62,24 @@
66
62
  }
67
63
  }
68
64
 
69
- const setClientStyling = () => {
65
+ const setClientStyling = ():void => {
70
66
  let sheet = document.createElement('style');
71
-
72
67
  sheet.innerHTML = clientstyling;
73
-
74
- if (show) {
75
- setTimeout(() => { modalElement.appendChild(sheet); });
76
- }
68
+ customStylingContainer.appendChild(sheet);
77
69
  }
78
70
 
79
- const setClientStylingURL = () => {
71
+ const setClientStylingURL = ():void => {
72
+ let url:URL = new URL(clientstylingurl);
80
73
  let cssFile:HTMLElement = document.createElement('style');
81
74
 
82
- fetch(new URL(clientstylingurl))
75
+ fetch(url.href)
83
76
  .then((res:any) => res.text())
84
77
  .then((data:any) => {
85
78
  cssFile.innerHTML = data
86
79
 
87
- customStylingContainer.appendChild(cssFile);
80
+ if (customStylingContainer) {
81
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
82
+ }
88
83
  });
89
84
  }
90
85
 
@@ -101,16 +96,14 @@
101
96
  });
102
97
 
103
98
  $: session && userid && endpoint && setSession();
104
- $: clientstyling && setClientStyling();
105
- $: clientstylingurl && setClientStylingURL();
106
- $: show && clientstylingurl && setClientStylingURL();
99
+ $: clientstyling && customStylingContainer && setClientStyling();
100
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
107
101
  </script>
108
102
 
109
103
  <div bind:this={customStylingContainer} part="CustomStylingContainer">
110
104
  {#if show}
111
105
  <div
112
106
  transition:fade="{{ transitionDuration: duration }}"
113
- bind:this={modalElement}
114
107
  bind:clientWidth={width}
115
108
  bind:clientHeight={height}
116
109
  class="FilterModalWindow"