@authrim/sveltekit 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.
Files changed (42) hide show
  1. package/LICENSE +191 -191
  2. package/README.md +527 -527
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +2 -2
  5. package/dist/components/AuthProvider.svelte +56 -56
  6. package/dist/components/ProtectedRoute.svelte +71 -71
  7. package/dist/components/SignInButton.svelte +93 -93
  8. package/dist/components/SignOutButton.svelte +72 -72
  9. package/dist/components/UserProfile.svelte +71 -71
  10. package/dist/direct-auth/session.d.ts +1 -1
  11. package/dist/direct-auth/session.d.ts.map +1 -1
  12. package/dist/direct-auth/session.js +4 -1
  13. package/dist/direct-auth/social.d.ts +1 -1
  14. package/dist/direct-auth/social.d.ts.map +1 -1
  15. package/dist/direct-auth/social.js +29 -2
  16. package/dist/ui/account/LinkAccountButton.svelte +133 -133
  17. package/dist/ui/account/LinkedAccountsList.svelte +233 -233
  18. package/dist/ui/account/UnlinkAccountButton.svelte +179 -179
  19. package/dist/ui/forms/EmailCodeForm.svelte +224 -224
  20. package/dist/ui/forms/PasskeyConditionalInput.svelte +173 -173
  21. package/dist/ui/forms/SocialLoginButtons.svelte +209 -209
  22. package/dist/ui/helpers/AuthError.svelte +124 -124
  23. package/dist/ui/helpers/AuthLoading.svelte +83 -83
  24. package/dist/ui/helpers/OTPInput.svelte +214 -214
  25. package/dist/ui/helpers/ResendCodeButton.svelte +140 -140
  26. package/dist/ui/passkey/PasskeyDeleteButton.svelte +177 -177
  27. package/dist/ui/passkey/PasskeyList.svelte +225 -225
  28. package/dist/ui/passkey/PasskeyRegisterButton.svelte +52 -52
  29. package/dist/ui/session/SessionExpiryIndicator.svelte +109 -109
  30. package/dist/ui/session/SessionList.svelte +231 -231
  31. package/dist/ui/session/SessionRevokeButton.svelte +72 -72
  32. package/dist/ui/shared/Badge.svelte +100 -100
  33. package/dist/ui/shared/Button.svelte +213 -213
  34. package/dist/ui/shared/Card.svelte +85 -85
  35. package/dist/ui/shared/Input.svelte +192 -192
  36. package/dist/ui/shared/Spinner.svelte +75 -75
  37. package/dist/ui/styles/base.css +168 -168
  38. package/dist/ui/styles/theme.css +279 -279
  39. package/dist/ui/templates/AccountSettingsTemplate.svelte +205 -205
  40. package/dist/ui/templates/LoginTemplate.svelte +234 -234
  41. package/dist/ui/templates/SignUpTemplate.svelte +345 -345
  42. package/package.json +112 -111
@@ -1,173 +1,173 @@
1
- <!--
2
- PasskeyConditionalInput Component
3
- Input field that supports WebAuthn conditional UI (autofill)
4
- -->
5
- <script lang="ts">
6
- import { createEventDispatcher } from 'svelte';
7
- import type { Size } from '../types.js';
8
-
9
- export let value = '';
10
- export let placeholder = 'Email or username';
11
- export let disabled = false;
12
- export let size: Size = 'md';
13
- export let label = '';
14
- export let showPasskeyHint = true;
15
- export let id = `passkey-input-${Math.random().toString(36).slice(2, 9)}`;
16
- let className = '';
17
- export { className as class };
18
-
19
- const dispatch = createEventDispatcher<{
20
- input: { value: string };
21
- focus: void;
22
- blur: void;
23
- }>();
24
-
25
- function handleInput(e: Event) {
26
- value = (e.target as HTMLInputElement).value;
27
- dispatch('input', { value });
28
- }
29
- </script>
30
-
31
- <div class="authrim-passkey-input {className}" {...$$restProps}>
32
- {#if label}
33
- <label for={id} class="authrim-passkey-input__label">{label}</label>
34
- {/if}
35
-
36
- <div class="authrim-passkey-input__wrap">
37
- <input
38
- {id}
39
- type="text"
40
- autocomplete="username webauthn"
41
- {placeholder}
42
- {value}
43
- {disabled}
44
- class="authrim-passkey-input__field authrim-passkey-input__field--{size}"
45
- on:input={handleInput}
46
- on:focus={() => dispatch('focus')}
47
- on:blur={() => dispatch('blur')}
48
- />
49
- {#if showPasskeyHint}
50
- <div class="authrim-passkey-input__hint" aria-hidden="true">
51
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
52
- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
53
- <circle cx="12" cy="16" r="1"/>
54
- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
55
- </svg>
56
- </div>
57
- {/if}
58
- </div>
59
-
60
- {#if showPasskeyHint}
61
- <p class="authrim-passkey-input__subtext">
62
- <svg viewBox="0 0 16 16" fill="currentColor" class="authrim-passkey-input__icon">
63
- <path d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 100-2 1 1 0 000 2z"/>
64
- </svg>
65
- Passkey suggestions will appear as you type
66
- </p>
67
- {/if}
68
- </div>
69
-
70
- <style>
71
- .authrim-passkey-input {
72
- display: flex;
73
- flex-direction: column;
74
- gap: var(--authrim-space-2);
75
- }
76
-
77
- .authrim-passkey-input__label {
78
- font-size: var(--authrim-text-sm);
79
- font-weight: 500;
80
- color: var(--authrim-color-text);
81
- letter-spacing: var(--authrim-tracking-tight);
82
- }
83
-
84
- .authrim-passkey-input__wrap {
85
- position: relative;
86
- }
87
-
88
- .authrim-passkey-input__field {
89
- width: 100%;
90
- font-family: var(--authrim-font-sans);
91
- font-size: var(--authrim-text-sm);
92
- background: var(--authrim-color-bg);
93
- border: 1.5px solid var(--authrim-color-border);
94
- border-radius: var(--authrim-radius-md);
95
- color: var(--authrim-color-text);
96
- transition:
97
- border-color var(--authrim-duration-fast) var(--authrim-ease-default),
98
- box-shadow var(--authrim-duration-fast) var(--authrim-ease-default);
99
- }
100
-
101
- .authrim-passkey-input__field::placeholder {
102
- color: var(--authrim-color-text-muted);
103
- }
104
-
105
- .authrim-passkey-input__field:hover:not(:disabled):not(:focus) {
106
- border-color: var(--authrim-color-border-strong);
107
- }
108
-
109
- .authrim-passkey-input__field:focus {
110
- outline: none;
111
- border-color: var(--authrim-color-primary);
112
- box-shadow: var(--authrim-shadow-focus);
113
- }
114
-
115
- .authrim-passkey-input__field:disabled {
116
- background: var(--authrim-color-bg-subtle);
117
- color: var(--authrim-color-text-muted);
118
- cursor: not-allowed;
119
- }
120
-
121
- .authrim-passkey-input__field--sm {
122
- height: 34px;
123
- padding: 0 var(--authrim-space-3);
124
- padding-right: 40px;
125
- }
126
-
127
- .authrim-passkey-input__field--md {
128
- height: 42px;
129
- padding: 0 var(--authrim-space-4);
130
- padding-right: 44px;
131
- }
132
-
133
- .authrim-passkey-input__field--lg {
134
- height: 50px;
135
- padding: 0 var(--authrim-space-4);
136
- padding-right: 48px;
137
- font-size: var(--authrim-text-base);
138
- }
139
-
140
- .authrim-passkey-input__hint {
141
- position: absolute;
142
- right: var(--authrim-space-3);
143
- top: 50%;
144
- transform: translateY(-50%);
145
- display: flex;
146
- align-items: center;
147
- justify-content: center;
148
- width: 24px;
149
- height: 24px;
150
- color: var(--authrim-color-text-muted);
151
- pointer-events: none;
152
- }
153
-
154
- .authrim-passkey-input__hint svg {
155
- width: 18px;
156
- height: 18px;
157
- }
158
-
159
- .authrim-passkey-input__subtext {
160
- display: flex;
161
- align-items: center;
162
- gap: var(--authrim-space-1);
163
- margin: 0;
164
- font-size: var(--authrim-text-xs);
165
- color: var(--authrim-color-text-muted);
166
- }
167
-
168
- .authrim-passkey-input__icon {
169
- width: 14px;
170
- height: 14px;
171
- flex-shrink: 0;
172
- }
173
- </style>
1
+ <!--
2
+ PasskeyConditionalInput Component
3
+ Input field that supports WebAuthn conditional UI (autofill)
4
+ -->
5
+ <script lang="ts">
6
+ import { createEventDispatcher } from 'svelte';
7
+ import type { Size } from '../types.js';
8
+
9
+ export let value = '';
10
+ export let placeholder = 'Email or username';
11
+ export let disabled = false;
12
+ export let size: Size = 'md';
13
+ export let label = '';
14
+ export let showPasskeyHint = true;
15
+ export let id = `passkey-input-${Math.random().toString(36).slice(2, 9)}`;
16
+ let className = '';
17
+ export { className as class };
18
+
19
+ const dispatch = createEventDispatcher<{
20
+ input: { value: string };
21
+ focus: void;
22
+ blur: void;
23
+ }>();
24
+
25
+ function handleInput(e: Event) {
26
+ value = (e.target as HTMLInputElement).value;
27
+ dispatch('input', { value });
28
+ }
29
+ </script>
30
+
31
+ <div class="authrim-passkey-input {className}" {...$$restProps}>
32
+ {#if label}
33
+ <label for={id} class="authrim-passkey-input__label">{label}</label>
34
+ {/if}
35
+
36
+ <div class="authrim-passkey-input__wrap">
37
+ <input
38
+ {id}
39
+ type="text"
40
+ autocomplete="username webauthn"
41
+ {placeholder}
42
+ {value}
43
+ {disabled}
44
+ class="authrim-passkey-input__field authrim-passkey-input__field--{size}"
45
+ on:input={handleInput}
46
+ on:focus={() => dispatch('focus')}
47
+ on:blur={() => dispatch('blur')}
48
+ />
49
+ {#if showPasskeyHint}
50
+ <div class="authrim-passkey-input__hint" aria-hidden="true">
51
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
52
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
53
+ <circle cx="12" cy="16" r="1"/>
54
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"/>
55
+ </svg>
56
+ </div>
57
+ {/if}
58
+ </div>
59
+
60
+ {#if showPasskeyHint}
61
+ <p class="authrim-passkey-input__subtext">
62
+ <svg viewBox="0 0 16 16" fill="currentColor" class="authrim-passkey-input__icon">
63
+ <path d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 100-2 1 1 0 000 2z"/>
64
+ </svg>
65
+ Passkey suggestions will appear as you type
66
+ </p>
67
+ {/if}
68
+ </div>
69
+
70
+ <style>
71
+ .authrim-passkey-input {
72
+ display: flex;
73
+ flex-direction: column;
74
+ gap: var(--authrim-space-2);
75
+ }
76
+
77
+ .authrim-passkey-input__label {
78
+ font-size: var(--authrim-text-sm);
79
+ font-weight: 500;
80
+ color: var(--authrim-color-text);
81
+ letter-spacing: var(--authrim-tracking-tight);
82
+ }
83
+
84
+ .authrim-passkey-input__wrap {
85
+ position: relative;
86
+ }
87
+
88
+ .authrim-passkey-input__field {
89
+ width: 100%;
90
+ font-family: var(--authrim-font-sans);
91
+ font-size: var(--authrim-text-sm);
92
+ background: var(--authrim-color-bg);
93
+ border: 1.5px solid var(--authrim-color-border);
94
+ border-radius: var(--authrim-radius-md);
95
+ color: var(--authrim-color-text);
96
+ transition:
97
+ border-color var(--authrim-duration-fast) var(--authrim-ease-default),
98
+ box-shadow var(--authrim-duration-fast) var(--authrim-ease-default);
99
+ }
100
+
101
+ .authrim-passkey-input__field::placeholder {
102
+ color: var(--authrim-color-text-muted);
103
+ }
104
+
105
+ .authrim-passkey-input__field:hover:not(:disabled):not(:focus) {
106
+ border-color: var(--authrim-color-border-strong);
107
+ }
108
+
109
+ .authrim-passkey-input__field:focus {
110
+ outline: none;
111
+ border-color: var(--authrim-color-primary);
112
+ box-shadow: var(--authrim-shadow-focus);
113
+ }
114
+
115
+ .authrim-passkey-input__field:disabled {
116
+ background: var(--authrim-color-bg-subtle);
117
+ color: var(--authrim-color-text-muted);
118
+ cursor: not-allowed;
119
+ }
120
+
121
+ .authrim-passkey-input__field--sm {
122
+ height: 34px;
123
+ padding: 0 var(--authrim-space-3);
124
+ padding-right: 40px;
125
+ }
126
+
127
+ .authrim-passkey-input__field--md {
128
+ height: 42px;
129
+ padding: 0 var(--authrim-space-4);
130
+ padding-right: 44px;
131
+ }
132
+
133
+ .authrim-passkey-input__field--lg {
134
+ height: 50px;
135
+ padding: 0 var(--authrim-space-4);
136
+ padding-right: 48px;
137
+ font-size: var(--authrim-text-base);
138
+ }
139
+
140
+ .authrim-passkey-input__hint {
141
+ position: absolute;
142
+ right: var(--authrim-space-3);
143
+ top: 50%;
144
+ transform: translateY(-50%);
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ width: 24px;
149
+ height: 24px;
150
+ color: var(--authrim-color-text-muted);
151
+ pointer-events: none;
152
+ }
153
+
154
+ .authrim-passkey-input__hint svg {
155
+ width: 18px;
156
+ height: 18px;
157
+ }
158
+
159
+ .authrim-passkey-input__subtext {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: var(--authrim-space-1);
163
+ margin: 0;
164
+ font-size: var(--authrim-text-xs);
165
+ color: var(--authrim-color-text-muted);
166
+ }
167
+
168
+ .authrim-passkey-input__icon {
169
+ width: 14px;
170
+ height: 14px;
171
+ flex-shrink: 0;
172
+ }
173
+ </style>