@konemono/nostr-login-components 1.0.4
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/dist/components/button-base.d.ts +11 -0
- package/dist/components/button-base.js +8 -0
- package/dist/components/button-base.js.map +1 -0
- package/dist/components/button-base2.js +52 -0
- package/dist/components/button-base2.js.map +1 -0
- package/dist/components/css.js +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +39 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +33 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/index3.js +248 -0
- package/dist/components/index3.js.map +1 -0
- package/dist/components/nl-auth.d.ts +11 -0
- package/dist/components/nl-auth.js +8 -0
- package/dist/components/nl-auth.js.map +1 -0
- package/dist/components/nl-auth2.js +352 -0
- package/dist/components/nl-auth2.js.map +1 -0
- package/dist/components/nl-banner.d.ts +11 -0
- package/dist/components/nl-banner.js +8 -0
- package/dist/components/nl-banner.js.map +1 -0
- package/dist/components/nl-banner2.js +195 -0
- package/dist/components/nl-banner2.js.map +1 -0
- package/dist/components/nl-button.d.ts +11 -0
- package/dist/components/nl-button.js +8 -0
- package/dist/components/nl-button.js.map +1 -0
- package/dist/components/nl-button2.js +45 -0
- package/dist/components/nl-button2.js.map +1 -0
- package/dist/components/nl-change-account.d.ts +11 -0
- package/dist/components/nl-change-account.js +8 -0
- package/dist/components/nl-change-account.js.map +1 -0
- package/dist/components/nl-change-account2.js +113 -0
- package/dist/components/nl-change-account2.js.map +1 -0
- package/dist/components/nl-confirm-logout.d.ts +11 -0
- package/dist/components/nl-confirm-logout.js +8 -0
- package/dist/components/nl-confirm-logout.js.map +1 -0
- package/dist/components/nl-confirm-logout2.js +61 -0
- package/dist/components/nl-confirm-logout2.js.map +1 -0
- package/dist/components/nl-connect.d.ts +11 -0
- package/dist/components/nl-connect.js +8 -0
- package/dist/components/nl-connect.js.map +1 -0
- package/dist/components/nl-connect2.js +86 -0
- package/dist/components/nl-connect2.js.map +1 -0
- package/dist/components/nl-dialog.d.ts +11 -0
- package/dist/components/nl-dialog.js +8 -0
- package/dist/components/nl-dialog.js.map +1 -0
- package/dist/components/nl-dialog2.js +44 -0
- package/dist/components/nl-dialog2.js.map +1 -0
- package/dist/components/nl-iframe.d.ts +11 -0
- package/dist/components/nl-iframe.js +8 -0
- package/dist/components/nl-iframe.js.map +1 -0
- package/dist/components/nl-iframe2.js +51 -0
- package/dist/components/nl-iframe2.js.map +1 -0
- package/dist/components/nl-import-flow.d.ts +11 -0
- package/dist/components/nl-import-flow.js +8 -0
- package/dist/components/nl-import-flow.js.map +1 -0
- package/dist/components/nl-import-flow2.js +91 -0
- package/dist/components/nl-import-flow2.js.map +1 -0
- package/dist/components/nl-info-extension.d.ts +11 -0
- package/dist/components/nl-info-extension.js +8 -0
- package/dist/components/nl-info-extension.js.map +1 -0
- package/dist/components/nl-info-extension2.js +36 -0
- package/dist/components/nl-info-extension2.js.map +1 -0
- package/dist/components/nl-info.d.ts +11 -0
- package/dist/components/nl-info.js +8 -0
- package/dist/components/nl-info.js.map +1 -0
- package/dist/components/nl-info2.js +98 -0
- package/dist/components/nl-info2.js.map +1 -0
- package/dist/components/nl-loading.d.ts +11 -0
- package/dist/components/nl-loading.js +8 -0
- package/dist/components/nl-loading.js.map +1 -0
- package/dist/components/nl-loading2.js +87 -0
- package/dist/components/nl-loading2.js.map +1 -0
- package/dist/components/nl-local-signup.d.ts +11 -0
- package/dist/components/nl-local-signup.js +8 -0
- package/dist/components/nl-local-signup.js.map +1 -0
- package/dist/components/nl-local-signup2.js +69 -0
- package/dist/components/nl-local-signup2.js.map +1 -0
- package/dist/components/nl-login-status.d.ts +11 -0
- package/dist/components/nl-login-status.js +8 -0
- package/dist/components/nl-login-status.js.map +1 -0
- package/dist/components/nl-otp-migrate.d.ts +11 -0
- package/dist/components/nl-otp-migrate.js +8 -0
- package/dist/components/nl-otp-migrate.js.map +1 -0
- package/dist/components/nl-otp-migrate2.js +67 -0
- package/dist/components/nl-otp-migrate2.js.map +1 -0
- package/dist/components/nl-previously-logged.d.ts +11 -0
- package/dist/components/nl-previously-logged.js +8 -0
- package/dist/components/nl-previously-logged.js.map +1 -0
- package/dist/components/nl-previously-logged2.js +98 -0
- package/dist/components/nl-previously-logged2.js.map +1 -0
- package/dist/components/nl-select.d.ts +11 -0
- package/dist/components/nl-select.js +8 -0
- package/dist/components/nl-select.js.map +1 -0
- package/dist/components/nl-select2.js +97 -0
- package/dist/components/nl-select2.js.map +1 -0
- package/dist/components/nl-signin-bunker-url.d.ts +11 -0
- package/dist/components/nl-signin-bunker-url.js +8 -0
- package/dist/components/nl-signin-bunker-url.js.map +1 -0
- package/dist/components/nl-signin-bunker-url2.js +59 -0
- package/dist/components/nl-signin-bunker-url2.js.map +1 -0
- package/dist/components/nl-signin-connection-string.d.ts +11 -0
- package/dist/components/nl-signin-connection-string.js +8 -0
- package/dist/components/nl-signin-connection-string.js.map +1 -0
- package/dist/components/nl-signin-connection-string2.js +2935 -0
- package/dist/components/nl-signin-connection-string2.js.map +1 -0
- package/dist/components/nl-signin-otp.d.ts +11 -0
- package/dist/components/nl-signin-otp.js +8 -0
- package/dist/components/nl-signin-otp.js.map +1 -0
- package/dist/components/nl-signin-otp2.js +72 -0
- package/dist/components/nl-signin-otp2.js.map +1 -0
- package/dist/components/nl-signin-read-only.d.ts +11 -0
- package/dist/components/nl-signin-read-only.js +8 -0
- package/dist/components/nl-signin-read-only.js.map +1 -0
- package/dist/components/nl-signin-read-only2.js +59 -0
- package/dist/components/nl-signin-read-only2.js.map +1 -0
- package/dist/components/nl-signin.d.ts +11 -0
- package/dist/components/nl-signin.js +8 -0
- package/dist/components/nl-signin.js.map +1 -0
- package/dist/components/nl-signin2.js +59 -0
- package/dist/components/nl-signin2.js.map +1 -0
- package/dist/components/nl-signup.d.ts +11 -0
- package/dist/components/nl-signup.js +8 -0
- package/dist/components/nl-signup.js.map +1 -0
- package/dist/components/nl-signup2.js +89 -0
- package/dist/components/nl-signup2.js.map +1 -0
- package/dist/components/nl-welcome-signin.d.ts +11 -0
- package/dist/components/nl-welcome-signin.js +8 -0
- package/dist/components/nl-welcome-signin.js.map +1 -0
- package/dist/components/nl-welcome-signin2.js +64 -0
- package/dist/components/nl-welcome-signin2.js.map +1 -0
- package/dist/components/nl-welcome-signup.d.ts +11 -0
- package/dist/components/nl-welcome-signup.js +8 -0
- package/dist/components/nl-welcome-signup.js.map +1 -0
- package/dist/components/nl-welcome-signup2.js +51 -0
- package/dist/components/nl-welcome-signup2.js.map +1 -0
- package/dist/components/nl-welcome.d.ts +11 -0
- package/dist/components/nl-welcome.js +8 -0
- package/dist/components/nl-welcome.js.map +1 -0
- package/dist/components/nl-welcome2.js +51 -0
- package/dist/components/nl-welcome2.js.map +1 -0
- package/dist/components/ns-login-status.js +58 -0
- package/dist/components/ns-login-status.js.map +1 -0
- package/dist/types/components/button-base/button-base.d.ts +11 -0
- package/dist/types/components/nl-auth/nl-auth.d.ts +43 -0
- package/dist/types/components/nl-banner/nl-banner.d.ts +34 -0
- package/dist/types/components/nl-button/nl-button.d.ts +9 -0
- package/dist/types/components/nl-change-account/nl-change-account.d.ts +28 -0
- package/dist/types/components/nl-confirm-logout/nl-confirm-logout.d.ts +12 -0
- package/dist/types/components/nl-connect/nl-connect.d.ts +18 -0
- package/dist/types/components/nl-dialog/nl-dialog.d.ts +6 -0
- package/dist/types/components/nl-iframe/nl-iframe.d.ts +9 -0
- package/dist/types/components/nl-import-flow/nl-import-flow.d.ts +18 -0
- package/dist/types/components/nl-info/nl-info.d.ts +12 -0
- package/dist/types/components/nl-info-extension/nl-info-extension.d.ts +3 -0
- package/dist/types/components/nl-loading/nl-loading.d.ts +9 -0
- package/dist/types/components/nl-local-signup/nl-local-signup.d.ts +14 -0
- package/dist/types/components/nl-login-status/ns-login-status.d.ts +5 -0
- package/dist/types/components/nl-otp-migrate/nl-otp-migrate.d.ts +12 -0
- package/dist/types/components/nl-previously-logged/nl-previously-logged.d.ts +19 -0
- package/dist/types/components/nl-select/nl-select.d.ts +28 -0
- package/dist/types/components/nl-signin/nl-signin.d.ts +11 -0
- package/dist/types/components/nl-signin-bunker-url/nl-signin-bunker-url.d.ts +11 -0
- package/dist/types/components/nl-signin-connection-string/nl-signin-connection-string.d.ts +13 -0
- package/dist/types/components/nl-signin-otp/nl-signin-otp.d.ts +14 -0
- package/dist/types/components/nl-signin-read-only/nl-signin-read-only.d.ts +11 -0
- package/dist/types/components/nl-signup/nl-signup.d.ts +20 -0
- package/dist/types/components/nl-welcome/nl-welcome.d.ts +6 -0
- package/dist/types/components/nl-welcome-signin/nl-welcome-signin.d.ts +13 -0
- package/dist/types/components/nl-welcome-signup/nl-welcome-signup.d.ts +6 -0
- package/dist/types/components.d.ts +925 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/store/index.d.ts +36 -0
- package/dist/types/types/button.d.ts +6 -0
- package/dist/types/types/index.d.ts +59 -0
- package/package.json +49 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as CURRENT_MODULE } from './index2.js';
|
|
3
|
+
import { s as state } from './index3.js';
|
|
4
|
+
import { d as defineCustomElement$m } from './button-base2.js';
|
|
5
|
+
import { d as defineCustomElement$l } from './nl-confirm-logout2.js';
|
|
6
|
+
import { d as defineCustomElement$k } from './nl-connect2.js';
|
|
7
|
+
import { d as defineCustomElement$j } from './nl-iframe2.js';
|
|
8
|
+
import { d as defineCustomElement$i } from './nl-import-flow2.js';
|
|
9
|
+
import { d as defineCustomElement$h } from './nl-info2.js';
|
|
10
|
+
import { d as defineCustomElement$g } from './nl-info-extension2.js';
|
|
11
|
+
import { d as defineCustomElement$f } from './nl-loading2.js';
|
|
12
|
+
import { d as defineCustomElement$e } from './nl-local-signup2.js';
|
|
13
|
+
import { d as defineCustomElement$d } from './ns-login-status.js';
|
|
14
|
+
import { d as defineCustomElement$c } from './nl-otp-migrate2.js';
|
|
15
|
+
import { d as defineCustomElement$b } from './nl-previously-logged2.js';
|
|
16
|
+
import { d as defineCustomElement$a } from './nl-select2.js';
|
|
17
|
+
import { d as defineCustomElement$9 } from './nl-signin2.js';
|
|
18
|
+
import { d as defineCustomElement$8 } from './nl-signin-bunker-url2.js';
|
|
19
|
+
import { d as defineCustomElement$7 } from './nl-signin-connection-string2.js';
|
|
20
|
+
import { d as defineCustomElement$6 } from './nl-signin-otp2.js';
|
|
21
|
+
import { d as defineCustomElement$5 } from './nl-signin-read-only2.js';
|
|
22
|
+
import { d as defineCustomElement$4 } from './nl-signup2.js';
|
|
23
|
+
import { d as defineCustomElement$3 } from './nl-welcome2.js';
|
|
24
|
+
import { d as defineCustomElement$2 } from './nl-welcome-signin2.js';
|
|
25
|
+
import { d as defineCustomElement$1 } from './nl-welcome-signup2.js';
|
|
26
|
+
|
|
27
|
+
import { baseCss } from './css.js';
|
|
28
|
+
const nlAuthCss = baseCss;
|
|
29
|
+
|
|
30
|
+
const NlAuthStyle0 = nlAuthCss;
|
|
31
|
+
|
|
32
|
+
const NlAuth = /*@__PURE__*/ proxyCustomElement(class NlAuth extends HTMLElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.__registerHost();
|
|
36
|
+
this.__attachShadow();
|
|
37
|
+
this.nlCloseModal = createEvent(this, "nlCloseModal", 7);
|
|
38
|
+
this.nlChangeDarkMode = createEvent(this, "nlChangeDarkMode", 7);
|
|
39
|
+
this.nlNostrConnectDefaultCancel = createEvent(this, "nlNostrConnectDefaultCancel", 7);
|
|
40
|
+
this.prevPath = '';
|
|
41
|
+
this.theme = 'default';
|
|
42
|
+
this.bunkers = '';
|
|
43
|
+
this.startScreen = CURRENT_MODULE.WELCOME;
|
|
44
|
+
this.authMethods = [];
|
|
45
|
+
this.hasExtension = false;
|
|
46
|
+
this.hasOTP = false;
|
|
47
|
+
this.isLoading = false;
|
|
48
|
+
this.isLoadingExtension = false;
|
|
49
|
+
this.isOTP = false;
|
|
50
|
+
this.authUrl = '';
|
|
51
|
+
this.iframeUrl = '';
|
|
52
|
+
this.error = '';
|
|
53
|
+
this.localSignup = false;
|
|
54
|
+
this.signupNjump = false;
|
|
55
|
+
this.njumpIframe = '';
|
|
56
|
+
this.accounts = [];
|
|
57
|
+
this.recents = [];
|
|
58
|
+
this.darkMode = false;
|
|
59
|
+
this.welcomeTitle = '';
|
|
60
|
+
this.welcomeDescription = '';
|
|
61
|
+
this.connectionString = '';
|
|
62
|
+
this.connectionStringServices = [];
|
|
63
|
+
}
|
|
64
|
+
watchLoadingHandler(newValue) {
|
|
65
|
+
state.isLoading = newValue;
|
|
66
|
+
}
|
|
67
|
+
watchLoadingExtensionHandler(newValue) {
|
|
68
|
+
state.isLoadingExtension = newValue;
|
|
69
|
+
}
|
|
70
|
+
watchOTPHandler(newValue) {
|
|
71
|
+
state.isOTP = newValue;
|
|
72
|
+
}
|
|
73
|
+
watchAuthUrlHandler(newValue) {
|
|
74
|
+
state.authUrl = newValue;
|
|
75
|
+
}
|
|
76
|
+
watchIframeUrlHandler(newValue) {
|
|
77
|
+
state.iframeUrl = newValue;
|
|
78
|
+
}
|
|
79
|
+
watchNjumpIframeHandler(newValue) {
|
|
80
|
+
state.njumpIframe = newValue;
|
|
81
|
+
}
|
|
82
|
+
watchErrorHandler(newValue) {
|
|
83
|
+
state.error = newValue;
|
|
84
|
+
}
|
|
85
|
+
handleClose() {
|
|
86
|
+
this.nlCloseModal.emit();
|
|
87
|
+
}
|
|
88
|
+
handleChangeDarkMode() {
|
|
89
|
+
this.nlChangeDarkMode.emit(!this.darkMode);
|
|
90
|
+
}
|
|
91
|
+
componentWillLoad() {
|
|
92
|
+
// init state
|
|
93
|
+
state.path = [this.startScreen];
|
|
94
|
+
state.error = '';
|
|
95
|
+
state.iframeUrl = '';
|
|
96
|
+
state.authUrl = '';
|
|
97
|
+
state.isLoading = false;
|
|
98
|
+
state.isLoadingExtension = false;
|
|
99
|
+
state.isOTP = false;
|
|
100
|
+
console.log('path', state.path);
|
|
101
|
+
}
|
|
102
|
+
handleClickToBack() {
|
|
103
|
+
state.path.pop();
|
|
104
|
+
state.path = [...state.path];
|
|
105
|
+
// reset
|
|
106
|
+
state.isLoading = false;
|
|
107
|
+
state.isLoadingExtension = false;
|
|
108
|
+
state.authUrl = '';
|
|
109
|
+
state.isOTP = false;
|
|
110
|
+
}
|
|
111
|
+
switchSignSignUpStrategy(str) {
|
|
112
|
+
if (CURRENT_MODULE.LOCAL_SIGNUP === str) {
|
|
113
|
+
state.path = [CURRENT_MODULE.WELCOME, CURRENT_MODULE.WELCOME_SIGNUP, str];
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
state.path = [CURRENT_MODULE.WELCOME, str];
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
const classWrapper = `w-full h-full fixed top-0 start-0 z-[80] overflow-x-hidden overflow-y-auto flex items-center ${this.darkMode ? 'dark' : ''}`;
|
|
120
|
+
const currentModule = state.path.at(-1);
|
|
121
|
+
if (currentModule !== this.prevPath && this.prevPath === CURRENT_MODULE.CONNECTION_STRING) {
|
|
122
|
+
this.nlNostrConnectDefaultCancel.emit();
|
|
123
|
+
}
|
|
124
|
+
this.prevPath = currentModule;
|
|
125
|
+
const renderModule = () => {
|
|
126
|
+
if (state.isOTP)
|
|
127
|
+
return h("nl-signin-otp", null);
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
// const t: CURRENT_MODULE = 'import' // lastValuePath
|
|
130
|
+
switch (currentModule) {
|
|
131
|
+
case CURRENT_MODULE.WELCOME:
|
|
132
|
+
return h("nl-welcome", { titleWelcome: this.welcomeTitle || undefined, description: this.welcomeDescription || undefined });
|
|
133
|
+
case CURRENT_MODULE.LOGIN:
|
|
134
|
+
return h("nl-signin", null);
|
|
135
|
+
case CURRENT_MODULE.SIGNUP:
|
|
136
|
+
return h("nl-signup", { bunkers: this.bunkers });
|
|
137
|
+
case CURRENT_MODULE.LOCAL_SIGNUP:
|
|
138
|
+
return h("nl-local-signup", { signupNjump: this.signupNjump });
|
|
139
|
+
case CURRENT_MODULE.CONFIRM_LOGOUT:
|
|
140
|
+
return h("nl-confirm-logout", null);
|
|
141
|
+
case CURRENT_MODULE.IMPORT_FLOW:
|
|
142
|
+
return h("nl-import-flow", { services: this.connectionStringServices });
|
|
143
|
+
case CURRENT_MODULE.IMPORT_OTP:
|
|
144
|
+
return h("nl-otp-migrate", { services: this.connectionStringServices });
|
|
145
|
+
case CURRENT_MODULE.INFO:
|
|
146
|
+
return h("nl-info", null);
|
|
147
|
+
case CURRENT_MODULE.EXTENSION:
|
|
148
|
+
return h("nl-info-extension", null);
|
|
149
|
+
case CURRENT_MODULE.LOGIN_READ_ONLY:
|
|
150
|
+
return h("nl-signin-read-only", null);
|
|
151
|
+
case CURRENT_MODULE.LOGIN_BUNKER_URL:
|
|
152
|
+
return h("nl-signin-bunker-url", null);
|
|
153
|
+
case CURRENT_MODULE.LOGIN_OTP:
|
|
154
|
+
return h("nl-signin-otp", null);
|
|
155
|
+
case CURRENT_MODULE.WELCOME_LOGIN:
|
|
156
|
+
return h("nl-welcome-signin", { hasOTP: this.hasOTP, authMethods: this.authMethods, hasExtension: this.hasExtension });
|
|
157
|
+
case CURRENT_MODULE.WELCOME_SIGNUP:
|
|
158
|
+
return h("nl-welcome-signup", null);
|
|
159
|
+
case CURRENT_MODULE.CONNECTION_STRING:
|
|
160
|
+
return h("nl-signin-connection-string", { connectionString: this.connectionString });
|
|
161
|
+
case CURRENT_MODULE.CONNECT:
|
|
162
|
+
return h("nl-connect", { connectionStringServices: this.connectionStringServices, authMethods: this.authMethods });
|
|
163
|
+
case CURRENT_MODULE.PREVIOUSLY_LOGGED:
|
|
164
|
+
return h("nl-previously-logged", { accounts: this.accounts, recents: this.recents });
|
|
165
|
+
case CURRENT_MODULE.IFRAME:
|
|
166
|
+
return h("nl-iframe", { iframeUrl: this.authUrl });
|
|
167
|
+
default:
|
|
168
|
+
return h("nl-welcome", null);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const showLogin = state.isOTP ||
|
|
172
|
+
(currentModule !== CURRENT_MODULE.INFO &&
|
|
173
|
+
currentModule !== CURRENT_MODULE.CONFIRM_LOGOUT &&
|
|
174
|
+
currentModule !== CURRENT_MODULE.IMPORT_FLOW &&
|
|
175
|
+
currentModule !== CURRENT_MODULE.WELCOME &&
|
|
176
|
+
currentModule !== CURRENT_MODULE.EXTENSION &&
|
|
177
|
+
currentModule !== CURRENT_MODULE.IFRAME &&
|
|
178
|
+
currentModule !== CURRENT_MODULE.PREVIOUSLY_LOGGED);
|
|
179
|
+
const showSignup = currentModule !== CURRENT_MODULE.IFRAME &&
|
|
180
|
+
(!this.authMethods.length || (!this.localSignup && this.authMethods.includes('connect')) || (this.localSignup && this.authMethods.includes('local')));
|
|
181
|
+
return (h("div", { class: `theme-${this.theme}`, dir: "ltr" }, h("div", { class: classWrapper }, h("div", { onClick: () => this.handleClose(), class: "absolute top-0 left-0 w-full h-full bg-gray-500 bg-opacity-75 z-[80]" }), h("div", { class: "nl-bg relative z-[81] w-full flex flex-col rounded-xl sm:max-w-lg sm:w-full sm:mx-auto" }, h("div", { class: `flex justify-between items-center py-3 px-4` }, h("div", { class: "flex gap-2 items-center" }, h("svg", { class: "w-7 h-7", width: "225", height: "224", viewBox: "0 0 225 224", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("rect", { width: "224.047", height: "224", rx: "64", fill: "#6951FA" }), h("path", { d: "M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z", fill: "white" })), h("p", { class: "font-bold nl-logo text-base" }, "Nostr ", h("span", { class: "font-light" }, "Login"))), h("div", { class: "flex gap-1" }, h("button", { onClick: () => this.handleChangeDarkMode(), type: "button", class: "nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent" }, h("span", { class: "sr-only" }, "Change theme"), this.darkMode ? (h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-5 h-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" }))) : (h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-5 h-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z" })))), !state.isLoading && (h("button", { onClick: () => (state.path = [...state.path, CURRENT_MODULE.INFO]), type: "button", class: "nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent" }, h("span", { class: "sr-only" }, "Info"), h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-5 h-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" })))), h("button", { onClick: () => this.handleClose(), type: "button", class: "nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent" }, h("span", { class: "sr-only" }, "Close"), h("svg", { class: "flex-shrink-0 w-5 h-5", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M18 6 6 18" }), h("path", { d: "m6 6 12 12" }))))), state.path.length > 1 && !state.isLoading && (h("div", { class: "p-4" }, h("button", { onClick: () => this.handleClickToBack(), type: "button", class: "nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600", "data-hs-overlay": "#hs-vertically-centered-modal" }, h("span", { class: "sr-only" }, "Back"), h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-5 h-5" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" }))))), state.isLoading || state.authUrl ? (h("nl-loading", { path: currentModule })) : (h(Fragment, null, renderModule(), showLogin && (h(Fragment, null, currentModule === CURRENT_MODULE.WELCOME_SIGNUP || currentModule === CURRENT_MODULE.SIGNUP || currentModule === CURRENT_MODULE.LOCAL_SIGNUP ? (h("div", { class: "p-4 overflow-y-auto" }, h("p", { class: "nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto" }, "If you already have a profile please", ' ', h("span", { onClick: () => this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_LOGIN), class: "cursor-pointer text-blue-400" }, "log in"), "."))) : (showSignup && (h("div", { class: "p-4 overflow-y-auto" }, h("p", { class: "nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto" }, "If you don't have a profile please", ' ', h("span", { onClick: () => this.localSignup ? this.switchSignSignUpStrategy(CURRENT_MODULE.LOCAL_SIGNUP) : this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_SIGNUP), class: "cursor-pointer text-blue-400" }, "sign up"), "."))))))))))));
|
|
182
|
+
}
|
|
183
|
+
static get watchers() { return {
|
|
184
|
+
"isLoading": ["watchLoadingHandler"],
|
|
185
|
+
"isLoadingExtension": ["watchLoadingExtensionHandler"],
|
|
186
|
+
"isOTP": ["watchOTPHandler"],
|
|
187
|
+
"authUrl": ["watchAuthUrlHandler"],
|
|
188
|
+
"iframeUrl": ["watchIframeUrlHandler"],
|
|
189
|
+
"njumpIframe": ["watchNjumpIframeHandler"],
|
|
190
|
+
"error": ["watchErrorHandler"]
|
|
191
|
+
}; }
|
|
192
|
+
static get style() { return NlAuthStyle0; }
|
|
193
|
+
}, [1, "nl-auth", {
|
|
194
|
+
"theme": [1025],
|
|
195
|
+
"bunkers": [1],
|
|
196
|
+
"startScreen": [1, "start-screen"],
|
|
197
|
+
"authMethods": [16],
|
|
198
|
+
"hasExtension": [4, "has-extension"],
|
|
199
|
+
"hasOTP": [4, "has-o-t-p"],
|
|
200
|
+
"isLoading": [4, "is-loading"],
|
|
201
|
+
"isLoadingExtension": [4, "is-loading-extension"],
|
|
202
|
+
"isOTP": [4, "is-o-t-p"],
|
|
203
|
+
"authUrl": [1, "auth-url"],
|
|
204
|
+
"iframeUrl": [1, "iframe-url"],
|
|
205
|
+
"error": [1],
|
|
206
|
+
"localSignup": [4, "local-signup"],
|
|
207
|
+
"signupNjump": [4, "signup-njump"],
|
|
208
|
+
"njumpIframe": [1, "njump-iframe"],
|
|
209
|
+
"accounts": [1040],
|
|
210
|
+
"recents": [1040],
|
|
211
|
+
"darkMode": [1028, "dark-mode"],
|
|
212
|
+
"welcomeTitle": [1, "welcome-title"],
|
|
213
|
+
"welcomeDescription": [1, "welcome-description"],
|
|
214
|
+
"connectionString": [1, "connection-string"],
|
|
215
|
+
"connectionStringServices": [16]
|
|
216
|
+
}, undefined, {
|
|
217
|
+
"isLoading": ["watchLoadingHandler"],
|
|
218
|
+
"isLoadingExtension": ["watchLoadingExtensionHandler"],
|
|
219
|
+
"isOTP": ["watchOTPHandler"],
|
|
220
|
+
"authUrl": ["watchAuthUrlHandler"],
|
|
221
|
+
"iframeUrl": ["watchIframeUrlHandler"],
|
|
222
|
+
"njumpIframe": ["watchNjumpIframeHandler"],
|
|
223
|
+
"error": ["watchErrorHandler"]
|
|
224
|
+
}]);
|
|
225
|
+
function defineCustomElement() {
|
|
226
|
+
if (typeof customElements === "undefined") {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const components = ["nl-auth", "button-base", "nl-confirm-logout", "nl-connect", "nl-iframe", "nl-import-flow", "nl-info", "nl-info-extension", "nl-loading", "nl-local-signup", "nl-login-status", "nl-otp-migrate", "nl-previously-logged", "nl-select", "nl-signin", "nl-signin-bunker-url", "nl-signin-connection-string", "nl-signin-otp", "nl-signin-read-only", "nl-signup", "nl-welcome", "nl-welcome-signin", "nl-welcome-signup"];
|
|
230
|
+
components.forEach(tagName => { switch (tagName) {
|
|
231
|
+
case "nl-auth":
|
|
232
|
+
if (!customElements.get(tagName)) {
|
|
233
|
+
customElements.define(tagName, NlAuth);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
case "button-base":
|
|
237
|
+
if (!customElements.get(tagName)) {
|
|
238
|
+
defineCustomElement$m();
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
case "nl-confirm-logout":
|
|
242
|
+
if (!customElements.get(tagName)) {
|
|
243
|
+
defineCustomElement$l();
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
case "nl-connect":
|
|
247
|
+
if (!customElements.get(tagName)) {
|
|
248
|
+
defineCustomElement$k();
|
|
249
|
+
}
|
|
250
|
+
break;
|
|
251
|
+
case "nl-iframe":
|
|
252
|
+
if (!customElements.get(tagName)) {
|
|
253
|
+
defineCustomElement$j();
|
|
254
|
+
}
|
|
255
|
+
break;
|
|
256
|
+
case "nl-import-flow":
|
|
257
|
+
if (!customElements.get(tagName)) {
|
|
258
|
+
defineCustomElement$i();
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
case "nl-info":
|
|
262
|
+
if (!customElements.get(tagName)) {
|
|
263
|
+
defineCustomElement$h();
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
case "nl-info-extension":
|
|
267
|
+
if (!customElements.get(tagName)) {
|
|
268
|
+
defineCustomElement$g();
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
case "nl-loading":
|
|
272
|
+
if (!customElements.get(tagName)) {
|
|
273
|
+
defineCustomElement$f();
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
case "nl-local-signup":
|
|
277
|
+
if (!customElements.get(tagName)) {
|
|
278
|
+
defineCustomElement$e();
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case "nl-login-status":
|
|
282
|
+
if (!customElements.get(tagName)) {
|
|
283
|
+
defineCustomElement$d();
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case "nl-otp-migrate":
|
|
287
|
+
if (!customElements.get(tagName)) {
|
|
288
|
+
defineCustomElement$c();
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case "nl-previously-logged":
|
|
292
|
+
if (!customElements.get(tagName)) {
|
|
293
|
+
defineCustomElement$b();
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case "nl-select":
|
|
297
|
+
if (!customElements.get(tagName)) {
|
|
298
|
+
defineCustomElement$a();
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
case "nl-signin":
|
|
302
|
+
if (!customElements.get(tagName)) {
|
|
303
|
+
defineCustomElement$9();
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
case "nl-signin-bunker-url":
|
|
307
|
+
if (!customElements.get(tagName)) {
|
|
308
|
+
defineCustomElement$8();
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
case "nl-signin-connection-string":
|
|
312
|
+
if (!customElements.get(tagName)) {
|
|
313
|
+
defineCustomElement$7();
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
case "nl-signin-otp":
|
|
317
|
+
if (!customElements.get(tagName)) {
|
|
318
|
+
defineCustomElement$6();
|
|
319
|
+
}
|
|
320
|
+
break;
|
|
321
|
+
case "nl-signin-read-only":
|
|
322
|
+
if (!customElements.get(tagName)) {
|
|
323
|
+
defineCustomElement$5();
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case "nl-signup":
|
|
327
|
+
if (!customElements.get(tagName)) {
|
|
328
|
+
defineCustomElement$4();
|
|
329
|
+
}
|
|
330
|
+
break;
|
|
331
|
+
case "nl-welcome":
|
|
332
|
+
if (!customElements.get(tagName)) {
|
|
333
|
+
defineCustomElement$3();
|
|
334
|
+
}
|
|
335
|
+
break;
|
|
336
|
+
case "nl-welcome-signin":
|
|
337
|
+
if (!customElements.get(tagName)) {
|
|
338
|
+
defineCustomElement$2();
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
case "nl-welcome-signup":
|
|
342
|
+
if (!customElements.get(tagName)) {
|
|
343
|
+
defineCustomElement$1();
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
} });
|
|
347
|
+
}
|
|
348
|
+
defineCustomElement();
|
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/B,MAEL,CACA,CACP,CACF,CACQ,CACZ,CACQ,CACZ,CACG,CACF,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/nl-auth/nl-auth.css?tag=nl-auth&encapsulation=shadow","src/components/nl-auth/nl-auth.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Event, EventEmitter, Fragment, h, Prop, Watch } from '@stencil/core';\nimport { AuthMethod, ConnectionString, CURRENT_MODULE, Info, NlTheme, RecentType } from '@/types';\nimport { state } from '@/store';\n\n@Component({\n tag: 'nl-auth',\n styleUrl: 'nl-auth.css',\n shadow: true,\n})\nexport class NlAuth {\n @Prop({ mutable: true }) theme: NlTheme = 'default';\n @Prop() bunkers: string = '';\n @Prop() startScreen: string = CURRENT_MODULE.WELCOME;\n @Prop() authMethods: AuthMethod[] = [];\n @Prop() hasExtension: boolean = false;\n @Prop() hasOTP: boolean = false;\n @Prop() isLoading: boolean = false;\n @Prop() isLoadingExtension: boolean = false;\n @Prop() isOTP: boolean = false;\n @Prop() authUrl: string = '';\n @Prop() iframeUrl: string = '';\n @Prop() error: string = '';\n @Prop() localSignup: boolean = false;\n @Prop() signupNjump: boolean = false;\n @Prop() njumpIframe: string = '';\n @Prop({ mutable: true }) accounts: Info[] = [];\n @Prop({ mutable: true }) recents: RecentType[] = [];\n @Prop({ mutable: true }) darkMode: boolean = false;\n @Prop() welcomeTitle: string = '';\n @Prop() welcomeDescription: string = '';\n @Prop() connectionString: string = '';\n @Prop() connectionStringServices: ConnectionString[] = [];\n\n @Event() nlCloseModal: EventEmitter;\n @Event() nlChangeDarkMode: EventEmitter<boolean>;\n @Event() nlNostrConnectDefaultCancel: EventEmitter<void>;\n\n prevPath: string = '';\n\n @Watch('isLoading')\n watchLoadingHandler(newValue: boolean) {\n state.isLoading = newValue;\n }\n\n @Watch('isLoadingExtension')\n watchLoadingExtensionHandler(newValue: boolean) {\n state.isLoadingExtension = newValue;\n }\n\n @Watch('isOTP')\n watchOTPHandler(newValue: boolean) {\n state.isOTP = newValue;\n }\n\n @Watch('authUrl')\n watchAuthUrlHandler(newValue: string) {\n state.authUrl = newValue;\n }\n\n @Watch('iframeUrl')\n watchIframeUrlHandler(newValue: string) {\n state.iframeUrl = newValue;\n }\n\n @Watch('njumpIframe')\n watchNjumpIframeHandler(newValue: string) {\n state.njumpIframe = newValue;\n }\n\n @Watch('error')\n watchErrorHandler(newValue: string) {\n state.error = newValue;\n }\n\n handleClose() {\n this.nlCloseModal.emit();\n }\n\n handleChangeDarkMode() {\n this.nlChangeDarkMode.emit(!this.darkMode);\n }\n\n componentWillLoad() {\n // init state\n state.path = [this.startScreen as CURRENT_MODULE];\n state.error = '';\n state.iframeUrl = '';\n state.authUrl = '';\n state.isLoading = false;\n state.isLoadingExtension = false;\n state.isOTP = false;\n\n console.log('path', state.path);\n }\n\n handleClickToBack() {\n state.path.pop();\n state.path = [...state.path];\n\n // reset\n state.isLoading = false;\n state.isLoadingExtension = false;\n state.authUrl = '';\n state.isOTP = false;\n }\n\n switchSignSignUpStrategy(str: CURRENT_MODULE) {\n if (CURRENT_MODULE.LOCAL_SIGNUP === str) {\n state.path = [CURRENT_MODULE.WELCOME, CURRENT_MODULE.WELCOME_SIGNUP, str];\n\n return;\n }\n\n state.path = [CURRENT_MODULE.WELCOME, str];\n }\n\n render() {\n const classWrapper = `w-full h-full fixed top-0 start-0 z-[80] overflow-x-hidden overflow-y-auto flex items-center ${this.darkMode ? 'dark' : ''}`;\n const currentModule = state.path.at(-1);\n\n if (currentModule !== this.prevPath && this.prevPath === CURRENT_MODULE.CONNECTION_STRING) {\n this.nlNostrConnectDefaultCancel.emit();\n }\n this.prevPath = currentModule;\n\n const renderModule = () => {\n if (state.isOTP) return <nl-signin-otp />;\n\n // @ts-ignore\n // const t: CURRENT_MODULE = 'import' // lastValuePath\n\n switch (currentModule) {\n case CURRENT_MODULE.WELCOME:\n return <nl-welcome titleWelcome={this.welcomeTitle || undefined} description={this.welcomeDescription || undefined} />;\n case CURRENT_MODULE.LOGIN:\n return <nl-signin />;\n case CURRENT_MODULE.SIGNUP:\n return <nl-signup bunkers={this.bunkers} />;\n case CURRENT_MODULE.LOCAL_SIGNUP:\n return <nl-local-signup signupNjump={this.signupNjump} />;\n case CURRENT_MODULE.CONFIRM_LOGOUT:\n return <nl-confirm-logout />;\n case CURRENT_MODULE.IMPORT_FLOW:\n return <nl-import-flow services={this.connectionStringServices} />;\n case CURRENT_MODULE.IMPORT_OTP:\n return <nl-otp-migrate services={this.connectionStringServices} />;\n case CURRENT_MODULE.INFO:\n return <nl-info />;\n case CURRENT_MODULE.EXTENSION:\n return <nl-info-extension />;\n case CURRENT_MODULE.LOGIN_READ_ONLY:\n return <nl-signin-read-only />;\n case CURRENT_MODULE.LOGIN_BUNKER_URL:\n return <nl-signin-bunker-url />;\n case CURRENT_MODULE.LOGIN_OTP:\n return <nl-signin-otp />;\n case CURRENT_MODULE.WELCOME_LOGIN:\n return <nl-welcome-signin hasOTP={this.hasOTP} authMethods={this.authMethods} hasExtension={this.hasExtension} />;\n case CURRENT_MODULE.WELCOME_SIGNUP:\n return <nl-welcome-signup />;\n case CURRENT_MODULE.CONNECTION_STRING:\n return <nl-signin-connection-string connectionString={this.connectionString} />;\n case CURRENT_MODULE.CONNECT:\n return <nl-connect connectionStringServices={this.connectionStringServices} authMethods={this.authMethods} />;\n case CURRENT_MODULE.PREVIOUSLY_LOGGED:\n return <nl-previously-logged accounts={this.accounts} recents={this.recents} />;\n case CURRENT_MODULE.IFRAME:\n return <nl-iframe iframeUrl={this.authUrl} />;\n default:\n return <nl-welcome />;\n }\n };\n\n const showLogin =\n state.isOTP ||\n (currentModule !== CURRENT_MODULE.INFO &&\n currentModule !== CURRENT_MODULE.CONFIRM_LOGOUT &&\n currentModule !== CURRENT_MODULE.IMPORT_FLOW &&\n currentModule !== CURRENT_MODULE.WELCOME &&\n currentModule !== CURRENT_MODULE.EXTENSION &&\n currentModule !== CURRENT_MODULE.IFRAME &&\n currentModule !== CURRENT_MODULE.PREVIOUSLY_LOGGED);\n\n const showSignup =\n currentModule !== CURRENT_MODULE.IFRAME &&\n (!this.authMethods.length || (!this.localSignup && this.authMethods.includes('connect')) || (this.localSignup && this.authMethods.includes('local')));\n\n return (\n <div class={`theme-${this.theme}`} dir=\"ltr\">\n <div class={classWrapper}>\n <div onClick={() => this.handleClose()} class=\"absolute top-0 left-0 w-full h-full bg-gray-500 bg-opacity-75 z-[80]\" />\n\n <div class=\"nl-bg relative z-[81] w-full flex flex-col rounded-xl sm:max-w-lg sm:w-full sm:mx-auto\">\n <div class={`flex justify-between items-center py-3 px-4`}>\n <div class=\"flex gap-2 items-center\">\n <svg class=\"w-7 h-7\" width=\"225\" height=\"224\" viewBox=\"0 0 225 224\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"224.047\" height=\"224\" rx=\"64\" fill=\"#6951FA\" />\n <path\n d=\"M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z\"\n fill=\"white\"\n />\n </svg>\n <p class=\"font-bold nl-logo text-base\">\n Nostr <span class=\"font-light\">Login</span>\n </p>\n </div>\n\n <div class=\"flex gap-1\">\n <button\n onClick={() => this.handleChangeDarkMode()}\n type=\"button\"\n class=\"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent\"\n >\n <span class=\"sr-only\">Change theme</span>\n {this.darkMode ? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"flex-shrink-0 w-5 h-5\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z\"\n />\n </svg>\n ) : (\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"flex-shrink-0 w-5 h-5\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z\"\n />\n </svg>\n )}\n </button>\n {!state.isLoading && (\n <button\n onClick={() => (state.path = [...state.path, CURRENT_MODULE.INFO])}\n type=\"button\"\n class=\"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent\"\n >\n <span class=\"sr-only\">Info</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"flex-shrink-0 w-5 h-5\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z\"\n />\n </svg>\n </button>\n )}\n <button\n onClick={() => this.handleClose()}\n type=\"button\"\n class=\"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent\"\n >\n <span class=\"sr-only\">Close</span>\n <svg\n class=\"flex-shrink-0 w-5 h-5\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n {state.path.length > 1 && !state.isLoading && (\n <div class=\"p-4\">\n <button\n onClick={() => this.handleClickToBack()}\n type=\"button\"\n class=\"nl-action-button flex justify-center items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600\"\n data-hs-overlay=\"#hs-vertically-centered-modal\"\n >\n <span class=\"sr-only\">Back</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"flex-shrink-0 w-5 h-5\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18\" />\n </svg>\n </button>\n </div>\n )}\n {state.isLoading || state.authUrl ? (\n <nl-loading path={currentModule} />\n ) : (\n <Fragment>\n {renderModule()}\n {showLogin && (\n <Fragment>\n {currentModule === CURRENT_MODULE.WELCOME_SIGNUP || currentModule === CURRENT_MODULE.SIGNUP || currentModule === CURRENT_MODULE.LOCAL_SIGNUP ? (\n <div class=\"p-4 overflow-y-auto\">\n <p class=\"nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto\">\n If you already have a profile please{' '}\n <span onClick={() => this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_LOGIN)} class=\"cursor-pointer text-blue-400\">\n log in\n </span>\n .\n </p>\n </div>\n ) : (\n showSignup && (\n <div class=\"p-4 overflow-y-auto\">\n <p class=\"nl-footer font-light text-center text-sm pt-3 max-w-96 mx-auto\">\n If you don't have a profile please{' '}\n <span\n onClick={() =>\n this.localSignup ? this.switchSignSignUpStrategy(CURRENT_MODULE.LOCAL_SIGNUP) : this.switchSignSignUpStrategy(CURRENT_MODULE.WELCOME_SIGNUP)\n }\n class=\"cursor-pointer text-blue-400\"\n >\n sign up\n </span>\n .\n </p>\n </div>\n )\n )}\n </Fragment>\n )}\n </Fragment>\n )}\n </div>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface NlBanner extends Components.NlBanner, HTMLElement {}
|
|
4
|
+
export const NlBanner: {
|
|
5
|
+
prototype: NlBanner;
|
|
6
|
+
new (): NlBanner;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"nl-banner.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
|
|
2
|
+
import { M as METHOD_MODULE } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './button-base2.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './nl-change-account2.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './nl-dialog2.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './ns-login-status.js';
|
|
7
|
+
|
|
8
|
+
import { baseCss } from './css.js';
|
|
9
|
+
const nlBannerCss = baseCss;
|
|
10
|
+
|
|
11
|
+
const NlBannerStyle0 = nlBannerCss;
|
|
12
|
+
|
|
13
|
+
const NlBanner = /*@__PURE__*/ proxyCustomElement(class NlBanner extends HTMLElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.__registerHost();
|
|
17
|
+
this.__attachShadow();
|
|
18
|
+
this.handleNotifyConfirmBanner = createEvent(this, "handleNotifyConfirmBanner", 7);
|
|
19
|
+
this.handleNotifyConfirmBannerIframe = createEvent(this, "handleNotifyConfirmBannerIframe", 7);
|
|
20
|
+
this.handleLoginBanner = createEvent(this, "handleLoginBanner", 7);
|
|
21
|
+
this.handleLogoutBanner = createEvent(this, "handleLogoutBanner", 7);
|
|
22
|
+
this.handleOpenWelcomeModal = createEvent(this, "handleOpenWelcomeModal", 7);
|
|
23
|
+
this.handleConfirmLogout = createEvent(this, "handleConfirmLogout", 7);
|
|
24
|
+
this.handleImportModal = createEvent(this, "handleImportModal", 7);
|
|
25
|
+
this.theme = 'default';
|
|
26
|
+
this.darkMode = false;
|
|
27
|
+
this.hiddenMode = false;
|
|
28
|
+
this.titleBanner = '';
|
|
29
|
+
this.isOpen = false;
|
|
30
|
+
this.isLoading = false;
|
|
31
|
+
this.notify = null;
|
|
32
|
+
this.userInfo = null;
|
|
33
|
+
this.accounts = [];
|
|
34
|
+
this.isUserImgError = false;
|
|
35
|
+
this.domain = '';
|
|
36
|
+
this.mode = '';
|
|
37
|
+
this.url = '';
|
|
38
|
+
this.isOpenConfirm = false;
|
|
39
|
+
}
|
|
40
|
+
watchNotifyHandler(notify) {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
this.isOpen = true;
|
|
43
|
+
this.isOpenConfirm = true;
|
|
44
|
+
this.domain = ((_a = this.userInfo) === null || _a === void 0 ? void 0 : _a.domain) || ((_d = (_c = (_b = this.userInfo) === null || _b === void 0 ? void 0 : _b.nip05) === null || _c === void 0 ? void 0 : _c.split('@')) === null || _d === void 0 ? void 0 : _d[1]) || '';
|
|
45
|
+
this.mode = notify.mode;
|
|
46
|
+
this.url = notify.url;
|
|
47
|
+
if (!this.mode) {
|
|
48
|
+
this.isOpenConfirm = false;
|
|
49
|
+
this.isOpen = false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleOpen() {
|
|
53
|
+
if (this.userInfo) {
|
|
54
|
+
this.isOpen = true;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.handleOpenWelcomeModal.emit();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
handleClose() {
|
|
61
|
+
this.isOpen = false;
|
|
62
|
+
}
|
|
63
|
+
handleLogin() {
|
|
64
|
+
this.handleLoginBanner.emit(METHOD_MODULE.LOGIN);
|
|
65
|
+
this.handleClose();
|
|
66
|
+
}
|
|
67
|
+
handleSignup() {
|
|
68
|
+
this.handleLoginBanner.emit(METHOD_MODULE.SIGNUP);
|
|
69
|
+
this.handleClose();
|
|
70
|
+
}
|
|
71
|
+
handleImport() {
|
|
72
|
+
this.handleImportModal.emit();
|
|
73
|
+
this.handleClose();
|
|
74
|
+
}
|
|
75
|
+
handleLogout() {
|
|
76
|
+
const isBackupKey = localStorage.getItem('backupKey');
|
|
77
|
+
if (isBackupKey) {
|
|
78
|
+
this.handleLogoutBanner.emit(METHOD_MODULE.LOGOUT);
|
|
79
|
+
this.handleClose();
|
|
80
|
+
localStorage.removeItem('backupKey');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (this.userInfo.authMethod === 'local') {
|
|
84
|
+
this.handleConfirmLogout.emit();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.handleLogoutBanner.emit(METHOD_MODULE.LOGOUT);
|
|
88
|
+
}
|
|
89
|
+
this.handleClose();
|
|
90
|
+
}
|
|
91
|
+
handleConfirm() {
|
|
92
|
+
switch (this.mode) {
|
|
93
|
+
case 'authUrl':
|
|
94
|
+
this.handleNotifyConfirmBanner.emit(this.url);
|
|
95
|
+
break;
|
|
96
|
+
case 'iframeAuthUrl':
|
|
97
|
+
this.handleNotifyConfirmBannerIframe.emit(this.url);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
this.handleClose();
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f;
|
|
104
|
+
const isShowImg = Boolean((_a = this.userInfo) === null || _a === void 0 ? void 0 : _a.picture);
|
|
105
|
+
const userName = ((_b = this.userInfo) === null || _b === void 0 ? void 0 : _b.name) || ((_e = (_d = (_c = this.userInfo) === null || _c === void 0 ? void 0 : _c.nip05) === null || _d === void 0 ? void 0 : _d.split('@')) === null || _e === void 0 ? void 0 : _e[0]) || ((_f = this.userInfo) === null || _f === void 0 ? void 0 : _f.pubkey) || '';
|
|
106
|
+
const isShowUserName = Boolean(userName);
|
|
107
|
+
const isTemporary = this.userInfo && this.userInfo.authMethod === 'local';
|
|
108
|
+
const isBackupKey = localStorage.getItem('backupKey');
|
|
109
|
+
const defaultUserAvatar = (h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-full" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" })));
|
|
110
|
+
const content = (h(Fragment, null, h("div", { class: "block w-[48px] h-[46px] relative z-10" }, h("div", { onClick: () => this.handleOpen(), class: `flex w-52 h-[46px] items-center pl-[11px]` }, h("span", { class: `${this.isLoading ? 'w-5 h-5 border-[2px] mr-3.5 ml-[2px] opacity-1' : 'w-0 h-0 border-[0px] mr-0 opacity-0 ml-0'} animate-spin transition-all duration-300 ease-in-out inline-block border-current border-t-transparent text-slate-900 dark:text-gray-300 rounded-full`, role: "status", "aria-label": "loading" }), this.userInfo ? (h("div", { class: `uppercase font-bold w-6 h-6 mr-2 rounded-full border border-gray-200 flex justify-center items-center` }, isShowImg ? (this.isUserImgError ? (defaultUserAvatar) : (h("img", { class: "w-full rounded-full", src: this.userInfo.picture, alt: "Logo", onError: () => (this.isUserImgError = true) }))) : isShowUserName ? (userName[0]) : (defaultUserAvatar))) : (h("div", { class: "flex justify-center items-center" }, h("svg", { class: "w-6 h-6", width: "225", height: "224", viewBox: "0 0 225 224", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("rect", { width: "224.047", height: "224", rx: "64", fill: "#6951FA" }), h("path", { d: "M162.441 135.941V88.0593C170.359 85.1674 176 77.5348 176 68.6696C176 57.2919 166.708 48 155.33 48C143.953 48 134.661 57.2444 134.661 68.6696C134.661 77.5822 140.302 85.1674 148.219 88.0593V135.941C147.698 136.13 147.176 136.367 146.655 136.604L87.3956 77.3452C88.6282 74.6904 89.2919 71.7511 89.2919 68.6696C89.2919 57.2444 80.0474 48 68.6696 48C57.2919 48 48 57.2444 48 68.6696C48 77.5822 53.6415 85.1674 61.5585 88.0593V135.941C53.6415 138.833 48 146.465 48 155.33C48 166.708 57.2444 176 68.6696 176C80.0948 176 89.3393 166.708 89.3393 155.33C89.3393 146.418 83.6978 138.833 75.7807 135.941V88.0593C76.3022 87.8696 76.8237 87.6326 77.3452 87.3956L136.604 146.655C135.372 149.31 134.708 152.249 134.708 155.33C134.708 166.708 143.953 176 155.378 176C166.803 176 176.047 166.708 176.047 155.33C176.047 146.418 170.406 138.833 162.489 135.941H162.441Z", fill: "white" })), this.isOpen && (h("span", { class: "px-2" }, h("b", null, "Nostr"), " Login")))), this.isOpen && isShowUserName && h("div", { class: "show-slow truncate w-16 text-xs" }, userName), this.isOpen && isShowUserName && h("nl-login-status", { info: this.userInfo }))), h("button", { onClick: () => this.handleClose(), type: "button", class: `${this.isOpen ? 'z-20' : 'z-0'} nl-action-button absolute right-2 top-2 z-0 show-slow grid place-items-center w-7 h-7 text-sm font-semibold rounded-full border border-transparent` }, h("span", { class: "sr-only" }, "Close"), h("svg", { class: "flex-shrink-0 w-5 h-5", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M18 6 6 18" }), h("path", { d: "m6 6 12 12" }))), h("div", { class: "p-3 show-slow" }, this.isOpenConfirm ? (h("div", null, h("div", { class: "w-8 h-8 p-1/2 rounded-full border border-gray-200 bg-white mb-2 mt-2 show-slow m-auto" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "#5a68ff", class: "w-full" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" }))), h("p", { class: "mb-2 text-center max-w-40 min-w-40 mx-auto" }, this.mode === 'timeout' ? 'Keys not responding, check your key storage app' : `Confirmation required at ${this.domain}`), this.mode === 'timeout' ? (h("a", { onClick: () => this.handleClose(), href: `https://${this.domain}`, target: "_blank", class: "nl-button text-nowrap py-2.5 px-3 w-full inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-none dark:focus:ring-1 dark:focus:ring-gray-600" }, "Go to ", this.domain)) : this.mode === 'rebind' ? (h("iframe", { src: this.url, width: '180', height: '80', frameBorder: '0' })) : (h("button-base", { onClick: () => this.handleConfirm(), titleBtn: "Confirm" })))) : (h("div", null, h("div", null, this.titleBanner && h("p", { class: "mb-2 text-center show-slow max-w-40 min-w-40 mx-auto" }, this.titleBanner), isTemporary && (h(Fragment, null, !isBackupKey && h("p", { class: "mb-2 text-center show-slow text-red-400 max-w-40 min-w-40 mx-auto" }, "Your profile may be lost if you close this tab"), h("div", { class: "mb-2" }, h("button-base", { onClick: () => this.handleImport(), theme: "lemonade", titleBtn: "Back up profile" })))), h("div", { class: "mb-2" }, h("nl-change-account", { currentAccount: this.userInfo, accounts: this.accounts })), !this.userInfo ? (h("div", null, h("button-base", { onClick: () => this.handleLogin(), titleBtn: "Log in" }, h("svg", { style: { display: 'none' }, slot: "icon-start", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-4 h-4" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" }))), h("button-base", { onClick: () => this.handleSignup(), titleBtn: "Sign up" }, h("svg", { style: { display: 'none' }, slot: "icon-start", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "flex-shrink-0 w-4 h-4" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z" }))))) : (h("button-base", { onClick: () => this.handleLogout(), titleBtn: "Log out" }))))))));
|
|
111
|
+
// https://gist.github.com/Haprog/848fc451c25da00b540e6d34c301e96a
|
|
112
|
+
function deepQuerySelectorAll(selector, root) {
|
|
113
|
+
root = root || document.body;
|
|
114
|
+
const results = Array.from(root.querySelectorAll(selector));
|
|
115
|
+
const pushNestedResults = function (root) {
|
|
116
|
+
deepQuerySelectorAll(selector, root).forEach(elem => {
|
|
117
|
+
if (!results.includes(elem)) {
|
|
118
|
+
results.push(elem);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
if (root.shadowRoot) {
|
|
123
|
+
pushNestedResults(root.shadowRoot);
|
|
124
|
+
}
|
|
125
|
+
for (const elem of Array.from(root.querySelectorAll('*'))) {
|
|
126
|
+
if (elem.shadowRoot) {
|
|
127
|
+
pushNestedResults(elem.shadowRoot);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return results;
|
|
131
|
+
}
|
|
132
|
+
const dialogs = deepQuerySelectorAll('dialog');
|
|
133
|
+
const needDialog = !!dialogs.find(d => d.open && !d.classList.contains('nl-banner-dialog'));
|
|
134
|
+
return (h("div", { class: `theme-${this.theme} ${!this.isOpen && this.hiddenMode ? 'hidden' : ''}` }, h("div", { class: this.darkMode && 'dark', dir: "ltr" }, this.isOpenConfirm && needDialog ? (h("nl-dialog", null, h("div", { class: `nl-banner ${this.isOpen ? 'w-52 h-auto right-2 rounded-r-lg isOpen ' : 'rounded-r-none hover:rounded-r-lg cursor-pointer'} z-50 w-12 h-12 fixed top-52 right-0 inline-block gap-x-2 text-sm font-medium rounded-lg hover:right-2 transition-all duration-300 ease-in-out` }, content))) : (h("div", { class: `nl-banner ${this.isOpen ? 'w-52 h-auto right-2 rounded-r-lg isOpen' : 'rounded-r-none hover:rounded-r-lg cursor-pointer'} z-50 w-12 h-12 fixed top-52 right-0 inline-block gap-x-2 text-sm font-medium rounded-lg hover:right-2 transition-all duration-300 ease-in-out` }, content)))));
|
|
135
|
+
}
|
|
136
|
+
static get watchers() { return {
|
|
137
|
+
"notify": ["watchNotifyHandler"]
|
|
138
|
+
}; }
|
|
139
|
+
static get style() { return NlBannerStyle0; }
|
|
140
|
+
}, [1, "nl-banner", {
|
|
141
|
+
"theme": [1025],
|
|
142
|
+
"darkMode": [1028, "dark-mode"],
|
|
143
|
+
"hiddenMode": [1028, "hidden-mode"],
|
|
144
|
+
"titleBanner": [1, "title-banner"],
|
|
145
|
+
"isOpen": [1028, "is-open"],
|
|
146
|
+
"isLoading": [4, "is-loading"],
|
|
147
|
+
"notify": [16],
|
|
148
|
+
"userInfo": [16],
|
|
149
|
+
"accounts": [1040],
|
|
150
|
+
"isUserImgError": [32],
|
|
151
|
+
"domain": [32],
|
|
152
|
+
"mode": [32],
|
|
153
|
+
"url": [32],
|
|
154
|
+
"isOpenConfirm": [32]
|
|
155
|
+
}, undefined, {
|
|
156
|
+
"notify": ["watchNotifyHandler"]
|
|
157
|
+
}]);
|
|
158
|
+
function defineCustomElement() {
|
|
159
|
+
if (typeof customElements === "undefined") {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const components = ["nl-banner", "button-base", "nl-change-account", "nl-dialog", "nl-login-status"];
|
|
163
|
+
components.forEach(tagName => { switch (tagName) {
|
|
164
|
+
case "nl-banner":
|
|
165
|
+
if (!customElements.get(tagName)) {
|
|
166
|
+
customElements.define(tagName, NlBanner);
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "button-base":
|
|
170
|
+
if (!customElements.get(tagName)) {
|
|
171
|
+
defineCustomElement$4();
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case "nl-change-account":
|
|
175
|
+
if (!customElements.get(tagName)) {
|
|
176
|
+
defineCustomElement$3();
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case "nl-dialog":
|
|
180
|
+
if (!customElements.get(tagName)) {
|
|
181
|
+
defineCustomElement$2();
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "nl-login-status":
|
|
185
|
+
if (!customElements.get(tagName)) {
|
|
186
|
+
defineCustomElement$1();
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
} });
|
|
190
|
+
}
|
|
191
|
+
defineCustomElement();
|
|
192
|
+
|
|
193
|
+
export { NlBanner as N, defineCustomElement as d };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=nl-banner2.js.map
|