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.
Files changed (244) hide show
  1. package/LICENSES.txt +18 -23
  2. package/README.md +540 -326
  3. package/base/api/drawer.d.ts +4 -0
  4. package/base/api/drawer.d.ts.map +1 -0
  5. package/base/api/drawer.js +12 -0
  6. package/base/api/drawer.js.map +1 -0
  7. package/base/api/user.d.ts +4 -0
  8. package/base/api/user.d.ts.map +1 -0
  9. package/base/api/user.js +25 -0
  10. package/base/api/user.js.map +1 -0
  11. package/base/api/verify.d.ts +4 -0
  12. package/base/api/verify.d.ts.map +1 -0
  13. package/base/api/verify.js +113 -0
  14. package/base/api/verify.js.map +1 -0
  15. package/base/deprecated/email-changed.d.ts +5 -0
  16. package/base/deprecated/email-changed.d.ts.map +1 -0
  17. package/base/deprecated/email-changed.js +9 -0
  18. package/base/deprecated/email-changed.js.map +1 -0
  19. package/base/events/emit.d.ts +12 -0
  20. package/base/events/emit.d.ts.map +1 -0
  21. package/base/events/emit.js +30 -0
  22. package/base/events/emit.js.map +1 -0
  23. package/base/events/names.d.ts +31 -0
  24. package/base/events/names.d.ts.map +1 -0
  25. package/base/events/names.js +31 -0
  26. package/base/events/names.js.map +1 -0
  27. package/base/events/types.d.ts +71 -0
  28. package/base/events/types.d.ts.map +1 -0
  29. package/base/events/types.js +2 -0
  30. package/base/events/types.js.map +1 -0
  31. package/base/export/pwa-auth.d.ts +17 -7
  32. package/base/export/pwa-auth.d.ts.map +1 -0
  33. package/base/export/pwa-auth.js +13 -7
  34. package/base/export/pwa-auth.js.map +1 -1
  35. package/base/firebase/attribute.d.ts +2 -0
  36. package/base/firebase/attribute.d.ts.map +1 -0
  37. package/base/firebase/attribute.js +17 -0
  38. package/base/firebase/attribute.js.map +1 -0
  39. package/base/firebase/authentication.d.ts +21 -10
  40. package/base/firebase/authentication.d.ts.map +1 -0
  41. package/base/firebase/authentication.js +65 -8
  42. package/base/firebase/authentication.js.map +1 -1
  43. package/base/firebase/google.d.ts +9 -0
  44. package/base/firebase/google.d.ts.map +1 -0
  45. package/base/firebase/google.js +56 -0
  46. package/base/firebase/google.js.map +1 -0
  47. package/base/firebase/interface.d.ts +7 -1
  48. package/base/firebase/interface.d.ts.map +1 -0
  49. package/base/firebase/interface.js +101 -68
  50. package/base/firebase/interface.js.map +1 -1
  51. package/base/firebase/message.d.ts +2 -0
  52. package/base/firebase/message.d.ts.map +1 -0
  53. package/base/firebase/message.js +35 -0
  54. package/base/firebase/message.js.map +1 -0
  55. package/base/firebase/password.d.ts +11 -0
  56. package/base/firebase/password.d.ts.map +1 -0
  57. package/base/firebase/password.js +16 -0
  58. package/base/firebase/password.js.map +1 -0
  59. package/base/lazyLoader.d.ts +1 -0
  60. package/base/lazyLoader.d.ts.map +1 -0
  61. package/base/redux/backend.d.ts +1 -0
  62. package/base/redux/backend.d.ts.map +1 -0
  63. package/base/redux/backend.js +1 -1
  64. package/base/redux/backend.js.map +1 -1
  65. package/base/redux/frontend.d.ts +16 -1
  66. package/base/redux/frontend.d.ts.map +1 -0
  67. package/base/redux/frontend.js +6 -3
  68. package/base/redux/frontend.js.map +1 -1
  69. package/base/store.d.ts +1 -6
  70. package/base/store.d.ts.map +1 -0
  71. package/base/store.js +2 -4
  72. package/base/store.js.map +1 -1
  73. package/base/webcomponents/css/animation.d.ts +3 -0
  74. package/base/webcomponents/css/animation.d.ts.map +1 -0
  75. package/base/webcomponents/css/animation.js +145 -67
  76. package/base/webcomponents/css/animation.js.map +1 -1
  77. package/base/webcomponents/css/svg.d.ts +1 -2
  78. package/base/webcomponents/css/svg.d.ts.map +1 -0
  79. package/base/webcomponents/css/svg.js +2 -4
  80. package/base/webcomponents/css/svg.js.map +1 -1
  81. package/base/webcomponents/css/tap.d.ts +3 -0
  82. package/base/webcomponents/css/tap.d.ts.map +1 -0
  83. package/base/webcomponents/css/tap.js +9 -0
  84. package/base/webcomponents/css/tap.js.map +1 -0
  85. package/base/webcomponents/css/toggle.d.ts +1 -0
  86. package/base/webcomponents/css/toggle.d.ts.map +1 -0
  87. package/base/webcomponents/css/toggle.js +5 -5
  88. package/base/webcomponents/drawer/css/drawer.d.ts +1 -0
  89. package/base/webcomponents/drawer/css/drawer.d.ts.map +1 -0
  90. package/base/webcomponents/drawer/css/drawer.js +53 -74
  91. package/base/webcomponents/drawer/css/drawer.js.map +1 -1
  92. package/base/webcomponents/drawer/css/exit.d.ts +1 -0
  93. package/base/webcomponents/drawer/css/exit.d.ts.map +1 -0
  94. package/base/webcomponents/drawer/css/exit.js +58 -52
  95. package/base/webcomponents/drawer/css/exit.js.map +1 -1
  96. package/base/webcomponents/drawer/css/link.d.ts +1 -0
  97. package/base/webcomponents/drawer/css/link.d.ts.map +1 -0
  98. package/base/webcomponents/drawer/css/link.js +9 -10
  99. package/base/webcomponents/drawer/css/link.js.map +1 -1
  100. package/base/webcomponents/drawer/css/paragraph.d.ts +1 -0
  101. package/base/webcomponents/drawer/css/paragraph.d.ts.map +1 -0
  102. package/base/webcomponents/drawer/css/paragraph.js +37 -20
  103. package/base/webcomponents/drawer/css/paragraph.js.map +1 -1
  104. package/base/webcomponents/drawer/drawer.d.ts +22 -7
  105. package/base/webcomponents/drawer/drawer.d.ts.map +1 -0
  106. package/base/webcomponents/drawer/drawer.js +300 -90
  107. package/base/webcomponents/drawer/drawer.js.map +1 -1
  108. package/base/webcomponents/drawer/keys.d.ts +4 -0
  109. package/base/webcomponents/drawer/keys.d.ts.map +1 -0
  110. package/base/webcomponents/drawer/keys.js +57 -0
  111. package/base/webcomponents/drawer/keys.js.map +1 -0
  112. package/base/webcomponents/form/css/button.d.ts +1 -0
  113. package/base/webcomponents/form/css/button.d.ts.map +1 -0
  114. package/base/webcomponents/form/css/button.js +108 -51
  115. package/base/webcomponents/form/css/button.js.map +1 -1
  116. package/base/webcomponents/form/css/input.d.ts +1 -0
  117. package/base/webcomponents/form/css/input.d.ts.map +1 -0
  118. package/base/webcomponents/form/css/input.js +22 -21
  119. package/base/webcomponents/form/css/input.js.map +1 -1
  120. package/base/webcomponents/form/css/label.d.ts +1 -0
  121. package/base/webcomponents/form/css/label.d.ts.map +1 -0
  122. package/base/webcomponents/form/css/label.js +22 -21
  123. package/base/webcomponents/form/css/label.js.map +1 -1
  124. package/base/webcomponents/form/css/list.d.ts +1 -0
  125. package/base/webcomponents/form/css/list.d.ts.map +1 -0
  126. package/base/webcomponents/form/css/list.js +19 -19
  127. package/base/webcomponents/form/css/notice.d.ts +3 -0
  128. package/base/webcomponents/form/css/notice.d.ts.map +1 -0
  129. package/base/webcomponents/form/css/notice.js +20 -0
  130. package/base/webcomponents/form/css/notice.js.map +1 -0
  131. package/base/webcomponents/form/css/status.d.ts +4 -0
  132. package/base/webcomponents/form/css/status.d.ts.map +1 -0
  133. package/base/webcomponents/form/css/status.js +44 -0
  134. package/base/webcomponents/form/css/status.js.map +1 -0
  135. package/base/webcomponents/form/css/toggle.d.ts +1 -0
  136. package/base/webcomponents/form/css/toggle.d.ts.map +1 -0
  137. package/base/webcomponents/form/css/toggle.js +43 -17
  138. package/base/webcomponents/form/css/toggle.js.map +1 -1
  139. package/base/webcomponents/form/draft.d.ts +5 -0
  140. package/base/webcomponents/form/draft.d.ts.map +1 -0
  141. package/base/webcomponents/form/draft.js +22 -0
  142. package/base/webcomponents/form/draft.js.map +1 -0
  143. package/base/webcomponents/form/forgot.d.ts +26 -3
  144. package/base/webcomponents/form/forgot.d.ts.map +1 -0
  145. package/base/webcomponents/form/forgot.js +297 -30
  146. package/base/webcomponents/form/forgot.js.map +1 -1
  147. package/base/webcomponents/form/google-button.d.ts +3 -0
  148. package/base/webcomponents/form/google-button.d.ts.map +1 -0
  149. package/base/webcomponents/form/google-button.js +23 -0
  150. package/base/webcomponents/form/google-button.js.map +1 -0
  151. package/base/webcomponents/form/letters.d.ts +3 -0
  152. package/base/webcomponents/form/letters.d.ts.map +1 -0
  153. package/base/webcomponents/form/letters.js +21 -0
  154. package/base/webcomponents/form/letters.js.map +1 -0
  155. package/base/webcomponents/form/login.d.ts +15 -0
  156. package/base/webcomponents/form/login.d.ts.map +1 -0
  157. package/base/webcomponents/form/login.js +261 -89
  158. package/base/webcomponents/form/login.js.map +1 -1
  159. package/base/webcomponents/form/notice.d.ts +4 -0
  160. package/base/webcomponents/form/notice.d.ts.map +1 -0
  161. package/base/webcomponents/form/notice.js +14 -0
  162. package/base/webcomponents/form/notice.js.map +1 -0
  163. package/base/webcomponents/form/reveal.d.ts +3 -0
  164. package/base/webcomponents/form/reveal.d.ts.map +1 -0
  165. package/base/webcomponents/form/reveal.js +14 -0
  166. package/base/webcomponents/form/reveal.js.map +1 -0
  167. package/base/webcomponents/form/signup.d.ts +13 -0
  168. package/base/webcomponents/form/signup.d.ts.map +1 -0
  169. package/base/webcomponents/form/signup.js +241 -100
  170. package/base/webcomponents/form/signup.js.map +1 -1
  171. package/base/webcomponents/form/verified.d.ts +3 -0
  172. package/base/webcomponents/form/verified.d.ts.map +1 -0
  173. package/base/webcomponents/form/verified.js +45 -0
  174. package/base/webcomponents/form/verified.js.map +1 -0
  175. package/base/webcomponents/icon/css/icon.d.ts +1 -0
  176. package/base/webcomponents/icon/css/icon.d.ts.map +1 -0
  177. package/base/webcomponents/icon/css/icon.js +63 -49
  178. package/base/webcomponents/icon/css/icon.js.map +1 -1
  179. package/base/webcomponents/icon/icon.d.ts +6 -4
  180. package/base/webcomponents/icon/icon.d.ts.map +1 -0
  181. package/base/webcomponents/icon/icon.js +48 -27
  182. package/base/webcomponents/icon/icon.js.map +1 -1
  183. package/base/webcomponents/login/css/auth.d.ts +3 -2
  184. package/base/webcomponents/login/css/auth.d.ts.map +1 -0
  185. package/base/webcomponents/login/css/auth.js +32 -37
  186. package/base/webcomponents/login/css/auth.js.map +1 -1
  187. package/base/webcomponents/login/css/link.d.ts +1 -0
  188. package/base/webcomponents/login/css/link.d.ts.map +1 -0
  189. package/base/webcomponents/login/css/link.js +9 -10
  190. package/base/webcomponents/login/css/link.js.map +1 -1
  191. package/base/webcomponents/login/css/paragraph.d.ts +1 -0
  192. package/base/webcomponents/login/css/paragraph.d.ts.map +1 -0
  193. package/base/webcomponents/login/css/paragraph.js +8 -8
  194. package/base/webcomponents/login/page.d.ts +11 -6
  195. package/base/webcomponents/login/page.d.ts.map +1 -0
  196. package/base/webcomponents/login/page.js +103 -55
  197. package/base/webcomponents/login/page.js.map +1 -1
  198. package/base/webcomponents/settings/css/navigation.d.ts +1 -0
  199. package/base/webcomponents/settings/css/navigation.d.ts.map +1 -0
  200. package/base/webcomponents/settings/css/navigation.js +78 -68
  201. package/base/webcomponents/settings/css/navigation.js.map +1 -1
  202. package/base/webcomponents/settings/input/delete.d.ts +7 -6
  203. package/base/webcomponents/settings/input/delete.d.ts.map +1 -0
  204. package/base/webcomponents/settings/input/delete.js +135 -48
  205. package/base/webcomponents/settings/input/delete.js.map +1 -1
  206. package/base/webcomponents/settings/input/email.d.ts +7 -5
  207. package/base/webcomponents/settings/input/email.d.ts.map +1 -0
  208. package/base/webcomponents/settings/input/email.js +155 -50
  209. package/base/webcomponents/settings/input/email.js.map +1 -1
  210. package/base/webcomponents/settings/input/name.d.ts +8 -5
  211. package/base/webcomponents/settings/input/name.d.ts.map +1 -0
  212. package/base/webcomponents/settings/input/name.js +116 -53
  213. package/base/webcomponents/settings/input/name.js.map +1 -1
  214. package/base/webcomponents/settings/input/password.d.ts +8 -5
  215. package/base/webcomponents/settings/input/password.d.ts.map +1 -0
  216. package/base/webcomponents/settings/input/password.js +200 -103
  217. package/base/webcomponents/settings/input/password.js.map +1 -1
  218. package/base/webcomponents/settings/input/uploader.d.ts +8 -6
  219. package/base/webcomponents/settings/input/uploader.d.ts.map +1 -0
  220. package/base/webcomponents/settings/input/uploader.js +209 -170
  221. package/base/webcomponents/settings/input/uploader.js.map +1 -1
  222. package/base/webcomponents/settings/input/verify.d.ts +64 -0
  223. package/base/webcomponents/settings/input/verify.d.ts.map +1 -0
  224. package/base/webcomponents/settings/input/verify.js +272 -0
  225. package/base/webcomponents/settings/input/verify.js.map +1 -0
  226. package/base/webcomponents/settings/settings.d.ts +15 -10
  227. package/base/webcomponents/settings/settings.d.ts.map +1 -0
  228. package/base/webcomponents/settings/settings.js +226 -147
  229. package/base/webcomponents/settings/settings.js.map +1 -1
  230. package/docs/sliders.md +66 -0
  231. package/firebase.md +125 -0
  232. package/intro.md +19 -0
  233. package/license +21 -21
  234. package/package.json +117 -71
  235. package/source/pwa-auth.js +1233 -469
  236. package/source/pwa-styles.css +50 -68
  237. package/base/redux/drawer.d.ts +0 -17
  238. package/base/redux/drawer.js +0 -22
  239. package/base/redux/drawer.js.map +0 -1
  240. package/demonstration/index.html +0 -99
  241. package/demonstration/pwa-styles.css +0 -77
  242. package/demonstration/styles.css +0 -77
  243. package/notes.md +0 -11
  244. 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 { listStyle } from '../form/css/list';
22
- import { animation } from '../css/animation';
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
- firstUpdated() {
31
- const forms = this.querySelectorAll('form');
32
- forms.forEach(item => {
33
- item.preventDefault();
34
- });
35
- this.shadowRoot.querySelector('button[value=profile]').addEventListener('click', () => {
36
- store.dispatch(navigateAuth('profile'));
37
- });
38
- this.shadowRoot.querySelector('button[value=verification]').addEventListener('click', () => {
39
- store.dispatch(navigateAuth('verification'));
40
- });
41
- this.shadowRoot.querySelector('button[value=password]').addEventListener('click', () => {
42
- store.dispatch(navigateAuth('password'));
43
- });
44
- this.shadowRoot.querySelector('button[value=delete]').addEventListener('click', () => {
45
- store.dispatch(navigateAuth('delete'));
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
- css `
58
-
59
- :host {
60
- display: grid;
61
- grid-template-rows: auto 1fr;
62
- background-color: var(--pwa_settings_background_color, white);
63
- }
64
-
65
- form {
66
- box-sizing: border-box;
67
- display: grid;
68
- border: 0;
69
- }
70
-
71
- .pageTitle { margin: 0; }
72
-
73
- /* up to 576 pixels */
74
- @media only screen and (max-width: 576px) {
75
- h2 {
76
- font-size: medium;
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
- return html `
85
-
86
- <!-- Page Menu -->
87
- <nav>
88
-
89
- <ul>
90
-
91
- <li>
92
- <button
93
- value="profile"
94
- ?on="${this.profileTopic === 'profile'}">Icon
95
- </button>
96
- </li>
97
-
98
- <li>
99
- <button
100
- value="verification"
101
- ?on="${this.profileTopic === 'verification'}">Profile
102
- </button>
103
- </li>
104
-
105
- <li>
106
- <button
107
- value="password"
108
- ?on="${this.profileTopic === 'password'}">Password
109
- </button>
110
- </li>
111
-
112
- <li>
113
- <button
114
- value="delete"
115
- ?on="${this.profileTopic === 'delete'}">Delete
116
- </button>
117
- </li>
118
-
119
- </ul>
120
-
121
- </nav>
122
-
123
-
124
- <div class= "wrapper">
125
- <div class= "inner">
126
-
127
-
128
- <!-- Page 1: Profile -->
129
- <section
130
- class="content ${this.profileTopic === 'profile' ? 'opened' : 'closed'}">
131
-
132
- <!-- Display Username -->
133
- <h2>${this.name}</h2>
134
-
135
- <!-- Custom Image Element - Display / Upload -->
136
- <contact-photo emptyArtwork="${this.empty}"></contact-photo>
137
-
138
- </section>
139
-
140
- <!-- Page 2: Verification -->
141
- <section
142
- class="content ${this.profileTopic === 'verification' ? 'opened' : 'closed'}">
143
-
144
- <!-- Page Title -->
145
- <h2>Contact Information</h2>
146
-
147
- <!-- Custom - Username -->
148
- <input-name></input-name>
149
-
150
- <!-- Custom - Email -->
151
- <contact-email></contact-email>
152
-
153
- </section>
154
-
155
- <!-- Page 3: Password -->
156
- <section
157
- class="content ${this.profileTopic === 'password' ? 'opened' : 'closed'}">
158
-
159
- <!-- Page Title -->
160
- <h2>Password</h2>
161
-
162
- <!-- Custom - Password -->
163
- <input-password></input-password>
164
-
165
- </section>
166
-
167
- <!-- Page 4: Delete -->
168
- <section
169
- class="content ${this.profileTopic === 'delete' ? 'opened' : 'closed'}">
170
-
171
- <!-- Page Title -->
172
- <h2>Delete Account</h2>
173
-
174
- <!-- Custom - Delete -->
175
- <delete-user></delete-user>
176
-
177
- </section>
178
-
179
- </div>
180
- </div>
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,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AC,MAAM;sBACxD,IAAI,CAAC,YAAY,KAAK,UAAU;6BACxB,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;;;;;;;;;;;;;;2BAczD,IAAI,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;sBACtD,IAAI,CAAC,YAAY,KAAK,QAAQ;6BACtB,IAAI,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;;;;;;;;;;;;;KAa7E,CAAA;IACH,CAAC;CAEF,CAAA;AA7OiD;IAA/C,QAAQ,CAAC,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"}
@@ -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).