pwa-auth 2.0.3 → 2.0.5
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/CHANGELOG.md +36 -26
- package/README.md +101 -87
- package/demo/index.html +22 -126
- package/demo/pwa-styles.css +77 -0
- package/deploy/css/font.d.ts.map +1 -1
- package/deploy/css/form/button.d.ts.map +1 -1
- package/deploy/css/form/input.d.ts.map +1 -1
- package/deploy/css/form/label.d.ts.map +1 -1
- package/deploy/css/form/list.d.ts.map +1 -1
- package/deploy/css/svg.d.ts.map +1 -1
- package/deploy/css/toggle.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/drawer.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/exit.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/link.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/paragraph.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/toggle.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/drawer.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/drawer.js +1 -1
- package/deploy/custom-elements/drawer/input/forgot.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/forgot.js +1 -1
- package/deploy/custom-elements/drawer/input/login.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/login.js +1 -1
- package/deploy/custom-elements/drawer/input/sign-up.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/sign-up.js +1 -1
- package/deploy/custom-elements/icon/css/icon.d.ts.map +1 -1
- package/deploy/custom-elements/icon/css/icon.js +0 -1
- package/deploy/custom-elements/icon/icon.d.ts.map +1 -1
- package/deploy/custom-elements/settings/css/navigation.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/delete.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/delete.js +1 -1
- package/deploy/custom-elements/settings/input/email.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/email.js +1 -1
- package/deploy/custom-elements/settings/input/images.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/images.js +1 -1
- package/deploy/custom-elements/settings/input/name.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/name.js +1 -1
- package/deploy/custom-elements/settings/input/password.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/password.js +1 -1
- package/deploy/custom-elements/settings/input/uploader.d.ts +0 -2
- package/deploy/custom-elements/settings/input/uploader.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/uploader.js +11 -22
- package/deploy/custom-elements/settings/settings.d.ts.map +1 -1
- package/deploy/firebase/firebase-login.d.ts +21 -0
- package/deploy/firebase/firebase-login.d.ts.map +1 -0
- package/deploy/firebase/firebase-login.js +85 -0
- package/deploy/firebase/firebase.d.ts +20 -0
- package/deploy/firebase/firebase.d.ts.map +1 -0
- package/deploy/firebase/firebase.js +76 -0
- package/deploy/firebase/start.d.ts.map +1 -0
- package/deploy/{start.js → firebase/start.js} +5 -4
- package/deploy/lazy-loader.d.ts.map +1 -1
- package/deploy/redux/backend.d.ts.map +1 -1
- package/deploy/redux/drawer.d.ts.map +1 -1
- package/deploy/redux/frontend.d.ts.map +1 -1
- package/deploy/redux/object.d.ts.map +1 -1
- package/deploy/store.d.ts.map +1 -1
- package/npm/pwa-auth.js +1 -1
- package/npm/pwa-styles.css +66 -0
- package/package.json +4 -3
- package/source/css/font.ts +17 -0
- package/source/css/form/button.ts +55 -0
- package/source/css/form/input.ts +25 -0
- package/source/css/form/label.ts +25 -0
- package/source/css/form/list.ts +23 -0
- package/source/css/svg.ts +5 -0
- package/source/css/toggle.ts +9 -0
- package/source/custom-elements/drawer/css/drawer.ts +64 -0
- package/source/custom-elements/drawer/css/exit.ts +49 -0
- package/source/custom-elements/drawer/css/link.ts +15 -0
- package/source/custom-elements/drawer/css/paragraph.ts +11 -0
- package/source/custom-elements/drawer/css/toggle.ts +19 -0
- package/source/custom-elements/drawer/drawer.ts +120 -0
- package/source/custom-elements/drawer/input/forgot.ts +121 -0
- package/source/custom-elements/drawer/input/login.ts +135 -0
- package/source/custom-elements/drawer/input/sign-up.ts +158 -0
- package/source/custom-elements/icon/css/icon.ts +70 -0
- package/source/custom-elements/icon/icon.ts +87 -0
- package/source/custom-elements/settings/css/navigation.ts +92 -0
- package/source/custom-elements/settings/input/delete.ts +83 -0
- package/source/custom-elements/settings/input/email.ts +135 -0
- package/source/custom-elements/settings/input/images.ts +57 -0
- package/source/custom-elements/settings/input/name.ts +99 -0
- package/source/custom-elements/settings/input/password.ts +156 -0
- package/source/custom-elements/settings/input/uploader.ts +326 -0
- package/source/custom-elements/settings/settings.ts +202 -0
- package/source/firebase/firebase-login.ts +246 -0
- package/source/firebase/firebase.ts +214 -0
- package/source/firebase/start.ts +216 -0
- package/source/lazy-loader.ts +20 -0
- package/source/redux/backend.ts +94 -0
- package/source/redux/drawer.ts +37 -0
- package/source/redux/frontend.ts +134 -0
- package/source/redux/object.ts +31 -0
- package/source/store.ts +19 -0
- package/website/404.html +33 -0
- package/website/THIRD_PARTY_LICENSES.txt +303 -0
- package/website/css/pwa-styles.css +36 -0
- package/website/css/styles.css +67 -0
- package/website/images/empty.jpg +0 -0
- package/website/images/favicon.ico +0 -0
- package/website/images/manifest/logo-144.png +0 -0
- package/website/images/manifest/logo-192.png +0 -0
- package/website/images/manifest/logo-48.png +0 -0
- package/website/images/manifest/logo-512.png +0 -0
- package/website/images/manifest/logo-72.png +0 -0
- package/website/images/manifest/logo-96.png +0 -0
- package/website/images/manifest/maskable_icon_x128.png +0 -0
- package/website/images/manifest/maskable_icon_x192.png +0 -0
- package/website/images/manifest/maskable_icon_x384.png +0 -0
- package/website/images/manifest/maskable_icon_x48.png +0 -0
- package/website/images/manifest/maskable_icon_x512.png +0 -0
- package/website/images/manifest/maskable_icon_x72.png +0 -0
- package/website/images/manifest/maskable_icon_x96.png +0 -0
- package/website/index.html +64 -0
- package/website/js/pwa-auth.js +306 -0
- package/website/sitemap.xml +11 -0
- package/deploy/interface.d.ts +0 -36
- package/deploy/interface.d.ts.map +0 -1
- package/deploy/interface.js +0 -176
- package/deploy/start.d.ts.map +0 -1
- /package/deploy/{start.d.ts → firebase/start.d.ts} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
|
|
3
|
+
/* WebComponent 1 : User Icon
|
|
4
|
+
<user-icon>
|
|
5
|
+
<button> */
|
|
6
|
+
--pwa_icon_hover: lightgrey;
|
|
7
|
+
--pwa_icon_background: #6cc04a;
|
|
8
|
+
--pwa_icon_border: 2px solid black;
|
|
9
|
+
|
|
10
|
+
/* WebComponent 1: logged-out
|
|
11
|
+
<user-icon>
|
|
12
|
+
<button class="login"> */
|
|
13
|
+
--pwa_icon_height: 32px; /* sync to --pwa_icon_diameter */
|
|
14
|
+
--pwa_icon_padding: 0px 16px;
|
|
15
|
+
--pwa_icon_radius: 6px;
|
|
16
|
+
--pwa_icon_font: 'Arial', sans-serif;
|
|
17
|
+
|
|
18
|
+
/* WebComponent 1: logged-in
|
|
19
|
+
<user-icon>
|
|
20
|
+
<button class="icon"> */
|
|
21
|
+
--pwa_icon_diameter: 32px; /* sync to --pwa_icon_height */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* WebComponent 2: Drop-down Drawer
|
|
26
|
+
<user-drawer>
|
|
27
|
+
<section>
|
|
28
|
+
<header></header>
|
|
29
|
+
<div class="spec"> */
|
|
30
|
+
--pwa_drawer_border: 3px #303030 solid;
|
|
31
|
+
--pwa_drawer_z-index: 2;
|
|
32
|
+
--pwa_drawer_border-radius: 20px;
|
|
33
|
+
|
|
34
|
+
/* WebComponent 2: Drop-down Drawer - logged-out
|
|
35
|
+
<div class="spec"> */
|
|
36
|
+
--pwa_drawer_text_color: #303030;
|
|
37
|
+
--pwa_drawer_background_color: #fff;
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/* WebComponent 3: Settings Page
|
|
42
|
+
<user-settings>
|
|
43
|
+
<nav></nav>
|
|
44
|
+
<section></section> */
|
|
45
|
+
--pwa_settings_background: white;
|
|
46
|
+
--pwa_divider: black;
|
|
47
|
+
|
|
48
|
+
/* Navigation */
|
|
49
|
+
--pwa_nav_button: grey;
|
|
50
|
+
--pwa_nav_select: black;
|
|
51
|
+
|
|
52
|
+
/* Section Header */
|
|
53
|
+
--pwa_section_header: black;
|
|
54
|
+
|
|
55
|
+
/* Label */
|
|
56
|
+
--pwa_label_text_color: black;
|
|
57
|
+
|
|
58
|
+
/* Input */
|
|
59
|
+
--pwa_input_background: #E1E5EB;
|
|
60
|
+
|
|
61
|
+
/* Button */
|
|
62
|
+
--pwa_action_text_color: #fff;
|
|
63
|
+
--pwa_action_background_color: #6cc04a;
|
|
64
|
+
--pwa_action_border_color: #60b23e;
|
|
65
|
+
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pwa-auth",
|
|
3
3
|
"author": "Jacek Markiewicz <jack.solutionbox@gmail.com>(https://www.jackspublishing.com)",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.5",
|
|
5
5
|
"description": "User Management Component with 3 HTML Tags, and 1 Boilerplate Function to display user icon, sign up, login, log out, change account details, delete account.",
|
|
6
6
|
"homepage": "https://pwa-authentic.firebaseapp.com",
|
|
7
7
|
"main": "pwa-auth.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"license": "BSD-3-Clause",
|
|
23
23
|
"flat": true,
|
|
24
24
|
"scripts": {
|
|
25
|
-
"
|
|
25
|
+
"demo": "web-dev-server --node-resolve --watch --open --app-index demo/index.html",
|
|
26
|
+
"website": "web-dev-server --node-resolve --watch --open --app-index website/index.html",
|
|
26
27
|
"rollup": "rollup -c"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"babel-plugin-template-html-minifier": "^4.1.0",
|
|
45
46
|
"firebase": "^12.1.0",
|
|
46
47
|
"rollup": "^4.46.3",
|
|
47
|
-
"rollup-plugin-html-literals": "^2.0.
|
|
48
|
+
"rollup-plugin-html-literals": "^2.0.1",
|
|
48
49
|
"rollup-plugin-license": "^3.6.0",
|
|
49
50
|
"rollup-plugin-summary": "^3.0.1"
|
|
50
51
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
|
|
3
|
+
export const fontStyles = css`
|
|
4
|
+
|
|
5
|
+
/* */
|
|
6
|
+
.x-font {
|
|
7
|
+
font-family: Roboto, Arial, sans-serif; /* 'Montserrat' */
|
|
8
|
+
line-height: 1.1;
|
|
9
|
+
letter-spacing: .007em;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
text-align: center;
|
|
13
|
+
text-decoration-style: solid;
|
|
14
|
+
text-transform: uppercase;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit"
|
|
2
|
+
|
|
3
|
+
export const buttonStyle: CSSResult = css`
|
|
4
|
+
|
|
5
|
+
.action-button:focus { outline:0; }
|
|
6
|
+
|
|
7
|
+
.action-button {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
margin: 16px 16px 16px auto;
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
text-align: center;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
touch-action: manipulation;
|
|
16
|
+
-webkit-appearance: button;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
font-size: 16px;
|
|
19
|
+
height: 38px;
|
|
20
|
+
line-height: 16px;
|
|
21
|
+
padding: 10px 16px;
|
|
22
|
+
border-radius: 6px;
|
|
23
|
+
color: var(--pwa_action_text_color);
|
|
24
|
+
background-color: var(--pwa_action_background_color);
|
|
25
|
+
border-color: var(--pwa_action_border_color);
|
|
26
|
+
box-shadow: 1px 1px 1px grey;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.saving{
|
|
30
|
+
transition: background-color 0.3s; /* Smooth transition for hover effect */
|
|
31
|
+
background-color: #D6EBD3;
|
|
32
|
+
border: 0.5px solid black;
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
height: 50px;
|
|
35
|
+
width: 100%;
|
|
36
|
+
margin: auto;
|
|
37
|
+
box-shadow: 1px 1px 1px grey;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* */
|
|
41
|
+
.submit:hover { background-color: #45a049; }
|
|
42
|
+
|
|
43
|
+
.submit {
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
width: 100%;
|
|
46
|
+
background-color: #4CAF50;
|
|
47
|
+
color: white;
|
|
48
|
+
padding: 14px 20px;
|
|
49
|
+
margin: 8px 0;
|
|
50
|
+
border: none;
|
|
51
|
+
border-radius: 4px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const inputStyle : CSSResult = css`
|
|
4
|
+
|
|
5
|
+
input[type=text],
|
|
6
|
+
input[type=email],
|
|
7
|
+
input[type=password],
|
|
8
|
+
select {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
-webkit-box-sizing: border-box;
|
|
11
|
+
height: 50px;
|
|
12
|
+
text-align: left;
|
|
13
|
+
margin: 0 16px 0 16px;
|
|
14
|
+
padding: 8px 16px;
|
|
15
|
+
background-color: var(--pwa_input_background);
|
|
16
|
+
border: 0;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
-webkit-border-radius: 4px;
|
|
19
|
+
font-size: smaller;
|
|
20
|
+
box-shadow: 1px 1px 1px grey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input.invalid { background-color: #ffdddd; }
|
|
24
|
+
|
|
25
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const labelStyle : CSSResult = css`
|
|
4
|
+
|
|
5
|
+
label { font-size: .9em; }
|
|
6
|
+
label {
|
|
7
|
+
display: grid;
|
|
8
|
+
color: var(--pwa_label_text_color);
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
margin: auto;
|
|
13
|
+
margin-bottom: 0;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
line-height: 36px;
|
|
16
|
+
padding: 0 16px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (max-width: 460px) {
|
|
20
|
+
|
|
21
|
+
label { font-size: .8em; }
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const listStyle: CSSResult = css`
|
|
4
|
+
|
|
5
|
+
ul {
|
|
6
|
+
list-style-type: none;
|
|
7
|
+
padding: 0;
|
|
8
|
+
margin: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
li {
|
|
12
|
+
display: grid;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.divider {
|
|
16
|
+
border-top: 2px dotted black;
|
|
17
|
+
border-bottom: 2px dotted black;
|
|
18
|
+
text-align: center;
|
|
19
|
+
width: 80%;
|
|
20
|
+
margin: auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
|
|
3
|
+
export const faceIcon = html`<svg viewBox="0 0 24 24" height="34px" width="34px"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></svg>`;
|
|
4
|
+
export const settings = html`<svg viewBox="0 0 24 24"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`;
|
|
5
|
+
export const close = html`<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const drawerStyle: CSSResult = css`
|
|
4
|
+
|
|
5
|
+
/* <user-drawer> : parent container */
|
|
6
|
+
:host {
|
|
7
|
+
position: absolute;
|
|
8
|
+
max-height: 0px;
|
|
9
|
+
transition: max-height 1.4s ease-out;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
height: auto;
|
|
12
|
+
display: grid;
|
|
13
|
+
padding-top: env(safe-area-inset-top);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([drawer]) {
|
|
17
|
+
transition-duration: 1.4s;
|
|
18
|
+
max-height: 100%;
|
|
19
|
+
transition: max-height 1.4s ease-out;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* wrapper : child container*/
|
|
23
|
+
.userDrawer {
|
|
24
|
+
position: fixed;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
transition-duration: 1.4s;
|
|
29
|
+
border: var(--pwa_drawer_border);
|
|
30
|
+
z-index: var(--pwa_drawer_z-index);
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
background-color: var(--pwa_drawer_background_color);
|
|
33
|
+
color: var(--pwa_drawer_text_color);
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
border-radius: var(--pwa_drawer_border-radius);
|
|
36
|
+
height: auto;
|
|
37
|
+
transition-property: visibility, max-height;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* wrapper closed */
|
|
41
|
+
.closed {
|
|
42
|
+
max-height: 0px;
|
|
43
|
+
transition: max-height 1.4s ease-out;
|
|
44
|
+
visibility: hidden;
|
|
45
|
+
transition-property: visibility, max-height;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* wrapper opened */
|
|
49
|
+
.opened {
|
|
50
|
+
max-height: 100%;
|
|
51
|
+
transition: max-height 1.4s ease-out;
|
|
52
|
+
visibility: visible;
|
|
53
|
+
transition-property: visibility, max-height;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
visibility: hidden;
|
|
60
|
+
will-change: transform;
|
|
61
|
+
transform: translate3d(0, -150%, 0);
|
|
62
|
+
transition-property: visibility, transform;
|
|
63
|
+
transform: translate3d(0, 0, 0);
|
|
64
|
+
*/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const exitStyle: CSSResult = css`
|
|
4
|
+
|
|
5
|
+
.exit {
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 80px 1fr 80px;
|
|
8
|
+
padding: 16px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.exit > h3 {
|
|
12
|
+
font-weight: 800;
|
|
13
|
+
font-size: .9em;
|
|
14
|
+
margin: 0px auto;
|
|
15
|
+
opacity: .8;
|
|
16
|
+
line-height: 36px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.exit > .remove {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
border: 0px;
|
|
23
|
+
color: red;
|
|
24
|
+
font-weight: 800;
|
|
25
|
+
font-size: .7em;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
opacity: .6;
|
|
28
|
+
}
|
|
29
|
+
/*
|
|
30
|
+
.exit > .refresh {
|
|
31
|
+
background-color: transparent;
|
|
32
|
+
border: 0px;
|
|
33
|
+
fill: blue;
|
|
34
|
+
height: 36px;
|
|
35
|
+
width: 36px;
|
|
36
|
+
padding: 0px;
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
.close {
|
|
40
|
+
height: 30px;
|
|
41
|
+
width: 42px;
|
|
42
|
+
margin: auto;
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
border: 0px;
|
|
45
|
+
fill: red;
|
|
46
|
+
opacity: .8;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { css, CSSResult } from "lit";
|
|
2
|
+
|
|
3
|
+
export const toggleStyle: CSSResult = css`
|
|
4
|
+
|
|
5
|
+
/* Switch Login / Sign-up Button */
|
|
6
|
+
.new {
|
|
7
|
+
padding: 12px;
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
appearance: none;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
border: 0px;
|
|
12
|
+
color: inherit;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
text-decoration: underline;
|
|
15
|
+
font-size: small;
|
|
16
|
+
line-height: 42px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
`
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { CSSResultArray, html, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
import { connect } from 'pwa-helpers/connect-mixin';
|
|
4
|
+
import { store, AppState } from '../../store';
|
|
5
|
+
import { close } from '../../css/svg';
|
|
6
|
+
import { show } from '../../css/toggle';
|
|
7
|
+
|
|
8
|
+
import { drawerStyle } from './css/drawer';
|
|
9
|
+
import { exitStyle } from './css/exit';
|
|
10
|
+
import { linkStyle } from './css/link';
|
|
11
|
+
import { lineStyle } from './css/paragraph';
|
|
12
|
+
import { listStyle } from '../../css/form/list';
|
|
13
|
+
|
|
14
|
+
import { toggleSign } from '../../redux/frontend';
|
|
15
|
+
import { logOut } from '../../firebase/start';
|
|
16
|
+
|
|
17
|
+
import './input/login';
|
|
18
|
+
import './input/sign-up';
|
|
19
|
+
|
|
20
|
+
@customElement('user-drawer')
|
|
21
|
+
export class UserDrawer extends connect(store)(LitElement) {
|
|
22
|
+
|
|
23
|
+
/** @attr settingsURL */
|
|
24
|
+
@property({type: String, reflect: true}) private settingsURL = '';
|
|
25
|
+
|
|
26
|
+
/** @attr drawer */
|
|
27
|
+
@property({type:Boolean, attribute: true, reflect: true}) public drawer = false; // Drawer State
|
|
28
|
+
|
|
29
|
+
/** @attr subscribe */
|
|
30
|
+
@property({type:Boolean, attribute: true, reflect: true}) public subscribe = false; // Drawer State
|
|
31
|
+
|
|
32
|
+
@state() private _name = ""; // Drawer State
|
|
33
|
+
@state() private _log = false; // Login State
|
|
34
|
+
@state() private _sign = false; // Sign-up State
|
|
35
|
+
|
|
36
|
+
constructor() { super(); }
|
|
37
|
+
|
|
38
|
+
stateChanged(state: AppState) {
|
|
39
|
+
this._name = state.backend!.name; // User Name
|
|
40
|
+
this.drawer = state.frontend!.drawer; // Drawer State
|
|
41
|
+
this._log = state.frontend!.login; // Logged in-out State
|
|
42
|
+
this._sign = state.frontend!.register; // Sign-up State
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
protected firstUpdated() {
|
|
46
|
+
|
|
47
|
+
this.shadowRoot!.querySelector('.close')!.addEventListener('click', () => {
|
|
48
|
+
store.dispatch(toggleSign());
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
this.shadowRoot!.querySelector('.leave')!.addEventListener('click', () => {
|
|
52
|
+
if (this._log) { logOut() }
|
|
53
|
+
store.dispatch( toggleSign() );
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static get styles(): CSSResultArray { return [
|
|
59
|
+
show,
|
|
60
|
+
drawerStyle,
|
|
61
|
+
exitStyle,
|
|
62
|
+
linkStyle,
|
|
63
|
+
lineStyle,
|
|
64
|
+
listStyle
|
|
65
|
+
] };
|
|
66
|
+
|
|
67
|
+
protected render() {
|
|
68
|
+
return html`
|
|
69
|
+
|
|
70
|
+
<!-- Drawer Wrapper -->
|
|
71
|
+
<section
|
|
72
|
+
class="userDrawer ${this.drawer ? 'opened' : 'closed'}">
|
|
73
|
+
|
|
74
|
+
<!-- Exit Button -->
|
|
75
|
+
<header class="exit">
|
|
76
|
+
<div></div>
|
|
77
|
+
<h3>${this._log ? this._name : this._sign === this.subscribe ? "Subscribe" : "Login" } </h3>
|
|
78
|
+
<button class="close">${close}</button>
|
|
79
|
+
</header>
|
|
80
|
+
|
|
81
|
+
<!-- Logged-out State -->
|
|
82
|
+
<div
|
|
83
|
+
class="spec"
|
|
84
|
+
?on="${ this._log === false }">
|
|
85
|
+
|
|
86
|
+
<!-- Log-in State -->
|
|
87
|
+
<user-log-in
|
|
88
|
+
class="spec"
|
|
89
|
+
?on="${ true === this._sign ? !this.subscribe : this.subscribe }"></user-log-in>
|
|
90
|
+
|
|
91
|
+
<!-- Sign-up State -->
|
|
92
|
+
<user-sign-up
|
|
93
|
+
class="spec"
|
|
94
|
+
?on="${ false === this._sign ? !this.subscribe : this.subscribe }"></user-sign-up>
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<!-- Logged-in State -->
|
|
99
|
+
<div
|
|
100
|
+
class="spec setLog"
|
|
101
|
+
?on="${ this._log === true }">
|
|
102
|
+
|
|
103
|
+
<p><a href="${this.settingsURL}">Settings</a></p>
|
|
104
|
+
|
|
105
|
+
<p><a class="leave" aria-label="log out">log out</a></p>
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare global {
|
|
117
|
+
interface HTMLElementTagNameMap {
|
|
118
|
+
'user-drawer': UserDrawer;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { html, TemplateResult, } from 'lit';
|
|
4
|
+
import { customElement, state } from "lit/decorators.js"
|
|
5
|
+
import { LazyLoader } from '../../../lazy-loader';
|
|
6
|
+
import { sendPasswordResetEmail/*, verifyPasswordResetCode*/ } from 'firebase/auth';
|
|
7
|
+
import { auth } from '../../../firebase/start';
|
|
8
|
+
|
|
9
|
+
@customElement('reset-email')
|
|
10
|
+
export class ResetEmail extends LazyLoader {
|
|
11
|
+
|
|
12
|
+
@state() private userEmail :string = '';
|
|
13
|
+
// @state() private code :string = '';
|
|
14
|
+
|
|
15
|
+
constructor() { super(); }
|
|
16
|
+
|
|
17
|
+
protected firstUpdated() {
|
|
18
|
+
|
|
19
|
+
this.shadowRoot!.querySelector(".reset")!.addEventListener("click", () => {
|
|
20
|
+
this.restPassword();
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Handle input changes to keep the password property in sync
|
|
26
|
+
private handleEmail(event: Event) {
|
|
27
|
+
const input = event.target as HTMLInputElement;
|
|
28
|
+
this.userEmail = input.value; // Update the property with the input value
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected render():TemplateResult {
|
|
32
|
+
return html`
|
|
33
|
+
|
|
34
|
+
<form class="resetPass">
|
|
35
|
+
|
|
36
|
+
<input
|
|
37
|
+
class ="email"
|
|
38
|
+
type ="text"
|
|
39
|
+
placeholder ="email"
|
|
40
|
+
@change ="${this.handleEmail}">
|
|
41
|
+
|
|
42
|
+
<button
|
|
43
|
+
type ="submit"
|
|
44
|
+
class ="reset">Forgot Password</button>
|
|
45
|
+
|
|
46
|
+
</form>
|
|
47
|
+
|
|
48
|
+
<input
|
|
49
|
+
class ="phoneVerify"
|
|
50
|
+
type ="text" />
|
|
51
|
+
|
|
52
|
+
`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// Reset Password Email
|
|
57
|
+
private restPassword = async () => {
|
|
58
|
+
|
|
59
|
+
await sendPasswordResetEmail( auth, this.userEmail )
|
|
60
|
+
.catch( (error:any) => { console.log(error); } );
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
private async restCode () {
|
|
65
|
+
|
|
66
|
+
await verifyPasswordResetCode(auth, this.code);
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
interface HTMLElementTagNameMap {
|
|
75
|
+
'reset-email': ResetEmail;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
let actionCodeSettings = {
|
|
82
|
+
url: 'https://www.contractorscentre.com/?email=user@example.com',
|
|
83
|
+
iOS: {
|
|
84
|
+
bundleId: 'com.contracotors.ios'
|
|
85
|
+
},
|
|
86
|
+
android: {
|
|
87
|
+
packageName: 'com.contracotors.android',
|
|
88
|
+
installApp: true,
|
|
89
|
+
minimumVersion: '12'
|
|
90
|
+
},
|
|
91
|
+
handleCodeInApp: true
|
|
92
|
+
};
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
private _restCode() {
|
|
98
|
+
let x:any = this.shadowRoot!.querySelector('.email')!
|
|
99
|
+
let email = x.target.value
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
firebase
|
|
102
|
+
.auth()
|
|
103
|
+
.sendPasswordResetEmail( email )
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
.then( () => { firebase.auth().confirmPasswordReset( code, newPassword )})
|
|
106
|
+
.catch( (error:any) => { console.log("Password Reset Error: ", error); });
|
|
107
|
+
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
firebase
|
|
110
|
+
.auth()
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
.verifyPasswordResetCode( code )
|
|
113
|
+
.then()
|
|
114
|
+
.catch()
|
|
115
|
+
|
|
116
|
+
// firebase.auth().confirmPasswordReset( code, newPassword )
|
|
117
|
+
// firebase.auth().verifyPasswordResetCode( code )
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
*/
|