@drmhse/authos-vue 0.1.4 → 0.2.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/index.js CHANGED
@@ -8,6 +8,440 @@ var ssoSdk = require('@drmhse/sso-sdk');
8
8
  // src/types.ts
9
9
  var AUTH_OS_INJECTION_KEY = /* @__PURE__ */ Symbol("authOS");
10
10
 
11
+ // src/styles.ts
12
+ var AUTHOS_STYLES = `
13
+ /* ==========================================================================
14
+ AuthOS Component Styles
15
+ CSS Variables + Default Theme
16
+ ========================================================================== */
17
+
18
+ :root {
19
+ /* Primary Colors */
20
+ --authos-color-primary: #6366f1;
21
+ --authos-color-primary-hover: #4f46e5;
22
+ --authos-color-primary-foreground: #ffffff;
23
+
24
+ /* Semantic Colors */
25
+ --authos-color-danger: #ef4444;
26
+ --authos-color-danger-foreground: #ffffff;
27
+ --authos-color-success: #22c55e;
28
+ --authos-color-warning: #f59e0b;
29
+
30
+ /* Surface Colors */
31
+ --authos-color-background: #ffffff;
32
+ --authos-color-surface: #ffffff;
33
+ --authos-color-foreground: #0f172a;
34
+ --authos-color-muted: #64748b;
35
+ --authos-color-muted-foreground: #64748b;
36
+
37
+ /* Component Colors */
38
+ --authos-color-border: #e2e8f0;
39
+ --authos-color-input: #ffffff;
40
+ --authos-color-input-border: #cbd5e1;
41
+ --authos-color-input-focus: #6366f1;
42
+ --authos-color-ring: rgba(99, 102, 241, 0.25);
43
+
44
+ /* Typography */
45
+ --authos-font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
46
+ --authos-font-size-xs: 0.75rem;
47
+ --authos-font-size-sm: 0.875rem;
48
+ --authos-font-size-base: 1rem;
49
+ --authos-font-size-lg: 1.125rem;
50
+
51
+ /* Spacing & Shape */
52
+ --authos-border-radius: 0.5rem;
53
+ --authos-border-radius-sm: 0.375rem;
54
+ --authos-border-radius-lg: 0.75rem;
55
+ --authos-spacing-xs: 0.25rem;
56
+ --authos-spacing-sm: 0.5rem;
57
+ --authos-spacing-md: 1rem;
58
+ --authos-spacing-lg: 1.5rem;
59
+
60
+ /* Shadows */
61
+ --authos-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
62
+ --authos-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
63
+ --authos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
64
+
65
+ /* Transitions */
66
+ --authos-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
67
+ }
68
+
69
+ /* Dark Mode */
70
+ @media (prefers-color-scheme: dark) {
71
+ :root {
72
+ --authos-color-primary: #818cf8;
73
+ --authos-color-primary-hover: #a5b4fc;
74
+
75
+ --authos-color-background: #0f172a;
76
+ --authos-color-surface: #1e293b;
77
+ --authos-color-foreground: #f1f5f9;
78
+ --authos-color-muted: #94a3b8;
79
+ --authos-color-muted-foreground: #94a3b8;
80
+
81
+ --authos-color-border: #334155;
82
+ --authos-color-input: #1e293b;
83
+ --authos-color-input-border: #475569;
84
+
85
+ --authos-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
86
+ --authos-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
87
+ --authos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
88
+ }
89
+ }
90
+
91
+ /* ==========================================================================
92
+ Base Form Styles
93
+ ========================================================================== */
94
+
95
+ [data-authos-signin],
96
+ [data-authos-signup],
97
+ [data-authos-magiclink],
98
+ [data-authos-passkey] {
99
+ font-family: var(--authos-font-family);
100
+ font-size: var(--authos-font-size-sm);
101
+ color: var(--authos-color-foreground);
102
+ width: 100%;
103
+ }
104
+
105
+ [data-authos-signin] form,
106
+ [data-authos-signup] form,
107
+ [data-authos-magiclink] form,
108
+ [data-authos-passkey] form {
109
+ display: flex;
110
+ flex-direction: column;
111
+ gap: var(--authos-spacing-md);
112
+ }
113
+
114
+ /* ==========================================================================
115
+ Field Styles
116
+ ========================================================================== */
117
+
118
+ [data-authos-field] {
119
+ display: flex;
120
+ flex-direction: column;
121
+ gap: var(--authos-spacing-xs);
122
+ }
123
+
124
+ [data-authos-field] label {
125
+ font-size: var(--authos-font-size-sm);
126
+ font-weight: 500;
127
+ color: var(--authos-color-foreground);
128
+ }
129
+
130
+ [data-authos-field] input {
131
+ width: 100%;
132
+ padding: 0.625rem 0.875rem;
133
+ font-size: var(--authos-font-size-sm);
134
+ font-family: inherit;
135
+ color: var(--authos-color-foreground);
136
+ background-color: var(--authos-color-input);
137
+ border: 1px solid var(--authos-color-input-border);
138
+ border-radius: var(--authos-border-radius);
139
+ outline: none;
140
+ transition: border-color var(--authos-transition), box-shadow var(--authos-transition);
141
+ }
142
+
143
+ [data-authos-field] input::placeholder {
144
+ color: var(--authos-color-muted);
145
+ }
146
+
147
+ [data-authos-field] input:focus {
148
+ border-color: var(--authos-color-input-focus);
149
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
150
+ }
151
+
152
+ [data-authos-field] input:disabled {
153
+ opacity: 0.6;
154
+ cursor: not-allowed;
155
+ }
156
+
157
+ /* ==========================================================================
158
+ Button Styles
159
+ ========================================================================== */
160
+
161
+ [data-authos-submit] {
162
+ display: inline-flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ gap: var(--authos-spacing-sm);
166
+ width: 100%;
167
+ padding: 0.625rem 1rem;
168
+ font-size: var(--authos-font-size-sm);
169
+ font-weight: 500;
170
+ font-family: inherit;
171
+ color: var(--authos-color-primary-foreground);
172
+ background-color: var(--authos-color-primary);
173
+ border: none;
174
+ border-radius: var(--authos-border-radius);
175
+ cursor: pointer;
176
+ outline: none;
177
+ transition: background-color var(--authos-transition), box-shadow var(--authos-transition);
178
+ }
179
+
180
+ [data-authos-submit]:hover:not(:disabled) {
181
+ background-color: var(--authos-color-primary-hover);
182
+ }
183
+
184
+ [data-authos-submit]:focus-visible {
185
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
186
+ }
187
+
188
+ [data-authos-submit]:disabled {
189
+ opacity: 0.6;
190
+ cursor: not-allowed;
191
+ }
192
+
193
+ [data-authos-back] {
194
+ display: inline-flex;
195
+ align-items: center;
196
+ justify-content: center;
197
+ padding: 0.5rem 1rem;
198
+ font-size: var(--authos-font-size-sm);
199
+ font-weight: 500;
200
+ font-family: inherit;
201
+ color: var(--authos-color-muted);
202
+ background: transparent;
203
+ border: none;
204
+ border-radius: var(--authos-border-radius);
205
+ cursor: pointer;
206
+ transition: color var(--authos-transition);
207
+ }
208
+
209
+ [data-authos-back]:hover {
210
+ color: var(--authos-color-foreground);
211
+ }
212
+
213
+ /* ==========================================================================
214
+ OAuth Button Styles
215
+ ========================================================================== */
216
+
217
+ [data-authos-oauth] {
218
+ display: inline-flex;
219
+ align-items: center;
220
+ justify-content: center;
221
+ gap: 0.75rem;
222
+ width: 100%;
223
+ padding: 0.625rem 1rem;
224
+ font-size: var(--authos-font-size-sm);
225
+ font-weight: 500;
226
+ font-family: var(--authos-font-family);
227
+ color: var(--authos-color-foreground);
228
+ background-color: var(--authos-color-surface);
229
+ border: 1px solid var(--authos-color-border);
230
+ border-radius: var(--authos-border-radius);
231
+ cursor: pointer;
232
+ outline: none;
233
+ transition: background-color var(--authos-transition), border-color var(--authos-transition), box-shadow var(--authos-transition);
234
+ }
235
+
236
+ [data-authos-oauth]:hover:not(:disabled) {
237
+ background-color: var(--authos-color-background);
238
+ border-color: var(--authos-color-input-border);
239
+ }
240
+
241
+ [data-authos-oauth]:focus-visible {
242
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
243
+ }
244
+
245
+ [data-authos-oauth]:disabled {
246
+ opacity: 0.6;
247
+ cursor: not-allowed;
248
+ }
249
+
250
+ [data-authos-oauth] svg {
251
+ width: 1.25rem;
252
+ height: 1.25rem;
253
+ flex-shrink: 0;
254
+ }
255
+
256
+ /* ==========================================================================
257
+ Divider Styles
258
+ ========================================================================== */
259
+
260
+ [data-authos-divider] {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: var(--authos-spacing-md);
264
+ margin: var(--authos-spacing-sm) 0;
265
+ }
266
+
267
+ [data-authos-divider]::before,
268
+ [data-authos-divider]::after {
269
+ content: '';
270
+ flex: 1;
271
+ height: 1px;
272
+ background-color: var(--authos-color-border);
273
+ }
274
+
275
+ [data-authos-divider] span {
276
+ font-size: var(--authos-font-size-xs);
277
+ color: var(--authos-color-muted);
278
+ text-transform: uppercase;
279
+ letter-spacing: 0.05em;
280
+ }
281
+
282
+ /* ==========================================================================
283
+ Error Styles
284
+ ========================================================================== */
285
+
286
+ [data-authos-error] {
287
+ display: flex;
288
+ align-items: center;
289
+ gap: var(--authos-spacing-sm);
290
+ padding: 0.75rem 1rem;
291
+ font-size: var(--authos-font-size-sm);
292
+ color: var(--authos-color-danger);
293
+ background-color: rgba(239, 68, 68, 0.1);
294
+ border: 1px solid rgba(239, 68, 68, 0.2);
295
+ border-radius: var(--authos-border-radius);
296
+ }
297
+
298
+ /* ==========================================================================
299
+ Link Styles
300
+ ========================================================================== */
301
+
302
+ [data-authos-link] {
303
+ font-size: var(--authos-font-size-sm);
304
+ color: var(--authos-color-primary);
305
+ text-decoration: none;
306
+ transition: color var(--authos-transition);
307
+ }
308
+
309
+ [data-authos-link]:hover {
310
+ color: var(--authos-color-primary-hover);
311
+ text-decoration: underline;
312
+ }
313
+
314
+ [data-authos-signup-prompt],
315
+ [data-authos-signin-prompt] {
316
+ text-align: center;
317
+ font-size: var(--authos-font-size-sm);
318
+ color: var(--authos-color-muted);
319
+ margin-top: var(--authos-spacing-sm);
320
+ }
321
+
322
+ /* ==========================================================================
323
+ OAuth Section
324
+ ========================================================================== */
325
+
326
+ [data-authos-oauth-section] {
327
+ display: flex;
328
+ flex-direction: column;
329
+ gap: var(--authos-spacing-sm);
330
+ }
331
+
332
+ /* ==========================================================================
333
+ User Button Styles
334
+ ========================================================================== */
335
+
336
+ [data-authos-userbutton] {
337
+ display: inline-flex;
338
+ align-items: center;
339
+ gap: var(--authos-spacing-sm);
340
+ font-family: var(--authos-font-family);
341
+ font-size: var(--authos-font-size-sm);
342
+ color: var(--authos-color-foreground);
343
+ }
344
+
345
+ [data-authos-userbutton] [data-authos-avatar] {
346
+ display: flex;
347
+ align-items: center;
348
+ justify-content: center;
349
+ width: 2rem;
350
+ height: 2rem;
351
+ font-size: var(--authos-font-size-xs);
352
+ font-weight: 600;
353
+ color: var(--authos-color-primary-foreground);
354
+ background-color: var(--authos-color-primary);
355
+ border-radius: 50%;
356
+ }
357
+
358
+ [data-authos-userbutton] [data-authos-email] {
359
+ color: var(--authos-color-foreground);
360
+ }
361
+
362
+ [data-authos-userbutton] [data-authos-logout] {
363
+ padding: 0.375rem 0.75rem;
364
+ font-size: var(--authos-font-size-xs);
365
+ font-weight: 500;
366
+ font-family: inherit;
367
+ color: var(--authos-color-muted);
368
+ background: transparent;
369
+ border: 1px solid var(--authos-color-border);
370
+ border-radius: var(--authos-border-radius-sm);
371
+ cursor: pointer;
372
+ transition: color var(--authos-transition), border-color var(--authos-transition);
373
+ }
374
+
375
+ [data-authos-userbutton] [data-authos-logout]:hover:not(:disabled) {
376
+ color: var(--authos-color-danger);
377
+ border-color: var(--authos-color-danger);
378
+ }
379
+
380
+ /* ==========================================================================
381
+ Organization Switcher Styles
382
+ ========================================================================== */
383
+
384
+ [data-authos-orgswitcher] {
385
+ font-family: var(--authos-font-family);
386
+ font-size: var(--authos-font-size-sm);
387
+ }
388
+
389
+ [data-authos-orgswitcher] select {
390
+ padding: 0.5rem 2rem 0.5rem 0.75rem;
391
+ font-size: var(--authos-font-size-sm);
392
+ font-family: inherit;
393
+ color: var(--authos-color-foreground);
394
+ background-color: var(--authos-color-input);
395
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
396
+ background-repeat: no-repeat;
397
+ background-position: right 0.5rem center;
398
+ border: 1px solid var(--authos-color-input-border);
399
+ border-radius: var(--authos-border-radius);
400
+ cursor: pointer;
401
+ outline: none;
402
+ appearance: none;
403
+ -webkit-appearance: none;
404
+ -moz-appearance: none;
405
+ transition: border-color var(--authos-transition), box-shadow var(--authos-transition);
406
+ }
407
+
408
+ [data-authos-orgswitcher] select:focus {
409
+ border-color: var(--authos-color-input-focus);
410
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
411
+ }
412
+
413
+ [data-authos-orgswitcher] select:disabled {
414
+ opacity: 0.6;
415
+ cursor: not-allowed;
416
+ }
417
+
418
+ /* ==========================================================================
419
+ Loading State
420
+ ========================================================================== */
421
+
422
+ [data-state="loading"] {
423
+ opacity: 0.6;
424
+ }
425
+ `;
426
+ var stylesInjected = false;
427
+ function injectStyles() {
428
+ if (stylesInjected) return;
429
+ if (typeof document === "undefined") return;
430
+ const styleElement = document.createElement("style");
431
+ styleElement.setAttribute("data-authos-styles", "");
432
+ styleElement.textContent = AUTHOS_STYLES;
433
+ document.head.appendChild(styleElement);
434
+ stylesInjected = true;
435
+ }
436
+ function applyVariables(variables) {
437
+ if (typeof document === "undefined") return;
438
+ const root = document.documentElement;
439
+ for (const [key, value] of Object.entries(variables)) {
440
+ const cssVar = `--authos-${key.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
441
+ root.style.setProperty(cssVar, value);
442
+ }
443
+ }
444
+
11
445
  // src/plugin.ts
12
446
  function createAuthOS(options) {
13
447
  const getStorage = () => {
@@ -48,6 +482,10 @@ function createAuthOS(options) {
48
482
  };
49
483
  return {
50
484
  install(app) {
485
+ injectStyles();
486
+ if (options.appearance?.variables) {
487
+ applyVariables(options.appearance.variables);
488
+ }
51
489
  vue.nextTick(() => {
52
490
  setInitialToken();
53
491
  });
@@ -281,7 +719,7 @@ var SignIn = vue.defineComponent({
281
719
  },
282
720
  emits: ["success", "error"],
283
721
  setup(props, { slots, emit }) {
284
- const { client } = useAuthOS();
722
+ const { client, options } = useAuthOS();
285
723
  const email = vue.ref("");
286
724
  const password = vue.ref("");
287
725
  const mfaCode = vue.ref("");
@@ -296,7 +734,9 @@ var SignIn = vue.defineComponent({
296
734
  if (step.value === "credentials") {
297
735
  const result = await client.auth.login({
298
736
  email: email.value,
299
- password: password.value
737
+ password: password.value,
738
+ org_slug: options.org,
739
+ service_slug: options.service
300
740
  });
301
741
  if (result.expires_in === MFA_PREAUTH_EXPIRY) {
302
742
  preauthToken.value = result.access_token;
@@ -336,31 +776,83 @@ var SignIn = vue.defineComponent({
336
776
  if (slots.default) {
337
777
  return slots.default(slotProps);
338
778
  }
339
- return vue.h("form", { onSubmit: (e) => {
340
- e.preventDefault();
341
- submit();
342
- } }, [
343
- step.value === "credentials" ? [
344
- vue.h("input", {
345
- type: "email",
346
- value: email.value,
347
- placeholder: "Email",
348
- onInput: (e) => email.value = e.target.value
349
- }),
350
- vue.h("input", {
351
- type: "password",
352
- value: password.value,
353
- placeholder: "Password",
354
- onInput: (e) => password.value = e.target.value
355
- })
356
- ] : vue.h("input", {
357
- type: "text",
358
- value: mfaCode.value,
359
- placeholder: "MFA Code",
360
- onInput: (e) => mfaCode.value = e.target.value
361
- }),
362
- error.value && vue.h("p", { style: "color: red" }, error.value),
363
- vue.h("button", { type: "submit", disabled: isSubmitting.value }, isSubmitting.value ? "Signing in..." : "Sign In")
779
+ if (step.value === "mfa") {
780
+ return vue.h("div", { "data-authos-signin": "", "data-state": "mfa" }, [
781
+ vue.h("form", { onSubmit: (e) => {
782
+ e.preventDefault();
783
+ submit();
784
+ } }, [
785
+ vue.h("div", { "data-authos-field": "mfa-code" }, [
786
+ vue.h("label", { for: "authos-mfa-code" }, "Verification Code"),
787
+ vue.h("input", {
788
+ id: "authos-mfa-code",
789
+ type: "text",
790
+ inputMode: "numeric",
791
+ autocomplete: "one-time-code",
792
+ value: mfaCode.value,
793
+ placeholder: "Enter 6-digit code",
794
+ required: true,
795
+ disabled: isSubmitting.value,
796
+ onInput: (e) => mfaCode.value = e.target.value
797
+ })
798
+ ]),
799
+ error.value && vue.h("div", { "data-authos-error": "" }, error.value),
800
+ vue.h("button", {
801
+ type: "submit",
802
+ disabled: isSubmitting.value,
803
+ "data-authos-submit": ""
804
+ }, isSubmitting.value ? "Verifying..." : "Verify"),
805
+ vue.h("button", {
806
+ type: "button",
807
+ "data-authos-back": "",
808
+ onClick: () => {
809
+ step.value = "credentials";
810
+ mfaCode.value = "";
811
+ preauthToken.value = "";
812
+ error.value = null;
813
+ }
814
+ }, "Back to login")
815
+ ])
816
+ ]);
817
+ }
818
+ return vue.h("div", { "data-authos-signin": "", "data-state": "credentials" }, [
819
+ vue.h("form", { onSubmit: (e) => {
820
+ e.preventDefault();
821
+ submit();
822
+ } }, [
823
+ vue.h("div", { "data-authos-field": "email" }, [
824
+ vue.h("label", { for: "authos-email" }, "Email"),
825
+ vue.h("input", {
826
+ id: "authos-email",
827
+ type: "email",
828
+ autocomplete: "email",
829
+ value: email.value,
830
+ placeholder: "Enter your email",
831
+ required: true,
832
+ disabled: isSubmitting.value,
833
+ onInput: (e) => email.value = e.target.value
834
+ })
835
+ ]),
836
+ vue.h("div", { "data-authos-field": "password" }, [
837
+ vue.h("label", { for: "authos-password" }, "Password"),
838
+ vue.h("input", {
839
+ id: "authos-password",
840
+ type: "password",
841
+ autocomplete: "current-password",
842
+ value: password.value,
843
+ placeholder: "Enter your password",
844
+ required: true,
845
+ disabled: isSubmitting.value,
846
+ onInput: (e) => password.value = e.target.value
847
+ })
848
+ ]),
849
+ error.value && vue.h("div", { "data-authos-error": "" }, error.value),
850
+ vue.h("button", {
851
+ type: "submit",
852
+ disabled: isSubmitting.value,
853
+ "data-authos-submit": ""
854
+ }, isSubmitting.value ? "Signing in..." : "Sign In")
855
+ ])
364
856
  ]);
365
857
  };
366
858
  }
@@ -375,6 +867,16 @@ var SignUp = vue.defineComponent({
375
867
  onError: {
376
868
  type: Function,
377
869
  default: void 0
870
+ },
871
+ /** Organization slug for tenant context */
872
+ orgSlug: {
873
+ type: String,
874
+ default: void 0
875
+ },
876
+ /** Service slug for tenant attribution (used with orgSlug) */
877
+ serviceSlug: {
878
+ type: String,
879
+ default: void 0
378
880
  }
379
881
  },
380
882
  emits: ["success", "error"],
@@ -390,7 +892,9 @@ var SignUp = vue.defineComponent({
390
892
  try {
391
893
  await client.auth.register({
392
894
  email: email.value,
393
- password: password.value
895
+ password: password.value,
896
+ org_slug: props.orgSlug,
897
+ service_slug: props.serviceSlug
394
898
  });
395
899
  emit("success");
396
900
  props.onSuccess?.();
@@ -417,24 +921,44 @@ var SignUp = vue.defineComponent({
417
921
  if (slots.default) {
418
922
  return slots.default(slotProps);
419
923
  }
420
- return vue.h("form", { onSubmit: (e) => {
421
- e.preventDefault();
422
- submit();
423
- } }, [
424
- vue.h("input", {
425
- type: "email",
426
- value: email.value,
427
- placeholder: "Email",
428
- onInput: (e) => email.value = e.target.value
429
- }),
430
- vue.h("input", {
431
- type: "password",
432
- value: password.value,
433
- placeholder: "Password",
434
- onInput: (e) => password.value = e.target.value
435
- }),
436
- error.value && vue.h("p", { style: "color: red" }, error.value),
437
- vue.h("button", { type: "submit", disabled: isSubmitting.value }, isSubmitting.value ? "Creating account..." : "Sign Up")
924
+ return vue.h("div", { "data-authos-signup": "", "data-state": "credentials" }, [
925
+ vue.h("form", { onSubmit: (e) => {
926
+ e.preventDefault();
927
+ submit();
928
+ } }, [
929
+ vue.h("div", { "data-authos-field": "email" }, [
930
+ vue.h("label", { for: "authos-signup-email" }, "Email"),
931
+ vue.h("input", {
932
+ id: "authos-signup-email",
933
+ type: "email",
934
+ autocomplete: "email",
935
+ value: email.value,
936
+ placeholder: "Enter your email",
937
+ required: true,
938
+ disabled: isSubmitting.value,
939
+ onInput: (e) => email.value = e.target.value
940
+ })
941
+ ]),
942
+ vue.h("div", { "data-authos-field": "password" }, [
943
+ vue.h("label", { for: "authos-signup-password" }, "Password"),
944
+ vue.h("input", {
945
+ id: "authos-signup-password",
946
+ type: "password",
947
+ autocomplete: "new-password",
948
+ value: password.value,
949
+ placeholder: "Create a password",
950
+ required: true,
951
+ disabled: isSubmitting.value,
952
+ onInput: (e) => password.value = e.target.value
953
+ })
954
+ ]),
955
+ error.value && vue.h("div", { "data-authos-error": "" }, error.value),
956
+ vue.h("button", {
957
+ type: "submit",
958
+ disabled: isSubmitting.value,
959
+ "data-authos-submit": ""
960
+ }, isSubmitting.value ? "Creating account..." : "Sign Up")
961
+ ])
438
962
  ]);
439
963
  };
440
964
  }
@@ -525,11 +1049,17 @@ var UserButton = vue.defineComponent({
525
1049
  if (!user.value) {
526
1050
  return vue.h("div", { "data-authos-userbutton": "", "data-state": "signed-out" }, "Not signed in");
527
1051
  }
528
- return vue.h("div", { "data-authos-userbutton": "", "data-state": "signed-in", style: "display: flex; align-items: center; gap: 8px;" }, [
529
- vue.h("span", user.value.email),
1052
+ const getInitials = (email) => {
1053
+ const name = email.split("@")[0];
1054
+ return name.substring(0, 2).toUpperCase();
1055
+ };
1056
+ return vue.h("div", { "data-authos-userbutton": "", "data-state": "signed-in" }, [
1057
+ vue.h("div", { "data-authos-avatar": "" }, getInitials(user.value.email)),
1058
+ vue.h("span", { "data-authos-email": "" }, user.value.email),
530
1059
  vue.h(
531
1060
  "button",
532
1061
  {
1062
+ "data-authos-logout": "",
533
1063
  onClick: logout,
534
1064
  disabled: isLoggingOut.value
535
1065
  },
@@ -600,6 +1130,55 @@ var PROVIDER_NAMES = {
600
1130
  google: "Google",
601
1131
  microsoft: "Microsoft"
602
1132
  };
1133
+ function getProviderIcon(provider) {
1134
+ switch (provider) {
1135
+ case "github":
1136
+ return vue.h("svg", {
1137
+ xmlns: "http://www.w3.org/2000/svg",
1138
+ viewBox: "0 0 24 24",
1139
+ fill: "currentColor",
1140
+ "aria-hidden": "true"
1141
+ }, [
1142
+ vue.h("path", {
1143
+ d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
1144
+ })
1145
+ ]);
1146
+ case "google":
1147
+ return vue.h("svg", {
1148
+ xmlns: "http://www.w3.org/2000/svg",
1149
+ viewBox: "0 0 24 24",
1150
+ "aria-hidden": "true"
1151
+ }, [
1152
+ vue.h("path", {
1153
+ fill: "#4285F4",
1154
+ d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
1155
+ }),
1156
+ vue.h("path", {
1157
+ fill: "#34A853",
1158
+ d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
1159
+ }),
1160
+ vue.h("path", {
1161
+ fill: "#FBBC05",
1162
+ d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
1163
+ }),
1164
+ vue.h("path", {
1165
+ fill: "#EA4335",
1166
+ d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
1167
+ })
1168
+ ]);
1169
+ case "microsoft":
1170
+ return vue.h("svg", {
1171
+ xmlns: "http://www.w3.org/2000/svg",
1172
+ viewBox: "0 0 23 23",
1173
+ "aria-hidden": "true"
1174
+ }, [
1175
+ vue.h("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
1176
+ vue.h("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
1177
+ vue.h("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
1178
+ vue.h("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
1179
+ ]);
1180
+ }
1181
+ }
603
1182
  var OAuthButton = vue.defineComponent({
604
1183
  name: "OAuthButton",
605
1184
  props: {
@@ -663,7 +1242,10 @@ See: https://docs.authos.dev/vue/oauth-setup`
663
1242
  "data-authos-oauth": "",
664
1243
  "data-provider": props.provider
665
1244
  },
666
- `Continue with ${providerName.value}`
1245
+ [
1246
+ getProviderIcon(props.provider),
1247
+ vue.h("span", `Continue with ${providerName.value}`)
1248
+ ]
667
1249
  );
668
1250
  };
669
1251
  }