ferst-core 0.16.0 → 0.17.1

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.
@@ -0,0 +1,370 @@
1
+ ---
2
+ /**
3
+ * MembersAccount — the members' account page's content (`/account`, the Ferst Members module):
4
+ * signing in with an emailed code, and the member's own account. The page's title is built; the
5
+ * rest is a React island (components/islands/MembersAccount.tsx, docs/BLOCK-ARCHITECTURE.md §8),
6
+ * drawn in the browser only, since it all depends on who is visiting. The island brings no look of
7
+ * its own: this file styles it from the site's tokens, in light and dark, and with the site's field
8
+ * treatment (`data-field` on <html>).
9
+ *
10
+ * Used by the injected route (routes/account.astro) and the showcase.
11
+ */
12
+ import MembersAccountIsland from './islands/MembersAccount.tsx';
13
+ import { ACCOUNT_TEXT } from '../lib/members-account';
14
+ ---
15
+
16
+ <section class="m-account" aria-labelledby="m-account-title">
17
+ <h1 id="m-account-title" class="m-account__title">{ACCOUNT_TEXT.title}</h1>
18
+ <MembersAccountIsland client:only="react">
19
+ <p slot="fallback" class="m-account__wait">{ACCOUNT_TEXT.loading}</p>
20
+ </MembersAccountIsland>
21
+ <noscript><p class="m-account__notice">{ACCOUNT_TEXT.noScript}</p></noscript>
22
+ </section>
23
+
24
+ <style is:global>
25
+ /* The island's markup isn't the build's, so these rules are global, every one under .m-account. */
26
+ .m-account {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 1.25rem;
30
+ max-width: 34rem;
31
+ margin: 0 auto;
32
+ padding: clamp(2rem, 6vw, 4rem) 1rem;
33
+ color: var(--fg);
34
+ box-sizing: border-box;
35
+ }
36
+ .m-account__title {
37
+ margin: 0;
38
+ font-family: var(--font-heading);
39
+ font-size: clamp(1.75rem, 4vw, 2.25rem);
40
+ line-height: 1.2;
41
+ color: var(--fg);
42
+ }
43
+ .m-account__app,
44
+ .m-account__card {
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: 1.1rem;
48
+ }
49
+ .m-account__card {
50
+ padding: clamp(1.25rem, 4vw, 2rem);
51
+ border: var(--card-border, 1px solid var(--border));
52
+ border-radius: var(--radius);
53
+ background: var(--bg-surface);
54
+ box-shadow: var(--shadow-sm);
55
+ }
56
+ .m-account__step,
57
+ .m-account__part-title {
58
+ margin: 0;
59
+ font-family: var(--font-heading);
60
+ font-size: 1.25rem;
61
+ line-height: 1.3;
62
+ color: var(--fg);
63
+ overflow-wrap: anywhere;
64
+ }
65
+ .m-account__part-title {
66
+ font-size: 1.05rem;
67
+ }
68
+ .m-account__step:focus {
69
+ outline: none;
70
+ }
71
+ .m-account__step:focus-visible {
72
+ outline: 2px solid var(--gold);
73
+ outline-offset: 4px;
74
+ }
75
+ .m-account__intro,
76
+ .m-account__status,
77
+ .m-account__wait,
78
+ .m-account__back {
79
+ margin: 0;
80
+ line-height: 1.6;
81
+ }
82
+ .m-account__intro,
83
+ .m-account__wait {
84
+ color: var(--muted);
85
+ }
86
+ .m-account__status {
87
+ font-weight: 600;
88
+ }
89
+ .m-account__welcome {
90
+ margin: 0;
91
+ padding: 1rem 1.1rem;
92
+ border-inline-start: 4px solid var(--gold);
93
+ border-radius: var(--radius-sm);
94
+ background: var(--bg-section);
95
+ line-height: 1.6;
96
+ white-space: pre-line;
97
+ }
98
+ .m-account a {
99
+ color: var(--accent);
100
+ text-decoration: underline;
101
+ text-underline-offset: 0.15em;
102
+ }
103
+ .m-account a:focus-visible {
104
+ outline: 2px solid var(--gold);
105
+ outline-offset: 2px;
106
+ border-radius: 2px;
107
+ }
108
+
109
+ /* What just happened: told once, in the site's colours. */
110
+ .m-account__notice {
111
+ margin: 0;
112
+ padding: 0.85rem 1rem;
113
+ border: 1px solid var(--border);
114
+ border-radius: var(--radius-sm);
115
+ background: var(--bg-section);
116
+ color: var(--fg);
117
+ line-height: 1.5;
118
+ }
119
+ .m-account__notice--done {
120
+ border-color: var(--gold);
121
+ background: var(--gold-light);
122
+ }
123
+ .m-account__notice--error {
124
+ border-color: var(--fg);
125
+ border-inline-start-width: 4px;
126
+ }
127
+
128
+ /* Fields, as every form on the site has them (the ContactForm's treatment). */
129
+ .m-account__form {
130
+ display: flex;
131
+ flex-direction: column;
132
+ gap: 1rem;
133
+ }
134
+ .m-account__form--row {
135
+ flex-flow: row wrap;
136
+ align-items: flex-end;
137
+ }
138
+ .m-account__form--row .m-account__field {
139
+ flex: 1 1 14rem;
140
+ }
141
+ .m-account__field {
142
+ display: flex;
143
+ flex-direction: column;
144
+ gap: 0.4rem;
145
+ }
146
+ .m-account__label {
147
+ font-family: var(--font-body);
148
+ font-size: 0.9375rem;
149
+ font-weight: 600;
150
+ color: var(--fg);
151
+ }
152
+ .m-account__hint {
153
+ font-size: 0.875rem;
154
+ color: var(--muted);
155
+ line-height: 1.5;
156
+ }
157
+ .m-account__error {
158
+ margin: 0;
159
+ font-size: 0.9rem;
160
+ font-weight: 600;
161
+ color: var(--fg);
162
+ line-height: 1.5;
163
+ }
164
+ .m-account__error::before {
165
+ content: '! ';
166
+ color: var(--gold);
167
+ }
168
+ .m-account__input {
169
+ font: inherit;
170
+ font-size: 1rem;
171
+ color: var(--fg);
172
+ background: var(--field-bg, var(--bg-surface));
173
+ border: var(--field-border, 1px solid var(--border));
174
+ border-radius: var(--field-radius, var(--radius-sm));
175
+ padding: 0.7rem 0.85rem;
176
+ width: 100%;
177
+ box-sizing: border-box;
178
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
179
+ }
180
+ .m-account__input--code {
181
+ max-width: 14rem;
182
+ font-family: var(--font-mono);
183
+ font-size: 1.35rem;
184
+ letter-spacing: 0.3em;
185
+ font-variant-numeric: tabular-nums;
186
+ }
187
+ .m-account__input:focus {
188
+ outline: none;
189
+ border-color: var(--gold);
190
+ box-shadow: 0 0 0 3px var(--gold-light);
191
+ }
192
+ .m-account__input[aria-invalid='true'] {
193
+ border-color: var(--fg);
194
+ border-width: 2px;
195
+ }
196
+ html[data-field='filled'] .m-account__input {
197
+ background: var(--bg-section);
198
+ border-color: transparent;
199
+ }
200
+ html[data-field='underline'] .m-account__input {
201
+ background: transparent;
202
+ border: none;
203
+ border-bottom: 1.5px solid var(--border);
204
+ border-radius: 0;
205
+ padding-inline: 0;
206
+ }
207
+ html[data-field='underline'] .m-account__input:focus {
208
+ border-bottom-color: var(--gold);
209
+ box-shadow: none;
210
+ }
211
+
212
+ /* The terms box: React Aria's tick box (a real, visually hidden checkbox), drawn here. */
213
+ .m-account__agree {
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: 0.4rem;
217
+ }
218
+ .m-account__check {
219
+ display: inline-flex;
220
+ align-items: flex-start;
221
+ gap: 0.65rem;
222
+ line-height: 1.5;
223
+ cursor: pointer;
224
+ }
225
+ .m-account__box {
226
+ flex: none;
227
+ display: grid;
228
+ place-items: center;
229
+ width: 1.25rem;
230
+ height: 1.25rem;
231
+ margin-top: 0.1rem;
232
+ border: 2px solid var(--fg);
233
+ border-radius: calc(var(--radius-sm) * 0.5);
234
+ background: var(--bg-surface);
235
+ box-sizing: border-box;
236
+ }
237
+ .m-account__box svg {
238
+ width: 0.9rem;
239
+ height: 0.9rem;
240
+ fill: none;
241
+ stroke: var(--on-brand);
242
+ stroke-width: 3;
243
+ stroke-linecap: round;
244
+ stroke-linejoin: round;
245
+ visibility: hidden;
246
+ }
247
+ .m-account__check[data-selected] .m-account__box {
248
+ background: var(--gold);
249
+ border-color: var(--gold);
250
+ }
251
+ .m-account__check[data-selected] .m-account__box svg {
252
+ visibility: visible;
253
+ }
254
+ .m-account__check[data-focus-visible] .m-account__box {
255
+ outline: 2px solid var(--gold);
256
+ outline-offset: 2px;
257
+ }
258
+ .m-account__check[data-invalid] .m-account__box {
259
+ border-width: 3px;
260
+ }
261
+ .m-account__links {
262
+ display: flex;
263
+ flex-wrap: wrap;
264
+ gap: 0.25rem 1rem;
265
+ margin: 0 0 0 1.9rem;
266
+ font-size: 0.9rem;
267
+ }
268
+
269
+ /* Buttons: the main one filled in the site's accent; the others quieter. */
270
+ .m-account__row {
271
+ display: flex;
272
+ flex-wrap: wrap;
273
+ align-items: center;
274
+ gap: 0.75rem 1.25rem;
275
+ }
276
+ .m-account__go,
277
+ .m-account__plain,
278
+ .m-account__danger {
279
+ align-self: flex-start;
280
+ min-height: 44px;
281
+ padding: 0.6rem 1.25rem;
282
+ font: inherit;
283
+ font-family: var(--font-heading);
284
+ font-weight: 600;
285
+ border-radius: var(--radius-sm);
286
+ cursor: pointer;
287
+ box-sizing: border-box;
288
+ touch-action: manipulation;
289
+ }
290
+ .m-account__go {
291
+ border: 2px solid var(--gold);
292
+ background: var(--gold);
293
+ color: var(--on-brand);
294
+ }
295
+ .m-account__go[data-hovered] {
296
+ background: color-mix(in srgb, var(--gold) 85%, #000);
297
+ border-color: color-mix(in srgb, var(--gold) 85%, #000);
298
+ }
299
+ .m-account__plain {
300
+ border: 2px solid var(--fg);
301
+ background: transparent;
302
+ color: var(--fg);
303
+ }
304
+ .m-account__plain[data-hovered] {
305
+ border-color: var(--gold);
306
+ color: var(--gold);
307
+ }
308
+ .m-account__danger {
309
+ border: 2px solid var(--fg);
310
+ background: var(--fg);
311
+ color: var(--bg-surface);
312
+ }
313
+ .m-account__link {
314
+ padding: 0.25rem 0;
315
+ border: 0;
316
+ background: none;
317
+ color: var(--fg);
318
+ font: inherit;
319
+ text-decoration: underline;
320
+ text-underline-offset: 0.15em;
321
+ cursor: pointer;
322
+ }
323
+ .m-account__link--danger {
324
+ color: var(--muted);
325
+ }
326
+ .m-account__go[data-focus-visible],
327
+ .m-account__plain[data-focus-visible],
328
+ .m-account__danger[data-focus-visible],
329
+ .m-account__link[data-focus-visible] {
330
+ outline: 2px solid var(--gold);
331
+ outline-offset: 2px;
332
+ }
333
+ .m-account [data-disabled],
334
+ .m-account [data-pending] {
335
+ opacity: 0.55;
336
+ cursor: default;
337
+ }
338
+
339
+ .m-account__part {
340
+ padding-top: 1.25rem;
341
+ border-top: 1px solid var(--border);
342
+ }
343
+ section.m-account__part {
344
+ display: flex;
345
+ flex-direction: column;
346
+ gap: 0.85rem;
347
+ }
348
+ .m-account__delete {
349
+ padding: 1rem 1.1rem;
350
+ border: 1px solid var(--border);
351
+ border-radius: var(--radius-sm);
352
+ background: var(--bg-section);
353
+ }
354
+ .m-account__sr {
355
+ position: absolute;
356
+ width: 1px;
357
+ height: 1px;
358
+ margin: -1px;
359
+ padding: 0;
360
+ overflow: hidden;
361
+ clip: rect(0 0 0 0);
362
+ white-space: nowrap;
363
+ border: 0;
364
+ }
365
+ @media (prefers-reduced-motion: reduce) {
366
+ .m-account__input {
367
+ transition: none;
368
+ }
369
+ }
370
+ </style>