pwa-auth 3.4.9 → 3.6.0
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/LICENSES.txt +18 -23
- package/README.md +540 -326
- package/base/api/drawer.d.ts +4 -0
- package/base/api/drawer.d.ts.map +1 -0
- package/base/api/drawer.js +12 -0
- package/base/api/drawer.js.map +1 -0
- package/base/api/user.d.ts +4 -0
- package/base/api/user.d.ts.map +1 -0
- package/base/api/user.js +25 -0
- package/base/api/user.js.map +1 -0
- package/base/api/verify.d.ts +4 -0
- package/base/api/verify.d.ts.map +1 -0
- package/base/api/verify.js +113 -0
- package/base/api/verify.js.map +1 -0
- package/base/deprecated/email-changed.d.ts +5 -0
- package/base/deprecated/email-changed.d.ts.map +1 -0
- package/base/deprecated/email-changed.js +9 -0
- package/base/deprecated/email-changed.js.map +1 -0
- package/base/events/emit.d.ts +12 -0
- package/base/events/emit.d.ts.map +1 -0
- package/base/events/emit.js +30 -0
- package/base/events/emit.js.map +1 -0
- package/base/events/names.d.ts +31 -0
- package/base/events/names.d.ts.map +1 -0
- package/base/events/names.js +31 -0
- package/base/events/names.js.map +1 -0
- package/base/events/types.d.ts +71 -0
- package/base/events/types.d.ts.map +1 -0
- package/base/events/types.js +2 -0
- package/base/events/types.js.map +1 -0
- package/base/export/pwa-auth.d.ts +17 -7
- package/base/export/pwa-auth.d.ts.map +1 -0
- package/base/export/pwa-auth.js +13 -7
- package/base/export/pwa-auth.js.map +1 -1
- package/base/firebase/attribute.d.ts +2 -0
- package/base/firebase/attribute.d.ts.map +1 -0
- package/base/firebase/attribute.js +17 -0
- package/base/firebase/attribute.js.map +1 -0
- package/base/firebase/authentication.d.ts +21 -10
- package/base/firebase/authentication.d.ts.map +1 -0
- package/base/firebase/authentication.js +65 -8
- package/base/firebase/authentication.js.map +1 -1
- package/base/firebase/google.d.ts +9 -0
- package/base/firebase/google.d.ts.map +1 -0
- package/base/firebase/google.js +56 -0
- package/base/firebase/google.js.map +1 -0
- package/base/firebase/interface.d.ts +7 -1
- package/base/firebase/interface.d.ts.map +1 -0
- package/base/firebase/interface.js +101 -68
- package/base/firebase/interface.js.map +1 -1
- package/base/firebase/message.d.ts +2 -0
- package/base/firebase/message.d.ts.map +1 -0
- package/base/firebase/message.js +35 -0
- package/base/firebase/message.js.map +1 -0
- package/base/firebase/password.d.ts +11 -0
- package/base/firebase/password.d.ts.map +1 -0
- package/base/firebase/password.js +16 -0
- package/base/firebase/password.js.map +1 -0
- package/base/lazyLoader.d.ts +1 -0
- package/base/lazyLoader.d.ts.map +1 -0
- package/base/redux/backend.d.ts +1 -0
- package/base/redux/backend.d.ts.map +1 -0
- package/base/redux/backend.js +1 -1
- package/base/redux/backend.js.map +1 -1
- package/base/redux/frontend.d.ts +16 -1
- package/base/redux/frontend.d.ts.map +1 -0
- package/base/redux/frontend.js +6 -3
- package/base/redux/frontend.js.map +1 -1
- package/base/store.d.ts +1 -6
- package/base/store.d.ts.map +1 -0
- package/base/store.js +2 -4
- package/base/store.js.map +1 -1
- package/base/webcomponents/css/animation.d.ts +3 -0
- package/base/webcomponents/css/animation.d.ts.map +1 -0
- package/base/webcomponents/css/animation.js +145 -67
- package/base/webcomponents/css/animation.js.map +1 -1
- package/base/webcomponents/css/svg.d.ts +1 -2
- package/base/webcomponents/css/svg.d.ts.map +1 -0
- package/base/webcomponents/css/svg.js +2 -4
- package/base/webcomponents/css/svg.js.map +1 -1
- package/base/webcomponents/css/tap.d.ts +3 -0
- package/base/webcomponents/css/tap.d.ts.map +1 -0
- package/base/webcomponents/css/tap.js +9 -0
- package/base/webcomponents/css/tap.js.map +1 -0
- package/base/webcomponents/css/toggle.d.ts +1 -0
- package/base/webcomponents/css/toggle.d.ts.map +1 -0
- package/base/webcomponents/css/toggle.js +5 -5
- package/base/webcomponents/drawer/css/drawer.d.ts +1 -0
- package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -0
- package/base/webcomponents/drawer/css/drawer.js +53 -74
- package/base/webcomponents/drawer/css/drawer.js.map +1 -1
- package/base/webcomponents/drawer/css/exit.d.ts +1 -0
- package/base/webcomponents/drawer/css/exit.d.ts.map +1 -0
- package/base/webcomponents/drawer/css/exit.js +58 -52
- package/base/webcomponents/drawer/css/exit.js.map +1 -1
- package/base/webcomponents/drawer/css/link.d.ts +1 -0
- package/base/webcomponents/drawer/css/link.d.ts.map +1 -0
- package/base/webcomponents/drawer/css/link.js +9 -10
- package/base/webcomponents/drawer/css/link.js.map +1 -1
- package/base/webcomponents/drawer/css/paragraph.d.ts +1 -0
- package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -0
- package/base/webcomponents/drawer/css/paragraph.js +37 -20
- package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
- package/base/webcomponents/drawer/drawer.d.ts +22 -7
- package/base/webcomponents/drawer/drawer.d.ts.map +1 -0
- package/base/webcomponents/drawer/drawer.js +300 -90
- package/base/webcomponents/drawer/drawer.js.map +1 -1
- package/base/webcomponents/drawer/keys.d.ts +4 -0
- package/base/webcomponents/drawer/keys.d.ts.map +1 -0
- package/base/webcomponents/drawer/keys.js +57 -0
- package/base/webcomponents/drawer/keys.js.map +1 -0
- package/base/webcomponents/form/css/button.d.ts +1 -0
- package/base/webcomponents/form/css/button.d.ts.map +1 -0
- package/base/webcomponents/form/css/button.js +108 -51
- package/base/webcomponents/form/css/button.js.map +1 -1
- package/base/webcomponents/form/css/input.d.ts +1 -0
- package/base/webcomponents/form/css/input.d.ts.map +1 -0
- package/base/webcomponents/form/css/input.js +22 -21
- package/base/webcomponents/form/css/input.js.map +1 -1
- package/base/webcomponents/form/css/label.d.ts +1 -0
- package/base/webcomponents/form/css/label.d.ts.map +1 -0
- package/base/webcomponents/form/css/label.js +22 -21
- package/base/webcomponents/form/css/label.js.map +1 -1
- package/base/webcomponents/form/css/list.d.ts +1 -0
- package/base/webcomponents/form/css/list.d.ts.map +1 -0
- package/base/webcomponents/form/css/list.js +19 -19
- package/base/webcomponents/form/css/notice.d.ts +3 -0
- package/base/webcomponents/form/css/notice.d.ts.map +1 -0
- package/base/webcomponents/form/css/notice.js +20 -0
- package/base/webcomponents/form/css/notice.js.map +1 -0
- package/base/webcomponents/form/css/status.d.ts +4 -0
- package/base/webcomponents/form/css/status.d.ts.map +1 -0
- package/base/webcomponents/form/css/status.js +44 -0
- package/base/webcomponents/form/css/status.js.map +1 -0
- package/base/webcomponents/form/css/toggle.d.ts +1 -0
- package/base/webcomponents/form/css/toggle.d.ts.map +1 -0
- package/base/webcomponents/form/css/toggle.js +43 -17
- package/base/webcomponents/form/css/toggle.js.map +1 -1
- package/base/webcomponents/form/draft.d.ts +5 -0
- package/base/webcomponents/form/draft.d.ts.map +1 -0
- package/base/webcomponents/form/draft.js +22 -0
- package/base/webcomponents/form/draft.js.map +1 -0
- package/base/webcomponents/form/forgot.d.ts +26 -3
- package/base/webcomponents/form/forgot.d.ts.map +1 -0
- package/base/webcomponents/form/forgot.js +297 -30
- package/base/webcomponents/form/forgot.js.map +1 -1
- package/base/webcomponents/form/google-button.d.ts +3 -0
- package/base/webcomponents/form/google-button.d.ts.map +1 -0
- package/base/webcomponents/form/google-button.js +23 -0
- package/base/webcomponents/form/google-button.js.map +1 -0
- package/base/webcomponents/form/letters.d.ts +3 -0
- package/base/webcomponents/form/letters.d.ts.map +1 -0
- package/base/webcomponents/form/letters.js +21 -0
- package/base/webcomponents/form/letters.js.map +1 -0
- package/base/webcomponents/form/login.d.ts +15 -0
- package/base/webcomponents/form/login.d.ts.map +1 -0
- package/base/webcomponents/form/login.js +261 -89
- package/base/webcomponents/form/login.js.map +1 -1
- package/base/webcomponents/form/notice.d.ts +4 -0
- package/base/webcomponents/form/notice.d.ts.map +1 -0
- package/base/webcomponents/form/notice.js +14 -0
- package/base/webcomponents/form/notice.js.map +1 -0
- package/base/webcomponents/form/reveal.d.ts +3 -0
- package/base/webcomponents/form/reveal.d.ts.map +1 -0
- package/base/webcomponents/form/reveal.js +14 -0
- package/base/webcomponents/form/reveal.js.map +1 -0
- package/base/webcomponents/form/signup.d.ts +13 -0
- package/base/webcomponents/form/signup.d.ts.map +1 -0
- package/base/webcomponents/form/signup.js +241 -100
- package/base/webcomponents/form/signup.js.map +1 -1
- package/base/webcomponents/form/verified.d.ts +3 -0
- package/base/webcomponents/form/verified.d.ts.map +1 -0
- package/base/webcomponents/form/verified.js +45 -0
- package/base/webcomponents/form/verified.js.map +1 -0
- package/base/webcomponents/icon/css/icon.d.ts +1 -0
- package/base/webcomponents/icon/css/icon.d.ts.map +1 -0
- package/base/webcomponents/icon/css/icon.js +63 -49
- package/base/webcomponents/icon/css/icon.js.map +1 -1
- package/base/webcomponents/icon/icon.d.ts +6 -4
- package/base/webcomponents/icon/icon.d.ts.map +1 -0
- package/base/webcomponents/icon/icon.js +48 -27
- package/base/webcomponents/icon/icon.js.map +1 -1
- package/base/webcomponents/login/css/auth.d.ts +3 -2
- package/base/webcomponents/login/css/auth.d.ts.map +1 -0
- package/base/webcomponents/login/css/auth.js +32 -37
- package/base/webcomponents/login/css/auth.js.map +1 -1
- package/base/webcomponents/login/css/link.d.ts +1 -0
- package/base/webcomponents/login/css/link.d.ts.map +1 -0
- package/base/webcomponents/login/css/link.js +9 -10
- package/base/webcomponents/login/css/link.js.map +1 -1
- package/base/webcomponents/login/css/paragraph.d.ts +1 -0
- package/base/webcomponents/login/css/paragraph.d.ts.map +1 -0
- package/base/webcomponents/login/css/paragraph.js +8 -8
- package/base/webcomponents/login/page.d.ts +11 -6
- package/base/webcomponents/login/page.d.ts.map +1 -0
- package/base/webcomponents/login/page.js +103 -55
- package/base/webcomponents/login/page.js.map +1 -1
- package/base/webcomponents/settings/css/navigation.d.ts +1 -0
- package/base/webcomponents/settings/css/navigation.d.ts.map +1 -0
- package/base/webcomponents/settings/css/navigation.js +78 -68
- package/base/webcomponents/settings/css/navigation.js.map +1 -1
- package/base/webcomponents/settings/input/delete.d.ts +7 -6
- package/base/webcomponents/settings/input/delete.d.ts.map +1 -0
- package/base/webcomponents/settings/input/delete.js +135 -48
- package/base/webcomponents/settings/input/delete.js.map +1 -1
- package/base/webcomponents/settings/input/email.d.ts +7 -5
- package/base/webcomponents/settings/input/email.d.ts.map +1 -0
- package/base/webcomponents/settings/input/email.js +155 -50
- package/base/webcomponents/settings/input/email.js.map +1 -1
- package/base/webcomponents/settings/input/name.d.ts +8 -5
- package/base/webcomponents/settings/input/name.d.ts.map +1 -0
- package/base/webcomponents/settings/input/name.js +116 -53
- package/base/webcomponents/settings/input/name.js.map +1 -1
- package/base/webcomponents/settings/input/password.d.ts +8 -5
- package/base/webcomponents/settings/input/password.d.ts.map +1 -0
- package/base/webcomponents/settings/input/password.js +200 -103
- package/base/webcomponents/settings/input/password.js.map +1 -1
- package/base/webcomponents/settings/input/uploader.d.ts +8 -6
- package/base/webcomponents/settings/input/uploader.d.ts.map +1 -0
- package/base/webcomponents/settings/input/uploader.js +209 -170
- package/base/webcomponents/settings/input/uploader.js.map +1 -1
- package/base/webcomponents/settings/input/verify.d.ts +64 -0
- package/base/webcomponents/settings/input/verify.d.ts.map +1 -0
- package/base/webcomponents/settings/input/verify.js +272 -0
- package/base/webcomponents/settings/input/verify.js.map +1 -0
- package/base/webcomponents/settings/settings.d.ts +15 -10
- package/base/webcomponents/settings/settings.d.ts.map +1 -0
- package/base/webcomponents/settings/settings.js +226 -147
- package/base/webcomponents/settings/settings.js.map +1 -1
- package/docs/sliders.md +66 -0
- package/firebase.md +125 -0
- package/intro.md +19 -0
- package/license +21 -21
- package/package.json +117 -71
- package/source/pwa-auth.js +1233 -469
- package/source/pwa-styles.css +50 -68
- package/base/redux/drawer.d.ts +0 -17
- package/base/redux/drawer.js +0 -22
- package/base/redux/drawer.js.map +0 -1
- package/demonstration/index.html +0 -99
- package/demonstration/pwa-styles.css +0 -77
- package/demonstration/styles.css +0 -77
- package/notes.md +0 -11
- package/source/THIRD_PARTY_LICENSES.txt +0 -303
|
@@ -10,175 +10,246 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { css, html, LitElement } from 'lit';
|
|
11
11
|
import { state, customElement, property } from 'lit/decorators.js';
|
|
12
12
|
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
13
|
-
import { store } from '../../store';
|
|
14
|
-
import { navigateAuth } from '../../redux/frontend';
|
|
15
|
-
import { navigation } from './css/navigation';
|
|
16
|
-
import './input/uploader';
|
|
17
|
-
import './input/name';
|
|
18
|
-
import './input/email';
|
|
19
|
-
import './input/password';
|
|
20
|
-
import './input/delete';
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
13
|
+
import { store } from '../../store.js';
|
|
14
|
+
import { navigateAuth } from '../../redux/frontend.js';
|
|
15
|
+
import { navigation } from './css/navigation.js';
|
|
16
|
+
import './input/uploader.js';
|
|
17
|
+
import './input/name.js';
|
|
18
|
+
import './input/email.js';
|
|
19
|
+
import './input/password.js';
|
|
20
|
+
import './input/delete.js';
|
|
21
|
+
import './input/verify.js';
|
|
22
|
+
import { listStyle } from '../form/css/list.js';
|
|
23
|
+
import { animation } from '../css/animation.js';
|
|
24
|
+
import { tapStyle } from '../css/tap.js';
|
|
25
|
+
import { applyFirebaseConfig } from '../../firebase/attribute.js';
|
|
26
|
+
import { accountTitle } from '../form/letters.js';
|
|
23
27
|
let UserSettings = class UserSettings extends connect(store)(LitElement) {
|
|
24
28
|
constructor() {
|
|
25
29
|
super();
|
|
26
30
|
this.empty = '';
|
|
27
31
|
this.profileTopic = '';
|
|
28
32
|
this.name = '';
|
|
33
|
+
this.email = '';
|
|
34
|
+
this.login = false;
|
|
35
|
+
this.onSubmit = (event) => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
};
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
applyFirebaseConfig(this);
|
|
41
|
+
super.connectedCallback();
|
|
42
|
+
this.addEventListener('submit', this.onSubmit);
|
|
43
|
+
}
|
|
44
|
+
disconnectedCallback() {
|
|
45
|
+
this.removeEventListener('submit', this.onSubmit);
|
|
46
|
+
super.disconnectedCallback();
|
|
47
|
+
}
|
|
48
|
+
onTabKey(event) {
|
|
49
|
+
if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft')
|
|
50
|
+
return;
|
|
51
|
+
const order = ['profile', 'verification', 'password', 'delete'];
|
|
52
|
+
const index = order.indexOf(this.profileTopic);
|
|
53
|
+
const step = event.key === 'ArrowRight' ? 1 : -1;
|
|
54
|
+
const next = order[(index + step + order.length) % order.length];
|
|
55
|
+
store.dispatch(navigateAuth(next));
|
|
56
|
+
this.updateComplete.then(() => {
|
|
57
|
+
this.shadowRoot?.querySelector(`button[value="${next}"]`)?.focus();
|
|
46
58
|
});
|
|
47
59
|
}
|
|
48
60
|
stateChanged(state) {
|
|
49
61
|
this.profileTopic = state.frontend.settings;
|
|
62
|
+
this.login = Boolean(state.frontend?.login);
|
|
50
63
|
this.name = state.backend.name;
|
|
64
|
+
this.email = state.backend.email;
|
|
51
65
|
}
|
|
52
66
|
static get styles() {
|
|
53
67
|
return [
|
|
54
68
|
navigation,
|
|
55
69
|
listStyle,
|
|
56
70
|
animation,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
grid
|
|
62
|
-
background-color: var(--pwa_settings_background_color,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
form {
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
display: grid;
|
|
68
|
-
border: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.pageTitle { margin: 0; }
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
tapStyle,
|
|
72
|
+
css `
|
|
73
|
+
|
|
74
|
+
:host {
|
|
75
|
+
display: grid;
|
|
76
|
+
background-color: var(--pwa_settings_background_color, #fffdf8);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
form {
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
display: grid;
|
|
82
|
+
border: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pageTitle { margin: 0; }
|
|
86
|
+
|
|
87
|
+
.signed-out {
|
|
88
|
+
margin: 0;
|
|
89
|
+
padding: 20px 16px;
|
|
90
|
+
text-align: center;
|
|
91
|
+
color: var(--pwa_label_text_color, #1c2430);
|
|
92
|
+
font-size: 0.95rem;
|
|
93
|
+
line-height: 1.45;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* up to 576 pixels */
|
|
97
|
+
@media only screen and (max-width: 576px) {
|
|
98
|
+
h2 {
|
|
99
|
+
font-size: medium;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
80
103
|
`
|
|
81
104
|
];
|
|
82
105
|
}
|
|
106
|
+
openTab(name) {
|
|
107
|
+
store.dispatch(navigateAuth(name));
|
|
108
|
+
}
|
|
83
109
|
render() {
|
|
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
|
-
value="
|
|
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
|
-
|
|
181
|
-
|
|
110
|
+
if (!this.login) {
|
|
111
|
+
return html `
|
|
112
|
+
<p class="signed-out" part="signed-out" role="status">Sign in to change the photo, name, email, or password.</p>
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
const title = accountTitle(this.name, this.email);
|
|
116
|
+
return html `
|
|
117
|
+
|
|
118
|
+
<!-- Page Menu -->
|
|
119
|
+
<nav aria-label="Account" @keydown="${this.onTabKey}">
|
|
120
|
+
|
|
121
|
+
<ul role="tablist">
|
|
122
|
+
|
|
123
|
+
<li>
|
|
124
|
+
<button
|
|
125
|
+
type="button"
|
|
126
|
+
role="tab"
|
|
127
|
+
part="tab"
|
|
128
|
+
value="profile"
|
|
129
|
+
aria-selected="${this.profileTopic === 'profile'}"
|
|
130
|
+
?on="${this.profileTopic === 'profile'}"
|
|
131
|
+
@click="${() => this.openTab('profile')}">Icon
|
|
132
|
+
</button>
|
|
133
|
+
</li>
|
|
134
|
+
|
|
135
|
+
<li>
|
|
136
|
+
<button
|
|
137
|
+
type="button"
|
|
138
|
+
role="tab"
|
|
139
|
+
part="tab"
|
|
140
|
+
value="verification"
|
|
141
|
+
aria-selected="${this.profileTopic === 'verification'}"
|
|
142
|
+
?on="${this.profileTopic === 'verification'}"
|
|
143
|
+
@click="${() => this.openTab('verification')}">Profile
|
|
144
|
+
</button>
|
|
145
|
+
</li>
|
|
146
|
+
|
|
147
|
+
<li>
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
role="tab"
|
|
151
|
+
part="tab"
|
|
152
|
+
value="password"
|
|
153
|
+
aria-selected="${this.profileTopic === 'password'}"
|
|
154
|
+
?on="${this.profileTopic === 'password'}"
|
|
155
|
+
@click="${() => this.openTab('password')}">Password
|
|
156
|
+
</button>
|
|
157
|
+
</li>
|
|
158
|
+
|
|
159
|
+
<li>
|
|
160
|
+
<button
|
|
161
|
+
type="button"
|
|
162
|
+
role="tab"
|
|
163
|
+
part="tab"
|
|
164
|
+
value="delete"
|
|
165
|
+
aria-selected="${this.profileTopic === 'delete'}"
|
|
166
|
+
?on="${this.profileTopic === 'delete'}"
|
|
167
|
+
@click="${() => this.openTab('delete')}">Delete
|
|
168
|
+
</button>
|
|
169
|
+
</li>
|
|
170
|
+
|
|
171
|
+
</ul>
|
|
172
|
+
|
|
173
|
+
</nav>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<div class= "wrapper">
|
|
177
|
+
<div class= "inner">
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
<!-- Page 1: Profile -->
|
|
181
|
+
<section
|
|
182
|
+
part="panel"
|
|
183
|
+
role="tabpanel"
|
|
184
|
+
aria-hidden="${this.profileTopic === 'profile' ? 'false' : 'true'}"
|
|
185
|
+
?inert="${this.profileTopic !== 'profile'}"
|
|
186
|
+
class="content ${this.profileTopic === 'profile' ? 'opened' : 'closed'}">
|
|
187
|
+
|
|
188
|
+
<!-- Display Username -->
|
|
189
|
+
<h2>${title}</h2>
|
|
190
|
+
|
|
191
|
+
<!-- Custom Image Element - Display / Upload -->
|
|
192
|
+
<contact-photo emptyArtwork="${this.empty}" exportparts="progress, file, preview"></contact-photo>
|
|
193
|
+
|
|
194
|
+
</section>
|
|
195
|
+
|
|
196
|
+
<!-- Page 2: Verification -->
|
|
197
|
+
<section
|
|
198
|
+
part="panel"
|
|
199
|
+
role="tabpanel"
|
|
200
|
+
aria-hidden="${this.profileTopic === 'verification' ? 'false' : 'true'}"
|
|
201
|
+
?inert="${this.profileTopic !== 'verification'}"
|
|
202
|
+
class="content ${this.profileTopic === 'verification' ? 'opened' : 'closed'}">
|
|
203
|
+
|
|
204
|
+
<!-- Page Title -->
|
|
205
|
+
<h2>Contact Information</h2>
|
|
206
|
+
|
|
207
|
+
<!-- Required - unverified notice. Sign-in stays open. -->
|
|
208
|
+
<email-verify exportparts="notice, status: verify-status, submit: verify-submit, verified, unverified"></email-verify>
|
|
209
|
+
|
|
210
|
+
<!-- Custom - Username -->
|
|
211
|
+
<input-name exportparts="name, submit: name-submit"></input-name>
|
|
212
|
+
|
|
213
|
+
<!-- Custom - Email -->
|
|
214
|
+
<contact-email exportparts="email, submit: email-submit"></contact-email>
|
|
215
|
+
|
|
216
|
+
</section>
|
|
217
|
+
|
|
218
|
+
<!-- Page 3: Password -->
|
|
219
|
+
<section
|
|
220
|
+
part="panel"
|
|
221
|
+
role="tabpanel"
|
|
222
|
+
aria-hidden="${this.profileTopic === 'password' ? 'false' : 'true'}"
|
|
223
|
+
?inert="${this.profileTopic !== 'password'}"
|
|
224
|
+
class="content ${this.profileTopic === 'password' ? 'opened' : 'closed'}">
|
|
225
|
+
|
|
226
|
+
<!-- Page Title -->
|
|
227
|
+
<h2>Password</h2>
|
|
228
|
+
|
|
229
|
+
<!-- Custom - Password -->
|
|
230
|
+
<input-password exportparts="password, verify, submit: password-submit"></input-password>
|
|
231
|
+
|
|
232
|
+
</section>
|
|
233
|
+
|
|
234
|
+
<!-- Page 4: Delete -->
|
|
235
|
+
<section
|
|
236
|
+
part="panel"
|
|
237
|
+
role="tabpanel"
|
|
238
|
+
aria-hidden="${this.profileTopic === 'delete' ? 'false' : 'true'}"
|
|
239
|
+
?inert="${this.profileTopic !== 'delete'}"
|
|
240
|
+
class="content ${this.profileTopic === 'delete' ? 'opened' : 'closed'}">
|
|
241
|
+
|
|
242
|
+
<!-- Page Title -->
|
|
243
|
+
<h2>Delete Account</h2>
|
|
244
|
+
|
|
245
|
+
<!-- Custom - Delete -->
|
|
246
|
+
<delete-user exportparts="submit: delete"></delete-user>
|
|
247
|
+
|
|
248
|
+
</section>
|
|
249
|
+
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
182
253
|
`;
|
|
183
254
|
}
|
|
184
255
|
};
|
|
@@ -194,6 +265,14 @@ __decorate([
|
|
|
194
265
|
state(),
|
|
195
266
|
__metadata("design:type", Object)
|
|
196
267
|
], UserSettings.prototype, "name", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
state(),
|
|
270
|
+
__metadata("design:type", Object)
|
|
271
|
+
], UserSettings.prototype, "email", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
state(),
|
|
274
|
+
__metadata("design:type", Object)
|
|
275
|
+
], UserSettings.prototype, "login", void 0);
|
|
197
276
|
UserSettings = __decorate([
|
|
198
277
|
customElement('user-settings'),
|
|
199
278
|
__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../typescript/webcomponents/settings/settings.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,MAAe,KAAK,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAgB,mBAAmB,CAAC;AAC7E,OAAO,EAAE,OAAO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EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;;2CAAmB;AAE1C;IAAhB,KAAK,EAAE;;kDAA2B;AAClB;IAAhB,KAAK,EAAE;;0CAAmB;AACV;IAAhB,KAAK,EAAE;;2CAAoB;AACX;IAAhB,KAAK,EAAE;;2CAAuB;AARpB,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;;GAClB,YAAY,CAgPxB"}
|
package/docs/sliders.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Slides
|
|
2
|
+
|
|
3
|
+
The slide is one module: `typescript/webcomponents/css/animation.ts`. `user-drawer`, `user-login`, and `user-settings` import it.
|
|
4
|
+
|
|
5
|
+
Three parts.
|
|
6
|
+
|
|
7
|
+
- The container carries `max-height`.
|
|
8
|
+
- The moving child carries `transform`.
|
|
9
|
+
- Closed content runs both. Class `closed` translates `translate3d(0, -102%, 0)` and plays `slide-out`, which animates `max-height`.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
The slide is two motions that run together. The container's `max-height` grows or shrinks the space. The child's `transform` slides the panel into that space. `inner` clips, so it looks like it comes from behind an edge.
|
|
14
|
+
|
|
15
|
+
On close, visibility is held for `1.4s`, so the panel does not vanish before the motion ends.
|
|
16
|
+
|
|
17
|
+
Closed content translates to `-102%` and runs `slide-out`, so height and position change together.
|
|
18
|
+
|
|
19
|
+
If either motion loses its timing, they fall out of step and the slide snaps.
|
|
20
|
+
|
|
21
|
+
## Elements
|
|
22
|
+
|
|
23
|
+
On the drawer, inside `.userDrawer`:
|
|
24
|
+
|
|
25
|
+
`spec` → `wrapper` → `inner` → `content`
|
|
26
|
+
|
|
27
|
+
`wrapper` does not transition. `inner` clips the slide.
|
|
28
|
+
|
|
29
|
+
| Piece | Element | What moves |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| Shell | `:host`, and `.userDrawer` with `in` / `out` | `max-height` |
|
|
32
|
+
| Sheet | `.spec` with `spec-in` / `spec-out` | `transform` |
|
|
33
|
+
| Forms and settings panels | `.content` with `opened` / `closed` | `transform`, and `slide-out` on `closed` |
|
|
34
|
+
|
|
35
|
+
Page login uses `spec` / `wrapper` / `inner` / `content` for the form swap. It has no collapsing shell. The four settings panels (`profile`, `verification`, `password`, `delete`) are `.content` inside `wrapper` / `inner`. They have no `.spec`.
|
|
36
|
+
|
|
37
|
+
`user-login` host uses the same max-height timing as the drawer shell. Nothing sets the `animation` attribute, so that host does not collapse.
|
|
38
|
+
|
|
39
|
+
## Triggers
|
|
40
|
+
|
|
41
|
+
- Attribute `drawer` on `user-drawer`. Classes `in` and `out` on `.userDrawer`. That opens and closes the shell.
|
|
42
|
+
- Classes `spec-in` and `spec-out` on `.spec`. Same flag. The sheet moves.
|
|
43
|
+
- Classes `opened` and `closed` on `.content`. Drawer and page forms follow sign-in versus sign-up. Settings panels follow the tab.
|
|
44
|
+
- Attribute `on` on `.spec` is `display`. It is not a slide.
|
|
45
|
+
- Attribute `animation` on `user-login` would open the host `max-height`. It is not set.
|
|
46
|
+
|
|
47
|
+
## Timings
|
|
48
|
+
|
|
49
|
+
Durations are literals. The shell beat is `1.4s`. Leave it there.
|
|
50
|
+
|
|
51
|
+
| Piece | Duration | Easing |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| Host and `.in` / `.out` `max-height` | `1.4s` | `ease-in-out` |
|
|
54
|
+
| `.in` visibility delay | `1.4s` | `linear` |
|
|
55
|
+
| `.spec-out` transform, open | `2.2s` | `ease` |
|
|
56
|
+
| `.spec-in` transform, close | `1.5s` | `ease` |
|
|
57
|
+
| `.content` transform | `2s` | `ease-in-out` |
|
|
58
|
+
| `slide-out` on `.closed` | `2s` | `ease-out` |
|
|
59
|
+
|
|
60
|
+
The sheet moves from `translate3d(0, -100%, 0)` to `translate3d(0, 0, 0)`. Opening was measured at `2.2s` (`.spec-out`). Closing uses `.spec-in` at `1.5s`.
|
|
61
|
+
|
|
62
|
+
No slide timing is a custom property. Hosts do not set one.
|
|
63
|
+
|
|
64
|
+
## Reduced motion
|
|
65
|
+
|
|
66
|
+
`prefers-reduced-motion: reduce` sets `transition-duration` and `animation-duration` to `0s` on the shell, the sheet, and `.content`. Only inside that media query. It does not go through a custom property.
|
package/firebase.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Firebase
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
- Firebase Authentication with email and password
|
|
6
|
+
- Google sign-in, if you leave Continue with Google on (the default)
|
|
7
|
+
- Cloud Storage bucket
|
|
8
|
+
- Google Analytics, if you call `logAccount` or `logAccountDelete`
|
|
9
|
+
|
|
10
|
+
## Storage rules
|
|
11
|
+
|
|
12
|
+
Storage rules must allow the signed-in user to read and write only `pwa-auth/{uid}/**`.
|
|
13
|
+
|
|
14
|
+
## Firestore rules
|
|
15
|
+
|
|
16
|
+
Firestore rules allow `users/{uid}` and `contractors/{uid}`, and any other document `deleteDocument` removes, only when the signed-in uid is the document id or the `owner` field. Everything else is denied. The host owns those documents. See [Data ownership](README.md#data-ownership).
|
|
17
|
+
|
|
18
|
+
## FIREBASE_CONFIG
|
|
19
|
+
|
|
20
|
+
Required. Call `initialize({ config })`, or set `window.process.env.FIREBASE_CONFIG` in a classic script before the module runs. One assignment. A second `window.process = …` replaces the first and drops keys you already set.
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<script>
|
|
24
|
+
window.process = { env: { FIREBASE_CONFIG: JSON.stringify({
|
|
25
|
+
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
26
|
+
authDomain: "xxxxxxx.xxxxxxx.xxx",
|
|
27
|
+
databaseURL: "https://xxxxxxx.xxxxxxx.xxx",
|
|
28
|
+
projectId: "xxxxxxx",
|
|
29
|
+
storageBucket: "xxxxxxx.xxxxxxx.xxx",
|
|
30
|
+
messagingSenderId: "xxxxxxxxxxx",
|
|
31
|
+
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
32
|
+
measurementId: "xxxxxxxxxxx"
|
|
33
|
+
}) } };
|
|
34
|
+
</script>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`authentication.ts` reads `process.env.FIREBASE_CONFIG` when `apiKey` is present and calls `initialize`. An empty config does not throw. Call `initialize` instead.
|
|
38
|
+
|
|
39
|
+
## initialize
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import { initialize } from 'pwa-auth';
|
|
43
|
+
import { getApp } from 'firebase/app';
|
|
44
|
+
|
|
45
|
+
// Optional - your config
|
|
46
|
+
initialize({
|
|
47
|
+
config: {
|
|
48
|
+
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
49
|
+
authDomain: "xxxxxxx.xxxxxxx.xxx",
|
|
50
|
+
projectId: "xxxxxxx",
|
|
51
|
+
storageBucket: "xxxxxxx.xxxxxxx.xxx",
|
|
52
|
+
messagingSenderId: "xxxxxxxxxxx",
|
|
53
|
+
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Optional - an app you already created. Omit FIREBASE_CONFIG when you do this.
|
|
58
|
+
initialize({ app: getApp() });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Export | |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `initialize({ app, config, actionCodeSettings })` | Boot Firebase. `app` is a host app. `config` is a host config. `actionCodeSettings` is optional and is passed to the verification email. The legacy `FIREBASE_CONFIG` script still works. |
|
|
64
|
+
|
|
65
|
+
## firebase-config attribute
|
|
66
|
+
|
|
67
|
+
Optional. A tag can carry the same JSON. The first element to connect wins, and only when the app is not up yet.
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<user-icon firebase-config='{"apiKey":"...","authDomain":"...","projectId":"..."}'></user-icon>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The first `initialize` wins. A later call with a different app throws.
|
|
74
|
+
|
|
75
|
+
## actionCodeSettings
|
|
76
|
+
|
|
77
|
+
Optional. `actionCodeSettings` is passed to `sendEmailVerification`. Put the continue URL in `url`. A later `initialize({ actionCodeSettings })` still stores it after the app is up.
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
initialize({
|
|
81
|
+
config,
|
|
82
|
+
actionCodeSettings: { url: 'https://example.com/continue' }
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Auth, Firestore, and Storage
|
|
87
|
+
|
|
88
|
+
| Export | |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `auth` | Firebase Auth for this app. Read `auth.currentUser` at call time. |
|
|
91
|
+
| `db` | Firestore. |
|
|
92
|
+
| `storage` | Cloud Storage. |
|
|
93
|
+
| `application` | The Firebase app from `initialize` or from `FIREBASE_CONFIG`. |
|
|
94
|
+
| `firebaseConfig` | The parsed config object. |
|
|
95
|
+
|
|
96
|
+
## Password
|
|
97
|
+
|
|
98
|
+
Firebase Auth's own minimum is 6 characters. Sign-up and a password change in `<user-settings>` ask for 8 to 128. Spaces and other characters are allowed. There is no requirement for a number or a symbol. The sentence under the field is "At least 8 characters. A passphrase works well." A short password reads "Use at least 8 characters."
|
|
99
|
+
|
|
100
|
+
In the Firebase console, open Authentication and turn on the password policy. Set the minimum to 8 so the server uses the same rule. This package does not change that policy.
|
|
101
|
+
|
|
102
|
+
## Google sign-in
|
|
103
|
+
|
|
104
|
+
Continue with Google uses Firebase `signInWithPopup`. A blocked popup, or a phone, uses `signInWithRedirect`. The first success creates the Firebase user.
|
|
105
|
+
|
|
106
|
+
On [pwa-authentic.firebaseapp.com](https://pwa-authentic.firebaseapp.com) the redirect works, because that host is Firebase Hosting and `authDomain` is the same site. A host on another domain should keep the popup. Redirect there needs the [Firebase redirect guidance](https://firebase.google.com/docs/auth/web/redirect-best-practices): `authDomain` must be that site, or the sign-in must be proxied through Firebase Hosting. Browsers block the third-party storage the redirect handler uses.
|
|
107
|
+
|
|
108
|
+
Enable Google in the Firebase console:
|
|
109
|
+
|
|
110
|
+
1. Open the project. Go to Build, Authentication.
|
|
111
|
+
2. Open Sign-in method.
|
|
112
|
+
3. Choose Google. Turn on Enable.
|
|
113
|
+
4. Set a public-facing support email. Save.
|
|
114
|
+
5. Open Settings, then Authorized domains.
|
|
115
|
+
6. `localhost` and your `firebaseapp.com` / `web.app` domains are already there. Add every other domain that embeds the component. Save.
|
|
116
|
+
|
|
117
|
+
`hide-google` on `<user-login>` or `<user-drawer>` removes the button.
|
|
118
|
+
|
|
119
|
+
## Emulators
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npm run test:emulator # Auth, Firestore, and Storage emulators, then the browser checks
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`npm run test:emulator` uses `firebase-tools` 14.24.0. Firestore and Storage need Java 21 or newer on `PATH`.
|
package/intro.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# A short introduction
|
|
2
|
+
|
|
3
|
+
## What it is
|
|
4
|
+
|
|
5
|
+
pwa-auth is the sign-in for your website. It stays on your site, in your own look. People use an email address and a password. There is one sign-in for the whole page.
|
|
6
|
+
|
|
7
|
+
## What it does for you
|
|
8
|
+
|
|
9
|
+
Your visitors see a button. Before they sign in it says Login, or Subscribe if you prefer that word. After they sign in it shows their photo.
|
|
10
|
+
|
|
11
|
+
A panel drops down from the top. They can create an account or sign in, or continue with Google in one click. Once they are in, they see their name, a link to their settings, and a way to log out.
|
|
12
|
+
|
|
13
|
+
In settings they can change their photo, name, email, and password, or delete the account. Creating an account sends a verification email. They can still sign in before they open that email.
|
|
14
|
+
|
|
15
|
+
They look after that sign-in themselves. Your site keeps the records it creates. This sign-in does not write those records, and deleting an account does not remove them. The files stored for that sign-in are removed with the account.
|
|
16
|
+
|
|
17
|
+
## How to get started
|
|
18
|
+
|
|
19
|
+
The person who adds this to your site follows the [Quick start](README.md#quick-start). There is also a [live demo](https://pwa-authentic.firebaseapp.com).
|