@sylphx/auth-solid 0.1.1 → 0.1.3
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/README.md +42 -2
- package/dist/browser.js +888 -380
- package/dist/index.d.ts +2 -1
- package/dist/locale.d.ts +1 -1
- package/dist/messages-iberian.d.ts +154 -0
- package/dist/messages.d.ts +230 -0
- package/dist/passkey-enroll.d.ts +11 -0
- package/dist/server.js +605 -151
- package/dist/sign-in-controller.d.ts +22 -21
- package/dist/sign-in-messages.d.ts +3 -0
- package/dist/sign-in-request.d.ts +24 -0
- package/dist/sign-in-webauthn.d.ts +2 -0
- package/dist/sign-in.css +9 -0
- package/dist/sign-in.d.ts +7 -2
- package/package.json +2 -2
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import { type EntryConfig, type Provider } from '@sylphx/auth/client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
cancelled: string;
|
|
5
|
-
use_existing: string;
|
|
6
|
-
invalid_credentials: string;
|
|
7
|
-
verify_email: string;
|
|
8
|
-
verification_failed: string;
|
|
9
|
-
invalid_code: string;
|
|
10
|
-
method_unavailable: string;
|
|
11
|
-
signup_failed: string;
|
|
12
|
-
invalid_input: string;
|
|
13
|
-
try_later: string;
|
|
14
|
-
unavailable: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const unavailable: string;
|
|
17
|
-
export type SignInErrorCode = keyof typeof errors;
|
|
18
|
-
export type SignInStep = 'choose' | 'password' | 'signup' | 'check_email' | 'confirm' | 'otp' | 'mfa';
|
|
1
|
+
import { type AuthMethod, type EntryConfig, type Provider } from '@sylphx/auth/client';
|
|
2
|
+
export { type SignInErrorCode, unavailable } from './sign-in-request.js';
|
|
3
|
+
export type SignInStep = 'choose' | 'password' | 'signup' | 'check_email' | 'confirm' | 'otp' | 'mfa' | 'recover' | 'recovery_sent';
|
|
19
4
|
export type SignInControllerOptions = {
|
|
20
5
|
/** A path already allowlisted by the application. */
|
|
21
6
|
next: string;
|
|
@@ -23,9 +8,24 @@ export type SignInControllerOptions = {
|
|
|
23
8
|
search: string;
|
|
24
9
|
/** The same-origin login pathname, used to scrub a confirmation link. */
|
|
25
10
|
loginPath?: string;
|
|
11
|
+
/** Public methods loaded by the host on the server, reused on hydration. */
|
|
12
|
+
initialConfig?: EntryConfig;
|
|
13
|
+
/** Same-origin pathname, defaults to /auth. */
|
|
14
|
+
routePrefix?: string;
|
|
15
|
+
/** Start a discoverable WebAuthn request once on the sign-in screen. */
|
|
16
|
+
conditionalPasskey?: boolean;
|
|
17
|
+
/** Return only versions the user has accepted; undefined means no acceptance. */
|
|
18
|
+
getAcceptance?: () => Readonly<Record<string, string>> | undefined;
|
|
19
|
+
/** Require the host to explicitly grant agreement before any authentication request. */
|
|
20
|
+
requireAgreement?: boolean;
|
|
21
|
+
/** The host's current agreement state. Pass a reactive prop or getter. */
|
|
22
|
+
agreementAccepted?: boolean;
|
|
23
|
+
/** Invoked with the validated provider destination before leaving the page. */
|
|
24
|
+
beforeOAuthNavigate?: (provider: Provider, target: string) => void | Promise<void>;
|
|
26
25
|
};
|
|
27
26
|
/** Create under a Solid owner. Requests start on mount and abort on cleanup. */
|
|
28
27
|
export declare function createSignInController(options: SignInControllerOptions): {
|
|
28
|
+
emailRoute: string;
|
|
29
29
|
config: import("solid-js").Accessor<EntryConfig | undefined>;
|
|
30
30
|
configFailed: import("solid-js").Accessor<boolean>;
|
|
31
31
|
loadConfig: () => Promise<void>;
|
|
@@ -34,7 +34,8 @@ export declare function createSignInController(options: SignInControllerOptions)
|
|
|
34
34
|
email: import("solid-js").Accessor<string>;
|
|
35
35
|
setEmail: import("solid-js").Setter<string>;
|
|
36
36
|
error: () => string;
|
|
37
|
-
errorCode: import("solid-js").Accessor<"" | "signin" | "cancelled" | "use_existing" | "invalid_credentials" | "verify_email" | "verification_failed" | "invalid_code" | "method_unavailable" | "signup_failed" | "invalid_input" | "try_later" | "unavailable">;
|
|
37
|
+
errorCode: import("solid-js").Accessor<"" | "signin" | "cancelled" | "use_existing" | "invalid_credentials" | "verify_email" | "acceptance_required" | "verification_failed" | "invalid_code" | "method_unavailable" | "signup_failed" | "invalid_input" | "try_later" | "unavailable">;
|
|
38
|
+
agreementAllowed: () => boolean;
|
|
38
39
|
busy: import("solid-js").Accessor<string>;
|
|
39
40
|
showPassword: import("solid-js").Accessor<boolean>;
|
|
40
41
|
setShowPassword: import("solid-js").Setter<boolean>;
|
|
@@ -44,12 +45,12 @@ export declare function createSignInController(options: SignInControllerOptions)
|
|
|
44
45
|
recovery: import("solid-js").Accessor<boolean>;
|
|
45
46
|
setRecovery: import("solid-js").Setter<boolean>;
|
|
46
47
|
wait: () => number;
|
|
47
|
-
continueWithEmail: () => Promise<void> | undefined;
|
|
48
|
+
continueWithEmail: (method?: Extract<AuthMethod, "otp" | "password">) => Promise<void> | undefined;
|
|
48
49
|
social: (provider: Provider) => Promise<void> | undefined;
|
|
49
50
|
sendCode: () => Promise<void> | undefined;
|
|
51
|
+
sendRecovery: () => Promise<void> | undefined;
|
|
50
52
|
verifyCode: (value?: string) => Promise<void> | undefined;
|
|
51
53
|
passkey: () => Promise<void> | undefined;
|
|
52
54
|
submitPassword: (password: string) => Promise<void> | undefined;
|
|
53
55
|
submitMfa: (value: string) => Promise<void> | undefined;
|
|
54
56
|
};
|
|
55
|
-
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AuthLocale, SignInMessagesOverride } from './messages.js';
|
|
2
|
+
/** Use the host's explicit language tag when the host also provides its copy. */
|
|
3
|
+
export declare function signInLanguage(fallback: AuthLocale, locale: string | undefined, messages: SignInMessagesOverride | undefined): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const errors: {
|
|
2
|
+
signin: string;
|
|
3
|
+
cancelled: string;
|
|
4
|
+
use_existing: string;
|
|
5
|
+
invalid_credentials: string;
|
|
6
|
+
acceptance_required: string;
|
|
7
|
+
verify_email: string;
|
|
8
|
+
verification_failed: string;
|
|
9
|
+
invalid_code: string;
|
|
10
|
+
method_unavailable: string;
|
|
11
|
+
signup_failed: string;
|
|
12
|
+
invalid_input: string;
|
|
13
|
+
try_later: string;
|
|
14
|
+
unavailable: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const unavailable: string;
|
|
17
|
+
export type SignInErrorCode = keyof typeof errors;
|
|
18
|
+
export declare function isErrorCode(value: unknown): value is SignInErrorCode;
|
|
19
|
+
export declare class SignInError extends Error {
|
|
20
|
+
readonly code: SignInErrorCode;
|
|
21
|
+
constructor(code: SignInErrorCode);
|
|
22
|
+
}
|
|
23
|
+
export declare function postAuthJSON(path: string, body: Record<string, unknown>, signal: AbortSignal): Promise<unknown>;
|
|
24
|
+
export {};
|
package/dist/sign-in.css
CHANGED
|
@@ -138,3 +138,12 @@
|
|
|
138
138
|
outline-offset: 2px;
|
|
139
139
|
}
|
|
140
140
|
.auth-sign-in-panel:is(:lang(zh), :lang(ja)) .auth-sign-in-title { letter-spacing: normal; line-height: 1.3; }
|
|
141
|
+
.auth-sign-in-last-used {
|
|
142
|
+
font-size: .75rem;
|
|
143
|
+
font-weight: normal;
|
|
144
|
+
margin-inline-start: .4em;
|
|
145
|
+
border: 1px solid currentColor;
|
|
146
|
+
border-radius: .75em;
|
|
147
|
+
padding: .1em .45em;
|
|
148
|
+
}
|
|
149
|
+
.auth-sign-in-primary, .auth-sign-in-secondary { flex-wrap: wrap; }
|
package/dist/sign-in.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type Provider } from '@sylphx/auth/client';
|
|
1
2
|
import { type JSX } from 'solid-js';
|
|
2
|
-
import { type AuthLocale } from './messages.js';
|
|
3
|
+
import { type AuthLocale, type SignInMessagesOverride } from './messages.js';
|
|
3
4
|
import { type SignInControllerOptions } from './sign-in-controller.js';
|
|
4
|
-
export type SignInClass = 'panel' | 'content' | 'kicker' | 'title' | 'sub' | 'error' | 'loading' | 'providers' | 'divider' | 'form' | 'primary' | 'secondary' | 'link' | 'switch' | 'password' | 'hint' | 'otp' | 'cells' | 'actions' | 'agreement' | 'locale';
|
|
5
|
+
export type SignInClass = 'panel' | 'content' | 'kicker' | 'title' | 'sub' | 'error' | 'loading' | 'providers' | 'divider' | 'form' | 'primary' | 'secondary' | 'link' | 'switch' | 'password' | 'hint' | 'otp' | 'cells' | 'actions' | 'agreement' | 'last-used' | 'locale';
|
|
5
6
|
export type SignInToken = '--auth-surface' | '--auth-muted-surface' | '--auth-text' | '--auth-muted' | '--auth-border' | '--auth-action' | '--auth-action-text' | '--auth-accent' | '--auth-radius' | '--auth-width' | '--auth-font' | '--auth-font-mono';
|
|
6
7
|
export type SignInAppearance = {
|
|
7
8
|
/** Classes applied to the named sign-in parts. */
|
|
@@ -17,6 +18,10 @@ export type SylphxSignInProps = SignInControllerOptions & {
|
|
|
17
18
|
kicker?: JSX.Element;
|
|
18
19
|
/** Optional agreement copy and links supplied by the host. */
|
|
19
20
|
agreement?: JSX.Element;
|
|
21
|
+
/** App-supplied non-authoritative preference from a completed sign-in. */
|
|
22
|
+
lastUsed?: Provider | 'password' | 'otp' | 'passkey';
|
|
23
|
+
/** Overrides normal strings and individual error messages. */
|
|
24
|
+
messages?: SignInMessagesOverride;
|
|
20
25
|
appearance?: SignInAppearance;
|
|
21
26
|
/** Controlled locale, or seed SSR with `localePreferences` and auto-detect in the browser. */
|
|
22
27
|
locale?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sylphx/auth-solid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"build": "tsc -p tsconfig.build.json && node build.mjs"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sylphx/auth": "0.1.
|
|
23
|
+
"@sylphx/auth": "0.1.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"solid-js": "^1.9.20"
|