@draftlab/auth 0.0.3 → 0.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.
Files changed (74) hide show
  1. package/dist/allow.d.ts +58 -1
  2. package/dist/allow.js +61 -2
  3. package/dist/client.d.ts +2 -3
  4. package/dist/client.js +2 -2
  5. package/dist/core.d.ts +128 -8
  6. package/dist/core.js +496 -12
  7. package/dist/error.d.ts +242 -1
  8. package/dist/error.js +235 -1
  9. package/dist/index.d.ts +1 -8
  10. package/dist/index.js +1 -12
  11. package/dist/keys.d.ts +1 -1
  12. package/dist/keys.js +138 -3
  13. package/dist/pkce.js +160 -1
  14. package/dist/provider/code.d.ts +211 -3
  15. package/dist/provider/code.js +1 -1
  16. package/dist/provider/facebook.d.ts +2 -3
  17. package/dist/provider/facebook.js +1 -5
  18. package/dist/provider/github.d.ts +2 -3
  19. package/dist/provider/github.js +1 -5
  20. package/dist/provider/google.d.ts +2 -3
  21. package/dist/provider/google.js +1 -5
  22. package/dist/provider/oauth2.d.ts +175 -3
  23. package/dist/provider/oauth2.js +153 -5
  24. package/dist/provider/password.d.ts +384 -3
  25. package/dist/provider/password.js +4 -4
  26. package/dist/provider/provider.d.ts +226 -2
  27. package/dist/random.js +85 -1
  28. package/dist/storage/memory.d.ts +1 -1
  29. package/dist/storage/memory.js +1 -1
  30. package/dist/storage/storage.d.ts +161 -1
  31. package/dist/storage/storage.js +60 -1
  32. package/dist/storage/turso.d.ts +1 -1
  33. package/dist/storage/turso.js +1 -1
  34. package/dist/storage/unstorage.d.ts +1 -1
  35. package/dist/storage/unstorage.js +1 -1
  36. package/dist/subject.d.ts +61 -2
  37. package/dist/themes/theme.d.ts +208 -1
  38. package/dist/themes/theme.js +118 -1
  39. package/dist/ui/base.js +420 -2
  40. package/dist/ui/code.d.ts +1 -3
  41. package/dist/ui/code.js +3 -4
  42. package/dist/ui/form.js +59 -1
  43. package/dist/ui/icon.js +190 -1
  44. package/dist/ui/password.d.ts +1 -3
  45. package/dist/ui/password.js +2 -3
  46. package/dist/ui/select.js +278 -4
  47. package/dist/util.d.ts +71 -1
  48. package/dist/util.js +106 -1
  49. package/package.json +2 -2
  50. package/dist/allow-CixonwTW.d.ts +0 -59
  51. package/dist/allow-DX5cehSc.js +0 -63
  52. package/dist/base-DRutbxgL.js +0 -422
  53. package/dist/code-DJxdFR7p.d.ts +0 -212
  54. package/dist/core-BZHEAefX.d.ts +0 -129
  55. package/dist/core-CDM5o4rs.js +0 -498
  56. package/dist/error-CWAdNAzm.d.ts +0 -243
  57. package/dist/error-DgAKK7b2.js +0 -237
  58. package/dist/form-6XKM_cOk.js +0 -61
  59. package/dist/icon-Ci5uqGB_.js +0 -192
  60. package/dist/keys-EEfxEGfO.js +0 -140
  61. package/dist/oauth2-B7-6Z7Lc.js +0 -155
  62. package/dist/oauth2-CXHukHf2.d.ts +0 -176
  63. package/dist/password-C4KLmO0O.d.ts +0 -385
  64. package/dist/pkce-276Za_rZ.js +0 -162
  65. package/dist/provider-tndlqCzp.d.ts +0 -227
  66. package/dist/random-SXMYlaVr.js +0 -87
  67. package/dist/select-BjySLL8I.js +0 -280
  68. package/dist/storage-BEaqEPNQ.js +0 -62
  69. package/dist/storage-CxKerLlc.d.ts +0 -162
  70. package/dist/subject-DMIMVtaT.d.ts +0 -62
  71. package/dist/theme-C9by7VXf.d.ts +0 -209
  72. package/dist/theme-CswaLtbW.js +0 -120
  73. package/dist/util-CSdHUFOo.js +0 -108
  74. package/dist/util-DbSKG1Xm.d.ts +0 -72
@@ -1,2 +1,209 @@
1
- import { ColorScheme, THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, Theme, getTheme, setTheme } from "../theme-C9by7VXf.js";
1
+ //#region src/themes/theme.d.ts
2
+ /**
3
+ * Use one of the built-in themes.
4
+ *
5
+ * @example
6
+ *
7
+ * ```ts
8
+ * import { THEME_SST } from "@draftauth/core/themes/theme"
9
+ *
10
+ * export default issuer({
11
+ * theme: THEME_SST,
12
+ * // ...
13
+ * })
14
+ * ```
15
+ *
16
+ * Or define your own.
17
+ *
18
+ * ```ts
19
+ * import type { Theme } from "@draftauth/core/themes/theme"
20
+ *
21
+ * const MY_THEME: Theme = {
22
+ * title: "Acne",
23
+ * radius: "none",
24
+ * favicon: "https://www.example.com/favicon.svg",
25
+ * // ...
26
+ * }
27
+ *
28
+ * export default issuer({
29
+ * theme: MY_THEME,
30
+ * // ...
31
+ * })
32
+ * ```
33
+ *
34
+ * @packageDocumentation
35
+ */
36
+ /**
37
+ * A type to define values for light and dark mode.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * {
42
+ * light: "#FFF",
43
+ * dark: "#000"
44
+ * }
45
+ * ```
46
+ */
47
+ interface ColorScheme {
48
+ /**
49
+ * The value for dark mode.
50
+ */
51
+ dark: string;
52
+ /**
53
+ * The value for light mode.
54
+ */
55
+ light: string;
56
+ }
57
+ /**
58
+ * A type to define your custom theme.
59
+ */
60
+ interface Theme {
61
+ /**
62
+ * The name of your app. Also used as the title of the page.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * {
67
+ * title: "Acne"
68
+ * }
69
+ * ```
70
+ */
71
+ title?: string;
72
+ /**
73
+ * A URL to the favicon of your app.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * {
78
+ * favicon: "https://www.example.com/favicon.svg"
79
+ * }
80
+ * ```
81
+ */
82
+ favicon?: string;
83
+ /**
84
+ * The border radius of the UI elements.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * {
89
+ * radius: "none"
90
+ * }
91
+ * ```
92
+ */
93
+ radius?: "none" | "sm" | "md" | "lg" | "full";
94
+ /**
95
+ * The primary color of the theme.
96
+ *
97
+ * Takes a color or both light and dark colors.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * {
102
+ * primary: "#FF5E00"
103
+ * }
104
+ * ```
105
+ */
106
+ primary: string | ColorScheme;
107
+ /**
108
+ * The background color of the theme.
109
+ *
110
+ * Takes a color or both light and dark colors.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * {
115
+ * background: "#FFF"
116
+ * }
117
+ * ```
118
+ */
119
+ background?: string | ColorScheme;
120
+ /**
121
+ * A URL to the logo of your app.
122
+ *
123
+ * Takes a single image or both light and dark mode versions.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * {
128
+ * logo: "https://www.example.com/logo.svg"
129
+ * }
130
+ * ```
131
+ */
132
+ logo?: string | ColorScheme;
133
+ /**
134
+ * The font family and scale of the theme.
135
+ */
136
+ font?: {
137
+ /**
138
+ * The font family of the theme.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * {
143
+ * font: {
144
+ * family: "Geist Mono, monospace"
145
+ * }
146
+ * }
147
+ * ```
148
+ */
149
+ family?: string;
150
+ /**
151
+ * The font scale of the theme. Can be used to increase or decrease the font sizes across
152
+ * the UI.
153
+ *
154
+ * @default "1"
155
+ * @example
156
+ * ```ts
157
+ * {
158
+ * font: {
159
+ * scale: "1.25"
160
+ * }
161
+ * }
162
+ * ```
163
+ */
164
+ scale?: string;
165
+ };
166
+ /**
167
+ * Custom CSS that's added to the page in a `<style>` tag.
168
+ *
169
+ * This can be used to import custom fonts.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * {
174
+ * css: `@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@100;200;300;400;500;600;700;800;900&display=swap');`
175
+ * }
176
+ * ```
177
+ */
178
+ css?: string;
179
+ }
180
+ /**
181
+ * Built-in default Draft Auth theme.
182
+ */
183
+ declare const THEME_DRAFTAUTH: Theme;
184
+ /**
185
+ * Built-in theme based on [Terminal](https://terminal.shop).
186
+ */
187
+ declare const THEME_TERMINAL: Theme;
188
+ /**
189
+ * Built-in theme based on [SST](https://sst.dev).
190
+ */
191
+ declare const THEME_SST: Theme;
192
+ /**
193
+ * Built-in theme based on [Supabase](https://supabase.com).
194
+ */
195
+ declare const THEME_SUPABASE: Theme;
196
+ /**
197
+ * Built-in theme based on [Vercel](https://vercel.com).
198
+ */
199
+ declare const THEME_VERCEL: Theme;
200
+ /**
201
+ * @internal
202
+ */
203
+ declare const setTheme: (value: Theme) => void;
204
+ /**
205
+ * @internal
206
+ */
207
+ declare const getTheme: () => any;
208
+ //#endregion
2
209
  export { ColorScheme, THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, Theme, getTheme, setTheme };
@@ -1,3 +1,120 @@
1
- import { THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, getTheme, setTheme } from "../theme-CswaLtbW.js";
1
+ //#region src/themes/theme.ts
2
+ /**
3
+ * Built-in default Draft Auth theme.
4
+ */
5
+ const THEME_DRAFTAUTH = {
6
+ title: "Draft Auth",
7
+ radius: "none",
8
+ background: {
9
+ dark: "black",
10
+ light: "white"
11
+ },
12
+ primary: {
13
+ dark: "white",
14
+ light: "black"
15
+ },
16
+ font: { family: "IBM Plex Sans, sans-serif" },
17
+ css: `
18
+ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@100;200;300;400;500;600;700&display=swap');
19
+ `
20
+ };
21
+ /**
22
+ * Built-in theme based on [Terminal](https://terminal.shop).
23
+ */
24
+ const THEME_TERMINAL = {
25
+ title: "terminal",
26
+ radius: "none",
27
+ favicon: "https://www.terminal.shop/favicon.svg",
28
+ logo: {
29
+ dark: "https://www.terminal.shop/images/logo-white.svg",
30
+ light: "https://www.terminal.shop/images/logo-black.svg"
31
+ },
32
+ primary: "#ff5e00",
33
+ background: {
34
+ dark: "rgb(0, 0, 0)",
35
+ light: "rgb(255, 255, 255)"
36
+ },
37
+ font: { family: "Geist Mono, monospace" },
38
+ css: `
39
+ @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100;200;300;400;500;600;700;800;900&display=swap');
40
+ `
41
+ };
42
+ /**
43
+ * Built-in theme based on [SST](https://sst.dev).
44
+ */
45
+ const THEME_SST = {
46
+ title: "SST",
47
+ favicon: "https://sst.dev/favicon.svg",
48
+ logo: {
49
+ dark: "https://sst.dev/favicon.svg",
50
+ light: "https://sst.dev/favicon.svg"
51
+ },
52
+ background: {
53
+ dark: "#1a1a2d",
54
+ light: "rgb(255, 255, 255)"
55
+ },
56
+ primary: "#f3663f",
57
+ font: { family: "Rubik, sans-serif" },
58
+ css: `
59
+ @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@100;200;300;400;500;600;700;800;900&display=swap');
60
+ `
61
+ };
62
+ /**
63
+ * Built-in theme based on [Supabase](https://supabase.com).
64
+ */
65
+ const THEME_SUPABASE = {
66
+ title: "Supabase",
67
+ logo: {
68
+ dark: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-dark.svg&w=128&q=75",
69
+ light: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-light.svg&w=128&q=75"
70
+ },
71
+ background: {
72
+ dark: "#171717",
73
+ light: "#f8f8f8"
74
+ },
75
+ primary: {
76
+ dark: "#006239",
77
+ light: "#72e3ad"
78
+ },
79
+ font: { family: "Varela Round, sans-serif" },
80
+ css: `
81
+ @import url('https://fonts.googleapis.com/css2?family=Varela+Round:wght@100;200;300;400;500;600;700;800;900&display=swap');
82
+ `
83
+ };
84
+ /**
85
+ * Built-in theme based on [Vercel](https://vercel.com).
86
+ */
87
+ const THEME_VERCEL = {
88
+ title: "Vercel",
89
+ logo: {
90
+ dark: "https://vercel.com/mktng/_next/static/media/vercel-logotype-dark.e8c0a742.svg",
91
+ light: "https://vercel.com/mktng/_next/static/media/vercel-logotype-light.700a8d26.svg"
92
+ },
93
+ background: {
94
+ dark: "black",
95
+ light: "white"
96
+ },
97
+ primary: {
98
+ dark: "white",
99
+ light: "black"
100
+ },
101
+ font: { family: "Geist, sans-serif" },
102
+ css: `
103
+ @import url('https://fonts.googleapis.com/css2?family=Geist:wght@100;200;300;400;500;600;700;800;900&display=swap');
104
+ `
105
+ };
106
+ /**
107
+ * @internal
108
+ */
109
+ const setTheme = (value) => {
110
+ globalThis.DRAFTAUTH_THEME = value;
111
+ };
112
+ /**
113
+ * @internal
114
+ */
115
+ const getTheme = () => {
116
+ return globalThis.DRAFTAUTH_THEME || THEME_DRAFTAUTH;
117
+ };
2
118
 
119
+ //#endregion
3
120
  export { THEME_DRAFTAUTH, THEME_SST, THEME_SUPABASE, THEME_TERMINAL, THEME_VERCEL, getTheme, setTheme };