@_mustachio/openauth 0.6.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.
Files changed (192) hide show
  1. package/dist/esm/client.js +186 -0
  2. package/dist/esm/css.d.js +0 -0
  3. package/dist/esm/error.js +73 -0
  4. package/dist/esm/index.js +14 -0
  5. package/dist/esm/issuer.js +558 -0
  6. package/dist/esm/jwt.js +16 -0
  7. package/dist/esm/keys.js +113 -0
  8. package/dist/esm/pkce.js +35 -0
  9. package/dist/esm/provider/apple.js +28 -0
  10. package/dist/esm/provider/arctic.js +43 -0
  11. package/dist/esm/provider/code.js +58 -0
  12. package/dist/esm/provider/cognito.js +16 -0
  13. package/dist/esm/provider/discord.js +15 -0
  14. package/dist/esm/provider/facebook.js +24 -0
  15. package/dist/esm/provider/github.js +15 -0
  16. package/dist/esm/provider/google.js +25 -0
  17. package/dist/esm/provider/index.js +3 -0
  18. package/dist/esm/provider/jumpcloud.js +15 -0
  19. package/dist/esm/provider/keycloak.js +15 -0
  20. package/dist/esm/provider/linkedin.js +15 -0
  21. package/dist/esm/provider/m2m.js +17 -0
  22. package/dist/esm/provider/microsoft.js +24 -0
  23. package/dist/esm/provider/oauth2.js +119 -0
  24. package/dist/esm/provider/oidc.js +69 -0
  25. package/dist/esm/provider/passkey.js +315 -0
  26. package/dist/esm/provider/password.js +306 -0
  27. package/dist/esm/provider/provider.js +10 -0
  28. package/dist/esm/provider/slack.js +15 -0
  29. package/dist/esm/provider/spotify.js +15 -0
  30. package/dist/esm/provider/twitch.js +15 -0
  31. package/dist/esm/provider/x.js +16 -0
  32. package/dist/esm/provider/yahoo.js +15 -0
  33. package/dist/esm/random.js +27 -0
  34. package/dist/esm/storage/aws.js +39 -0
  35. package/dist/esm/storage/cloudflare.js +42 -0
  36. package/dist/esm/storage/dynamo.js +116 -0
  37. package/dist/esm/storage/memory.js +88 -0
  38. package/dist/esm/storage/storage.js +36 -0
  39. package/dist/esm/subject.js +7 -0
  40. package/dist/esm/ui/base.js +407 -0
  41. package/dist/esm/ui/code.js +151 -0
  42. package/dist/esm/ui/form.js +43 -0
  43. package/dist/esm/ui/icon.js +92 -0
  44. package/dist/esm/ui/passkey.js +329 -0
  45. package/dist/esm/ui/password.js +338 -0
  46. package/dist/esm/ui/select.js +187 -0
  47. package/dist/esm/ui/theme.js +115 -0
  48. package/dist/esm/util.js +54 -0
  49. package/dist/types/client.d.ts +466 -0
  50. package/dist/types/client.d.ts.map +1 -0
  51. package/dist/types/error.d.ts +77 -0
  52. package/dist/types/error.d.ts.map +1 -0
  53. package/dist/types/index.d.ts +20 -0
  54. package/dist/types/index.d.ts.map +1 -0
  55. package/dist/types/issuer.d.ts +465 -0
  56. package/dist/types/issuer.d.ts.map +1 -0
  57. package/dist/types/jwt.d.ts +6 -0
  58. package/dist/types/jwt.d.ts.map +1 -0
  59. package/dist/types/keys.d.ts +18 -0
  60. package/dist/types/keys.d.ts.map +1 -0
  61. package/dist/types/pkce.d.ts +7 -0
  62. package/dist/types/pkce.d.ts.map +1 -0
  63. package/dist/types/provider/apple.d.ts +108 -0
  64. package/dist/types/provider/apple.d.ts.map +1 -0
  65. package/dist/types/provider/arctic.d.ts +16 -0
  66. package/dist/types/provider/arctic.d.ts.map +1 -0
  67. package/dist/types/provider/code.d.ts +74 -0
  68. package/dist/types/provider/code.d.ts.map +1 -0
  69. package/dist/types/provider/cognito.d.ts +64 -0
  70. package/dist/types/provider/cognito.d.ts.map +1 -0
  71. package/dist/types/provider/discord.d.ts +38 -0
  72. package/dist/types/provider/discord.d.ts.map +1 -0
  73. package/dist/types/provider/facebook.d.ts +74 -0
  74. package/dist/types/provider/facebook.d.ts.map +1 -0
  75. package/dist/types/provider/github.d.ts +38 -0
  76. package/dist/types/provider/github.d.ts.map +1 -0
  77. package/dist/types/provider/google.d.ts +74 -0
  78. package/dist/types/provider/google.d.ts.map +1 -0
  79. package/dist/types/provider/index.d.ts +4 -0
  80. package/dist/types/provider/index.d.ts.map +1 -0
  81. package/dist/types/provider/jumpcloud.d.ts +38 -0
  82. package/dist/types/provider/jumpcloud.d.ts.map +1 -0
  83. package/dist/types/provider/keycloak.d.ts +67 -0
  84. package/dist/types/provider/keycloak.d.ts.map +1 -0
  85. package/dist/types/provider/linkedin.d.ts +6 -0
  86. package/dist/types/provider/linkedin.d.ts.map +1 -0
  87. package/dist/types/provider/m2m.d.ts +34 -0
  88. package/dist/types/provider/m2m.d.ts.map +1 -0
  89. package/dist/types/provider/microsoft.d.ts +89 -0
  90. package/dist/types/provider/microsoft.d.ts.map +1 -0
  91. package/dist/types/provider/oauth2.d.ts +133 -0
  92. package/dist/types/provider/oauth2.d.ts.map +1 -0
  93. package/dist/types/provider/oidc.d.ts +91 -0
  94. package/dist/types/provider/oidc.d.ts.map +1 -0
  95. package/dist/types/provider/passkey.d.ts +143 -0
  96. package/dist/types/provider/passkey.d.ts.map +1 -0
  97. package/dist/types/provider/password.d.ts +210 -0
  98. package/dist/types/provider/password.d.ts.map +1 -0
  99. package/dist/types/provider/provider.d.ts +29 -0
  100. package/dist/types/provider/provider.d.ts.map +1 -0
  101. package/dist/types/provider/slack.d.ts +59 -0
  102. package/dist/types/provider/slack.d.ts.map +1 -0
  103. package/dist/types/provider/spotify.d.ts +38 -0
  104. package/dist/types/provider/spotify.d.ts.map +1 -0
  105. package/dist/types/provider/twitch.d.ts +38 -0
  106. package/dist/types/provider/twitch.d.ts.map +1 -0
  107. package/dist/types/provider/x.d.ts +38 -0
  108. package/dist/types/provider/x.d.ts.map +1 -0
  109. package/dist/types/provider/yahoo.d.ts +38 -0
  110. package/dist/types/provider/yahoo.d.ts.map +1 -0
  111. package/dist/types/random.d.ts +3 -0
  112. package/dist/types/random.d.ts.map +1 -0
  113. package/dist/types/storage/aws.d.ts +4 -0
  114. package/dist/types/storage/aws.d.ts.map +1 -0
  115. package/dist/types/storage/cloudflare.d.ts +34 -0
  116. package/dist/types/storage/cloudflare.d.ts.map +1 -0
  117. package/dist/types/storage/dynamo.d.ts +65 -0
  118. package/dist/types/storage/dynamo.d.ts.map +1 -0
  119. package/dist/types/storage/memory.d.ts +49 -0
  120. package/dist/types/storage/memory.d.ts.map +1 -0
  121. package/dist/types/storage/storage.d.ts +15 -0
  122. package/dist/types/storage/storage.d.ts.map +1 -0
  123. package/dist/types/subject.d.ts +122 -0
  124. package/dist/types/subject.d.ts.map +1 -0
  125. package/dist/types/ui/base.d.ts +5 -0
  126. package/dist/types/ui/base.d.ts.map +1 -0
  127. package/dist/types/ui/code.d.ts +104 -0
  128. package/dist/types/ui/code.d.ts.map +1 -0
  129. package/dist/types/ui/form.d.ts +6 -0
  130. package/dist/types/ui/form.d.ts.map +1 -0
  131. package/dist/types/ui/icon.d.ts +6 -0
  132. package/dist/types/ui/icon.d.ts.map +1 -0
  133. package/dist/types/ui/passkey.d.ts +5 -0
  134. package/dist/types/ui/passkey.d.ts.map +1 -0
  135. package/dist/types/ui/password.d.ts +139 -0
  136. package/dist/types/ui/password.d.ts.map +1 -0
  137. package/dist/types/ui/select.d.ts +55 -0
  138. package/dist/types/ui/select.d.ts.map +1 -0
  139. package/dist/types/ui/theme.d.ts +207 -0
  140. package/dist/types/ui/theme.d.ts.map +1 -0
  141. package/dist/types/util.d.ts +8 -0
  142. package/dist/types/util.d.ts.map +1 -0
  143. package/package.json +51 -0
  144. package/src/client.ts +749 -0
  145. package/src/css.d.ts +4 -0
  146. package/src/error.ts +120 -0
  147. package/src/index.ts +26 -0
  148. package/src/issuer.ts +1302 -0
  149. package/src/jwt.ts +17 -0
  150. package/src/keys.ts +139 -0
  151. package/src/pkce.ts +40 -0
  152. package/src/provider/apple.ts +127 -0
  153. package/src/provider/arctic.ts +66 -0
  154. package/src/provider/code.ts +227 -0
  155. package/src/provider/cognito.ts +74 -0
  156. package/src/provider/discord.ts +45 -0
  157. package/src/provider/facebook.ts +84 -0
  158. package/src/provider/github.ts +45 -0
  159. package/src/provider/google.ts +85 -0
  160. package/src/provider/index.ts +3 -0
  161. package/src/provider/jumpcloud.ts +45 -0
  162. package/src/provider/keycloak.ts +75 -0
  163. package/src/provider/linkedin.ts +12 -0
  164. package/src/provider/m2m.ts +56 -0
  165. package/src/provider/microsoft.ts +100 -0
  166. package/src/provider/oauth2.ts +297 -0
  167. package/src/provider/oidc.ts +179 -0
  168. package/src/provider/passkey.ts +655 -0
  169. package/src/provider/password.ts +672 -0
  170. package/src/provider/provider.ts +33 -0
  171. package/src/provider/slack.ts +67 -0
  172. package/src/provider/spotify.ts +45 -0
  173. package/src/provider/twitch.ts +45 -0
  174. package/src/provider/x.ts +46 -0
  175. package/src/provider/yahoo.ts +45 -0
  176. package/src/random.ts +24 -0
  177. package/src/storage/aws.ts +59 -0
  178. package/src/storage/cloudflare.ts +77 -0
  179. package/src/storage/dynamo.ts +193 -0
  180. package/src/storage/memory.ts +135 -0
  181. package/src/storage/storage.ts +46 -0
  182. package/src/subject.ts +130 -0
  183. package/src/ui/base.tsx +118 -0
  184. package/src/ui/code.tsx +215 -0
  185. package/src/ui/form.tsx +40 -0
  186. package/src/ui/icon.tsx +95 -0
  187. package/src/ui/passkey.tsx +321 -0
  188. package/src/ui/password.tsx +405 -0
  189. package/src/ui/select.tsx +221 -0
  190. package/src/ui/theme.ts +319 -0
  191. package/src/ui/ui.css +252 -0
  192. package/src/util.ts +58 -0
@@ -0,0 +1,338 @@
1
+ // src/ui/password.tsx
2
+ import { Layout } from "./base.js";
3
+ import"./form.js";
4
+ import { FormAlert } from "./form.js";
5
+ import { jsxDEV, Fragment } from "hono/jsx/jsx-dev-runtime";
6
+ var DEFAULT_COPY = {
7
+ error_email_taken: "There is already an account with this email.",
8
+ error_invalid_code: "Code is incorrect.",
9
+ error_invalid_email: "Email is not valid.",
10
+ error_invalid_password: "Password is incorrect.",
11
+ error_password_mismatch: "Passwords do not match.",
12
+ error_validation_error: "Password does not meet requirements.",
13
+ register_title: "Welcome to the app",
14
+ register_description: "Sign in with your email",
15
+ login_title: "Welcome to the app",
16
+ login_description: "Sign in with your email",
17
+ register: "Register",
18
+ register_prompt: "Don't have an account?",
19
+ login_prompt: "Already have an account?",
20
+ login: "Login",
21
+ change_prompt: "Forgot password?",
22
+ code_resend: "Resend code",
23
+ code_return: "Back to",
24
+ logo: "A",
25
+ input_email: "Email",
26
+ input_password: "Password",
27
+ input_code: "Code",
28
+ input_repeat: "Repeat password",
29
+ button_continue: "Continue"
30
+ };
31
+ function PasswordUI(input) {
32
+ const copy = {
33
+ ...DEFAULT_COPY,
34
+ ...input.copy
35
+ };
36
+ return {
37
+ validatePassword: input.validatePassword,
38
+ sendCode: input.sendCode,
39
+ login: async (_req, form, error) => {
40
+ const jsx = /* @__PURE__ */ jsxDEV(Layout, {
41
+ children: /* @__PURE__ */ jsxDEV("form", {
42
+ "data-component": "form",
43
+ method: "post",
44
+ children: [
45
+ /* @__PURE__ */ jsxDEV(FormAlert, {
46
+ message: error?.type && copy?.[`error_${error.type}`]
47
+ }, undefined, false, undefined, this),
48
+ /* @__PURE__ */ jsxDEV("input", {
49
+ "data-component": "input",
50
+ type: "email",
51
+ name: "email",
52
+ required: true,
53
+ placeholder: copy.input_email,
54
+ autofocus: !error,
55
+ value: form?.get("email")?.toString()
56
+ }, undefined, false, undefined, this),
57
+ /* @__PURE__ */ jsxDEV("input", {
58
+ "data-component": "input",
59
+ autofocus: error?.type === "invalid_password",
60
+ required: true,
61
+ type: "password",
62
+ name: "password",
63
+ placeholder: copy.input_password,
64
+ autoComplete: "current-password"
65
+ }, undefined, false, undefined, this),
66
+ /* @__PURE__ */ jsxDEV("button", {
67
+ "data-component": "button",
68
+ children: copy.button_continue
69
+ }, undefined, false, undefined, this),
70
+ /* @__PURE__ */ jsxDEV("div", {
71
+ "data-component": "form-footer",
72
+ children: [
73
+ /* @__PURE__ */ jsxDEV("span", {
74
+ children: [
75
+ copy.register_prompt,
76
+ " ",
77
+ /* @__PURE__ */ jsxDEV("a", {
78
+ "data-component": "link",
79
+ href: "register",
80
+ children: copy.register
81
+ }, undefined, false, undefined, this)
82
+ ]
83
+ }, undefined, true, undefined, this),
84
+ /* @__PURE__ */ jsxDEV("a", {
85
+ "data-component": "link",
86
+ href: "change",
87
+ children: copy.change_prompt
88
+ }, undefined, false, undefined, this)
89
+ ]
90
+ }, undefined, true, undefined, this)
91
+ ]
92
+ }, undefined, true, undefined, this)
93
+ }, undefined, false, undefined, this);
94
+ return new Response(jsx.toString(), {
95
+ status: error ? 401 : 200,
96
+ headers: {
97
+ "Content-Type": "text/html"
98
+ }
99
+ });
100
+ },
101
+ register: async (_req, state, form, error) => {
102
+ const emailError = ["invalid_email", "email_taken"].includes(error?.type || "");
103
+ const passwordError = [
104
+ "invalid_password",
105
+ "password_mismatch",
106
+ "validation_error"
107
+ ].includes(error?.type || "");
108
+ const jsx = /* @__PURE__ */ jsxDEV(Layout, {
109
+ children: /* @__PURE__ */ jsxDEV("form", {
110
+ "data-component": "form",
111
+ method: "post",
112
+ children: [
113
+ /* @__PURE__ */ jsxDEV(FormAlert, {
114
+ message: error?.type ? error.type === "validation_error" ? error.message ?? copy?.[`error_${error.type}`] : copy?.[`error_${error.type}`] : undefined
115
+ }, undefined, false, undefined, this),
116
+ state.type === "start" && /* @__PURE__ */ jsxDEV(Fragment, {
117
+ children: [
118
+ /* @__PURE__ */ jsxDEV("input", {
119
+ type: "hidden",
120
+ name: "action",
121
+ value: "register"
122
+ }, undefined, false, undefined, this),
123
+ /* @__PURE__ */ jsxDEV("input", {
124
+ "data-component": "input",
125
+ autofocus: !error || emailError,
126
+ type: "email",
127
+ name: "email",
128
+ value: !emailError ? form?.get("email")?.toString() : "",
129
+ required: true,
130
+ placeholder: copy.input_email
131
+ }, undefined, false, undefined, this),
132
+ /* @__PURE__ */ jsxDEV("input", {
133
+ "data-component": "input",
134
+ autofocus: passwordError,
135
+ type: "password",
136
+ name: "password",
137
+ placeholder: copy.input_password,
138
+ required: true,
139
+ value: !passwordError ? form?.get("password")?.toString() : "",
140
+ autoComplete: "new-password"
141
+ }, undefined, false, undefined, this),
142
+ /* @__PURE__ */ jsxDEV("input", {
143
+ "data-component": "input",
144
+ type: "password",
145
+ name: "repeat",
146
+ required: true,
147
+ autofocus: passwordError,
148
+ placeholder: copy.input_repeat,
149
+ autoComplete: "new-password"
150
+ }, undefined, false, undefined, this),
151
+ /* @__PURE__ */ jsxDEV("button", {
152
+ "data-component": "button",
153
+ children: copy.button_continue
154
+ }, undefined, false, undefined, this),
155
+ /* @__PURE__ */ jsxDEV("div", {
156
+ "data-component": "form-footer",
157
+ children: /* @__PURE__ */ jsxDEV("span", {
158
+ children: [
159
+ copy.login_prompt,
160
+ " ",
161
+ /* @__PURE__ */ jsxDEV("a", {
162
+ "data-component": "link",
163
+ href: "authorize",
164
+ children: copy.login
165
+ }, undefined, false, undefined, this)
166
+ ]
167
+ }, undefined, true, undefined, this)
168
+ }, undefined, false, undefined, this)
169
+ ]
170
+ }, undefined, true, undefined, this),
171
+ state.type === "code" && /* @__PURE__ */ jsxDEV(Fragment, {
172
+ children: [
173
+ /* @__PURE__ */ jsxDEV("input", {
174
+ type: "hidden",
175
+ name: "action",
176
+ value: "verify"
177
+ }, undefined, false, undefined, this),
178
+ /* @__PURE__ */ jsxDEV("input", {
179
+ "data-component": "input",
180
+ autofocus: true,
181
+ name: "code",
182
+ minLength: 6,
183
+ maxLength: 6,
184
+ required: true,
185
+ placeholder: copy.input_code,
186
+ autoComplete: "one-time-code"
187
+ }, undefined, false, undefined, this),
188
+ /* @__PURE__ */ jsxDEV("button", {
189
+ "data-component": "button",
190
+ children: copy.button_continue
191
+ }, undefined, false, undefined, this)
192
+ ]
193
+ }, undefined, true, undefined, this)
194
+ ]
195
+ }, undefined, true, undefined, this)
196
+ }, undefined, false, undefined, this);
197
+ return new Response(jsx.toString(), {
198
+ headers: {
199
+ "Content-Type": "text/html"
200
+ }
201
+ });
202
+ },
203
+ change: async (_req, state, form, error) => {
204
+ const passwordError = [
205
+ "invalid_password",
206
+ "password_mismatch",
207
+ "validation_error"
208
+ ].includes(error?.type || "");
209
+ const jsx = /* @__PURE__ */ jsxDEV(Layout, {
210
+ children: [
211
+ /* @__PURE__ */ jsxDEV("form", {
212
+ "data-component": "form",
213
+ method: "post",
214
+ replace: true,
215
+ children: [
216
+ /* @__PURE__ */ jsxDEV(FormAlert, {
217
+ message: error?.type ? error.type === "validation_error" ? error.message ?? copy?.[`error_${error.type}`] : copy?.[`error_${error.type}`] : undefined
218
+ }, undefined, false, undefined, this),
219
+ state.type === "start" && /* @__PURE__ */ jsxDEV(Fragment, {
220
+ children: [
221
+ /* @__PURE__ */ jsxDEV("input", {
222
+ type: "hidden",
223
+ name: "action",
224
+ value: "code"
225
+ }, undefined, false, undefined, this),
226
+ /* @__PURE__ */ jsxDEV("input", {
227
+ "data-component": "input",
228
+ autofocus: true,
229
+ type: "email",
230
+ name: "email",
231
+ required: true,
232
+ value: form?.get("email")?.toString(),
233
+ placeholder: copy.input_email
234
+ }, undefined, false, undefined, this)
235
+ ]
236
+ }, undefined, true, undefined, this),
237
+ state.type === "code" && /* @__PURE__ */ jsxDEV(Fragment, {
238
+ children: [
239
+ /* @__PURE__ */ jsxDEV("input", {
240
+ type: "hidden",
241
+ name: "action",
242
+ value: "verify"
243
+ }, undefined, false, undefined, this),
244
+ /* @__PURE__ */ jsxDEV("input", {
245
+ "data-component": "input",
246
+ autofocus: true,
247
+ name: "code",
248
+ minLength: 6,
249
+ maxLength: 6,
250
+ required: true,
251
+ placeholder: copy.input_code,
252
+ autoComplete: "one-time-code"
253
+ }, undefined, false, undefined, this)
254
+ ]
255
+ }, undefined, true, undefined, this),
256
+ state.type === "update" && /* @__PURE__ */ jsxDEV(Fragment, {
257
+ children: [
258
+ /* @__PURE__ */ jsxDEV("input", {
259
+ type: "hidden",
260
+ name: "action",
261
+ value: "update"
262
+ }, undefined, false, undefined, this),
263
+ /* @__PURE__ */ jsxDEV("input", {
264
+ "data-component": "input",
265
+ autofocus: true,
266
+ type: "password",
267
+ name: "password",
268
+ placeholder: copy.input_password,
269
+ required: true,
270
+ value: !passwordError ? form?.get("password")?.toString() : "",
271
+ autoComplete: "new-password"
272
+ }, undefined, false, undefined, this),
273
+ /* @__PURE__ */ jsxDEV("input", {
274
+ "data-component": "input",
275
+ type: "password",
276
+ name: "repeat",
277
+ required: true,
278
+ value: !passwordError ? form?.get("password")?.toString() : "",
279
+ placeholder: copy.input_repeat,
280
+ autoComplete: "new-password"
281
+ }, undefined, false, undefined, this)
282
+ ]
283
+ }, undefined, true, undefined, this),
284
+ /* @__PURE__ */ jsxDEV("button", {
285
+ "data-component": "button",
286
+ children: copy.button_continue
287
+ }, undefined, false, undefined, this)
288
+ ]
289
+ }, undefined, true, undefined, this),
290
+ state.type === "code" && /* @__PURE__ */ jsxDEV("form", {
291
+ method: "post",
292
+ children: [
293
+ /* @__PURE__ */ jsxDEV("input", {
294
+ type: "hidden",
295
+ name: "action",
296
+ value: "code"
297
+ }, undefined, false, undefined, this),
298
+ /* @__PURE__ */ jsxDEV("input", {
299
+ type: "hidden",
300
+ name: "email",
301
+ value: state.email
302
+ }, undefined, false, undefined, this),
303
+ state.type === "code" && /* @__PURE__ */ jsxDEV("div", {
304
+ "data-component": "form-footer",
305
+ children: [
306
+ /* @__PURE__ */ jsxDEV("span", {
307
+ children: [
308
+ copy.code_return,
309
+ " ",
310
+ /* @__PURE__ */ jsxDEV("a", {
311
+ "data-component": "link",
312
+ href: "authorize",
313
+ children: copy.login.toLowerCase()
314
+ }, undefined, false, undefined, this)
315
+ ]
316
+ }, undefined, true, undefined, this),
317
+ /* @__PURE__ */ jsxDEV("button", {
318
+ "data-component": "link",
319
+ children: copy.code_resend
320
+ }, undefined, false, undefined, this)
321
+ ]
322
+ }, undefined, true, undefined, this)
323
+ ]
324
+ }, undefined, true, undefined, this)
325
+ ]
326
+ }, undefined, true, undefined, this);
327
+ return new Response(jsx.toString(), {
328
+ status: error ? 400 : 200,
329
+ headers: {
330
+ "Content-Type": "text/html"
331
+ }
332
+ });
333
+ }
334
+ };
335
+ }
336
+ export {
337
+ PasswordUI
338
+ };
@@ -0,0 +1,187 @@
1
+ // src/ui/select.tsx
2
+ import { Layout } from "./base.js";
3
+ import { ICON_GITHUB, ICON_GOOGLE } from "./icon.js";
4
+ import { jsxDEV } from "hono/jsx/jsx-dev-runtime";
5
+ function Select(props) {
6
+ return async (providers, _req) => {
7
+ const jsx = /* @__PURE__ */ jsxDEV(Layout, {
8
+ children: /* @__PURE__ */ jsxDEV("div", {
9
+ "data-component": "form",
10
+ children: Object.entries(providers).map(([key, type]) => {
11
+ const match = props?.providers?.[key];
12
+ if (match?.hide)
13
+ return;
14
+ const icon = ICON[key];
15
+ return /* @__PURE__ */ jsxDEV("a", {
16
+ href: `/${key}/authorize`,
17
+ "data-component": "button",
18
+ "data-color": "ghost",
19
+ children: [
20
+ icon && /* @__PURE__ */ jsxDEV("i", {
21
+ "data-slot": "icon",
22
+ children: icon
23
+ }, undefined, false, undefined, this),
24
+ "Continue with ",
25
+ match?.display || DISPLAY[type] || type
26
+ ]
27
+ }, undefined, true, undefined, this);
28
+ })
29
+ }, undefined, false, undefined, this)
30
+ }, undefined, false, undefined, this);
31
+ return new Response(jsx.toString(), {
32
+ headers: {
33
+ "Content-Type": "text/html"
34
+ }
35
+ });
36
+ };
37
+ }
38
+ var DISPLAY = {
39
+ twitch: "Twitch",
40
+ google: "Google",
41
+ github: "GitHub",
42
+ apple: "Apple",
43
+ x: "X",
44
+ facebook: "Facebook",
45
+ microsoft: "Microsoft",
46
+ slack: "Slack"
47
+ };
48
+ var ICON = {
49
+ code: /* @__PURE__ */ jsxDEV("svg", {
50
+ fill: "currentColor",
51
+ viewBox: "0 0 52 52",
52
+ "data-name": "Layer 1",
53
+ xmlns: "http://www.w3.org/2000/svg",
54
+ children: /* @__PURE__ */ jsxDEV("path", {
55
+ d: "M8.55,36.91A6.55,6.55,0,1,1,2,43.45,6.54,6.54,0,0,1,8.55,36.91Zm17.45,0a6.55,6.55,0,1,1-6.55,6.54A6.55,6.55,0,0,1,26,36.91Zm17.45,0a6.55,6.55,0,1,1-6.54,6.54A6.54,6.54,0,0,1,43.45,36.91ZM8.55,19.45A6.55,6.55,0,1,1,2,26,6.55,6.55,0,0,1,8.55,19.45Zm17.45,0A6.55,6.55,0,1,1,19.45,26,6.56,6.56,0,0,1,26,19.45Zm17.45,0A6.55,6.55,0,1,1,36.91,26,6.55,6.55,0,0,1,43.45,19.45ZM8.55,2A6.55,6.55,0,1,1,2,8.55,6.54,6.54,0,0,1,8.55,2ZM26,2a6.55,6.55,0,1,1-6.55,6.55A6.55,6.55,0,0,1,26,2ZM43.45,2a6.55,6.55,0,1,1-6.54,6.55A6.55,6.55,0,0,1,43.45,2Z",
56
+ "fill-rule": "evenodd"
57
+ }, undefined, false, undefined, this)
58
+ }, undefined, false, undefined, this),
59
+ password: /* @__PURE__ */ jsxDEV("svg", {
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ viewBox: "0 0 24 24",
62
+ fill: "currentColor",
63
+ children: /* @__PURE__ */ jsxDEV("path", {
64
+ "fill-rule": "evenodd",
65
+ d: "M12 1.5a5.25 5.25 0 0 0-5.25 5.25v3a3 3 0 0 0-3 3v6.75a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3v-6.75a3 3 0 0 0-3-3v-3c0-2.9-2.35-5.25-5.25-5.25Zm3.75 8.25v-3a3.75 3.75 0 1 0-7.5 0v3h7.5Z",
66
+ "clip-rule": "evenodd"
67
+ }, undefined, false, undefined, this)
68
+ }, undefined, false, undefined, this),
69
+ twitch: /* @__PURE__ */ jsxDEV("svg", {
70
+ role: "img",
71
+ xmlns: "http://www.w3.org/2000/svg",
72
+ viewBox: "0 0 448 512",
73
+ children: /* @__PURE__ */ jsxDEV("path", {
74
+ fill: "currentColor",
75
+ d: "M40.1 32L10 108.9v314.3h107V480h60.2l56.8-56.8h87l117-117V32H40.1zm357.8 254.1L331 353H224l-56.8 56.8V353H76.9V72.1h321v214zM331 149v116.9h-40.1V149H331zm-107 0v116.9h-40.1V149H224z"
76
+ }, undefined, false, undefined, this)
77
+ }, undefined, false, undefined, this),
78
+ google: ICON_GOOGLE,
79
+ github: ICON_GITHUB,
80
+ apple: /* @__PURE__ */ jsxDEV("svg", {
81
+ role: "img",
82
+ xmlns: "http://www.w3.org/2000/svg",
83
+ viewBox: "0 0 814 1000",
84
+ children: /* @__PURE__ */ jsxDEV("path", {
85
+ fill: "currentColor",
86
+ d: "M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z "
87
+ }, undefined, false, undefined, this)
88
+ }, undefined, false, undefined, this),
89
+ x: /* @__PURE__ */ jsxDEV("svg", {
90
+ role: "img",
91
+ xmlns: "http://www.w3.org/2000/svg",
92
+ viewBox: "0 0 1200 1227",
93
+ children: /* @__PURE__ */ jsxDEV("path", {
94
+ fill: "currentColor",
95
+ d: "M714.163 519.284 1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284h.026ZM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854v-.026Z"
96
+ }, undefined, false, undefined, this)
97
+ }, undefined, false, undefined, this),
98
+ microsoft: /* @__PURE__ */ jsxDEV("svg", {
99
+ role: "img",
100
+ viewBox: "0 0 256 256",
101
+ xmlns: "http://www.w3.org/2000/svg",
102
+ preserveAspectRatio: "xMidYMid",
103
+ children: [
104
+ /* @__PURE__ */ jsxDEV("path", {
105
+ fill: "#F1511B",
106
+ d: "M121.666 121.666H0V0h121.666z"
107
+ }, undefined, false, undefined, this),
108
+ /* @__PURE__ */ jsxDEV("path", {
109
+ fill: "#80CC28",
110
+ d: "M256 121.666H134.335V0H256z"
111
+ }, undefined, false, undefined, this),
112
+ /* @__PURE__ */ jsxDEV("path", {
113
+ fill: "#00ADEF",
114
+ d: "M121.663 256.002H0V134.336h121.663z"
115
+ }, undefined, false, undefined, this),
116
+ /* @__PURE__ */ jsxDEV("path", {
117
+ fill: "#FBBC09",
118
+ d: "M256 256.002H134.335V134.336H256z"
119
+ }, undefined, false, undefined, this)
120
+ ]
121
+ }, undefined, true, undefined, this),
122
+ facebook: /* @__PURE__ */ jsxDEV("svg", {
123
+ role: "img",
124
+ xmlns: "http://www.w3.org/2000/svg",
125
+ viewBox: "0 0 36 36",
126
+ fill: "url(#a)",
127
+ children: [
128
+ /* @__PURE__ */ jsxDEV("defs", {
129
+ children: /* @__PURE__ */ jsxDEV("linearGradient", {
130
+ x1: "50%",
131
+ x2: "50%",
132
+ y1: "97.078%",
133
+ y2: "0%",
134
+ id: "a",
135
+ children: [
136
+ /* @__PURE__ */ jsxDEV("stop", {
137
+ offset: "0%",
138
+ "stop-color": "#0062E0"
139
+ }, undefined, false, undefined, this),
140
+ /* @__PURE__ */ jsxDEV("stop", {
141
+ offset: "100%",
142
+ "stop-color": "#19AFFF"
143
+ }, undefined, false, undefined, this)
144
+ ]
145
+ }, undefined, true, undefined, this)
146
+ }, undefined, false, undefined, this),
147
+ /* @__PURE__ */ jsxDEV("path", {
148
+ d: "M15 35.8C6.5 34.3 0 26.9 0 18 0 8.1 8.1 0 18 0s18 8.1 18 18c0 8.9-6.5 16.3-15 17.8l-1-.8h-4l-1 .8z"
149
+ }, undefined, false, undefined, this),
150
+ /* @__PURE__ */ jsxDEV("path", {
151
+ fill: "#FFF",
152
+ d: "m25 23 .8-5H21v-3.5c0-1.4.5-2.5 2.7-2.5H26V7.4c-1.3-.2-2.7-.4-4-.4-4.1 0-7 2.5-7 7v4h-4.5v5H15v12.7c1 .2 2 .3 3 .3s2-.1 3-.3V23h4z"
153
+ }, undefined, false, undefined, this)
154
+ ]
155
+ }, undefined, true, undefined, this),
156
+ slack: /* @__PURE__ */ jsxDEV("svg", {
157
+ role: "img",
158
+ "enable-background": "new 0 0 2447.6 2452.5",
159
+ viewBox: "0 0 2447.6 2452.5",
160
+ xmlns: "http://www.w3.org/2000/svg",
161
+ children: /* @__PURE__ */ jsxDEV("g", {
162
+ "clip-rule": "evenodd",
163
+ "fill-rule": "evenodd",
164
+ children: [
165
+ /* @__PURE__ */ jsxDEV("path", {
166
+ d: "m897.4 0c-135.3.1-244.8 109.9-244.7 245.2-.1 135.3 109.5 245.1 244.8 245.2h244.8v-245.1c.1-135.3-109.5-245.1-244.9-245.3.1 0 .1 0 0 0m0 654h-652.6c-135.3.1-244.9 109.9-244.8 245.2-.2 135.3 109.4 245.1 244.7 245.3h652.7c135.3-.1 244.9-109.9 244.8-245.2.1-135.4-109.5-245.2-244.8-245.3z",
167
+ fill: "#36c5f0"
168
+ }, undefined, false, undefined, this),
169
+ /* @__PURE__ */ jsxDEV("path", {
170
+ d: "m2447.6 899.2c.1-135.3-109.5-245.1-244.8-245.2-135.3.1-244.9 109.9-244.8 245.2v245.3h244.8c135.3-.1 244.9-109.9 244.8-245.3zm-652.7 0v-654c.1-135.2-109.4-245-244.7-245.2-135.3.1-244.9 109.9-244.8 245.2v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.3z",
171
+ fill: "#2eb67d"
172
+ }, undefined, false, undefined, this),
173
+ /* @__PURE__ */ jsxDEV("path", {
174
+ d: "m1550.1 2452.5c135.3-.1 244.9-109.9 244.8-245.2.1-135.3-109.5-245.1-244.8-245.2h-244.8v245.2c-.1 135.2 109.5 245 244.8 245.2zm0-654.1h652.7c135.3-.1 244.9-109.9 244.8-245.2.2-135.3-109.4-245.1-244.7-245.3h-652.7c-135.3.1-244.9 109.9-244.8 245.2-.1 135.4 109.4 245.2 244.7 245.3z",
175
+ fill: "#ecb22e"
176
+ }, undefined, false, undefined, this),
177
+ /* @__PURE__ */ jsxDEV("path", {
178
+ d: "m0 1553.2c-.1 135.3 109.5 245.1 244.8 245.2 135.3-.1 244.9-109.9 244.8-245.2v-245.2h-244.8c-135.3.1-244.9 109.9-244.8 245.2zm652.7 0v654c-.2 135.3 109.4 245.1 244.7 245.3 135.3-.1 244.9-109.9 244.8-245.2v-653.9c.2-135.3-109.4-245.1-244.7-245.3-135.4 0-244.9 109.8-244.8 245.1 0 0 0 .1 0 0",
179
+ fill: "#e01e5a"
180
+ }, undefined, false, undefined, this)
181
+ ]
182
+ }, undefined, true, undefined, this)
183
+ }, undefined, false, undefined, this)
184
+ };
185
+ export {
186
+ Select
187
+ };
@@ -0,0 +1,115 @@
1
+ // src/ui/theme.ts
2
+ var THEME_OPENAUTH = {
3
+ title: "OpenAuth",
4
+ radius: "none",
5
+ background: {
6
+ dark: "black",
7
+ light: "white"
8
+ },
9
+ primary: {
10
+ dark: "white",
11
+ light: "black"
12
+ },
13
+ font: {
14
+ family: "IBM Plex Sans, sans-serif"
15
+ },
16
+ css: `
17
+ @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@100;200;300;400;500;600;700&display=swap');
18
+ `
19
+ };
20
+ var THEME_TERMINAL = {
21
+ title: "terminal",
22
+ radius: "none",
23
+ favicon: "https://www.terminal.shop/favicon.svg",
24
+ logo: {
25
+ dark: "https://www.terminal.shop/images/logo-white.svg",
26
+ light: "https://www.terminal.shop/images/logo-black.svg"
27
+ },
28
+ primary: "#ff5e00",
29
+ background: {
30
+ dark: "rgb(0, 0, 0)",
31
+ light: "rgb(255, 255, 255)"
32
+ },
33
+ font: {
34
+ family: "Geist Mono, monospace"
35
+ },
36
+ css: `
37
+ @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100;200;300;400;500;600;700;800;900&display=swap');
38
+ `
39
+ };
40
+ var THEME_SST = {
41
+ title: "SST",
42
+ favicon: "https://sst.dev/favicon.svg",
43
+ logo: {
44
+ dark: "https://sst.dev/favicon.svg",
45
+ light: "https://sst.dev/favicon.svg"
46
+ },
47
+ background: {
48
+ dark: "#1a1a2d",
49
+ light: "rgb(255, 255, 255)"
50
+ },
51
+ primary: "#f3663f",
52
+ font: {
53
+ family: "Rubik, sans-serif"
54
+ },
55
+ css: `
56
+ @import url('https://fonts.googleapis.com/css2?family=Rubik:wght@100;200;300;400;500;600;700;800;900&display=swap');
57
+ `
58
+ };
59
+ var THEME_SUPABASE = {
60
+ title: "Supabase",
61
+ logo: {
62
+ dark: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-dark.svg&w=128&q=75",
63
+ light: "https://supabase.com/dashboard/_next/image?url=%2Fdashboard%2Fimg%2Fsupabase-light.svg&w=128&q=75"
64
+ },
65
+ background: {
66
+ dark: "#171717",
67
+ light: "#f8f8f8"
68
+ },
69
+ primary: {
70
+ dark: "#006239",
71
+ light: "#72e3ad"
72
+ },
73
+ font: {
74
+ family: "Varela Round, sans-serif"
75
+ },
76
+ css: `
77
+ @import url('https://fonts.googleapis.com/css2?family=Varela+Round:wght@100;200;300;400;500;600;700;800;900&display=swap');
78
+ `
79
+ };
80
+ var THEME_VERCEL = {
81
+ title: "Vercel",
82
+ logo: {
83
+ dark: "https://vercel.com/mktng/_next/static/media/vercel-logotype-dark.e8c0a742.svg",
84
+ light: "https://vercel.com/mktng/_next/static/media/vercel-logotype-light.700a8d26.svg"
85
+ },
86
+ background: {
87
+ dark: "black",
88
+ light: "white"
89
+ },
90
+ primary: {
91
+ dark: "white",
92
+ light: "black"
93
+ },
94
+ font: {
95
+ family: "Geist, sans-serif"
96
+ },
97
+ css: `
98
+ @import url('https://fonts.googleapis.com/css2?family=Geist:wght@100;200;300;400;500;600;700;800;900&display=swap');
99
+ `
100
+ };
101
+ function setTheme(value) {
102
+ globalThis.OPENAUTH_THEME = value;
103
+ }
104
+ function getTheme() {
105
+ return globalThis.OPENAUTH_THEME || THEME_OPENAUTH;
106
+ }
107
+ export {
108
+ setTheme,
109
+ getTheme,
110
+ THEME_VERCEL,
111
+ THEME_TERMINAL,
112
+ THEME_SUPABASE,
113
+ THEME_SST,
114
+ THEME_OPENAUTH
115
+ };