@everymatrix/player-panic-button 1.16.1
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 -0
- package/dist/panic-button.js +6965 -0
- package/dist/panic-button.js.map +1 -0
- package/dist/player-panic-button.js +6965 -0
- package/dist/player-panic-button.js.map +1 -0
- package/index.html +37 -0
- package/index.js +1 -0
- package/package.json +39 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +59 -0
- package/src/PlayerPanicButton.svelte +253 -0
- package/src/i18n.js +25 -0
- package/src/index.ts +4 -0
- package/src/translations.js +29 -0
- package/stories/PanicButton.stories.js +13 -0
- package/tsconfig.json +6 -0
package/index.html
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf-8'>
|
|
5
|
+
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
6
|
+
|
|
7
|
+
<title>
|
|
8
|
+
player-panic-button
|
|
9
|
+
</title>
|
|
10
|
+
<link rel="stylesheet" href="public/reset.css">
|
|
11
|
+
<script src='dist/player-panic-button.js'></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
<style>
|
|
16
|
+
html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
|
|
17
|
+
.header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
|
|
18
|
+
.header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
|
|
19
|
+
.header__name { color: #fff; }
|
|
20
|
+
.header__name span { margin-right: 10px; font-weight: bold; }
|
|
21
|
+
.webcomponent { padding: 10px 20px; }
|
|
22
|
+
</style>
|
|
23
|
+
<header class="header">
|
|
24
|
+
<div class="header__logo">
|
|
25
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="161" height="132" viewBox="0 0 161 132"><defs><linearGradient x1="0%" y1="50%" y2="50%" id="a"><stop stop-color="#2A3B8F" offset="0%"/><stop stop-color="#29ABE2" offset="100%"/></linearGradient><linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c"><stop stop-color="#B4D44E" offset="0%"/><stop stop-color="#E7F716" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path fill="#166DA5" d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"/><path fill="#8FDB69" d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"/><path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z"/><path fill="url(#a)" opacity=".95" d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"/><path fill="url(#c)" opacity=".95" d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"/><path fill="#010101" d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"/></g></svg>
|
|
26
|
+
</div>
|
|
27
|
+
<h1 class="header__name">
|
|
28
|
+
<span>WEBCOMPONENT:</span> player-panic-button
|
|
29
|
+
</h1>
|
|
30
|
+
</header>
|
|
31
|
+
|
|
32
|
+
<div class="webcomponent">
|
|
33
|
+
<player-panic-button></player-panic-button>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './dist/player-panic-button.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@everymatrix/player-panic-button",
|
|
3
|
+
"version": "1.16.1",
|
|
4
|
+
"main": "dist/player-panic-button.js",
|
|
5
|
+
"svelte": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "sirv public",
|
|
8
|
+
"build": "cross-env NODE_ENV=production && rollup -c",
|
|
9
|
+
"dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
|
|
10
|
+
"validate": "svelte-check",
|
|
11
|
+
"test": "echo"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
15
|
+
"@rollup/plugin-commonjs": "^16.0.0",
|
|
16
|
+
"@rollup/plugin-node-resolve": "^10.0.0",
|
|
17
|
+
"@rollup/plugin-typescript": "^6.0.0",
|
|
18
|
+
"@tsconfig/svelte": "^1.0.0",
|
|
19
|
+
"rollup": "^2.3.4",
|
|
20
|
+
"rollup-plugin-dev-server": "^0.4.3",
|
|
21
|
+
"rollup-plugin-livereload": "^2.0.0",
|
|
22
|
+
"rollup-plugin-svelte": "^7.0.0",
|
|
23
|
+
"rollup-plugin-terser": "^7.0.0",
|
|
24
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
25
|
+
"svelte-check": "^1.0.0",
|
|
26
|
+
"svelte-preprocess": "^5.0.0",
|
|
27
|
+
"tslib": "^2.0.0",
|
|
28
|
+
"typescript": "^3.9.3"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"cross-env": "^7.0.3",
|
|
32
|
+
"sirv-cli": "^1.0.0",
|
|
33
|
+
"svelte": "^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "a305078a67c4daeeb719b3e79cecee8b7c87f030"
|
|
39
|
+
}
|
|
Binary file
|
package/public/reset.css
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* http://meyerweb.com/eric/tools/css/reset/
|
|
2
|
+
v2.0 | 20110126
|
|
3
|
+
License: none (public domain)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
html, body, div, span, applet, object, iframe,
|
|
7
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
8
|
+
a, abbr, acronym, address, big, cite, code,
|
|
9
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
|
10
|
+
small, strike, strong, sub, sup, tt, var,
|
|
11
|
+
b, u, i, center,
|
|
12
|
+
dl, dt, dd, ol, ul, li,
|
|
13
|
+
fieldset, form, label, legend,
|
|
14
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
|
15
|
+
article, aside, canvas, details, embed,
|
|
16
|
+
figure, figcaption, footer, header, hgroup,
|
|
17
|
+
menu, nav, output, ruby, section, summary,
|
|
18
|
+
time, mark, audio, video {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 0;
|
|
22
|
+
font-size: 100%;
|
|
23
|
+
font: inherit;
|
|
24
|
+
vertical-align: baseline;
|
|
25
|
+
}
|
|
26
|
+
/* HTML5 display-role reset for older browsers */
|
|
27
|
+
article, aside, details, figcaption, figure,
|
|
28
|
+
footer, header, hgroup, menu, nav, section {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
body {
|
|
32
|
+
line-height: 1;
|
|
33
|
+
}
|
|
34
|
+
ol, ul {
|
|
35
|
+
list-style: none;
|
|
36
|
+
}
|
|
37
|
+
blockquote, q {
|
|
38
|
+
quotes: none;
|
|
39
|
+
}
|
|
40
|
+
blockquote:before, blockquote:after,
|
|
41
|
+
q:before, q:after {
|
|
42
|
+
content: '';
|
|
43
|
+
content: none;
|
|
44
|
+
}
|
|
45
|
+
table {
|
|
46
|
+
border-collapse: collapse;
|
|
47
|
+
border-spacing: 0;
|
|
48
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import svelte from 'rollup-plugin-svelte';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
+
import serve from 'rollup-plugin-dev-server';
|
|
5
|
+
import livereload from 'rollup-plugin-livereload';
|
|
6
|
+
import { terser } from 'rollup-plugin-terser';
|
|
7
|
+
import sveltePreprocess from 'svelte-preprocess';
|
|
8
|
+
import typescript from '@rollup/plugin-typescript';
|
|
9
|
+
const production = process.env.NODE_ENV === 'production';
|
|
10
|
+
const dev = process.env.NODE_ENV === 'development';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
input: 'src/index.ts',
|
|
14
|
+
output: {
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
format: 'umd',
|
|
17
|
+
name: 'app',
|
|
18
|
+
file: 'dist/player-panic-button.js'
|
|
19
|
+
},
|
|
20
|
+
plugins: [
|
|
21
|
+
svelte({
|
|
22
|
+
preprocess: sveltePreprocess(),
|
|
23
|
+
compilerOptions: {
|
|
24
|
+
// enable run-time checks when not in production
|
|
25
|
+
customElement: true,
|
|
26
|
+
dev: !production
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
commonjs(),
|
|
30
|
+
resolve({
|
|
31
|
+
browser: true,
|
|
32
|
+
dedupe: ['svelte']
|
|
33
|
+
}),
|
|
34
|
+
dev && serve({
|
|
35
|
+
open: true,
|
|
36
|
+
verbose: true,
|
|
37
|
+
allowCrossOrigin: true,
|
|
38
|
+
historyApiFallback: false,
|
|
39
|
+
host: 'localhost',
|
|
40
|
+
port: 5050,
|
|
41
|
+
}),
|
|
42
|
+
dev && livereload({ watch: ['', 'dist'] }),
|
|
43
|
+
typescript({
|
|
44
|
+
sourceMap: !production,
|
|
45
|
+
inlineSources: !production,
|
|
46
|
+
}),
|
|
47
|
+
// If we're building for production (npm run build
|
|
48
|
+
// instead of npm run dev), minify
|
|
49
|
+
production &&
|
|
50
|
+
terser({
|
|
51
|
+
output: {
|
|
52
|
+
comments: "all"
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
],
|
|
56
|
+
watch: {
|
|
57
|
+
clearScreen: false
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import { getDevice } from 'rvhelper';
|
|
5
|
+
import { _, addNewMessages, setLocale } from './i18n';
|
|
6
|
+
import { TRANSLATIONS } from './translations';
|
|
7
|
+
|
|
8
|
+
export let lang:string = 'en';
|
|
9
|
+
export let customtext:string = '';
|
|
10
|
+
export let clientstyling:string = '';
|
|
11
|
+
export let clientstylingurl:string = '';
|
|
12
|
+
export let alternativestyling:string = '';
|
|
13
|
+
export let translationurl:string = '';
|
|
14
|
+
|
|
15
|
+
let panicButton:HTMLElement;
|
|
16
|
+
let customStylingContainer:HTMLElement;
|
|
17
|
+
let panicLoading:boolean = false;
|
|
18
|
+
let timer: number = 0;
|
|
19
|
+
let timerInterval:any;
|
|
20
|
+
let userAgent:any = window.navigator.userAgent;
|
|
21
|
+
|
|
22
|
+
const setTranslationUrl = ():void => {
|
|
23
|
+
let url:string = translationurl;
|
|
24
|
+
|
|
25
|
+
fetch(url).then((res:any) => res.json())
|
|
26
|
+
.then((res) => {
|
|
27
|
+
Object.keys(res).forEach((item:any):void => {
|
|
28
|
+
addNewMessages(item, res[item]);
|
|
29
|
+
});
|
|
30
|
+
}).catch((err:any) => {
|
|
31
|
+
console.log(err);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Object.keys(TRANSLATIONS).forEach((item) => {
|
|
36
|
+
addNewMessages(item, TRANSLATIONS[item]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const addEventsToDisplayedElements = () => {
|
|
40
|
+
panicButton?.addEventListener("mousedown", startInterval, false);
|
|
41
|
+
panicButton?.addEventListener('touchstart', startInterval, false);
|
|
42
|
+
|
|
43
|
+
// on mouseup stop interval count
|
|
44
|
+
panicButton?.addEventListener("mouseup", endInterval, false);
|
|
45
|
+
panicButton?.addEventListener("touchend", endInterval, false);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const removeEventsToDisplayedElements = ():void => {
|
|
49
|
+
panicLoading = false;
|
|
50
|
+
panicButton?.removeEventListener("mousedown", startInterval);
|
|
51
|
+
panicButton?.removeEventListener('touchstart', startInterval);
|
|
52
|
+
|
|
53
|
+
// on mouseup stop interval count
|
|
54
|
+
panicButton?.removeEventListener("mouseup", endInterval);
|
|
55
|
+
panicButton?.removeEventListener("touchend", endInterval);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const startInterval = ():void => {
|
|
59
|
+
timer = 0;
|
|
60
|
+
panicLoading = true;
|
|
61
|
+
|
|
62
|
+
timerInterval = setInterval(() => {
|
|
63
|
+
timer++;
|
|
64
|
+
if (timer >= 2) {
|
|
65
|
+
window.postMessage({type: 'PanicButtonClicked'}, window.location.href);
|
|
66
|
+
clearInterval(timerInterval);
|
|
67
|
+
|
|
68
|
+
//Analytics event
|
|
69
|
+
if(typeof gtag == 'function'){
|
|
70
|
+
gtag('event', 'PanicButtonClicked', {
|
|
71
|
+
'context': 'PanicButton'
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, 1000);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const endInterval = ():void => {
|
|
79
|
+
panicLoading = false;
|
|
80
|
+
clearInterval(timerInterval);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const setClientStyling = ():void => {
|
|
84
|
+
let sheet = document.createElement('style');
|
|
85
|
+
sheet.innerHTML = clientstyling;
|
|
86
|
+
customStylingContainer.appendChild(sheet);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const setClientStylingURL = ():void => {
|
|
90
|
+
let url:URL = new URL(clientstylingurl);
|
|
91
|
+
let cssFile:HTMLElement = document.createElement('style');
|
|
92
|
+
|
|
93
|
+
fetch(url.href)
|
|
94
|
+
.then((res:any) => res.text())
|
|
95
|
+
.then((data:any) => {
|
|
96
|
+
cssFile.innerHTML = data
|
|
97
|
+
|
|
98
|
+
setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onMount(() => {
|
|
103
|
+
return () => {
|
|
104
|
+
removeEventsToDisplayedElements();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
$: panicButton && addEventsToDisplayedElements();
|
|
110
|
+
$: lang && setLocale(lang);
|
|
111
|
+
$: clientstyling && customStylingContainer && setClientStyling();
|
|
112
|
+
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
113
|
+
$: translationurl && setTranslationUrl();
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<div class="{alternativestyling == 'true' ? "PanicButtonV2" : ""}" bind:this={customStylingContainer}>
|
|
117
|
+
<div class="PanicSection {(getDevice(userAgent) !== 'PC') ? 'PanicSectionMobile' : ''}" part="PanicSection {(getDevice(userAgent) !== 'PC') ? 'PanicSectionMobile' : ''}">
|
|
118
|
+
<button
|
|
119
|
+
class="PanicButton {(getDevice(userAgent) !== 'PC') ? 'PanicButtonMobile' : ''}"
|
|
120
|
+
class:PanicButtonAnimation={panicLoading}
|
|
121
|
+
part="PanicButton {(getDevice(userAgent) !== 'PC') ? 'PanicButtonMobile' : ''}"
|
|
122
|
+
bind:this={panicButton}>
|
|
123
|
+
{customtext || $_('panicButtonString')}
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<style lang="scss">
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
$button-width: 280px;
|
|
133
|
+
|
|
134
|
+
*,
|
|
135
|
+
*::before,
|
|
136
|
+
*::after {
|
|
137
|
+
margin: 0;
|
|
138
|
+
padding: 0;
|
|
139
|
+
list-style: none;
|
|
140
|
+
text-decoration: none;
|
|
141
|
+
outline: none;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.PanicSection {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 10px;
|
|
149
|
+
margin: 20px 0;
|
|
150
|
+
|
|
151
|
+
.PanicButton {
|
|
152
|
+
border-radius: 5px;
|
|
153
|
+
border: 1px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
154
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
155
|
+
font-size: 10px;
|
|
156
|
+
width: $button-width;
|
|
157
|
+
height: fit-content;
|
|
158
|
+
padding: 15px;
|
|
159
|
+
color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// the use of !important is necessary in order to override margin from .PanicSection
|
|
165
|
+
.PanicSectionMobile {
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: 0;
|
|
168
|
+
left: 0;
|
|
169
|
+
width: 100%;
|
|
170
|
+
text-align: center;
|
|
171
|
+
margin: 20px 0 0 0 !important;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.PanicButtonMobile {
|
|
175
|
+
border-radius: 5px;
|
|
176
|
+
margin: 0 10px;
|
|
177
|
+
border: 1px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
178
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
179
|
+
width: 100% !important;
|
|
180
|
+
height: 30px;
|
|
181
|
+
color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
|
|
184
|
+
//Remove text selection for panic button on mobile
|
|
185
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
186
|
+
-webkit-user-select: none; /* Safari */
|
|
187
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
188
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
189
|
+
user-select: none;
|
|
190
|
+
// End of removing selection properties
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.PanicButtonAnimation {
|
|
194
|
+
background: -webkit-linear-gradient(
|
|
195
|
+
135deg,
|
|
196
|
+
rgba(20, 20, 20, 0) 55%, rgba(20, 20, 20, 0.3) 100%
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
background: -moz-linear-gradient(
|
|
200
|
+
135deg,
|
|
201
|
+
rgba(20, 20, 20, 0) 55%, rgba(20, 20, 20, 0.3) 100%
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
background: -o-linear-gradient(
|
|
205
|
+
135deg,
|
|
206
|
+
rgba(20, 20, 20, 0) 55%, rgba(20, 20, 20, 0.3) 100%
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
210
|
+
width: $button-width;
|
|
211
|
+
color: var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));
|
|
212
|
+
|
|
213
|
+
-webkit-animation: bar-animation 2s linear;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@-webkit-keyframes bar-animation {
|
|
217
|
+
0% {
|
|
218
|
+
background-position: 0;
|
|
219
|
+
}
|
|
220
|
+
100% {
|
|
221
|
+
background-position: $button-width;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.PanicButtonV2{
|
|
226
|
+
$button-width: 388px;
|
|
227
|
+
|
|
228
|
+
.PanicButton {
|
|
229
|
+
border: 1px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
230
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
231
|
+
width: $button-width;
|
|
232
|
+
font-size: 12px;
|
|
233
|
+
}
|
|
234
|
+
.PanicButtonMobile {
|
|
235
|
+
border: 1px solid var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
236
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
237
|
+
font-size: 10px;
|
|
238
|
+
}
|
|
239
|
+
.PanicButtonAnimation {
|
|
240
|
+
background-color: var(--emfe-w-casino-color-primary, var(--emfe-w-color-pink-500, #D0046C));
|
|
241
|
+
width: $button-width;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@-webkit-keyframes bar-animation {
|
|
245
|
+
0% {
|
|
246
|
+
background-position: 0;
|
|
247
|
+
}
|
|
248
|
+
100% {
|
|
249
|
+
background-position: $button-width;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
</style>
|
package/src/i18n.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dictionary,
|
|
3
|
+
locale,
|
|
4
|
+
addMessages,
|
|
5
|
+
_,
|
|
6
|
+
} from 'svelte-i18n';
|
|
7
|
+
|
|
8
|
+
function setupI18n({ withLocale: _locale, translations }) {
|
|
9
|
+
locale.subscribe((data) => {
|
|
10
|
+
if (data == null) {
|
|
11
|
+
dictionary.set(translations);
|
|
12
|
+
locale.set(_locale);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function addNewMessages(lang, dict) {
|
|
18
|
+
addMessages(lang, dict);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function setLocale(_locale) {
|
|
22
|
+
locale.set(_locale);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { _, setupI18n, addNewMessages, setLocale };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const TRANSLATIONS = {
|
|
2
|
+
'en': {
|
|
3
|
+
'panicButtonString': 'Hold button for 3 seconds to take 24-hour timeout',
|
|
4
|
+
},
|
|
5
|
+
'zh-hk': {
|
|
6
|
+
'panicButtonString': '长按3秒24小时即时锁定',
|
|
7
|
+
},
|
|
8
|
+
'fr': {
|
|
9
|
+
'panicButtonString': 'Maintenez le bouton enfoncé pendant 3 secondes pour prendre un verrouillage instantané de 24 heures',
|
|
10
|
+
},
|
|
11
|
+
'ro': {
|
|
12
|
+
'panicButtonString': 'Tine apasat 3 secunde pentru a lua o pauza de 24h',
|
|
13
|
+
},
|
|
14
|
+
'es': {
|
|
15
|
+
'panicButtonString': 'Dar clic durante 3 segundos para tomar un descanso de 24 horas',
|
|
16
|
+
},
|
|
17
|
+
'de': {
|
|
18
|
+
'panicButtonString': 'Button für 3 Sekunden drücken um eine 24-stündige Auszeit zu nehmen',
|
|
19
|
+
},
|
|
20
|
+
'hr': {
|
|
21
|
+
'panicButtonString': 'Držite gumb 3 sekunde kako biste aktivirali vremensko ograničenje od 24 sata',
|
|
22
|
+
},
|
|
23
|
+
'sl': {
|
|
24
|
+
'panicButtonString': 'Držite gumb 3 sekunde, da bi vzeli 24 urni premor',
|
|
25
|
+
},
|
|
26
|
+
'pl': {
|
|
27
|
+
'panicButtonString': 'Przytrzymaj przycisk przez 3 sekundy, aby uzyskać 24-godzinny limit czasu',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html } from 'lit-element';
|
|
2
|
+
|
|
3
|
+
import PanicButton from '../src/PanicButton';
|
|
4
|
+
|
|
5
|
+
// This default export determines where your story goes in the story list
|
|
6
|
+
export default {
|
|
7
|
+
title: 'PanicButton',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// 👇 We create a “template” of how args map to rendering
|
|
11
|
+
const PanicButton = ({ aProperty }) => html`<player-panic-button></player-panic-button>`;
|
|
12
|
+
|
|
13
|
+
export const FirstStory = PanicButton.bind({});
|