cauthy-auth 0.5.2 → 0.8.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 (72) hide show
  1. package/README.md +68 -3
  2. package/dist/{cauthy-BCTCqubt.d.ts → cauthy-Bn3iv50y.d.ts} +1 -1
  3. package/dist/{cauthy-hswMoS7B.d.mts → cauthy-C29HCvag.d.mts} +1 -1
  4. package/dist/cli.js +490 -25
  5. package/dist/client.d.mts +236 -0
  6. package/dist/client.d.ts +236 -0
  7. package/dist/client.js +331 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/client.mjs +297 -0
  10. package/dist/client.mjs.map +1 -0
  11. package/dist/express.d.mts +24 -0
  12. package/dist/express.d.ts +24 -0
  13. package/dist/express.js +102 -0
  14. package/dist/express.js.map +1 -0
  15. package/dist/express.mjs +76 -0
  16. package/dist/express.mjs.map +1 -0
  17. package/dist/fastify.d.mts +2 -2
  18. package/dist/fastify.d.ts +2 -2
  19. package/dist/fastify.js +3 -1
  20. package/dist/fastify.js.map +1 -1
  21. package/dist/fastify.mjs +3 -1
  22. package/dist/fastify.mjs.map +1 -1
  23. package/dist/hono.d.mts +23 -0
  24. package/dist/hono.d.ts +23 -0
  25. package/dist/hono.js +50 -0
  26. package/dist/hono.js.map +1 -0
  27. package/dist/hono.mjs +24 -0
  28. package/dist/hono.mjs.map +1 -0
  29. package/dist/index.d.mts +44 -6
  30. package/dist/index.d.ts +44 -6
  31. package/dist/index.js +668 -37
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +656 -37
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/next.d.mts +24 -0
  36. package/dist/next.d.ts +24 -0
  37. package/dist/next.js +77 -0
  38. package/dist/next.js.map +1 -0
  39. package/dist/next.mjs +52 -0
  40. package/dist/next.mjs.map +1 -0
  41. package/dist/react.d.mts +546 -7
  42. package/dist/react.d.ts +546 -7
  43. package/dist/react.js +925 -14
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +913 -10
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/styles.css +271 -0
  48. package/dist/svelte.d.mts +26 -0
  49. package/dist/svelte.d.ts +26 -0
  50. package/dist/svelte.js +402 -0
  51. package/dist/svelte.js.map +1 -0
  52. package/dist/svelte.mjs +373 -0
  53. package/dist/svelte.mjs.map +1 -0
  54. package/dist/{system-DvcQjORr.d.ts → system-DhRr_WxR.d.ts} +139 -1
  55. package/dist/{system-CR8p4BjB.d.mts → system-ZD_Wa8Bm.d.mts} +139 -1
  56. package/dist/theme.d.mts +56 -1
  57. package/dist/theme.d.ts +56 -1
  58. package/dist/theme.js +181 -5
  59. package/dist/theme.js.map +1 -1
  60. package/dist/theme.mjs +176 -4
  61. package/dist/theme.mjs.map +1 -1
  62. package/dist/validate-B_iC-4y8.d.mts +19 -0
  63. package/dist/validate-B_iC-4y8.d.ts +19 -0
  64. package/dist/vue.d.mts +28 -0
  65. package/dist/vue.d.ts +28 -0
  66. package/dist/vue.js +420 -0
  67. package/dist/vue.js.map +1 -0
  68. package/dist/vue.mjs +391 -0
  69. package/dist/vue.mjs.map +1 -0
  70. package/package.json +68 -7
  71. package/dist/permissions-B-a3eN0h.d.mts +0 -52
  72. package/dist/permissions-B-a3eN0h.d.ts +0 -52
@@ -0,0 +1,271 @@
1
+ /*
2
+ * cauthy-auth/styles.css — a look for the ready-made forms (<SignIn />,
3
+ * <SignUp />, <Account />…), with no dependencies.
4
+ *
5
+ * import 'cauthy-auth/styles.css'
6
+ *
7
+ * Every rule is inside :where(), so it weighs nothing: any rule of the
8
+ * application's own wins. The colours, corners and typeface are variables
9
+ * (--cauthy-*). The forms set them to what a person chose for the workspace
10
+ * in Cauthy's dashboard; set them yourself with `workspaceLook={false}`. A part
11
+ * given a class of its own (`classNames`) is left to it, and a form with
12
+ * `unstyled` is not touched at all.
13
+ */
14
+
15
+ :where([data-cauthy]) {
16
+ --cauthy-surface: #ffffff;
17
+ --cauthy-text: #12100e;
18
+ --cauthy-text-muted: #514a42;
19
+ --cauthy-border: #e2dbd0;
20
+ --cauthy-input-background: var(--cauthy-surface);
21
+ --cauthy-input-border: #cfc7ba;
22
+ --cauthy-primary: #12100e;
23
+ --cauthy-primary-text: #f5f1ea;
24
+ --cauthy-accent: #8a6e3b;
25
+ --cauthy-error: #b42318;
26
+ --cauthy-error-background: #fef3f2;
27
+ --cauthy-success: #067647;
28
+ --cauthy-success-background: #ecfdf3;
29
+ --cauthy-radius: 6px;
30
+ --cauthy-button-radius: 6px;
31
+ --cauthy-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
32
+
33
+ font-family: var(--cauthy-font);
34
+ font-size: 14px;
35
+ line-height: 1.45;
36
+ color: var(--cauthy-text);
37
+ box-sizing: border-box;
38
+ }
39
+
40
+ :where([data-cauthy]) *,
41
+ :where([data-cauthy]) *::before,
42
+ :where([data-cauthy]) *::after {
43
+ box-sizing: inherit;
44
+ }
45
+
46
+ /* ── The form, and the account screen's parts ─────────────────────────────── */
47
+
48
+ :where(.cauthy-form[data-cauthy]),
49
+ :where([data-cauthy] .cauthy-section) {
50
+ display: flex;
51
+ flex-direction: column;
52
+ gap: 12px;
53
+ width: 100%;
54
+ max-width: 380px;
55
+ margin: 0;
56
+ }
57
+
58
+ :where(.cauthy-account[data-cauthy]) {
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: 16px;
62
+ width: 100%;
63
+ max-width: 520px;
64
+ }
65
+
66
+ :where([data-cauthy] .cauthy-section) {
67
+ max-width: none;
68
+ padding: 18px;
69
+ background: var(--cauthy-surface);
70
+ border: 1px solid var(--cauthy-border);
71
+ border-radius: var(--cauthy-radius);
72
+ }
73
+
74
+ :where([data-cauthy] .cauthy-heading) {
75
+ margin: 0;
76
+ font-size: 16px;
77
+ font-weight: 600;
78
+ }
79
+
80
+ /* ── Fields ──────────────────────────────────────────────────────────────── */
81
+
82
+ :where([data-cauthy] .cauthy-field) {
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: 6px;
86
+ }
87
+
88
+ :where([data-cauthy] .cauthy-label) {
89
+ display: flex;
90
+ justify-content: space-between;
91
+ align-items: baseline;
92
+ gap: 8px;
93
+ font-size: 13px;
94
+ font-weight: 500;
95
+ color: var(--cauthy-text-muted);
96
+ }
97
+
98
+ :where([data-cauthy] .cauthy-input) {
99
+ width: 100%;
100
+ height: 40px;
101
+ padding: 0 12px;
102
+ font: inherit;
103
+ color: var(--cauthy-text);
104
+ background: var(--cauthy-input-background);
105
+ border: 1px solid var(--cauthy-input-border);
106
+ border-radius: var(--cauthy-radius);
107
+ outline: none;
108
+ transition: border-color 0.15s, box-shadow 0.15s;
109
+ }
110
+
111
+ :where([data-cauthy] .cauthy-input:focus-visible) {
112
+ border-color: var(--cauthy-accent);
113
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--cauthy-accent) 25%, transparent);
114
+ }
115
+
116
+ :where([data-cauthy] .cauthy-input[aria-invalid="true"]) {
117
+ border-color: var(--cauthy-error);
118
+ }
119
+
120
+ :where([data-cauthy] .cauthy-fieldError) {
121
+ font-size: 12px;
122
+ color: var(--cauthy-error);
123
+ }
124
+
125
+ /* ── Buttons ─────────────────────────────────────────────────────────────── */
126
+
127
+ :where([data-cauthy] .cauthy-button),
128
+ :where([data-cauthy] .cauthy-providerButton) {
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ gap: 8px;
133
+ width: 100%;
134
+ min-height: 40px;
135
+ padding: 0 16px;
136
+ font: inherit;
137
+ font-weight: 500;
138
+ border-radius: var(--cauthy-button-radius);
139
+ cursor: pointer;
140
+ transition: filter 0.15s, background-color 0.15s;
141
+ }
142
+
143
+ :where([data-cauthy] .cauthy-button) {
144
+ color: var(--cauthy-primary-text);
145
+ background: var(--cauthy-primary);
146
+ border: 1px solid var(--cauthy-primary);
147
+ }
148
+
149
+ :where([data-cauthy] .cauthy-providerButton) {
150
+ color: var(--cauthy-text);
151
+ background: var(--cauthy-input-background);
152
+ border: 1px solid var(--cauthy-input-border);
153
+ }
154
+
155
+ :where([data-cauthy] .cauthy-button:hover:not(:disabled)),
156
+ :where([data-cauthy] .cauthy-providerButton:hover:not(:disabled)) {
157
+ filter: brightness(0.94);
158
+ }
159
+
160
+ :where([data-cauthy] .cauthy-button:focus-visible),
161
+ :where([data-cauthy] .cauthy-providerButton:focus-visible) {
162
+ outline: 2px solid var(--cauthy-accent);
163
+ outline-offset: 2px;
164
+ }
165
+
166
+ :where([data-cauthy] .cauthy-button:disabled),
167
+ :where([data-cauthy] .cauthy-providerButton:disabled) {
168
+ opacity: 0.6;
169
+ cursor: default;
170
+ }
171
+
172
+ :where(.cauthy-section) > :where(.cauthy-button, .cauthy-providerButton) {
173
+ width: auto;
174
+ align-self: flex-start;
175
+ }
176
+
177
+ /* ── Words around the form ───────────────────────────────────────────────── */
178
+
179
+ :where([data-cauthy] .cauthy-link) {
180
+ color: var(--cauthy-accent);
181
+ font-size: 13px;
182
+ text-decoration: none;
183
+ }
184
+
185
+ :where([data-cauthy] .cauthy-link:hover) {
186
+ text-decoration: underline;
187
+ }
188
+
189
+ :where([data-cauthy] .cauthy-separator) {
190
+ display: flex;
191
+ align-items: center;
192
+ gap: 10px;
193
+ margin: 4px 0;
194
+ font-size: 12px;
195
+ color: var(--cauthy-text-muted);
196
+ }
197
+
198
+ :where([data-cauthy] .cauthy-separator)::before,
199
+ :where([data-cauthy] .cauthy-separator)::after {
200
+ content: "";
201
+ flex: 1;
202
+ height: 1px;
203
+ background: var(--cauthy-border);
204
+ }
205
+
206
+ :where([data-cauthy] .cauthy-notice) {
207
+ margin: 0;
208
+ color: var(--cauthy-text-muted);
209
+ }
210
+
211
+ :where([data-cauthy] [role="status"].cauthy-notice) {
212
+ padding: 8px 12px;
213
+ color: var(--cauthy-success);
214
+ background: var(--cauthy-success-background);
215
+ border-radius: var(--cauthy-radius);
216
+ }
217
+
218
+ :where([data-cauthy] .cauthy-error) {
219
+ margin: 0;
220
+ padding: 10px 12px;
221
+ font-size: 13px;
222
+ color: var(--cauthy-error);
223
+ background: var(--cauthy-error-background);
224
+ border-radius: var(--cauthy-radius);
225
+ }
226
+
227
+ :where([data-cauthy] .cauthy-footer) {
228
+ margin: 4px 0 0;
229
+ font-size: 13px;
230
+ text-align: center;
231
+ color: var(--cauthy-text-muted);
232
+ }
233
+
234
+ /* ── The account screen's lists ──────────────────────────────────────────── */
235
+
236
+ :where([data-cauthy] .cauthy-secret) {
237
+ padding: 8px 10px;
238
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
239
+ font-size: 13px;
240
+ word-break: break-all;
241
+ background: var(--cauthy-input-background);
242
+ border: 1px dashed var(--cauthy-input-border);
243
+ border-radius: var(--cauthy-radius);
244
+ }
245
+
246
+ :where([data-cauthy] .cauthy-codes) {
247
+ display: grid;
248
+ grid-template-columns: repeat(2, minmax(0, 1fr));
249
+ gap: 6px;
250
+ margin: 0;
251
+ padding: 0;
252
+ list-style: none;
253
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
254
+ }
255
+
256
+ :where([data-cauthy] .cauthy-sessions) {
257
+ display: flex;
258
+ flex-direction: column;
259
+ gap: 6px;
260
+ margin: 0;
261
+ padding: 0;
262
+ list-style: none;
263
+ }
264
+
265
+ :where([data-cauthy] .cauthy-session) {
266
+ padding: 8px 10px;
267
+ font-size: 13px;
268
+ color: var(--cauthy-text-muted);
269
+ border: 1px solid var(--cauthy-border);
270
+ border-radius: var(--cauthy-radius);
271
+ }
@@ -0,0 +1,26 @@
1
+ import { SessionStore, SessionState, SessionStoreOptions } from './client.mjs';
2
+ export { Account, AccountSession, AuthClient, AuthError, AuthMethods, AuthResult } from './client.mjs';
3
+ import { i as PublicSession } from './system-ZD_Wa8Bm.mjs';
4
+ export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-ZD_Wa8Bm.mjs';
5
+ import './theme.mjs';
6
+ import './validate-B_iC-4y8.mjs';
7
+ import 'jose';
8
+
9
+ /** A value Svelte can read with `$`: its store contract. */
10
+ interface Readable<T> {
11
+ subscribe(run: (value: T) => void): () => void;
12
+ }
13
+ interface CauthySession extends Pick<SessionStore, 'refresh' | 'signIn' | 'signOut' | 'accountUrl' | 'auth' | 'basePath'> {
14
+ /** The signed-in person and their organizations, or null: `$session`. */
15
+ session: Readable<PublicSession | null>;
16
+ /** `$status`: loading, authenticated or unauthenticated. */
17
+ status: Readable<SessionState['status']>;
18
+ }
19
+ /**
20
+ * Give it `initialSession` from a load function (`event.locals`, or
21
+ * `auth.toPublic(await auth.getSession(request))`) and the first paint knows
22
+ * who is there.
23
+ */
24
+ declare function createCauthySession(options?: SessionStoreOptions): CauthySession;
25
+
26
+ export { type CauthySession, SessionStoreOptions as CauthySessionOptions, PublicSession, type Readable, createCauthySession };
@@ -0,0 +1,26 @@
1
+ import { SessionStore, SessionState, SessionStoreOptions } from './client.js';
2
+ export { Account, AccountSession, AuthClient, AuthError, AuthMethods, AuthResult } from './client.js';
3
+ import { i as PublicSession } from './system-DhRr_WxR.js';
4
+ export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-DhRr_WxR.js';
5
+ import './theme.js';
6
+ import './validate-B_iC-4y8.js';
7
+ import 'jose';
8
+
9
+ /** A value Svelte can read with `$`: its store contract. */
10
+ interface Readable<T> {
11
+ subscribe(run: (value: T) => void): () => void;
12
+ }
13
+ interface CauthySession extends Pick<SessionStore, 'refresh' | 'signIn' | 'signOut' | 'accountUrl' | 'auth' | 'basePath'> {
14
+ /** The signed-in person and their organizations, or null: `$session`. */
15
+ session: Readable<PublicSession | null>;
16
+ /** `$status`: loading, authenticated or unauthenticated. */
17
+ status: Readable<SessionState['status']>;
18
+ }
19
+ /**
20
+ * Give it `initialSession` from a load function (`event.locals`, or
21
+ * `auth.toPublic(await auth.getSession(request))`) and the first paint knows
22
+ * who is there.
23
+ */
24
+ declare function createCauthySession(options?: SessionStoreOptions): CauthySession;
25
+
26
+ export { type CauthySession, SessionStoreOptions as CauthySessionOptions, PublicSession, type Readable, createCauthySession };