@everymatrix/mini-games-lobby 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/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-85e4b23a.js +1211 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/mini-games-lobby.cjs.entry.js +79 -259
- package/dist/cjs/mini-games-lobby.cjs.js +17 -11
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/mini-games-lobby/index.js +1 -0
- package/dist/collection/components/mini-games-lobby/mini-games-lobby.js +193 -212
- package/dist/collection/decorators/base.decorator.js +9 -9
- package/dist/collection/decorators/locale.decorator.js +27 -27
- package/dist/collection/decorators/style.decorator.js +21 -21
- package/dist/collection/decorators/style.util.js +26 -26
- package/dist/collection/renders/GameLauncher.js +5 -12
- package/dist/collection/renders/Games.js +6 -12
- package/dist/collection/utils/fetch.js +20 -20
- package/dist/collection/utils/translation.js +9 -9
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-394aa256.js +1183 -0
- package/dist/esm/loader.js +7 -13
- package/dist/esm/mini-games-lobby.entry.js +79 -259
- package/dist/esm/mini-games-lobby.js +14 -11
- package/dist/mini-games-lobby/mini-games-lobby.esm.js +1 -1
- package/dist/mini-games-lobby/p-77bf5852.js +2 -0
- package/dist/mini-games-lobby/p-e1255160.js +1 -0
- package/dist/mini-games-lobby/p-e9908e53.entry.js +1 -0
- 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/mini-games-lobby/.stencil/packages/stencil/mini-games-lobby/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/mini-games-lobby/.stencil/packages/stencil/mini-games-lobby/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/mini-games-lobby/index.d.ts +1 -0
- package/dist/types/components/mini-games-lobby/mini-games-lobby.d.ts +47 -47
- package/dist/types/renders/GameLauncher.d.ts +2 -2
- package/dist/types/renders/Games.d.ts +3 -3
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/translation.d.ts +10 -10
- package/dist/types/utils/utils.d.ts +1 -0
- 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 +8 -5
- package/dist/cjs/index-90b83e7e.js +0 -1298
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/mini-games-lobby.d.ts +0 -11
- package/dist/components/mini-games-lobby.js +0 -323
- package/dist/esm/index-ced8f413.js +0 -1271
- 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/mini-games-lobby/p-49a0f62e.entry.js +0 -1
- package/dist/mini-games-lobby/p-e3451601.js +0 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/mini-games-lobby/.stencil/packages/mini-games-lobby/stencil.config.d.ts +0 -2
|
@@ -1,221 +1,202 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Games, GameLauncher } from '../../renders';
|
|
5
|
-
import { Locale } from '../../decorators/locale.decorator';
|
|
6
|
-
import { Style } from '../../decorators/style.decorator';
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { fetchGames, getUrl } from "../../utils/fetch";
|
|
3
|
+
import { Games, GameLauncher } from "../../renders";
|
|
7
4
|
export class MiniGamesLobby {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
this.filter = undefined;
|
|
7
|
+
this.session = undefined;
|
|
8
|
+
this.endpoint = undefined;
|
|
9
|
+
this.language = 'en';
|
|
10
|
+
this.clientStyling = '';
|
|
11
|
+
this.clientStylingUrl = '';
|
|
12
|
+
this.translationUrl = '';
|
|
13
|
+
this.locale = undefined;
|
|
14
|
+
this.launchUrl = undefined;
|
|
15
|
+
this.games = [];
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return (h("div", { key: '03127172e2daf14e75622b50e1ccddf6aa7171bb', id: "LobbyContainer" }, h(GameLauncher, { key: 'c025d961edfa15f2ff589d160a13927db9ad0464', src: this.launchUrl,
|
|
19
|
+
host: this.host }), h(Games, { key: '54141632cded87451053d4efa6480bfadf315f7e', text: this.locale.MiniGames,
|
|
20
|
+
games: this.games,
|
|
21
|
+
onClickGame: this.onClickGame.bind(this) })));
|
|
22
|
+
}
|
|
23
|
+
async updateGames() {
|
|
24
|
+
this.games = await fetchGames.bind(this).call();
|
|
25
|
+
}
|
|
26
|
+
onClickGame(launchUrl_raw) {
|
|
27
|
+
this.launchUrl = getUrl(launchUrl_raw, {
|
|
28
|
+
language: this.language,
|
|
29
|
+
_sid: this.session,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
13
32
|
/**
|
|
14
|
-
*
|
|
33
|
+
* define for @Style Decorator
|
|
15
34
|
*/
|
|
16
|
-
|
|
35
|
+
async componentDidLoad() {
|
|
36
|
+
this.updateGames();
|
|
37
|
+
}
|
|
17
38
|
/**
|
|
18
|
-
*
|
|
39
|
+
* define for @Locale and @Style
|
|
19
40
|
*/
|
|
20
|
-
|
|
41
|
+
componentShouldUpdate() { }
|
|
21
42
|
/**
|
|
22
|
-
*
|
|
43
|
+
* define for @Locale
|
|
23
44
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
"complexType": {
|
|
181
|
-
"original": "string",
|
|
182
|
-
"resolved": "string",
|
|
183
|
-
"references": {}
|
|
184
|
-
},
|
|
185
|
-
"required": false,
|
|
186
|
-
"optional": false,
|
|
187
|
-
"docs": {
|
|
188
|
-
"tags": [],
|
|
189
|
-
"text": "translation via url"
|
|
190
|
-
},
|
|
191
|
-
"attribute": "translation-url",
|
|
192
|
-
"reflect": false,
|
|
193
|
-
"defaultValue": "''"
|
|
45
|
+
componentWillLoad() { }
|
|
46
|
+
static get is() { return "mini-games-lobby"; }
|
|
47
|
+
static get encapsulation() { return "shadow"; }
|
|
48
|
+
static get originalStyleUrls() {
|
|
49
|
+
return {
|
|
50
|
+
"$": ["mini-games-lobby.scss"]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
static get styleUrls() {
|
|
54
|
+
return {
|
|
55
|
+
"$": ["mini-games-lobby.css"]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static get properties() {
|
|
59
|
+
return {
|
|
60
|
+
"filter": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"mutable": false,
|
|
63
|
+
"complexType": {
|
|
64
|
+
"original": "string",
|
|
65
|
+
"resolved": "string",
|
|
66
|
+
"references": {}
|
|
67
|
+
},
|
|
68
|
+
"required": false,
|
|
69
|
+
"optional": false,
|
|
70
|
+
"docs": {
|
|
71
|
+
"tags": [],
|
|
72
|
+
"text": "filter for interface /casino/games"
|
|
73
|
+
},
|
|
74
|
+
"attribute": "filter",
|
|
75
|
+
"reflect": false
|
|
76
|
+
},
|
|
77
|
+
"session": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"mutable": false,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "string",
|
|
82
|
+
"resolved": "string",
|
|
83
|
+
"references": {}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": "User Session"
|
|
90
|
+
},
|
|
91
|
+
"attribute": "session",
|
|
92
|
+
"reflect": false
|
|
93
|
+
},
|
|
94
|
+
"endpoint": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "string",
|
|
99
|
+
"resolved": "string",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Endpoint URL for the source of data"
|
|
107
|
+
},
|
|
108
|
+
"attribute": "endpoint",
|
|
109
|
+
"reflect": false
|
|
110
|
+
},
|
|
111
|
+
"language": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "string",
|
|
116
|
+
"resolved": "string",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": "Language of the widget"
|
|
124
|
+
},
|
|
125
|
+
"attribute": "language",
|
|
126
|
+
"reflect": false,
|
|
127
|
+
"defaultValue": "'en'"
|
|
128
|
+
},
|
|
129
|
+
"clientStyling": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "string",
|
|
134
|
+
"resolved": "string",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "Client custom styling via string"
|
|
142
|
+
},
|
|
143
|
+
"attribute": "client-styling",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "''"
|
|
146
|
+
},
|
|
147
|
+
"clientStylingUrl": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string",
|
|
152
|
+
"resolved": "string",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": "Client custom styling via url"
|
|
160
|
+
},
|
|
161
|
+
"attribute": "client-styling-url",
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"defaultValue": "''"
|
|
164
|
+
},
|
|
165
|
+
"translationUrl": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "string",
|
|
170
|
+
"resolved": "string",
|
|
171
|
+
"references": {}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": "translation via url"
|
|
178
|
+
},
|
|
179
|
+
"attribute": "translation-url",
|
|
180
|
+
"reflect": false,
|
|
181
|
+
"defaultValue": "''"
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
static get states() {
|
|
186
|
+
return {
|
|
187
|
+
"locale": {},
|
|
188
|
+
"launchUrl": {},
|
|
189
|
+
"games": {}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
static get elementRef() { return "host"; }
|
|
193
|
+
static get watchers() {
|
|
194
|
+
return [{
|
|
195
|
+
"propName": "endpoint",
|
|
196
|
+
"methodName": "updateGames"
|
|
197
|
+
}, {
|
|
198
|
+
"propName": "language",
|
|
199
|
+
"methodName": "updateGames"
|
|
200
|
+
}];
|
|
194
201
|
}
|
|
195
|
-
}; }
|
|
196
|
-
static get states() { return {
|
|
197
|
-
"locale": {},
|
|
198
|
-
"launchUrl": {},
|
|
199
|
-
"games": {}
|
|
200
|
-
}; }
|
|
201
|
-
static get elementRef() { return "host"; }
|
|
202
|
-
static get watchers() { return [{
|
|
203
|
-
"propName": "endpoint",
|
|
204
|
-
"methodName": "updateGames"
|
|
205
|
-
}, {
|
|
206
|
-
"propName": "language",
|
|
207
|
-
"methodName": "updateGames"
|
|
208
|
-
}]; }
|
|
209
202
|
}
|
|
210
|
-
__decorate([
|
|
211
|
-
Locale(),
|
|
212
|
-
__metadata("design:type", String)
|
|
213
|
-
], MiniGamesLobby.prototype, "language", void 0);
|
|
214
|
-
__decorate([
|
|
215
|
-
Style(),
|
|
216
|
-
__metadata("design:type", String)
|
|
217
|
-
], MiniGamesLobby.prototype, "clientStyling", void 0);
|
|
218
|
-
__decorate([
|
|
219
|
-
Style(),
|
|
220
|
-
__metadata("design:type", String)
|
|
221
|
-
], MiniGamesLobby.prototype, "clientStylingUrl", void 0);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const apply = (proto, lifecycle, run) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
proto[lifecycle] = function (...args) {
|
|
7
|
-
run.bind(this, ...args).call();
|
|
8
|
-
if (existLifeCycle) {
|
|
9
|
-
return existLifeCycle.bind(this, ...args).call();
|
|
2
|
+
const existLifeCycle = proto[lifecycle];
|
|
3
|
+
if (!existLifeCycle) {
|
|
4
|
+
throw new Error('lifecycle ' + lifecycle + ' not defined');
|
|
10
5
|
}
|
|
11
|
-
|
|
6
|
+
proto[lifecycle] = function (...args) {
|
|
7
|
+
run.bind(this, ...args).call();
|
|
8
|
+
if (existLifeCycle) {
|
|
9
|
+
return existLifeCycle.bind(this, ...args).call();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
12
|
};
|
|
@@ -2,39 +2,39 @@ import { apply } from "./base.decorator";
|
|
|
2
2
|
import { translation } from "../utils/translation";
|
|
3
3
|
import { fetcher } from "../utils/fetch";
|
|
4
4
|
const getLocale = (_translations, language) => {
|
|
5
|
-
|
|
5
|
+
return _translations[language] || _translations['en'];
|
|
6
6
|
};
|
|
7
7
|
function setLocale() {
|
|
8
|
-
|
|
8
|
+
this.locale = getLocale(this.translation, this.language);
|
|
9
9
|
}
|
|
10
10
|
async function setLocaleByUrl(isInit = true) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
if (this.translationUrl) {
|
|
12
|
+
this.translation = await fetcher(this.translationUrl);
|
|
13
|
+
setLocale.bind(this).call();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
if (!isInit) {
|
|
17
|
+
this.translation = translation;
|
|
18
|
+
setLocale.bind(this).call();
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
|
-
}
|
|
21
21
|
}
|
|
22
22
|
export const Locale = () => {
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
return (proto, prop) => {
|
|
25
|
-
apply(proto, 'componentWillLoad', async function () {
|
|
26
|
-
this.translation = translation;
|
|
27
|
-
setLocale.bind(this).call();
|
|
28
|
-
setLocaleByUrl.bind(this, true).call();
|
|
29
|
-
});
|
|
30
23
|
// @ts-ignore
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
return (proto, prop) => {
|
|
25
|
+
apply(proto, 'componentWillLoad', async function () {
|
|
26
|
+
this.translation = translation;
|
|
27
|
+
setLocale.bind(this).call();
|
|
28
|
+
setLocaleByUrl.bind(this, true).call();
|
|
29
|
+
});
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
apply(proto, 'componentShouldUpdate', async function (newValue, oldValue, key) {
|
|
32
|
+
if (key === 'language') {
|
|
33
|
+
setLocale.bind(this).call();
|
|
34
|
+
}
|
|
35
|
+
if (key === 'translationUrl') {
|
|
36
|
+
setLocaleByUrl.bind(this, false).call();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
40
|
};
|
|
@@ -2,27 +2,27 @@ import { getElement } from "@stencil/core";
|
|
|
2
2
|
import { apply } from "./base.decorator";
|
|
3
3
|
import { setClientStyling, setClientStylingUrl } from "./style.util";
|
|
4
4
|
const matchStyleProcess = (root, value, key) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
switch (key) {
|
|
6
|
+
case 'clientStyling':
|
|
7
|
+
setClientStyling(root, value);
|
|
8
|
+
break;
|
|
9
|
+
case 'clientStylingUrl':
|
|
10
|
+
setClientStylingUrl(root, value);
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
13
|
};
|
|
14
14
|
export const Style = () => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
return (proto, prop) => {
|
|
16
|
+
apply(proto, 'componentDidLoad', function () {
|
|
17
|
+
const root = getElement(this).shadowRoot;
|
|
18
|
+
matchStyleProcess(root, this[prop], prop);
|
|
19
|
+
});
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
apply(proto, 'componentShouldUpdate', function (newValue, oldValue, key) {
|
|
22
|
+
if (key !== prop)
|
|
23
|
+
return;
|
|
24
|
+
const root = getElement(this).shadowRoot;
|
|
25
|
+
matchStyleProcess(root, this[prop], prop);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
28
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
export const fetchText = async (url) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
let styleCode;
|
|
3
|
+
try {
|
|
4
|
+
let res = await fetch(url);
|
|
5
|
+
styleCode = await res.text();
|
|
6
|
+
}
|
|
7
|
+
catch (err) {
|
|
8
|
+
console.error('error ', err);
|
|
9
|
+
}
|
|
10
|
+
return styleCode;
|
|
11
11
|
};
|
|
12
12
|
const setStyle = (container, index, styleCode) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const sheet = new CSSStyleSheet();
|
|
14
|
+
styleCode && sheet.insertRule(styleCode);
|
|
15
|
+
try {
|
|
16
|
+
container.adoptedStyleSheets[index] = sheet;
|
|
17
|
+
}
|
|
18
|
+
catch (err) { }
|
|
19
19
|
};
|
|
20
20
|
const getCode = async (url) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
let styleCode;
|
|
22
|
+
if (url) {
|
|
23
|
+
styleCode = await fetchText(url);
|
|
24
|
+
}
|
|
25
|
+
return styleCode;
|
|
26
26
|
};
|
|
27
27
|
export const setClientStyling = (root, styleCode) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (!root)
|
|
29
|
+
return;
|
|
30
|
+
setStyle(root, 1, styleCode);
|
|
31
31
|
};
|
|
32
32
|
export const setClientStylingUrl = async (root, url) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
if (!root)
|
|
34
|
+
return;
|
|
35
|
+
setStyle(root, 2, await getCode(url));
|
|
36
36
|
};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { Fragment, h } from "@stencil/core";
|
|
2
|
-
import CrossIcon from
|
|
3
|
-
import FullScreenIcon from
|
|
4
|
-
import LaunchHeaderIcon from
|
|
5
|
-
const renderTopbar = () => (h("div", { id: "GameLaunchHeader" },
|
|
6
|
-
h("img", { src: LaunchHeaderIcon }),
|
|
7
|
-
h("button", { type: "button", class: "GameIcon GameIcon--full-screen" },
|
|
8
|
-
h("img", { src: FullScreenIcon })),
|
|
9
|
-
h("button", { type: "button", class: "GameIcon GameIcon--close" },
|
|
10
|
-
h("img", { src: CrossIcon }))));
|
|
2
|
+
import CrossIcon from "../images/CrossIcon.svg";
|
|
3
|
+
import FullScreenIcon from "../images/FullScreenIcon.svg";
|
|
4
|
+
import LaunchHeaderIcon from "../images/LaunchHeaderIcon.svg";
|
|
5
|
+
const renderTopbar = () => (h("div", { id: "GameLaunchHeader" }, h("img", { src: LaunchHeaderIcon }), h("button", { type: "button", class: "GameIcon GameIcon--full-screen" }, h("img", { src: FullScreenIcon })), h("button", { type: "button", class: "GameIcon GameIcon--close" }, h("img", { src: CrossIcon }))));
|
|
11
6
|
export const GameLauncher = ({ src, host }) => {
|
|
12
|
-
|
|
13
|
-
renderTopbar(),
|
|
14
|
-
h("iframe", { src: src, width: '100%', height: host.clientWidth / 16 * 9, frameborder: "0" })));
|
|
7
|
+
return src && (h(Fragment, null, renderTopbar(), h("iframe", { src: src, width: '100%', height: host.clientWidth / 16 * 9, frameborder: "0" })));
|
|
15
8
|
};
|