@molecule/app-auth-shell-solid 0.0.0-stage → 0.0.1-stage
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.
- package/LICENSE +202 -0
- package/README.md +521 -2
- package/dist/AuthFormStateProvider.d.ts +29 -0
- package/dist/AuthFormStateProvider.d.ts.map +1 -0
- package/dist/AuthFormStateProvider.jsx +44 -0
- package/dist/AuthFormStateProvider.jsx.map +1 -0
- package/dist/AuthShell.d.ts +99 -0
- package/dist/AuthShell.d.ts.map +1 -0
- package/dist/AuthShell.jsx +187 -0
- package/dist/AuthShell.jsx.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +153 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/useAuthFormState.d.ts +25 -0
- package/dist/useAuthFormState.d.ts.map +1 -0
- package/dist/useAuthFormState.js +121 -0
- package/dist/useAuthFormState.js.map +1 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,522 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-18T20:19:59.646Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-auth-shell-solid
|
|
10
|
+
|
|
11
|
+
`@molecule/app-auth-shell-solid` — centered glassmorphic shell for auth pages
|
|
12
|
+
(Login, Signup, ForgotPassword, ResetPassword), the Solid counterpart of
|
|
13
|
+
`@molecule/app-auth-shell-react`: the same exports, the same props (React
|
|
14
|
+
names), and the same DOM for the same input.
|
|
15
|
+
|
|
16
|
+
Apps pass per-app `decoration` (orbs, gradient backdrop) and `brand` (logo +
|
|
17
|
+
tagline) as JSX props. The shell handles layout, the glass card,
|
|
18
|
+
heading/subheading, body, footer, and the "Back to home" link.
|
|
19
|
+
|
|
20
|
+
The shell also provides its content through `<AuthFormStateProvider>`, so any
|
|
21
|
+
form rendered inside inherits cross-view email persistence. Forms read it via
|
|
22
|
+
`useAuthFormStateContext()`, or use the standalone `useAuthFormState`
|
|
23
|
+
primitive. Persistence flows through the `@molecule/app-storage`
|
|
24
|
+
`StorageProvider` abstraction (never raw `sessionStorage`), defaulting to a
|
|
25
|
+
process-shared in-memory store.
|
|
26
|
+
|
|
27
|
+
Besides the `AuthShell` preset, the package exports the composable
|
|
28
|
+
primitives — `AuthShellContainer`, `AuthShellDecoration`, `AuthShellCard`,
|
|
29
|
+
`AuthShellHeading`, `AuthShellFooter`, `AuthShellBackLink` — plus a
|
|
30
|
+
two-column family for the split layout: `AuthShellSplit` >
|
|
31
|
+
`AuthShellSplitRow` > (`AuthShellPanel` + `AuthShellCardColumn`).
|
|
32
|
+
|
|
33
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
34
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
35
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { AuthShell, useAuthFormStateContext } from '@molecule/app-auth-shell-solid'
|
|
41
|
+
import { createSessionStorageProvider } from '@molecule/app-storage-localstorage'
|
|
42
|
+
|
|
43
|
+
const sessionStore = createSessionStorageProvider({ prefix: 'auth_' })
|
|
44
|
+
|
|
45
|
+
export function Login() {
|
|
46
|
+
const { fields, setField } = useAuthFormStateContext()
|
|
47
|
+
return (
|
|
48
|
+
<AuthShell
|
|
49
|
+
heading="Sign in"
|
|
50
|
+
subheading="Welcome back."
|
|
51
|
+
brand={<h2>Acme</h2>}
|
|
52
|
+
formStateStorage={sessionStore}
|
|
53
|
+
footer={<p>No account? Sign up</p>}
|
|
54
|
+
>
|
|
55
|
+
<form>
|
|
56
|
+
<input
|
|
57
|
+
value={fields().email ?? ''}
|
|
58
|
+
onInput={(e) => setField('email', e.currentTarget.value)}
|
|
59
|
+
/>
|
|
60
|
+
</form>
|
|
61
|
+
</AuthShell>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Type
|
|
67
|
+
|
|
68
|
+
`feature`
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install @molecule/app-auth-shell-solid @molecule/app-logger @molecule/app-solid @molecule/app-storage @molecule/app-ui @molecule/app-ui-solid solid-js
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API
|
|
77
|
+
|
|
78
|
+
### Interfaces
|
|
79
|
+
|
|
80
|
+
#### `AuthFormFields`
|
|
81
|
+
|
|
82
|
+
Shared auth form field values. `email` is the canonical cross-view field;
|
|
83
|
+
additional string fields (e.g. a name carried from Signup) may be stored
|
|
84
|
+
alongside it.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
interface AuthFormFields {
|
|
88
|
+
/** Email address, shared across all auth views. */
|
|
89
|
+
email?: string
|
|
90
|
+
/** Any other shared string field (e.g. `name`). */
|
|
91
|
+
[field: string]: string | undefined
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### `UseAuthFormStateOptions`
|
|
96
|
+
|
|
97
|
+
Options for {@link useAuthFormState}.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
interface UseAuthFormStateOptions {
|
|
101
|
+
/** Storage provider backing persistence (defaults to a process-shared in-memory provider). */
|
|
102
|
+
storage?: StorageProvider
|
|
103
|
+
/** Storage key for the persisted fields. Defaults to `molecule.auth.form-state`. */
|
|
104
|
+
storageKey?: string
|
|
105
|
+
/** Seed values used before hydration completes / when storage is empty. */
|
|
106
|
+
initialFields?: AuthFormFields
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### `AuthFormState`
|
|
111
|
+
|
|
112
|
+
The value {@link useAuthFormState} returns.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface AuthFormState {
|
|
116
|
+
/** Current field values (email + any shared fields), as an accessor. */
|
|
117
|
+
fields: Accessor<AuthFormFields>
|
|
118
|
+
/** `true` once the initial read from storage has completed, as an accessor. */
|
|
119
|
+
hydrated: Accessor<boolean>
|
|
120
|
+
/** Sets a single field and persists the new state. */
|
|
121
|
+
setField: (name: string, value: string) => void
|
|
122
|
+
/** Merges a patch of fields and persists the new state. */
|
|
123
|
+
setFields: (patch: AuthFormFields) => void
|
|
124
|
+
/** Clears all persisted auth form state and removes the storage key. */
|
|
125
|
+
clear: () => void
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### `AuthFormStateProviderProps`
|
|
130
|
+
|
|
131
|
+
Props for {@link AuthFormStateProvider}.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
interface AuthFormStateProviderProps {
|
|
135
|
+
/** Children rendered inside the provider. */
|
|
136
|
+
children?: JSX.Element
|
|
137
|
+
/** Storage provider backing persistence (defaults to a shared in-memory provider). */
|
|
138
|
+
storage?: StorageProvider
|
|
139
|
+
/** Storage key for the persisted fields. */
|
|
140
|
+
storageKey?: string
|
|
141
|
+
/** Seed values used before hydration / when storage is empty. */
|
|
142
|
+
initialFields?: AuthFormFields
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### `AuthShellContainerProps`
|
|
147
|
+
|
|
148
|
+
Props accepted by {@link AuthShellContainer}.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
interface AuthShellContainerProps {
|
|
152
|
+
/** Content rendered inside the container. */
|
|
153
|
+
children?: JSX.Element
|
|
154
|
+
/** Optional CSS background applied to the container. */
|
|
155
|
+
style?: JSX.CSSProperties
|
|
156
|
+
/** Extra classes appended after the defaults. */
|
|
157
|
+
className?: string
|
|
158
|
+
/** Layout direction. Defaults to `'centered'`; pass `'column'` for a vertical stack. */
|
|
159
|
+
layout?: 'centered' | 'column'
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### `AuthShellCardProps`
|
|
164
|
+
|
|
165
|
+
Props accepted by {@link AuthShellCard}.
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
interface AuthShellCardProps {
|
|
169
|
+
/** Content rendered inside the card. */
|
|
170
|
+
children?: JSX.Element
|
|
171
|
+
/** Override the default glass surface. */
|
|
172
|
+
surfaceClassName?: string
|
|
173
|
+
/** Extra layout classes appended after the flex/padding defaults. */
|
|
174
|
+
className?: string
|
|
175
|
+
/** Override the outer `<main>` wrapper classes. */
|
|
176
|
+
outerClassName?: string
|
|
177
|
+
/** `data-mol-id` pass-through for E2E selectors. */
|
|
178
|
+
dataMolId?: string
|
|
179
|
+
/** Optional CSS style applied to the card's inner surface. */
|
|
180
|
+
style?: JSX.CSSProperties
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### `AuthShellHeadingProps`
|
|
185
|
+
|
|
186
|
+
Props accepted by {@link AuthShellHeading}.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
interface AuthShellHeadingProps {
|
|
190
|
+
/** The heading text. */
|
|
191
|
+
heading: string
|
|
192
|
+
/** Optional subheading paragraph. */
|
|
193
|
+
subheading?: string
|
|
194
|
+
/** Optional small uppercase tag rendered above the heading. */
|
|
195
|
+
eyebrow?: string
|
|
196
|
+
/** Optional override for the h1 className. */
|
|
197
|
+
headingClassName?: string
|
|
198
|
+
/** Optional override for the h1 style. */
|
|
199
|
+
headingStyle?: JSX.CSSProperties
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### `AuthShellBackLinkProps`
|
|
204
|
+
|
|
205
|
+
Props accepted by {@link AuthShellBackLink}.
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
interface AuthShellBackLinkProps {
|
|
209
|
+
/** Destination. Defaults to `/`. */
|
|
210
|
+
to?: string
|
|
211
|
+
/** Translated label override; falls back to `auth.backHome` → "Back to home" when absent, empty or blank. */
|
|
212
|
+
label?: string
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### `AuthShellSplitProps`
|
|
217
|
+
|
|
218
|
+
Props accepted by {@link AuthShellSplit}.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
interface AuthShellSplitProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
222
|
+
/** The split row (and optionally a site footer sibling). */
|
|
223
|
+
children?: JSX.Element
|
|
224
|
+
/** Cosmetic classes (background, text color, font) for the outer container. */
|
|
225
|
+
className?: string
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `AuthShellSplitRowProps`
|
|
230
|
+
|
|
231
|
+
Props accepted by {@link AuthShellSplitRow}.
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
interface AuthShellSplitRowProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
235
|
+
/** The brand panel and the card column. */
|
|
236
|
+
children?: JSX.Element
|
|
237
|
+
/** Layout classes for the row (typically `cm.flex({})` or `cm.grid({ cols: 2 })`). */
|
|
238
|
+
className?: string
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### `AuthShellPanelProps`
|
|
243
|
+
|
|
244
|
+
Props accepted by {@link AuthShellPanel}.
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
interface AuthShellPanelProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
248
|
+
/** The app's bespoke decoration, wordmark or social proof. */
|
|
249
|
+
children?: JSX.Element
|
|
250
|
+
/** Cosmetic classes — width ratio, padding, gradient, positioning. */
|
|
251
|
+
className?: string
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### `AuthShellCardColumnProps`
|
|
256
|
+
|
|
257
|
+
Props accepted by {@link AuthShellCardColumn}.
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
interface AuthShellCardColumnProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
261
|
+
/** The form card content. */
|
|
262
|
+
children?: JSX.Element
|
|
263
|
+
/** Cosmetic classes — width ratio, padding. */
|
|
264
|
+
className?: string
|
|
265
|
+
/** Element to render. Defaults to `'section'`. */
|
|
266
|
+
as?: 'section' | 'main'
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### `AuthShellProps`
|
|
271
|
+
|
|
272
|
+
Props accepted by {@link AuthShell}.
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
interface AuthShellProps {
|
|
276
|
+
/** The heading text. */
|
|
277
|
+
heading: string
|
|
278
|
+
/** The subheading text. */
|
|
279
|
+
subheading: string
|
|
280
|
+
/** The form body. */
|
|
281
|
+
children?: JSX.Element
|
|
282
|
+
/** Optional footer node. */
|
|
283
|
+
footer?: JSX.Element
|
|
284
|
+
/** Optional brand node rendered above the heading. */
|
|
285
|
+
brand?: JSX.Element
|
|
286
|
+
/** Optional background decoration node. */
|
|
287
|
+
decoration?: JSX.Element
|
|
288
|
+
/** Destination of the back link. Defaults to `/`. */
|
|
289
|
+
backTo?: string
|
|
290
|
+
/** Whether to render the back link. Defaults to `true`. */
|
|
291
|
+
showBackLink?: boolean
|
|
292
|
+
/** Storage provider backing cross-view auth form persistence. */
|
|
293
|
+
formStateStorage?: StorageProvider
|
|
294
|
+
/** Storage key for the persisted auth form state. */
|
|
295
|
+
formStateKey?: string
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Functions
|
|
300
|
+
|
|
301
|
+
#### `AuthFormStateProvider(props)`
|
|
302
|
+
|
|
303
|
+
Provides a single {@link useAuthFormState} instance to all descendants via
|
|
304
|
+
Solid's context, so sibling/child auth forms share the same email.
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
function AuthFormStateProvider(props: AuthFormStateProviderProps): JSX.Element
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
- `props` — Children plus optional storage provider, key, and seed fields.
|
|
311
|
+
|
|
312
|
+
**Returns:** The provider component.
|
|
313
|
+
|
|
314
|
+
#### `useAuthFormStateContext()`
|
|
315
|
+
|
|
316
|
+
Reads the shared auth form state from the nearest
|
|
317
|
+
{@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
function useAuthFormStateContext(): AuthFormState
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Returns:** The shared {@link AuthFormState}.
|
|
324
|
+
|
|
325
|
+
#### `AuthShellContainer(props)`
|
|
326
|
+
|
|
327
|
+
Outer full-screen container — centered flex, padded, with optional
|
|
328
|
+
absolute-positioned background decoration child.
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
function AuthShellContainer(props: AuthShellContainerProps): JSX.Element
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
- `props` — Component props (see {@link AuthShellContainerProps}).
|
|
335
|
+
|
|
336
|
+
**Returns:** The container element.
|
|
337
|
+
|
|
338
|
+
#### `AuthShellDecoration(props)`
|
|
339
|
+
|
|
340
|
+
Absolute-positioned background decoration layer — orbs, mesh gradients,
|
|
341
|
+
radial glows.
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
function AuthShellDecoration(props: { children?: JSX.Element }): JSX.Element
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
- `props` — Component props (the children are the decoration).
|
|
348
|
+
|
|
349
|
+
**Returns:** The decoration element.
|
|
350
|
+
|
|
351
|
+
#### `AuthShellCard(props)`
|
|
352
|
+
|
|
353
|
+
The centered glassmorphic card surface.
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
function AuthShellCard(props: AuthShellCardProps): JSX.Element
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
- `props` — Component props (see {@link AuthShellCardProps}).
|
|
360
|
+
|
|
361
|
+
**Returns:** The card element.
|
|
362
|
+
|
|
363
|
+
#### `AuthShellHeading(props)`
|
|
364
|
+
|
|
365
|
+
Centered heading block: optional eyebrow + h1 + optional subheading.
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
function AuthShellHeading(props: AuthShellHeadingProps): JSX.Element
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
- `props` — Component props (see {@link AuthShellHeadingProps}).
|
|
372
|
+
|
|
373
|
+
**Returns:** The heading element.
|
|
374
|
+
|
|
375
|
+
#### `AuthShellFooter(props)`
|
|
376
|
+
|
|
377
|
+
Footer inside the card — small text with a top border.
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
function AuthShellFooter(props: { children?: JSX.Element }): JSX.Element
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
- `props` — Component props (the children are the footer content).
|
|
384
|
+
|
|
385
|
+
**Returns:** The footer element.
|
|
386
|
+
|
|
387
|
+
#### `AuthShellBackLink(props)`
|
|
388
|
+
|
|
389
|
+
"Back to home" link (or custom destination) rendered below the card.
|
|
390
|
+
|
|
391
|
+
The arrow's Material Symbols glyph span is `aria-hidden="true"`, so the
|
|
392
|
+
link's accessible name is its `t()` label alone.
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
function AuthShellBackLink(props: AuthShellBackLinkProps): JSX.Element
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
- `props` — Component props (see {@link AuthShellBackLinkProps}).
|
|
399
|
+
|
|
400
|
+
**Returns:** The back-link element.
|
|
401
|
+
|
|
402
|
+
#### `AuthShellSplit(props)`
|
|
403
|
+
|
|
404
|
+
Outer frame for the two-column "decorated brand panel + card" auth layout.
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
function AuthShellSplit(props: AuthShellSplitProps): JSX.Element
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
- `props` — Component props (see {@link AuthShellSplitProps}).
|
|
411
|
+
|
|
412
|
+
**Returns:** The split element.
|
|
413
|
+
|
|
414
|
+
#### `AuthShellSplitRow(props)`
|
|
415
|
+
|
|
416
|
+
The vertically-flexed two-column row inside `<AuthShellSplit>`.
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
function AuthShellSplitRow(props: AuthShellSplitRowProps): JSX.Element
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
- `props` — Component props (see {@link AuthShellSplitRowProps}).
|
|
423
|
+
|
|
424
|
+
**Returns:** The split-row element.
|
|
425
|
+
|
|
426
|
+
#### `AuthShellPanel(props)`
|
|
427
|
+
|
|
428
|
+
A decorative `<aside>` that collapses on mobile (the brand-panel half).
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
function AuthShellPanel(props: AuthShellPanelProps): JSX.Element
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
- `props` — Component props (see {@link AuthShellPanelProps}).
|
|
435
|
+
|
|
436
|
+
**Returns:** The panel element.
|
|
437
|
+
|
|
438
|
+
#### `AuthShellCardColumn(props)`
|
|
439
|
+
|
|
440
|
+
A `<section>` (or `<main>`, via `as`) that centers its children on both axes.
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
function AuthShellCardColumn(props: AuthShellCardColumnProps): JSX.Element
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
- `props` — Component props (see {@link AuthShellCardColumnProps}).
|
|
447
|
+
|
|
448
|
+
**Returns:** The card-column element.
|
|
449
|
+
|
|
450
|
+
#### `AuthShell(props)`
|
|
451
|
+
|
|
452
|
+
Convenience preset composing container, decoration, card, heading, footer,
|
|
453
|
+
and back-link into a single component. Wraps its content in an
|
|
454
|
+
`<AuthFormStateProvider>`.
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
function AuthShell(props: AuthShellProps): JSX.Element
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
- `props` — Component props (see {@link AuthShellProps}).
|
|
461
|
+
|
|
462
|
+
**Returns:** The preset shell element.
|
|
463
|
+
|
|
464
|
+
#### `useAuthFormState(options)`
|
|
465
|
+
|
|
466
|
+
Solid primitive holding email + shared auth fields, persisted across auth
|
|
467
|
+
views via an injectable `StorageProvider` and cleared on successful auth.
|
|
468
|
+
|
|
469
|
+
```typescript
|
|
470
|
+
function useAuthFormState(options?: UseAuthFormStateOptions): AuthFormState
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
- `options` — Optional storage provider, storage key, and seed fields.
|
|
474
|
+
|
|
475
|
+
**Returns:** The current fields plus `setField`/`setFields`/`clear` and a `hydrated` flag.
|
|
476
|
+
|
|
477
|
+
### Constants
|
|
478
|
+
|
|
479
|
+
#### `DEFAULT_AUTH_FORM_STATE_KEY`
|
|
480
|
+
|
|
481
|
+
Default storage key for persisted auth form fields.
|
|
482
|
+
|
|
483
|
+
```typescript
|
|
484
|
+
const DEFAULT_AUTH_FORM_STATE_KEY: 'molecule.auth.form-state'
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## Injection Notes
|
|
488
|
+
|
|
489
|
+
### Requirements
|
|
490
|
+
|
|
491
|
+
Peer dependencies:
|
|
492
|
+
|
|
493
|
+
- `@molecule/app-logger` ^1.0.1
|
|
494
|
+
- `@molecule/app-solid` ^3.6.0
|
|
495
|
+
- `@molecule/app-storage` ^1.0.1
|
|
496
|
+
- `@molecule/app-ui` ^1.3.11
|
|
497
|
+
- `@molecule/app-ui-solid` ^1.1.0
|
|
498
|
+
- `solid-js` ^1.8.0
|
|
499
|
+
|
|
500
|
+
### Runtime Dependencies
|
|
501
|
+
|
|
502
|
+
- `@molecule/app-logger`
|
|
503
|
+
- `@molecule/app-solid`
|
|
504
|
+
- `@molecule/app-storage`
|
|
505
|
+
- `@molecule/app-ui`
|
|
506
|
+
- `@molecule/app-ui-solid`
|
|
507
|
+
- `solid-js`
|
|
508
|
+
|
|
509
|
+
`AuthShell` renders the binding's router `<Link>` ("Back to home") by
|
|
510
|
+
default, so it MUST be rendered under a `MoleculeProvider` whose config has a
|
|
511
|
+
router; pass `showBackLink={false}` in router-less setups. The back link's
|
|
512
|
+
arrow uses the Material Symbols icon font; the glyph span is
|
|
513
|
+
`aria-hidden="true"`, so the link's accessible name is its `t()` label alone.
|
|
514
|
+
Form-state persistence defaults to a process-shared in-memory store (survives
|
|
515
|
+
route swaps, not reloads) — inject
|
|
516
|
+
`createSessionStorageProvider()` for reload-safe, tab-scoped persistence.
|
|
517
|
+
Translations come from the companion `@molecule/app-locales-auth-shell`
|
|
518
|
+
locale bond.
|
|
519
|
+
|
|
520
|
+
## Translations
|
|
521
|
+
|
|
522
|
+
Translation strings are provided by `@molecule/app-locales-auth-shell`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid context wiring for {@link useAuthFormState}.
|
|
3
|
+
*
|
|
4
|
+
* `<AuthShell>` wraps its content in `<AuthFormStateProvider>` so any auth form
|
|
5
|
+
* rendered inside inherits cross-view email persistence — call
|
|
6
|
+
* `useAuthFormStateContext()` from the form to bind the shared `email` (and
|
|
7
|
+
* other shared fields) and to `clear()` on successful auth.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type JSX } from 'solid-js';
|
|
12
|
+
import type { AuthFormState, AuthFormStateProviderProps } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Provides a single {@link useAuthFormState} instance to all descendants via
|
|
15
|
+
* Solid's context, so sibling/child auth forms share the same email.
|
|
16
|
+
*
|
|
17
|
+
* @param props - Children plus optional storage provider, key, and seed fields.
|
|
18
|
+
* @returns The provider component.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AuthFormStateProvider(props: AuthFormStateProviderProps): JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the shared auth form state from the nearest
|
|
23
|
+
* {@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
24
|
+
*
|
|
25
|
+
* @returns The shared {@link AuthFormState}.
|
|
26
|
+
* @throws {Error} If called outside an `<AuthFormStateProvider>`/`<AuthShell>`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useAuthFormStateContext(): AuthFormState;
|
|
29
|
+
//# sourceMappingURL=AuthFormStateProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthFormStateProvider.d.ts","sourceRoot":"","sources":["../src/AuthFormStateProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAiB,KAAK,GAAG,EAAc,MAAM,UAAU,CAAA;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAM3E;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,GAAG,CAAC,OAAO,CASpF;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAQvD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid context wiring for {@link useAuthFormState}.
|
|
3
|
+
*
|
|
4
|
+
* `<AuthShell>` wraps its content in `<AuthFormStateProvider>` so any auth form
|
|
5
|
+
* rendered inside inherits cross-view email persistence — call
|
|
6
|
+
* `useAuthFormStateContext()` from the form to bind the shared `email` (and
|
|
7
|
+
* other shared fields) and to `clear()` on successful auth.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { createContext, useContext } from 'solid-js';
|
|
12
|
+
import { useAuthFormState } from './useAuthFormState.js';
|
|
13
|
+
/** The context under which {@link AuthFormStateProvider} publishes the shared state. */
|
|
14
|
+
const AuthFormStateContext = createContext();
|
|
15
|
+
/**
|
|
16
|
+
* Provides a single {@link useAuthFormState} instance to all descendants via
|
|
17
|
+
* Solid's context, so sibling/child auth forms share the same email.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Children plus optional storage provider, key, and seed fields.
|
|
20
|
+
* @returns The provider component.
|
|
21
|
+
*/
|
|
22
|
+
export function AuthFormStateProvider(props) {
|
|
23
|
+
const state = useAuthFormState({
|
|
24
|
+
storage: props.storage,
|
|
25
|
+
storageKey: props.storageKey,
|
|
26
|
+
initialFields: props.initialFields,
|
|
27
|
+
});
|
|
28
|
+
return (<AuthFormStateContext.Provider value={state}>{props.children}</AuthFormStateContext.Provider>);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads the shared auth form state from the nearest
|
|
32
|
+
* {@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
33
|
+
*
|
|
34
|
+
* @returns The shared {@link AuthFormState}.
|
|
35
|
+
* @throws {Error} If called outside an `<AuthFormStateProvider>`/`<AuthShell>`.
|
|
36
|
+
*/
|
|
37
|
+
export function useAuthFormStateContext() {
|
|
38
|
+
const state = useContext(AuthFormStateContext);
|
|
39
|
+
if (!state) {
|
|
40
|
+
throw new Error('useAuthFormStateContext must be used within an <AuthFormStateProvider> (or <AuthShell>, which renders one).');
|
|
41
|
+
}
|
|
42
|
+
return state;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=AuthFormStateProvider.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthFormStateProvider.jsx","sourceRoot":"","sources":["../src/AuthFormStateProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAY,UAAU,EAAE,MAAM,UAAU,CAAA;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,wFAAwF;AACxF,MAAM,oBAAoB,GAAG,aAAa,EAAiB,CAAA;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,aAAa,EAAE,KAAK,CAAC,aAAa;KACnC,CAAC,CAAA;IACF,OAAO,CACL,CAAC,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAC9F,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,6GAA6G,CAC9G,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solid auth-page layout shell — the Solid counterpart of
|
|
3
|
+
* `@molecule/app-auth-shell-react`. Same exports, same props (React names),
|
|
4
|
+
* same DOM for the same input.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { type Component, type JSX } from 'solid-js';
|
|
9
|
+
import type { AuthShellBackLinkProps, AuthShellCardColumnProps, AuthShellCardProps, AuthShellContainerProps, AuthShellHeadingProps, AuthShellPanelProps, AuthShellProps, AuthShellSplitProps, AuthShellSplitRowProps } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Outer full-screen container — centered flex, padded, with optional
|
|
12
|
+
* absolute-positioned background decoration child.
|
|
13
|
+
*
|
|
14
|
+
* @param props - Component props (see {@link AuthShellContainerProps}).
|
|
15
|
+
* @returns The container element.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AuthShellContainer: Component<AuthShellContainerProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Absolute-positioned background decoration layer — orbs, mesh gradients,
|
|
20
|
+
* radial glows.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Component props (the children are the decoration).
|
|
23
|
+
* @returns The decoration element.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AuthShellDecoration: Component<{
|
|
26
|
+
children?: JSX.Element;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* The centered glassmorphic card surface.
|
|
30
|
+
*
|
|
31
|
+
* @param props - Component props (see {@link AuthShellCardProps}).
|
|
32
|
+
* @returns The card element.
|
|
33
|
+
*/
|
|
34
|
+
export declare const AuthShellCard: Component<AuthShellCardProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Centered heading block: optional eyebrow + h1 + optional subheading.
|
|
37
|
+
*
|
|
38
|
+
* @param props - Component props (see {@link AuthShellHeadingProps}).
|
|
39
|
+
* @returns The heading element.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AuthShellHeading: Component<AuthShellHeadingProps>;
|
|
42
|
+
/**
|
|
43
|
+
* Footer inside the card — small text with a top border.
|
|
44
|
+
*
|
|
45
|
+
* @param props - Component props (the children are the footer content).
|
|
46
|
+
* @returns The footer element.
|
|
47
|
+
*/
|
|
48
|
+
export declare const AuthShellFooter: Component<{
|
|
49
|
+
children?: JSX.Element;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* "Back to home" link (or custom destination) rendered below the card.
|
|
53
|
+
*
|
|
54
|
+
* The arrow's Material Symbols glyph span is `aria-hidden="true"`, so the
|
|
55
|
+
* link's accessible name is its `t()` label alone.
|
|
56
|
+
*
|
|
57
|
+
* @param props - Component props (see {@link AuthShellBackLinkProps}).
|
|
58
|
+
* @returns The back-link element.
|
|
59
|
+
*/
|
|
60
|
+
export declare const AuthShellBackLink: Component<AuthShellBackLinkProps>;
|
|
61
|
+
/**
|
|
62
|
+
* Outer frame for the two-column "decorated brand panel + card" auth layout.
|
|
63
|
+
*
|
|
64
|
+
* @param props - Component props (see {@link AuthShellSplitProps}).
|
|
65
|
+
* @returns The split element.
|
|
66
|
+
*/
|
|
67
|
+
export declare const AuthShellSplit: Component<AuthShellSplitProps>;
|
|
68
|
+
/**
|
|
69
|
+
* The vertically-flexed two-column row inside `<AuthShellSplit>`.
|
|
70
|
+
*
|
|
71
|
+
* @param props - Component props (see {@link AuthShellSplitRowProps}).
|
|
72
|
+
* @returns The split-row element.
|
|
73
|
+
*/
|
|
74
|
+
export declare const AuthShellSplitRow: Component<AuthShellSplitRowProps>;
|
|
75
|
+
/**
|
|
76
|
+
* A decorative `<aside>` that collapses on mobile (the brand-panel half).
|
|
77
|
+
*
|
|
78
|
+
* @param props - Component props (see {@link AuthShellPanelProps}).
|
|
79
|
+
* @returns The panel element.
|
|
80
|
+
*/
|
|
81
|
+
export declare const AuthShellPanel: Component<AuthShellPanelProps>;
|
|
82
|
+
/**
|
|
83
|
+
* A `<section>` (or `<main>`, via `as`) that centers its children on both axes.
|
|
84
|
+
*
|
|
85
|
+
* @param props - Component props (see {@link AuthShellCardColumnProps}).
|
|
86
|
+
* @returns The card-column element.
|
|
87
|
+
*/
|
|
88
|
+
export declare const AuthShellCardColumn: Component<AuthShellCardColumnProps>;
|
|
89
|
+
/**
|
|
90
|
+
* Convenience preset composing container, decoration, card, heading, footer,
|
|
91
|
+
* and back-link into a single component. Wraps its content in an
|
|
92
|
+
* `<AuthFormStateProvider>`.
|
|
93
|
+
*
|
|
94
|
+
* @param props - Component props (see {@link AuthShellProps}).
|
|
95
|
+
* @returns The preset shell element.
|
|
96
|
+
*/
|
|
97
|
+
export declare const AuthShell: Component<AuthShellProps>;
|
|
98
|
+
export default AuthShell;
|
|
99
|
+
//# sourceMappingURL=AuthShell.d.ts.map
|