@authrim/sveltekit 0.1.0 → 0.1.2

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 (34) hide show
  1. package/LICENSE +191 -191
  2. package/README.md +527 -531
  3. package/dist/components/AuthProvider.svelte +56 -56
  4. package/dist/components/ProtectedRoute.svelte +71 -71
  5. package/dist/components/SignInButton.svelte +93 -93
  6. package/dist/components/SignOutButton.svelte +72 -72
  7. package/dist/components/UserProfile.svelte +71 -71
  8. package/dist/ui/account/LinkAccountButton.svelte +133 -133
  9. package/dist/ui/account/LinkedAccountsList.svelte +233 -233
  10. package/dist/ui/account/UnlinkAccountButton.svelte +179 -179
  11. package/dist/ui/forms/EmailCodeForm.svelte +224 -224
  12. package/dist/ui/forms/PasskeyConditionalInput.svelte +173 -173
  13. package/dist/ui/forms/SocialLoginButtons.svelte +209 -209
  14. package/dist/ui/helpers/AuthError.svelte +124 -124
  15. package/dist/ui/helpers/AuthLoading.svelte +83 -83
  16. package/dist/ui/helpers/OTPInput.svelte +214 -214
  17. package/dist/ui/helpers/ResendCodeButton.svelte +140 -140
  18. package/dist/ui/passkey/PasskeyDeleteButton.svelte +177 -177
  19. package/dist/ui/passkey/PasskeyList.svelte +225 -225
  20. package/dist/ui/passkey/PasskeyRegisterButton.svelte +52 -52
  21. package/dist/ui/session/SessionExpiryIndicator.svelte +109 -109
  22. package/dist/ui/session/SessionList.svelte +231 -231
  23. package/dist/ui/session/SessionRevokeButton.svelte +72 -72
  24. package/dist/ui/shared/Badge.svelte +100 -100
  25. package/dist/ui/shared/Button.svelte +213 -213
  26. package/dist/ui/shared/Card.svelte +85 -85
  27. package/dist/ui/shared/Input.svelte +192 -192
  28. package/dist/ui/shared/Spinner.svelte +75 -75
  29. package/dist/ui/styles/base.css +168 -168
  30. package/dist/ui/styles/theme.css +279 -279
  31. package/dist/ui/templates/AccountSettingsTemplate.svelte +205 -205
  32. package/dist/ui/templates/LoginTemplate.svelte +234 -234
  33. package/dist/ui/templates/SignUpTemplate.svelte +345 -345
  34. package/package.json +112 -111
@@ -1,100 +1,100 @@
1
- <!--
2
- Badge Component
3
- Status indicator with variants
4
- -->
5
- <script lang="ts">
6
- import type { Size } from '../types.js';
7
-
8
- export let variant: 'default' | 'success' | 'warning' | 'error' | 'info' | 'accent' = 'default';
9
- export let size: Size = 'md';
10
- export let dot = false;
11
- let className = '';
12
- export { className as class };
13
- </script>
14
-
15
- <span
16
- class="authrim-badge authrim-badge--{variant} authrim-badge--{size} {className}"
17
- class:authrim-badge--dot={dot}
18
- {...$$restProps}
19
- >
20
- {#if dot}
21
- <span class="authrim-badge__dot" aria-hidden="true"></span>
22
- {/if}
23
- <slot />
24
- </span>
25
-
26
- <style>
27
- .authrim-badge {
28
- display: inline-flex;
29
- align-items: center;
30
- gap: var(--authrim-space-1);
31
- font-family: var(--authrim-font-sans);
32
- font-weight: 500;
33
- border-radius: var(--authrim-radius-full);
34
- white-space: nowrap;
35
- letter-spacing: var(--authrim-tracking-tight);
36
- }
37
-
38
- /* Sizes */
39
- .authrim-badge--sm {
40
- height: 20px;
41
- padding: 0 var(--authrim-space-2);
42
- font-size: 11px;
43
- }
44
-
45
- .authrim-badge--md {
46
- height: 24px;
47
- padding: 0 var(--authrim-space-3);
48
- font-size: var(--authrim-text-xs);
49
- }
50
-
51
- .authrim-badge--lg {
52
- height: 28px;
53
- padding: 0 var(--authrim-space-3);
54
- font-size: var(--authrim-text-sm);
55
- }
56
-
57
- /* Variants */
58
- .authrim-badge--default {
59
- background: var(--authrim-color-bg-subtle);
60
- color: var(--authrim-color-text-secondary);
61
- }
62
-
63
- .authrim-badge--success {
64
- background: var(--authrim-color-success-subtle);
65
- color: var(--authrim-color-success-text);
66
- }
67
-
68
- .authrim-badge--warning {
69
- background: var(--authrim-color-warning-subtle);
70
- color: var(--authrim-color-warning-text);
71
- }
72
-
73
- .authrim-badge--error {
74
- background: var(--authrim-color-error-subtle);
75
- color: var(--authrim-color-error-text);
76
- }
77
-
78
- .authrim-badge--info {
79
- background: var(--authrim-color-info-subtle);
80
- color: var(--authrim-color-info-text);
81
- }
82
-
83
- .authrim-badge--accent {
84
- background: var(--authrim-color-primary-subtle);
85
- color: var(--authrim-color-primary);
86
- }
87
-
88
- /* Dot indicator */
89
- .authrim-badge__dot {
90
- width: 6px;
91
- height: 6px;
92
- border-radius: 50%;
93
- background: currentColor;
94
- }
95
-
96
- .authrim-badge--sm .authrim-badge__dot {
97
- width: 5px;
98
- height: 5px;
99
- }
100
- </style>
1
+ <!--
2
+ Badge Component
3
+ Status indicator with variants
4
+ -->
5
+ <script lang="ts">
6
+ import type { Size } from '../types.js';
7
+
8
+ export let variant: 'default' | 'success' | 'warning' | 'error' | 'info' | 'accent' = 'default';
9
+ export let size: Size = 'md';
10
+ export let dot = false;
11
+ let className = '';
12
+ export { className as class };
13
+ </script>
14
+
15
+ <span
16
+ class="authrim-badge authrim-badge--{variant} authrim-badge--{size} {className}"
17
+ class:authrim-badge--dot={dot}
18
+ {...$$restProps}
19
+ >
20
+ {#if dot}
21
+ <span class="authrim-badge__dot" aria-hidden="true"></span>
22
+ {/if}
23
+ <slot />
24
+ </span>
25
+
26
+ <style>
27
+ .authrim-badge {
28
+ display: inline-flex;
29
+ align-items: center;
30
+ gap: var(--authrim-space-1);
31
+ font-family: var(--authrim-font-sans);
32
+ font-weight: 500;
33
+ border-radius: var(--authrim-radius-full);
34
+ white-space: nowrap;
35
+ letter-spacing: var(--authrim-tracking-tight);
36
+ }
37
+
38
+ /* Sizes */
39
+ .authrim-badge--sm {
40
+ height: 20px;
41
+ padding: 0 var(--authrim-space-2);
42
+ font-size: 11px;
43
+ }
44
+
45
+ .authrim-badge--md {
46
+ height: 24px;
47
+ padding: 0 var(--authrim-space-3);
48
+ font-size: var(--authrim-text-xs);
49
+ }
50
+
51
+ .authrim-badge--lg {
52
+ height: 28px;
53
+ padding: 0 var(--authrim-space-3);
54
+ font-size: var(--authrim-text-sm);
55
+ }
56
+
57
+ /* Variants */
58
+ .authrim-badge--default {
59
+ background: var(--authrim-color-bg-subtle);
60
+ color: var(--authrim-color-text-secondary);
61
+ }
62
+
63
+ .authrim-badge--success {
64
+ background: var(--authrim-color-success-subtle);
65
+ color: var(--authrim-color-success-text);
66
+ }
67
+
68
+ .authrim-badge--warning {
69
+ background: var(--authrim-color-warning-subtle);
70
+ color: var(--authrim-color-warning-text);
71
+ }
72
+
73
+ .authrim-badge--error {
74
+ background: var(--authrim-color-error-subtle);
75
+ color: var(--authrim-color-error-text);
76
+ }
77
+
78
+ .authrim-badge--info {
79
+ background: var(--authrim-color-info-subtle);
80
+ color: var(--authrim-color-info-text);
81
+ }
82
+
83
+ .authrim-badge--accent {
84
+ background: var(--authrim-color-primary-subtle);
85
+ color: var(--authrim-color-primary);
86
+ }
87
+
88
+ /* Dot indicator */
89
+ .authrim-badge__dot {
90
+ width: 6px;
91
+ height: 6px;
92
+ border-radius: 50%;
93
+ background: currentColor;
94
+ }
95
+
96
+ .authrim-badge--sm .authrim-badge__dot {
97
+ width: 5px;
98
+ height: 5px;
99
+ }
100
+ </style>
@@ -1,213 +1,213 @@
1
- <!--
2
- Button Component
3
- Primary action component with variants and loading states
4
- -->
5
- <script lang="ts">
6
- import type { Size, Variant } from '../types.js';
7
- import Spinner from './Spinner.svelte';
8
-
9
- export let variant: Variant = 'primary';
10
- export let size: Size = 'md';
11
- export let loading = false;
12
- export let disabled = false;
13
- export let fullWidth = false;
14
- export let type: 'button' | 'submit' | 'reset' = 'button';
15
- let className = '';
16
- export { className as class };
17
-
18
- $: isDisabled = disabled || loading;
19
- </script>
20
-
21
- <button
22
- {type}
23
- disabled={isDisabled}
24
- class="authrim-btn authrim-btn--{variant} authrim-btn--{size} {className}"
25
- class:authrim-btn--loading={loading}
26
- class:authrim-btn--full={fullWidth}
27
- on:click
28
- on:focus
29
- on:blur
30
- {...$$restProps}
31
- >
32
- {#if loading}
33
- <span class="authrim-btn__spinner">
34
- <Spinner size={size === 'lg' ? 'md' : 'sm'} />
35
- </span>
36
- {/if}
37
- <span class="authrim-btn__content" class:authrim-btn__content--hidden={loading}>
38
- <slot />
39
- </span>
40
- </button>
41
-
42
- <style>
43
- .authrim-btn {
44
- position: relative;
45
- display: inline-flex;
46
- align-items: center;
47
- justify-content: center;
48
- gap: var(--authrim-space-2);
49
- font-family: var(--authrim-font-sans);
50
- font-weight: 600;
51
- letter-spacing: var(--authrim-tracking-tight);
52
- border: 1.5px solid transparent;
53
- border-radius: var(--authrim-radius-md);
54
- cursor: pointer;
55
- white-space: nowrap;
56
- user-select: none;
57
- transition:
58
- background-color var(--authrim-duration-fast) var(--authrim-ease-default),
59
- border-color var(--authrim-duration-fast) var(--authrim-ease-default),
60
- color var(--authrim-duration-fast) var(--authrim-ease-default),
61
- box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
62
- transform var(--authrim-duration-fast) var(--authrim-ease-default);
63
- }
64
-
65
- .authrim-btn:focus-visible {
66
- outline: none;
67
- box-shadow: var(--authrim-shadow-focus);
68
- }
69
-
70
- .authrim-btn:active:not(:disabled) {
71
- transform: scale(0.98);
72
- }
73
-
74
- .authrim-btn:disabled {
75
- opacity: 0.5;
76
- cursor: not-allowed;
77
- }
78
-
79
- /* Sizes */
80
- .authrim-btn--sm {
81
- height: 34px;
82
- padding: 0 var(--authrim-space-3);
83
- font-size: var(--authrim-text-sm);
84
- border-radius: var(--authrim-radius-sm);
85
- }
86
-
87
- .authrim-btn--md {
88
- height: 42px;
89
- padding: 0 var(--authrim-space-5);
90
- font-size: var(--authrim-text-sm);
91
- }
92
-
93
- .authrim-btn--lg {
94
- height: 50px;
95
- padding: 0 var(--authrim-space-6);
96
- font-size: var(--authrim-text-base);
97
- border-radius: var(--authrim-radius-lg);
98
- }
99
-
100
- /* Primary */
101
- .authrim-btn--primary {
102
- background: linear-gradient(
103
- 180deg,
104
- var(--authrim-color-primary) 0%,
105
- var(--authrim-color-primary-active) 100%
106
- );
107
- border-color: var(--authrim-color-primary-active);
108
- color: var(--authrim-color-primary-text);
109
- box-shadow:
110
- var(--authrim-shadow-sm),
111
- inset 0 1px 0 rgba(255, 255, 255, 0.1);
112
- }
113
-
114
- .authrim-btn--primary:hover:not(:disabled) {
115
- background: linear-gradient(
116
- 180deg,
117
- var(--authrim-color-primary-hover) 0%,
118
- var(--authrim-color-primary) 100%
119
- );
120
- box-shadow:
121
- var(--authrim-shadow-md),
122
- inset 0 1px 0 rgba(255, 255, 255, 0.15);
123
- }
124
-
125
- /* Secondary */
126
- .authrim-btn--secondary {
127
- background: var(--authrim-color-bg-subtle);
128
- border-color: var(--authrim-color-border);
129
- color: var(--authrim-color-text);
130
- }
131
-
132
- .authrim-btn--secondary:hover:not(:disabled) {
133
- background: var(--authrim-color-bg-muted);
134
- border-color: var(--authrim-color-border-strong);
135
- }
136
-
137
- /* Outline */
138
- .authrim-btn--outline {
139
- background: transparent;
140
- border-color: var(--authrim-color-border-strong);
141
- color: var(--authrim-color-text);
142
- }
143
-
144
- .authrim-btn--outline:hover:not(:disabled) {
145
- background: var(--authrim-color-bg-subtle);
146
- border-color: var(--authrim-color-text-muted);
147
- }
148
-
149
- /* Ghost */
150
- .authrim-btn--ghost {
151
- background: transparent;
152
- border-color: transparent;
153
- color: var(--authrim-color-text-secondary);
154
- }
155
-
156
- .authrim-btn--ghost:hover:not(:disabled) {
157
- background: var(--authrim-color-bg-subtle);
158
- color: var(--authrim-color-text);
159
- }
160
-
161
- /* Destructive */
162
- .authrim-btn--destructive {
163
- background: linear-gradient(
164
- 180deg,
165
- var(--authrim-color-error) 0%,
166
- var(--authrim-color-error-hover) 100%
167
- );
168
- border-color: var(--authrim-color-error-hover);
169
- color: white;
170
- box-shadow:
171
- var(--authrim-shadow-sm),
172
- inset 0 1px 0 rgba(255, 255, 255, 0.1);
173
- }
174
-
175
- .authrim-btn--destructive:hover:not(:disabled) {
176
- background: linear-gradient(
177
- 180deg,
178
- var(--authrim-color-error-hover) 0%,
179
- var(--authrim-color-error) 100%
180
- );
181
- }
182
-
183
- .authrim-btn--destructive:focus-visible {
184
- box-shadow: var(--authrim-shadow-focus-error);
185
- }
186
-
187
- /* Full width */
188
- .authrim-btn--full {
189
- width: 100%;
190
- }
191
-
192
- /* Loading state */
193
- .authrim-btn--loading {
194
- cursor: wait;
195
- }
196
-
197
- .authrim-btn__spinner {
198
- position: absolute;
199
- display: flex;
200
- align-items: center;
201
- justify-content: center;
202
- }
203
-
204
- .authrim-btn__content {
205
- display: flex;
206
- align-items: center;
207
- gap: var(--authrim-space-2);
208
- }
209
-
210
- .authrim-btn__content--hidden {
211
- visibility: hidden;
212
- }
213
- </style>
1
+ <!--
2
+ Button Component
3
+ Primary action component with variants and loading states
4
+ -->
5
+ <script lang="ts">
6
+ import type { Size, Variant } from '../types.js';
7
+ import Spinner from './Spinner.svelte';
8
+
9
+ export let variant: Variant = 'primary';
10
+ export let size: Size = 'md';
11
+ export let loading = false;
12
+ export let disabled = false;
13
+ export let fullWidth = false;
14
+ export let type: 'button' | 'submit' | 'reset' = 'button';
15
+ let className = '';
16
+ export { className as class };
17
+
18
+ $: isDisabled = disabled || loading;
19
+ </script>
20
+
21
+ <button
22
+ {type}
23
+ disabled={isDisabled}
24
+ class="authrim-btn authrim-btn--{variant} authrim-btn--{size} {className}"
25
+ class:authrim-btn--loading={loading}
26
+ class:authrim-btn--full={fullWidth}
27
+ on:click
28
+ on:focus
29
+ on:blur
30
+ {...$$restProps}
31
+ >
32
+ {#if loading}
33
+ <span class="authrim-btn__spinner">
34
+ <Spinner size={size === 'lg' ? 'md' : 'sm'} />
35
+ </span>
36
+ {/if}
37
+ <span class="authrim-btn__content" class:authrim-btn__content--hidden={loading}>
38
+ <slot />
39
+ </span>
40
+ </button>
41
+
42
+ <style>
43
+ .authrim-btn {
44
+ position: relative;
45
+ display: inline-flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ gap: var(--authrim-space-2);
49
+ font-family: var(--authrim-font-sans);
50
+ font-weight: 600;
51
+ letter-spacing: var(--authrim-tracking-tight);
52
+ border: 1.5px solid transparent;
53
+ border-radius: var(--authrim-radius-md);
54
+ cursor: pointer;
55
+ white-space: nowrap;
56
+ user-select: none;
57
+ transition:
58
+ background-color var(--authrim-duration-fast) var(--authrim-ease-default),
59
+ border-color var(--authrim-duration-fast) var(--authrim-ease-default),
60
+ color var(--authrim-duration-fast) var(--authrim-ease-default),
61
+ box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
62
+ transform var(--authrim-duration-fast) var(--authrim-ease-default);
63
+ }
64
+
65
+ .authrim-btn:focus-visible {
66
+ outline: none;
67
+ box-shadow: var(--authrim-shadow-focus);
68
+ }
69
+
70
+ .authrim-btn:active:not(:disabled) {
71
+ transform: scale(0.98);
72
+ }
73
+
74
+ .authrim-btn:disabled {
75
+ opacity: 0.5;
76
+ cursor: not-allowed;
77
+ }
78
+
79
+ /* Sizes */
80
+ .authrim-btn--sm {
81
+ height: 34px;
82
+ padding: 0 var(--authrim-space-3);
83
+ font-size: var(--authrim-text-sm);
84
+ border-radius: var(--authrim-radius-sm);
85
+ }
86
+
87
+ .authrim-btn--md {
88
+ height: 42px;
89
+ padding: 0 var(--authrim-space-5);
90
+ font-size: var(--authrim-text-sm);
91
+ }
92
+
93
+ .authrim-btn--lg {
94
+ height: 50px;
95
+ padding: 0 var(--authrim-space-6);
96
+ font-size: var(--authrim-text-base);
97
+ border-radius: var(--authrim-radius-lg);
98
+ }
99
+
100
+ /* Primary */
101
+ .authrim-btn--primary {
102
+ background: linear-gradient(
103
+ 180deg,
104
+ var(--authrim-color-primary) 0%,
105
+ var(--authrim-color-primary-active) 100%
106
+ );
107
+ border-color: var(--authrim-color-primary-active);
108
+ color: var(--authrim-color-primary-text);
109
+ box-shadow:
110
+ var(--authrim-shadow-sm),
111
+ inset 0 1px 0 rgba(255, 255, 255, 0.1);
112
+ }
113
+
114
+ .authrim-btn--primary:hover:not(:disabled) {
115
+ background: linear-gradient(
116
+ 180deg,
117
+ var(--authrim-color-primary-hover) 0%,
118
+ var(--authrim-color-primary) 100%
119
+ );
120
+ box-shadow:
121
+ var(--authrim-shadow-md),
122
+ inset 0 1px 0 rgba(255, 255, 255, 0.15);
123
+ }
124
+
125
+ /* Secondary */
126
+ .authrim-btn--secondary {
127
+ background: var(--authrim-color-bg-subtle);
128
+ border-color: var(--authrim-color-border);
129
+ color: var(--authrim-color-text);
130
+ }
131
+
132
+ .authrim-btn--secondary:hover:not(:disabled) {
133
+ background: var(--authrim-color-bg-muted);
134
+ border-color: var(--authrim-color-border-strong);
135
+ }
136
+
137
+ /* Outline */
138
+ .authrim-btn--outline {
139
+ background: transparent;
140
+ border-color: var(--authrim-color-border-strong);
141
+ color: var(--authrim-color-text);
142
+ }
143
+
144
+ .authrim-btn--outline:hover:not(:disabled) {
145
+ background: var(--authrim-color-bg-subtle);
146
+ border-color: var(--authrim-color-text-muted);
147
+ }
148
+
149
+ /* Ghost */
150
+ .authrim-btn--ghost {
151
+ background: transparent;
152
+ border-color: transparent;
153
+ color: var(--authrim-color-text-secondary);
154
+ }
155
+
156
+ .authrim-btn--ghost:hover:not(:disabled) {
157
+ background: var(--authrim-color-bg-subtle);
158
+ color: var(--authrim-color-text);
159
+ }
160
+
161
+ /* Destructive */
162
+ .authrim-btn--destructive {
163
+ background: linear-gradient(
164
+ 180deg,
165
+ var(--authrim-color-error) 0%,
166
+ var(--authrim-color-error-hover) 100%
167
+ );
168
+ border-color: var(--authrim-color-error-hover);
169
+ color: white;
170
+ box-shadow:
171
+ var(--authrim-shadow-sm),
172
+ inset 0 1px 0 rgba(255, 255, 255, 0.1);
173
+ }
174
+
175
+ .authrim-btn--destructive:hover:not(:disabled) {
176
+ background: linear-gradient(
177
+ 180deg,
178
+ var(--authrim-color-error-hover) 0%,
179
+ var(--authrim-color-error) 100%
180
+ );
181
+ }
182
+
183
+ .authrim-btn--destructive:focus-visible {
184
+ box-shadow: var(--authrim-shadow-focus-error);
185
+ }
186
+
187
+ /* Full width */
188
+ .authrim-btn--full {
189
+ width: 100%;
190
+ }
191
+
192
+ /* Loading state */
193
+ .authrim-btn--loading {
194
+ cursor: wait;
195
+ }
196
+
197
+ .authrim-btn__spinner {
198
+ position: absolute;
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ }
203
+
204
+ .authrim-btn__content {
205
+ display: flex;
206
+ align-items: center;
207
+ gap: var(--authrim-space-2);
208
+ }
209
+
210
+ .authrim-btn__content--hidden {
211
+ visibility: hidden;
212
+ }
213
+ </style>