@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,85 +1,85 @@
1
- <!--
2
- Card Component
3
- Container with border, shadow, and optional header/footer
4
- -->
5
- <script lang="ts">
6
- export let padding: 'none' | 'sm' | 'md' | 'lg' = 'md';
7
- export let bordered = true;
8
- export let shadow: 'none' | 'sm' | 'md' | 'lg' = 'sm';
9
- export let hoverable = false;
10
- let className = '';
11
- export { className as class };
12
- </script>
13
-
14
- <div
15
- class="authrim-card authrim-card--p-{padding} authrim-card--shadow-{shadow} {className}"
16
- class:authrim-card--bordered={bordered}
17
- class:authrim-card--hoverable={hoverable}
18
- {...$$restProps}
19
- >
20
- {#if $$slots.header}
21
- <div class="authrim-card__header">
22
- <slot name="header" />
23
- </div>
24
- {/if}
25
-
26
- <div class="authrim-card__body">
27
- <slot />
28
- </div>
29
-
30
- {#if $$slots.footer}
31
- <div class="authrim-card__footer">
32
- <slot name="footer" />
33
- </div>
34
- {/if}
35
- </div>
36
-
37
- <style>
38
- .authrim-card {
39
- background: var(--authrim-color-bg);
40
- border-radius: var(--authrim-radius-lg);
41
- overflow: hidden;
42
- transition:
43
- box-shadow var(--authrim-duration-normal) var(--authrim-ease-default),
44
- transform var(--authrim-duration-normal) var(--authrim-ease-default);
45
- }
46
-
47
- .authrim-card--bordered {
48
- border: 1.5px solid var(--authrim-color-border);
49
- }
50
-
51
- .authrim-card--hoverable:hover {
52
- transform: translateY(-2px);
53
- box-shadow: var(--authrim-shadow-lg);
54
- }
55
-
56
- /* Shadows */
57
- .authrim-card--shadow-none { box-shadow: none; }
58
- .authrim-card--shadow-sm { box-shadow: var(--authrim-shadow-sm); }
59
- .authrim-card--shadow-md { box-shadow: var(--authrim-shadow-md); }
60
- .authrim-card--shadow-lg { box-shadow: var(--authrim-shadow-lg); }
61
-
62
- /* Padding */
63
- .authrim-card--p-none .authrim-card__body { padding: 0; }
64
- .authrim-card--p-sm .authrim-card__body { padding: var(--authrim-space-3); }
65
- .authrim-card--p-md .authrim-card__body { padding: var(--authrim-space-5); }
66
- .authrim-card--p-lg .authrim-card__body { padding: var(--authrim-space-6); }
67
-
68
- .authrim-card__header {
69
- padding: var(--authrim-space-4) var(--authrim-space-5);
70
- border-bottom: 1px solid var(--authrim-color-border);
71
- background: var(--authrim-color-bg-subtle);
72
- }
73
-
74
- .authrim-card--p-sm .authrim-card__header { padding: var(--authrim-space-3); }
75
- .authrim-card--p-lg .authrim-card__header { padding: var(--authrim-space-5) var(--authrim-space-6); }
76
-
77
- .authrim-card__footer {
78
- padding: var(--authrim-space-4) var(--authrim-space-5);
79
- border-top: 1px solid var(--authrim-color-border);
80
- background: var(--authrim-color-bg-subtle);
81
- }
82
-
83
- .authrim-card--p-sm .authrim-card__footer { padding: var(--authrim-space-3); }
84
- .authrim-card--p-lg .authrim-card__footer { padding: var(--authrim-space-5) var(--authrim-space-6); }
85
- </style>
1
+ <!--
2
+ Card Component
3
+ Container with border, shadow, and optional header/footer
4
+ -->
5
+ <script lang="ts">
6
+ export let padding: 'none' | 'sm' | 'md' | 'lg' = 'md';
7
+ export let bordered = true;
8
+ export let shadow: 'none' | 'sm' | 'md' | 'lg' = 'sm';
9
+ export let hoverable = false;
10
+ let className = '';
11
+ export { className as class };
12
+ </script>
13
+
14
+ <div
15
+ class="authrim-card authrim-card--p-{padding} authrim-card--shadow-{shadow} {className}"
16
+ class:authrim-card--bordered={bordered}
17
+ class:authrim-card--hoverable={hoverable}
18
+ {...$$restProps}
19
+ >
20
+ {#if $$slots.header}
21
+ <div class="authrim-card__header">
22
+ <slot name="header" />
23
+ </div>
24
+ {/if}
25
+
26
+ <div class="authrim-card__body">
27
+ <slot />
28
+ </div>
29
+
30
+ {#if $$slots.footer}
31
+ <div class="authrim-card__footer">
32
+ <slot name="footer" />
33
+ </div>
34
+ {/if}
35
+ </div>
36
+
37
+ <style>
38
+ .authrim-card {
39
+ background: var(--authrim-color-bg);
40
+ border-radius: var(--authrim-radius-lg);
41
+ overflow: hidden;
42
+ transition:
43
+ box-shadow var(--authrim-duration-normal) var(--authrim-ease-default),
44
+ transform var(--authrim-duration-normal) var(--authrim-ease-default);
45
+ }
46
+
47
+ .authrim-card--bordered {
48
+ border: 1.5px solid var(--authrim-color-border);
49
+ }
50
+
51
+ .authrim-card--hoverable:hover {
52
+ transform: translateY(-2px);
53
+ box-shadow: var(--authrim-shadow-lg);
54
+ }
55
+
56
+ /* Shadows */
57
+ .authrim-card--shadow-none { box-shadow: none; }
58
+ .authrim-card--shadow-sm { box-shadow: var(--authrim-shadow-sm); }
59
+ .authrim-card--shadow-md { box-shadow: var(--authrim-shadow-md); }
60
+ .authrim-card--shadow-lg { box-shadow: var(--authrim-shadow-lg); }
61
+
62
+ /* Padding */
63
+ .authrim-card--p-none .authrim-card__body { padding: 0; }
64
+ .authrim-card--p-sm .authrim-card__body { padding: var(--authrim-space-3); }
65
+ .authrim-card--p-md .authrim-card__body { padding: var(--authrim-space-5); }
66
+ .authrim-card--p-lg .authrim-card__body { padding: var(--authrim-space-6); }
67
+
68
+ .authrim-card__header {
69
+ padding: var(--authrim-space-4) var(--authrim-space-5);
70
+ border-bottom: 1px solid var(--authrim-color-border);
71
+ background: var(--authrim-color-bg-subtle);
72
+ }
73
+
74
+ .authrim-card--p-sm .authrim-card__header { padding: var(--authrim-space-3); }
75
+ .authrim-card--p-lg .authrim-card__header { padding: var(--authrim-space-5) var(--authrim-space-6); }
76
+
77
+ .authrim-card__footer {
78
+ padding: var(--authrim-space-4) var(--authrim-space-5);
79
+ border-top: 1px solid var(--authrim-color-border);
80
+ background: var(--authrim-color-bg-subtle);
81
+ }
82
+
83
+ .authrim-card--p-sm .authrim-card__footer { padding: var(--authrim-space-3); }
84
+ .authrim-card--p-lg .authrim-card__footer { padding: var(--authrim-space-5) var(--authrim-space-6); }
85
+ </style>
@@ -1,192 +1,192 @@
1
- <!--
2
- Input Component
3
- Text input with label and error states
4
- -->
5
- <script lang="ts">
6
- import type { Size } from '../types.js';
7
-
8
- export let type: 'text' | 'email' | 'password' | 'tel' | 'url' = 'text';
9
- export let size: Size = 'md';
10
- export let value = '';
11
- export let placeholder = '';
12
- export let disabled = false;
13
- export let error = false;
14
- export let errorMessage = '';
15
- export let label = '';
16
- export let required = false;
17
- export let fullWidth = false;
18
- export let id = '';
19
- let className = '';
20
- export { className as class };
21
-
22
- // Generate stable ID once on component creation
23
- const generatedId = `authrim-input-${Math.random().toString(36).slice(2, 9)}`;
24
- $: inputId = id || generatedId;
25
- $: hasError = error || !!errorMessage;
26
- </script>
27
-
28
- <div
29
- class="authrim-input-wrap {className}"
30
- class:authrim-input-wrap--full={fullWidth}
31
- >
32
- {#if label}
33
- <label for={inputId} class="authrim-input__label">
34
- {label}
35
- {#if required}
36
- <span class="authrim-input__required" aria-hidden="true">*</span>
37
- {/if}
38
- </label>
39
- {/if}
40
-
41
- <div class="authrim-input__container">
42
- <input
43
- id={inputId}
44
- {type}
45
- bind:value
46
- {placeholder}
47
- {disabled}
48
- {required}
49
- class="authrim-input authrim-input--{size}"
50
- class:authrim-input--error={hasError}
51
- aria-invalid={hasError}
52
- aria-describedby={errorMessage ? `${inputId}-error` : undefined}
53
- on:input
54
- on:focus
55
- on:blur
56
- on:keydown
57
- on:keyup
58
- {...$$restProps}
59
- />
60
- {#if $$slots.suffix}
61
- <div class="authrim-input__suffix">
62
- <slot name="suffix" />
63
- </div>
64
- {/if}
65
- </div>
66
-
67
- {#if errorMessage}
68
- <p id="{inputId}-error" class="authrim-input__error" role="alert">
69
- <svg class="authrim-input__error-icon" viewBox="0 0 16 16" fill="currentColor">
70
- <path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 10.5a.75.75 0 110-1.5.75.75 0 010 1.5zM8.75 8a.75.75 0 01-1.5 0V5a.75.75 0 011.5 0v3z"/>
71
- </svg>
72
- {errorMessage}
73
- </p>
74
- {/if}
75
- </div>
76
-
77
- <style>
78
- .authrim-input-wrap {
79
- display: flex;
80
- flex-direction: column;
81
- gap: var(--authrim-space-2);
82
- }
83
-
84
- .authrim-input-wrap--full {
85
- width: 100%;
86
- }
87
-
88
- .authrim-input__label {
89
- font-size: var(--authrim-text-sm);
90
- font-weight: 500;
91
- color: var(--authrim-color-text);
92
- letter-spacing: var(--authrim-tracking-tight);
93
- }
94
-
95
- .authrim-input__required {
96
- color: var(--authrim-color-error);
97
- margin-left: 2px;
98
- }
99
-
100
- .authrim-input__container {
101
- position: relative;
102
- display: flex;
103
- }
104
-
105
- .authrim-input {
106
- width: 100%;
107
- font-family: var(--authrim-font-sans);
108
- font-size: var(--authrim-text-sm);
109
- background: var(--authrim-color-bg);
110
- border: 1.5px solid var(--authrim-color-border);
111
- border-radius: var(--authrim-radius-md);
112
- color: var(--authrim-color-text);
113
- transition:
114
- border-color var(--authrim-duration-fast) var(--authrim-ease-default),
115
- box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
116
- background-color var(--authrim-duration-fast) var(--authrim-ease-default);
117
- }
118
-
119
- .authrim-input::placeholder {
120
- color: var(--authrim-color-text-muted);
121
- }
122
-
123
- .authrim-input:hover:not(:disabled):not(:focus) {
124
- border-color: var(--authrim-color-border-strong);
125
- }
126
-
127
- .authrim-input:focus {
128
- outline: none;
129
- border-color: var(--authrim-color-border-focus);
130
- box-shadow: var(--authrim-shadow-focus);
131
- }
132
-
133
- .authrim-input:disabled {
134
- background: var(--authrim-color-bg-subtle);
135
- color: var(--authrim-color-text-muted);
136
- cursor: not-allowed;
137
- }
138
-
139
- .authrim-input--error {
140
- border-color: var(--authrim-color-error);
141
- }
142
-
143
- .authrim-input--error:focus {
144
- border-color: var(--authrim-color-error);
145
- box-shadow: var(--authrim-shadow-focus-error);
146
- }
147
-
148
- /* Sizes */
149
- .authrim-input--sm {
150
- height: 34px;
151
- padding: 0 var(--authrim-space-3);
152
- border-radius: var(--authrim-radius-sm);
153
- }
154
-
155
- .authrim-input--md {
156
- height: 42px;
157
- padding: 0 var(--authrim-space-3);
158
- }
159
-
160
- .authrim-input--lg {
161
- height: 50px;
162
- padding: 0 var(--authrim-space-4);
163
- font-size: var(--authrim-text-base);
164
- border-radius: var(--authrim-radius-lg);
165
- }
166
-
167
- .authrim-input__suffix {
168
- position: absolute;
169
- right: var(--authrim-space-3);
170
- top: 50%;
171
- transform: translateY(-50%);
172
- display: flex;
173
- align-items: center;
174
- color: var(--authrim-color-text-muted);
175
- }
176
-
177
- .authrim-input__error {
178
- display: flex;
179
- align-items: center;
180
- gap: var(--authrim-space-1);
181
- font-size: var(--authrim-text-xs);
182
- color: var(--authrim-color-error);
183
- margin: 0;
184
- animation: authrim-fade-up var(--authrim-duration-fast) var(--authrim-ease-out);
185
- }
186
-
187
- .authrim-input__error-icon {
188
- width: 14px;
189
- height: 14px;
190
- flex-shrink: 0;
191
- }
192
- </style>
1
+ <!--
2
+ Input Component
3
+ Text input with label and error states
4
+ -->
5
+ <script lang="ts">
6
+ import type { Size } from '../types.js';
7
+
8
+ export let type: 'text' | 'email' | 'password' | 'tel' | 'url' = 'text';
9
+ export let size: Size = 'md';
10
+ export let value = '';
11
+ export let placeholder = '';
12
+ export let disabled = false;
13
+ export let error = false;
14
+ export let errorMessage = '';
15
+ export let label = '';
16
+ export let required = false;
17
+ export let fullWidth = false;
18
+ export let id = '';
19
+ let className = '';
20
+ export { className as class };
21
+
22
+ // Generate stable ID once on component creation
23
+ const generatedId = `authrim-input-${Math.random().toString(36).slice(2, 9)}`;
24
+ $: inputId = id || generatedId;
25
+ $: hasError = error || !!errorMessage;
26
+ </script>
27
+
28
+ <div
29
+ class="authrim-input-wrap {className}"
30
+ class:authrim-input-wrap--full={fullWidth}
31
+ >
32
+ {#if label}
33
+ <label for={inputId} class="authrim-input__label">
34
+ {label}
35
+ {#if required}
36
+ <span class="authrim-input__required" aria-hidden="true">*</span>
37
+ {/if}
38
+ </label>
39
+ {/if}
40
+
41
+ <div class="authrim-input__container">
42
+ <input
43
+ id={inputId}
44
+ {type}
45
+ bind:value
46
+ {placeholder}
47
+ {disabled}
48
+ {required}
49
+ class="authrim-input authrim-input--{size}"
50
+ class:authrim-input--error={hasError}
51
+ aria-invalid={hasError}
52
+ aria-describedby={errorMessage ? `${inputId}-error` : undefined}
53
+ on:input
54
+ on:focus
55
+ on:blur
56
+ on:keydown
57
+ on:keyup
58
+ {...$$restProps}
59
+ />
60
+ {#if $$slots.suffix}
61
+ <div class="authrim-input__suffix">
62
+ <slot name="suffix" />
63
+ </div>
64
+ {/if}
65
+ </div>
66
+
67
+ {#if errorMessage}
68
+ <p id="{inputId}-error" class="authrim-input__error" role="alert">
69
+ <svg class="authrim-input__error-icon" viewBox="0 0 16 16" fill="currentColor">
70
+ <path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 10.5a.75.75 0 110-1.5.75.75 0 010 1.5zM8.75 8a.75.75 0 01-1.5 0V5a.75.75 0 011.5 0v3z"/>
71
+ </svg>
72
+ {errorMessage}
73
+ </p>
74
+ {/if}
75
+ </div>
76
+
77
+ <style>
78
+ .authrim-input-wrap {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: var(--authrim-space-2);
82
+ }
83
+
84
+ .authrim-input-wrap--full {
85
+ width: 100%;
86
+ }
87
+
88
+ .authrim-input__label {
89
+ font-size: var(--authrim-text-sm);
90
+ font-weight: 500;
91
+ color: var(--authrim-color-text);
92
+ letter-spacing: var(--authrim-tracking-tight);
93
+ }
94
+
95
+ .authrim-input__required {
96
+ color: var(--authrim-color-error);
97
+ margin-left: 2px;
98
+ }
99
+
100
+ .authrim-input__container {
101
+ position: relative;
102
+ display: flex;
103
+ }
104
+
105
+ .authrim-input {
106
+ width: 100%;
107
+ font-family: var(--authrim-font-sans);
108
+ font-size: var(--authrim-text-sm);
109
+ background: var(--authrim-color-bg);
110
+ border: 1.5px solid var(--authrim-color-border);
111
+ border-radius: var(--authrim-radius-md);
112
+ color: var(--authrim-color-text);
113
+ transition:
114
+ border-color var(--authrim-duration-fast) var(--authrim-ease-default),
115
+ box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
116
+ background-color var(--authrim-duration-fast) var(--authrim-ease-default);
117
+ }
118
+
119
+ .authrim-input::placeholder {
120
+ color: var(--authrim-color-text-muted);
121
+ }
122
+
123
+ .authrim-input:hover:not(:disabled):not(:focus) {
124
+ border-color: var(--authrim-color-border-strong);
125
+ }
126
+
127
+ .authrim-input:focus {
128
+ outline: none;
129
+ border-color: var(--authrim-color-border-focus);
130
+ box-shadow: var(--authrim-shadow-focus);
131
+ }
132
+
133
+ .authrim-input:disabled {
134
+ background: var(--authrim-color-bg-subtle);
135
+ color: var(--authrim-color-text-muted);
136
+ cursor: not-allowed;
137
+ }
138
+
139
+ .authrim-input--error {
140
+ border-color: var(--authrim-color-error);
141
+ }
142
+
143
+ .authrim-input--error:focus {
144
+ border-color: var(--authrim-color-error);
145
+ box-shadow: var(--authrim-shadow-focus-error);
146
+ }
147
+
148
+ /* Sizes */
149
+ .authrim-input--sm {
150
+ height: 34px;
151
+ padding: 0 var(--authrim-space-3);
152
+ border-radius: var(--authrim-radius-sm);
153
+ }
154
+
155
+ .authrim-input--md {
156
+ height: 42px;
157
+ padding: 0 var(--authrim-space-3);
158
+ }
159
+
160
+ .authrim-input--lg {
161
+ height: 50px;
162
+ padding: 0 var(--authrim-space-4);
163
+ font-size: var(--authrim-text-base);
164
+ border-radius: var(--authrim-radius-lg);
165
+ }
166
+
167
+ .authrim-input__suffix {
168
+ position: absolute;
169
+ right: var(--authrim-space-3);
170
+ top: 50%;
171
+ transform: translateY(-50%);
172
+ display: flex;
173
+ align-items: center;
174
+ color: var(--authrim-color-text-muted);
175
+ }
176
+
177
+ .authrim-input__error {
178
+ display: flex;
179
+ align-items: center;
180
+ gap: var(--authrim-space-1);
181
+ font-size: var(--authrim-text-xs);
182
+ color: var(--authrim-color-error);
183
+ margin: 0;
184
+ animation: authrim-fade-up var(--authrim-duration-fast) var(--authrim-ease-out);
185
+ }
186
+
187
+ .authrim-input__error-icon {
188
+ width: 14px;
189
+ height: 14px;
190
+ flex-shrink: 0;
191
+ }
192
+ </style>