@draftlab/auth 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/allow.d.ts +58 -1
- package/dist/allow.js +61 -2
- package/dist/client.d.ts +2 -3
- package/dist/client.js +2 -2
- package/dist/core.d.ts +128 -8
- package/dist/core.js +496 -12
- package/dist/error.d.ts +242 -1
- package/dist/error.js +235 -1
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -12
- package/dist/keys.d.ts +1 -1
- package/dist/keys.js +138 -3
- package/dist/pkce.js +160 -1
- package/dist/provider/code.d.ts +227 -3
- package/dist/provider/code.js +27 -14
- package/dist/provider/facebook.d.ts +2 -3
- package/dist/provider/facebook.js +1 -5
- package/dist/provider/github.d.ts +2 -3
- package/dist/provider/github.js +1 -5
- package/dist/provider/google.d.ts +2 -3
- package/dist/provider/google.js +1 -5
- package/dist/provider/oauth2.d.ts +175 -3
- package/dist/provider/oauth2.js +153 -5
- package/dist/provider/password.d.ts +384 -3
- package/dist/provider/password.js +4 -4
- package/dist/provider/provider.d.ts +226 -2
- package/dist/random.js +85 -1
- package/dist/storage/memory.d.ts +2 -2
- package/dist/storage/memory.js +1 -1
- package/dist/storage/storage.d.ts +161 -1
- package/dist/storage/storage.js +60 -1
- package/dist/storage/turso.d.ts +1 -1
- package/dist/storage/turso.js +1 -1
- package/dist/storage/unstorage.d.ts +2 -2
- package/dist/storage/unstorage.js +2 -2
- package/dist/subject.d.ts +61 -2
- package/dist/themes/theme.d.ts +208 -1
- package/dist/themes/theme.js +118 -1
- package/dist/ui/base.d.ts +22 -35
- package/dist/ui/base.js +388 -3
- package/dist/ui/code.d.ts +22 -137
- package/dist/ui/code.js +199 -161
- package/dist/ui/form.d.ts +8 -6
- package/dist/ui/form.js +57 -1
- package/dist/ui/icon.d.ts +7 -84
- package/dist/ui/icon.js +69 -2
- package/dist/ui/password.d.ts +30 -37
- package/dist/ui/password.js +340 -237
- package/dist/ui/select.d.ts +19 -218
- package/dist/ui/select.js +91 -4
- package/dist/util.d.ts +71 -1
- package/dist/util.js +106 -1
- package/package.json +5 -3
- package/dist/allow-CixonwTW.d.ts +0 -59
- package/dist/allow-DX5cehSc.js +0 -63
- package/dist/base-DRutbxgL.js +0 -422
- package/dist/code-DJxdFR7p.d.ts +0 -212
- package/dist/core-BZHEAefX.d.ts +0 -129
- package/dist/core-CDM5o4rs.js +0 -498
- package/dist/error-CWAdNAzm.d.ts +0 -243
- package/dist/error-DgAKK7b2.js +0 -237
- package/dist/form-6XKM_cOk.js +0 -61
- package/dist/icon-Ci5uqGB_.js +0 -192
- package/dist/keys-EEfxEGfO.js +0 -140
- package/dist/oauth2-B7-6Z7Lc.js +0 -155
- package/dist/oauth2-CXHukHf2.d.ts +0 -176
- package/dist/password-C4KLmO0O.d.ts +0 -385
- package/dist/pkce-276Za_rZ.js +0 -162
- package/dist/provider-tndlqCzp.d.ts +0 -227
- package/dist/random-SXMYlaVr.js +0 -87
- package/dist/select-BjySLL8I.js +0 -280
- package/dist/storage-BEaqEPNQ.js +0 -62
- package/dist/storage-CxKerLlc.d.ts +0 -162
- package/dist/subject-DMIMVtaT.d.ts +0 -62
- package/dist/theme-C9by7VXf.d.ts +0 -209
- package/dist/theme-CswaLtbW.js +0 -120
- package/dist/util-CSdHUFOo.js +0 -108
- package/dist/util-DbSKG1Xm.d.ts +0 -72
package/dist/ui/icon.d.ts
CHANGED
|
@@ -1,98 +1,21 @@
|
|
|
1
|
+
import { ComponentChildren } from "preact";
|
|
2
|
+
|
|
1
3
|
//#region src/ui/icon.d.ts
|
|
2
|
-
|
|
3
|
-
* Icon components for Draft Auth UI.
|
|
4
|
-
* Provides SVG icons for various authentication providers and common UI elements.
|
|
5
|
-
*
|
|
6
|
-
* ## Usage
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { ICON_GITHUB, ICON_GOOGLE, ICON_EMAIL } from "./icon"
|
|
10
|
-
*
|
|
11
|
-
* // In provider buttons
|
|
12
|
-
* const buttonHtml = `
|
|
13
|
-
* <button>
|
|
14
|
-
* ${ICON_GITHUB}
|
|
15
|
-
* Continue with GitHub
|
|
16
|
-
* </button>
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
* // In form elements
|
|
20
|
-
* const formHtml = `
|
|
21
|
-
* <div>
|
|
22
|
-
* ${ICON_EMAIL}
|
|
23
|
-
* Email verification
|
|
24
|
-
* </div>
|
|
25
|
-
* `
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* ## Features
|
|
29
|
-
*
|
|
30
|
-
* - **Consistent sizing**: All icons are properly sized and scalable
|
|
31
|
-
* - **Accessibility**: Proper ARIA labels and semantic markup
|
|
32
|
-
* - **Current color**: Icons inherit text color for easy theming
|
|
33
|
-
* - **Optimized SVGs**: Clean, minimal SVG markup for performance
|
|
34
|
-
*
|
|
35
|
-
* @packageDocumentation
|
|
36
|
-
*/
|
|
4
|
+
|
|
37
5
|
/**
|
|
38
6
|
* GitHub brand icon with official logo design.
|
|
39
7
|
* Used for GitHub authentication provider buttons and references.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* const buttonHtml = `
|
|
44
|
-
* <button data-component="provider-button">
|
|
45
|
-
* ${ICON_GITHUB}
|
|
46
|
-
* Sign in with GitHub
|
|
47
|
-
* </button>
|
|
48
|
-
* `
|
|
49
|
-
* ```
|
|
50
8
|
*/
|
|
51
|
-
declare const ICON_GITHUB
|
|
9
|
+
declare const ICON_GITHUB: () => ComponentChildren;
|
|
52
10
|
/**
|
|
53
11
|
* Google brand icon with official multicolor logo design.
|
|
54
12
|
* Used for Google authentication provider buttons and references.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* const buttonHtml = `
|
|
59
|
-
* <button data-component="provider-button">
|
|
60
|
-
* ${ICON_GOOGLE}
|
|
61
|
-
* Continue with Google
|
|
62
|
-
* </button>
|
|
63
|
-
* `
|
|
64
|
-
* ```
|
|
65
13
|
*/
|
|
66
|
-
declare const ICON_GOOGLE
|
|
14
|
+
declare const ICON_GOOGLE: () => ComponentChildren;
|
|
67
15
|
/**
|
|
68
16
|
* Email envelope icon for email-related authentication flows.
|
|
69
17
|
* Used in email verification, password reset, and contact forms.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```ts
|
|
73
|
-
* const inputGroupHtml = `
|
|
74
|
-
* <div data-component="input-group">
|
|
75
|
-
* ${ICON_EMAIL}
|
|
76
|
-
* <input type="email" placeholder="Enter your email" />
|
|
77
|
-
* </div>
|
|
78
|
-
* `
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
declare const ICON_EMAIL = "\n\t<svg\n\t\taria-label=\"Email\"\n\t\tfill=\"none\"\n\t\trole=\"img\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-width=\"1.5\"\n\t\tviewBox=\"0 0 24 24\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<path\n\t\t\td=\"M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75\"\n\t\t\tstroke-linecap=\"round\"\n\t\t\tstroke-linejoin=\"round\"\n\t\t/>\n\t</svg>\n";
|
|
82
|
-
/**
|
|
83
|
-
* Slack brand icon with official logo design.
|
|
84
|
-
* Used for Slack authentication provider buttons and workplace integrations.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```ts
|
|
88
|
-
* const buttonHtml = `
|
|
89
|
-
* <button data-component="provider-button">
|
|
90
|
-
* ${ICON_SLACK}
|
|
91
|
-
* Continue with Slack
|
|
92
|
-
* </button>
|
|
93
|
-
* `
|
|
94
|
-
* ```
|
|
95
18
|
*/
|
|
96
|
-
declare const
|
|
19
|
+
declare const ICON_EMAIL: () => ComponentChildren;
|
|
97
20
|
//#endregion
|
|
98
|
-
export { ICON_EMAIL, ICON_GITHUB, ICON_GOOGLE
|
|
21
|
+
export { ICON_EMAIL, ICON_GITHUB, ICON_GOOGLE };
|
package/dist/ui/icon.js
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//#region src/ui/icon.tsx
|
|
4
|
+
/**
|
|
5
|
+
* GitHub brand icon with official logo design.
|
|
6
|
+
* Used for GitHub authentication provider buttons and references.
|
|
7
|
+
*/
|
|
8
|
+
const ICON_GITHUB = () => /* @__PURE__ */ jsx("svg", {
|
|
9
|
+
"aria-label": "GitHub",
|
|
10
|
+
fill: "currentColor",
|
|
11
|
+
height: "250",
|
|
12
|
+
preserveAspectRatio: "xMidYMid",
|
|
13
|
+
role: "img",
|
|
14
|
+
viewBox: "0 0 256 250",
|
|
15
|
+
width: "256",
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
children: /* @__PURE__ */ jsx("path", { d: "M128.001 0C57.317 0 0 57.307 0 128.001c0 56.554 36.676 104.535 87.535 121.46 6.397 1.185 8.746-2.777 8.746-6.158 0-3.052-.12-13.135-.174-23.83-35.61 7.742-43.124-15.103-43.124-15.103-5.823-14.795-14.213-18.73-14.213-18.73-11.613-7.944.876-7.78.876-7.78 12.853.902 19.621 13.19 19.621 13.19 11.417 19.568 29.945 13.911 37.249 10.64 1.149-8.272 4.466-13.92 8.127-17.116-28.431-3.236-58.318-14.212-58.318-63.258 0-13.975 5-25.394 13.188-34.358-1.329-3.224-5.71-16.242 1.24-33.874 0 0 10.749-3.44 35.21 13.121 10.21-2.836 21.16-4.258 32.038-4.307 10.878.049 21.837 1.47 32.066 4.307 24.431-16.56 35.165-13.12 35.165-13.12 6.967 17.63 2.584 30.65 1.255 33.873 8.207 8.964 13.173 20.383 13.173 34.358 0 49.163-29.944 59.988-58.447 63.157 4.591 3.972 8.682 11.762 8.682 23.704 0 17.126-.148 30.91-.148 35.126 0 3.407 2.304 7.398 8.792 6.14C219.37 232.5 256 184.537 256 128.002 256 57.307 198.691 0 128.001 0Zm-80.06 182.34c-.282.636-1.283.827-2.194.39-.929-.417-1.45-1.284-1.15-1.922.276-.655 1.279-.838 2.205-.399.93.418 1.46 1.293 1.139 1.931Zm6.296 5.618c-.61.566-1.804.303-2.614-.591-.837-.892-.994-2.086-.375-2.66.63-.566 1.787-.301 2.626.591.838.903 1 2.088.363 2.66Zm4.32 7.188c-.785.545-2.067.034-2.86-1.104-.784-1.138-.784-2.503.017-3.05.795-.547 2.058-.055 2.861 1.075.782 1.157.782 2.522-.019 3.08Zm7.304 8.325c-.701.774-2.196.566-3.29-.49-1.119-1.032-1.43-2.496-.726-3.27.71-.776 2.213-.558 3.315.49 1.11 1.03 1.45 2.505.701 3.27Zm9.442 2.81c-.31 1.003-1.75 1.459-3.199 1.033-1.448-.439-2.395-1.613-2.103-2.626.301-1.01 1.747-1.484 3.207-1.028 1.446.436 2.396 1.602 2.095 2.622Zm10.744 1.193c.036 1.055-1.193 1.93-2.715 1.95-1.53.034-2.769-.82-2.786-1.86 0-1.065 1.202-1.932 2.733-1.958 1.522-.03 2.768.818 2.768 1.868Zm10.555-.405c.182 1.03-.875 2.088-2.387 2.37-1.485.271-2.861-.365-3.05-1.386-.184-1.056.893-2.114 2.376-2.387 1.514-.263 2.868.356 3.061 1.403Z" })
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Google brand icon with official multicolor logo design.
|
|
21
|
+
* Used for Google authentication provider buttons and references.
|
|
22
|
+
*/
|
|
23
|
+
const ICON_GOOGLE = () => /* @__PURE__ */ jsxs("svg", {
|
|
24
|
+
"aria-label": "Google",
|
|
25
|
+
height: "262",
|
|
26
|
+
preserveAspectRatio: "xMidYMid",
|
|
27
|
+
role: "img",
|
|
28
|
+
viewBox: "0 0 256 262",
|
|
29
|
+
width: "256",
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("path", {
|
|
33
|
+
d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027",
|
|
34
|
+
fill: "#4285F4"
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsx("path", {
|
|
37
|
+
d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1",
|
|
38
|
+
fill: "#34A853"
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx("path", {
|
|
41
|
+
d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782",
|
|
42
|
+
fill: "#FBBC05"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx("path", {
|
|
45
|
+
d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251",
|
|
46
|
+
fill: "#EB4335"
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Email envelope icon for email-related authentication flows.
|
|
52
|
+
* Used in email verification, password reset, and contact forms.
|
|
53
|
+
*/
|
|
54
|
+
const ICON_EMAIL = () => /* @__PURE__ */ jsx("svg", {
|
|
55
|
+
"aria-label": "Email",
|
|
56
|
+
fill: "none",
|
|
57
|
+
role: "img",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "1.5",
|
|
60
|
+
viewBox: "0 0 24 24",
|
|
61
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
62
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
63
|
+
d: "M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75",
|
|
64
|
+
strokeLinecap: "round",
|
|
65
|
+
strokeLinejoin: "round"
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ICON_EMAIL, ICON_GITHUB, ICON_GOOGLE };
|
package/dist/ui/password.d.ts
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../provider-tndlqCzp.js";
|
|
3
|
-
import { PasswordConfig } from "../password-C4KLmO0O.js";
|
|
1
|
+
import { PasswordConfig } from "../provider/password.js";
|
|
4
2
|
|
|
5
3
|
//#region src/ui/password.d.ts
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
9
|
-
* All text can be customized via the copy prop.
|
|
6
|
+
* Strongly typed copy text configuration for password UI
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
error_email_taken: string;
|
|
13
|
-
error_invalid_code: string;
|
|
14
|
-
error_invalid_email: string;
|
|
15
|
-
error_invalid_password: string;
|
|
16
|
-
error_password_mismatch: string;
|
|
17
|
-
error_validation_error: string;
|
|
18
|
-
register_title: string;
|
|
19
|
-
register_description: string;
|
|
20
|
-
login_title: string;
|
|
21
|
-
login_description: string;
|
|
22
|
-
register: string;
|
|
23
|
-
register_prompt: string;
|
|
24
|
-
login_prompt: string;
|
|
25
|
-
login: string;
|
|
26
|
-
change_prompt: string;
|
|
27
|
-
code_resend: string;
|
|
28
|
-
code_return: string;
|
|
29
|
-
input_email: string;
|
|
30
|
-
input_password: string;
|
|
31
|
-
input_code: string;
|
|
32
|
-
input_repeat: string;
|
|
33
|
-
button_continue: string;
|
|
34
|
-
logo: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Type for customizable UI copy text.
|
|
38
|
-
*/
|
|
39
|
-
type PasswordUICopy = typeof DEFAULT_COPY;
|
|
8
|
+
interface PasswordUICopy {
|
|
9
|
+
readonly error_email_taken: string;
|
|
10
|
+
readonly error_invalid_code: string;
|
|
11
|
+
readonly error_invalid_email: string;
|
|
12
|
+
readonly error_invalid_password: string;
|
|
13
|
+
readonly error_password_mismatch: string;
|
|
14
|
+
readonly error_validation_error: string;
|
|
15
|
+
readonly register_title: string;
|
|
16
|
+
readonly register_description: string;
|
|
17
|
+
readonly login_title: string;
|
|
18
|
+
readonly login_description: string;
|
|
19
|
+
readonly register: string;
|
|
20
|
+
readonly register_prompt: string;
|
|
21
|
+
readonly login_prompt: string;
|
|
22
|
+
readonly login: string;
|
|
23
|
+
readonly change_prompt: string;
|
|
24
|
+
readonly code_resend: string;
|
|
25
|
+
readonly code_return: string;
|
|
26
|
+
readonly input_email: string;
|
|
27
|
+
readonly input_password: string;
|
|
28
|
+
readonly input_code: string;
|
|
29
|
+
readonly input_repeat: string;
|
|
30
|
+
readonly button_continue: string;
|
|
31
|
+
readonly logo: string;
|
|
32
|
+
}
|
|
40
33
|
/**
|
|
41
|
-
* Configuration options for the PasswordUI component
|
|
34
|
+
* Configuration options for the PasswordUI component
|
|
42
35
|
*/
|
|
43
36
|
interface PasswordUIOptions extends Pick<PasswordConfig, "sendCode" | "validatePassword"> {
|
|
44
37
|
/**
|
|
45
|
-
* Custom text copy for UI labels, messages, and errors
|
|
38
|
+
* Custom text copy for UI labels, messages, and errors
|
|
46
39
|
*/
|
|
47
40
|
readonly copy?: Partial<PasswordUICopy>;
|
|
48
41
|
}
|
|
49
42
|
/**
|
|
50
|
-
* Creates a complete UI configuration for password-based authentication
|
|
43
|
+
* Creates a complete UI configuration for password-based authentication
|
|
51
44
|
*/
|
|
52
45
|
declare const PasswordUI: (options: PasswordUIOptions) => PasswordConfig;
|
|
53
46
|
//#endregion
|