uncial-cms 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index-page.js +22 -6
  2. package/package.json +1 -1
@@ -35,7 +35,12 @@ export function mountIndexPage(target, opts) {
35
35
  const editorView = document.createElement('section');
36
36
  editorView.className = 'uncial-cms-fallback-editor';
37
37
  editorView.hidden = true;
38
- root.append(status, listView, editorView);
38
+ const signInButton = document.createElement('button');
39
+ signInButton.type = 'button';
40
+ signInButton.className = 'uncial-cms-sign-in';
41
+ signInButton.textContent = 'Sign in';
42
+ signInButton.hidden = true;
43
+ root.append(status, signInButton, listView, editorView);
39
44
  target.append(root);
40
45
  let destroyed = false;
41
46
  let adapter = null;
@@ -207,11 +212,22 @@ export function mountIndexPage(target, opts) {
207
212
  return;
208
213
  applyHash();
209
214
  };
210
- void load().catch((error) => {
211
- if (destroyed)
212
- return;
213
- setStatus(error instanceof Error ? error.message : 'Failed to load the site index.');
214
- });
215
+ // The first attempt runs outside a click, where browsers block the sign-in
216
+ // popup, so a failed sign-in is retried from a button.
217
+ const signIn = async () => {
218
+ signInButton.hidden = true;
219
+ try {
220
+ await load();
221
+ }
222
+ catch (error) {
223
+ if (destroyed)
224
+ return;
225
+ setStatus(error instanceof Error ? error.message : 'Failed to load the site index.');
226
+ signInButton.hidden = false;
227
+ }
228
+ };
229
+ signInButton.addEventListener('click', () => void signIn());
230
+ void signIn();
215
231
  return {
216
232
  destroy() {
217
233
  destroyed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uncial-cms",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",