@molecule/app-auth-shell-svelte 0.0.0-stage → 1.1.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.
- package/LICENSE +202 -0
- package/README.md +439 -2
- package/dist/AuthFormStateProvider.svelte +22 -0
- package/dist/AuthFormStateProvider.svelte.d.ts +5 -0
- package/dist/AuthFormStateProvider.svelte.d.ts.map +1 -0
- package/dist/AuthShell.svelte +56 -0
- package/dist/AuthShell.svelte.d.ts +5 -0
- package/dist/AuthShell.svelte.d.ts.map +1 -0
- package/dist/AuthShellBackLink.svelte +28 -0
- package/dist/AuthShellBackLink.svelte.d.ts +5 -0
- package/dist/AuthShellBackLink.svelte.d.ts.map +1 -0
- package/dist/AuthShellCard.svelte +38 -0
- package/dist/AuthShellCard.svelte.d.ts +5 -0
- package/dist/AuthShellCard.svelte.d.ts.map +1 -0
- package/dist/AuthShellCardColumn.svelte +26 -0
- package/dist/AuthShellCardColumn.svelte.d.ts +5 -0
- package/dist/AuthShellCardColumn.svelte.d.ts.map +1 -0
- package/dist/AuthShellContainer.svelte +31 -0
- package/dist/AuthShellContainer.svelte.d.ts +5 -0
- package/dist/AuthShellContainer.svelte.d.ts.map +1 -0
- package/dist/AuthShellDecoration.svelte +16 -0
- package/dist/AuthShellDecoration.svelte.d.ts +8 -0
- package/dist/AuthShellDecoration.svelte.d.ts.map +1 -0
- package/dist/AuthShellFooter.svelte +18 -0
- package/dist/AuthShellFooter.svelte.d.ts +8 -0
- package/dist/AuthShellFooter.svelte.d.ts.map +1 -0
- package/dist/AuthShellHeading.svelte +38 -0
- package/dist/AuthShellHeading.svelte.d.ts +5 -0
- package/dist/AuthShellHeading.svelte.d.ts.map +1 -0
- package/dist/AuthShellPanel.svelte +18 -0
- package/dist/AuthShellPanel.svelte.d.ts +5 -0
- package/dist/AuthShellPanel.svelte.d.ts.map +1 -0
- package/dist/AuthShellSplit.svelte +18 -0
- package/dist/AuthShellSplit.svelte.d.ts +5 -0
- package/dist/AuthShellSplit.svelte.d.ts.map +1 -0
- package/dist/AuthShellSplitRow.svelte +18 -0
- package/dist/AuthShellSplitRow.svelte.d.ts +5 -0
- package/dist/AuthShellSplitRow.svelte.d.ts.map +1 -0
- package/dist/components.d.ts +19 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +18 -0
- package/dist/context.d.ts +20 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +26 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/keys.d.ts +9 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +8 -0
- package/dist/styles.d.ts +20 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +67 -0
- package/dist/types.d.ts +163 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/useAuthFormState.d.ts +27 -0
- package/dist/useAuthFormState.d.ts.map +1 -0
- package/dist/useAuthFormState.js +122 -0
- package/package.json +77 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,440 @@
|
|
|
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-18T23:41:35.456Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-auth-shell-svelte
|
|
10
|
+
|
|
11
|
+
`@molecule/app-auth-shell-svelte` — centered glassmorphic shell for auth
|
|
12
|
+
pages (Login, Signup, ForgotPassword, ResetPassword), the Svelte counterpart
|
|
13
|
+
of `@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 snippets. The shell handles layout, the glass card,
|
|
18
|
+
heading/subheading, body, footer, and the "Back to home" link.
|
|
19
|
+
|
|
20
|
+
The shell also publishes its content through `AuthFormStateProvider` (via
|
|
21
|
+
Svelte context), so any form rendered inside inherits cross-view email
|
|
22
|
+
persistence. Forms read it via `useAuthFormStateContext()`, or use the
|
|
23
|
+
standalone `useAuthFormState` hook. Persistence flows through the
|
|
24
|
+
`@molecule/app-storage` `StorageProvider` abstraction (never raw
|
|
25
|
+
`sessionStorage`), defaulting to a 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
|
+
```svelte
|
|
40
|
+
<script lang="ts">
|
|
41
|
+
import { AuthShell, useAuthFormStateContext } from '@molecule/app-auth-shell-svelte'
|
|
42
|
+
import { createSessionStorageProvider } from '@molecule/app-storage-localstorage'
|
|
43
|
+
|
|
44
|
+
const sessionStore = createSessionStorageProvider({ prefix: 'auth_' })
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<AuthShell heading="Sign in" subheading="Welcome back." formStateStorage={sessionStore}>
|
|
48
|
+
{#snippet brand()}<h2>Acme</h2>{/snippet}
|
|
49
|
+
{#snippet footer()}<p>No account? Sign up</p>{/snippet}
|
|
50
|
+
<LoginForm />
|
|
51
|
+
</AuthShell>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Type
|
|
55
|
+
|
|
56
|
+
`feature`
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install @molecule/app-auth-shell-svelte @molecule/app-logger @molecule/app-storage @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API
|
|
65
|
+
|
|
66
|
+
### Interfaces
|
|
67
|
+
|
|
68
|
+
#### `AuthFormFields`
|
|
69
|
+
|
|
70
|
+
Shared auth form field values. `email` is the canonical cross-view field;
|
|
71
|
+
additional string fields (e.g. a name carried from Signup) may be stored
|
|
72
|
+
alongside it.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
interface AuthFormFields {
|
|
76
|
+
/** Email address, shared across all auth views. */
|
|
77
|
+
email?: string
|
|
78
|
+
/** Any other shared string field (e.g. `name`). */
|
|
79
|
+
[field: string]: string | undefined
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `UseAuthFormStateOptions`
|
|
84
|
+
|
|
85
|
+
Options for {@link useAuthFormState}.
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
interface UseAuthFormStateOptions {
|
|
89
|
+
/** Storage provider backing persistence (defaults to a process-shared in-memory provider). */
|
|
90
|
+
storage?: StorageProvider
|
|
91
|
+
/** Storage key for the persisted fields. Defaults to `molecule.auth.form-state`. */
|
|
92
|
+
storageKey?: string
|
|
93
|
+
/** Seed values used before hydration completes / when storage is empty. */
|
|
94
|
+
initialFields?: AuthFormFields
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### `AuthFormState`
|
|
99
|
+
|
|
100
|
+
The value {@link useAuthFormState} returns.
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface AuthFormState {
|
|
104
|
+
/** Current field values (email + any shared fields), as a writable store. */
|
|
105
|
+
fields: Writable<AuthFormFields>
|
|
106
|
+
/** `true` once the initial read from storage has completed, as a writable store. */
|
|
107
|
+
hydrated: Writable<boolean>
|
|
108
|
+
/** Sets a single field and persists the new state. */
|
|
109
|
+
setField: (name: string, value: string) => void
|
|
110
|
+
/** Merges a patch of fields and persists the new state. */
|
|
111
|
+
setFields: (patch: AuthFormFields) => void
|
|
112
|
+
/** Clears all persisted auth form state and removes the storage key. */
|
|
113
|
+
clear: () => void
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### `AuthFormStateProviderProps`
|
|
118
|
+
|
|
119
|
+
Props for {@link AuthFormStateProvider}.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface AuthFormStateProviderProps {
|
|
123
|
+
/** Children rendered inside the provider. */
|
|
124
|
+
children?: Snippet
|
|
125
|
+
/** Storage provider backing persistence (defaults to a shared in-memory provider). */
|
|
126
|
+
storage?: StorageProvider
|
|
127
|
+
/** Storage key for the persisted fields. */
|
|
128
|
+
storageKey?: string
|
|
129
|
+
/** Seed values used before hydration / when storage is empty. */
|
|
130
|
+
initialFields?: AuthFormFields
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### `AuthShellContainerProps`
|
|
135
|
+
|
|
136
|
+
Props accepted by {@link AuthShellContainer}.
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface AuthShellContainerProps {
|
|
140
|
+
/** Content rendered inside the container. */
|
|
141
|
+
children?: Snippet
|
|
142
|
+
/** Optional CSS background applied to the container. */
|
|
143
|
+
style?: AuthShellStyle
|
|
144
|
+
/** Extra classes appended after the defaults. */
|
|
145
|
+
className?: string
|
|
146
|
+
/** Layout direction. Defaults to `'centered'`; pass `'column'` for a vertical stack. */
|
|
147
|
+
layout?: 'centered' | 'column'
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### `AuthShellCardProps`
|
|
152
|
+
|
|
153
|
+
Props accepted by {@link AuthShellCard}.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
interface AuthShellCardProps {
|
|
157
|
+
/** Content rendered inside the card. */
|
|
158
|
+
children?: Snippet
|
|
159
|
+
/** Override the default glass surface. */
|
|
160
|
+
surfaceClassName?: string
|
|
161
|
+
/** Extra layout classes appended after the flex/padding defaults. */
|
|
162
|
+
className?: string
|
|
163
|
+
/** Override the outer `<main>` wrapper classes. */
|
|
164
|
+
outerClassName?: string
|
|
165
|
+
/** `data-mol-id` pass-through for E2E selectors. */
|
|
166
|
+
dataMolId?: string
|
|
167
|
+
/** Optional CSS style applied to the card's inner surface. */
|
|
168
|
+
style?: AuthShellStyle
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### `AuthShellHeadingProps`
|
|
173
|
+
|
|
174
|
+
Props accepted by {@link AuthShellHeading}.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
interface AuthShellHeadingProps {
|
|
178
|
+
/** The heading text. */
|
|
179
|
+
heading: string
|
|
180
|
+
/** Optional subheading paragraph. */
|
|
181
|
+
subheading?: string
|
|
182
|
+
/** Optional small uppercase tag rendered above the heading. */
|
|
183
|
+
eyebrow?: string
|
|
184
|
+
/** Optional override for the h1 className. */
|
|
185
|
+
headingClassName?: string
|
|
186
|
+
/** Optional override for the h1 style. */
|
|
187
|
+
headingStyle?: AuthShellStyle
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### `AuthShellBackLinkProps`
|
|
192
|
+
|
|
193
|
+
Props accepted by {@link AuthShellBackLink}.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
interface AuthShellBackLinkProps {
|
|
197
|
+
/** Destination. Defaults to `/`. */
|
|
198
|
+
to?: string
|
|
199
|
+
/** Translated label override; falls back to `auth.backHome` → "Back to home" when absent, empty or blank. */
|
|
200
|
+
label?: string
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### `AuthShellSplitProps`
|
|
205
|
+
|
|
206
|
+
Props accepted by {@link AuthShellSplit}.
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
interface AuthShellSplitProps {
|
|
210
|
+
/** The split row (and optionally a site footer sibling). */
|
|
211
|
+
children?: Snippet
|
|
212
|
+
/** Cosmetic classes (background, text color, font) for the outer container. */
|
|
213
|
+
className?: string
|
|
214
|
+
/** Any other attribute React would spread onto the container. */
|
|
215
|
+
[attribute: string]: unknown
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### `AuthShellSplitRowProps`
|
|
220
|
+
|
|
221
|
+
Props accepted by {@link AuthShellSplitRow}.
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
interface AuthShellSplitRowProps {
|
|
225
|
+
/** The brand panel and the card column. */
|
|
226
|
+
children?: Snippet
|
|
227
|
+
/** Layout classes for the row (typically `cm.flex({})` or `cm.grid({ cols: 2 })`). */
|
|
228
|
+
className?: string
|
|
229
|
+
/** Any other attribute React would spread onto the row. */
|
|
230
|
+
[attribute: string]: unknown
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### `AuthShellPanelProps`
|
|
235
|
+
|
|
236
|
+
Props accepted by {@link AuthShellPanel}.
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
interface AuthShellPanelProps {
|
|
240
|
+
/** The app's bespoke decoration, wordmark or social proof. */
|
|
241
|
+
children?: Snippet
|
|
242
|
+
/** Cosmetic classes — width ratio, padding, gradient, positioning. */
|
|
243
|
+
className?: string
|
|
244
|
+
/** Any other attribute React would spread onto the panel. */
|
|
245
|
+
[attribute: string]: unknown
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### `AuthShellCardColumnProps`
|
|
250
|
+
|
|
251
|
+
Props accepted by {@link AuthShellCardColumn}.
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
interface AuthShellCardColumnProps {
|
|
255
|
+
/** The form card content. */
|
|
256
|
+
children?: Snippet
|
|
257
|
+
/** Cosmetic classes — width ratio, padding. */
|
|
258
|
+
className?: string
|
|
259
|
+
/** Element to render. Defaults to `'section'`. */
|
|
260
|
+
as?: 'section' | 'main'
|
|
261
|
+
/** Any other attribute React would spread onto the column. */
|
|
262
|
+
[attribute: string]: unknown
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### `AuthShellProps`
|
|
267
|
+
|
|
268
|
+
Props accepted by {@link AuthShell}.
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
interface AuthShellProps {
|
|
272
|
+
/** The heading text. */
|
|
273
|
+
heading: string
|
|
274
|
+
/** The subheading text. */
|
|
275
|
+
subheading: string
|
|
276
|
+
/** The form body. */
|
|
277
|
+
children: Snippet
|
|
278
|
+
/** Optional footer node. */
|
|
279
|
+
footer?: Snippet
|
|
280
|
+
/** Optional brand node rendered above the heading. */
|
|
281
|
+
brand?: Snippet
|
|
282
|
+
/** Optional background decoration node. */
|
|
283
|
+
decoration?: Snippet
|
|
284
|
+
/** Destination of the back link. Defaults to `/`. */
|
|
285
|
+
backTo?: string
|
|
286
|
+
/** Whether to render the back link. Defaults to `true`. */
|
|
287
|
+
showBackLink?: boolean
|
|
288
|
+
/** Storage provider backing cross-view auth form persistence. */
|
|
289
|
+
formStateStorage?: StorageProvider
|
|
290
|
+
/** Storage key for the persisted auth form state. */
|
|
291
|
+
formStateKey?: string
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Functions
|
|
296
|
+
|
|
297
|
+
#### `useAuthFormStateContext()`
|
|
298
|
+
|
|
299
|
+
Reads the shared auth form state from the nearest
|
|
300
|
+
{@link AuthFormStateProvider} (which `<AuthShell>` renders by default).
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
function useAuthFormStateContext(): AuthFormState
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Returns:** The shared {@link AuthFormState}.
|
|
307
|
+
|
|
308
|
+
#### `useAuthFormState(options)`
|
|
309
|
+
|
|
310
|
+
Svelte hook holding email + shared auth fields, persisted across auth views
|
|
311
|
+
via an injectable `StorageProvider` and cleared on successful auth.
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
function useAuthFormState(
|
|
315
|
+
options?: UseAuthFormStateOptions | (() => UseAuthFormStateOptions | undefined),
|
|
316
|
+
): AuthFormState
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
- `options` — Optional storage provider, storage key, and seed fields, or a getter of them (a getter lets a component pass its `$props()` without Svelte's local-reference warning, since the props are read once at init).
|
|
320
|
+
|
|
321
|
+
**Returns:** The current fields plus `setField`/`setFields`/`clear` and a `hydrated` flag.
|
|
322
|
+
|
|
323
|
+
### Constants
|
|
324
|
+
|
|
325
|
+
#### `AuthFormStateProvider`
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
const AuthFormStateProvider: LegacyComponentType
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
#### `AuthShell`
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const AuthShell: LegacyComponentType
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### `AuthShellBackLink`
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const AuthShellBackLink: LegacyComponentType
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### `AuthShellCard`
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
const AuthShellCard: LegacyComponentType
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### `AuthShellCardColumn`
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
const AuthShellCardColumn: LegacyComponentType
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### `AuthShellContainer`
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
const AuthShellContainer: LegacyComponentType
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
#### `AuthShellDecoration`
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
const AuthShellDecoration: LegacyComponentType
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
#### `AuthShellFooter`
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
const AuthShellFooter: LegacyComponentType
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
#### `AuthShellHeading`
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
const AuthShellHeading: LegacyComponentType
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### `AuthShellPanel`
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
const AuthShellPanel: LegacyComponentType
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### `AuthShellSplit`
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
const AuthShellSplit: LegacyComponentType
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
#### `AuthShellSplitRow`
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
const AuthShellSplitRow: LegacyComponentType
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### `DEFAULT_AUTH_FORM_STATE_KEY`
|
|
398
|
+
|
|
399
|
+
Default storage key for persisted auth form fields.
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
const DEFAULT_AUTH_FORM_STATE_KEY: 'molecule.auth.form-state'
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## Injection Notes
|
|
406
|
+
|
|
407
|
+
### Requirements
|
|
408
|
+
|
|
409
|
+
Peer dependencies:
|
|
410
|
+
|
|
411
|
+
- `@molecule/app-logger` ^1.0.1
|
|
412
|
+
- `@molecule/app-storage` ^1.0.1
|
|
413
|
+
- `@molecule/app-svelte` ^3.6.0
|
|
414
|
+
- `@molecule/app-ui` ^1.3.11
|
|
415
|
+
- `@molecule/app-ui-svelte` ^1.1.0
|
|
416
|
+
- `svelte` ^5.0.0
|
|
417
|
+
|
|
418
|
+
### Runtime Dependencies
|
|
419
|
+
|
|
420
|
+
- `@molecule/app-logger`
|
|
421
|
+
- `@molecule/app-storage`
|
|
422
|
+
- `@molecule/app-svelte`
|
|
423
|
+
- `@molecule/app-ui`
|
|
424
|
+
- `@molecule/app-ui-svelte`
|
|
425
|
+
- `svelte`
|
|
426
|
+
|
|
427
|
+
`AuthShell` renders the binding's router `<Link>` ("Back to home") by
|
|
428
|
+
default, so it MUST be rendered under `setMoleculeContext` with a router;
|
|
429
|
+
pass `showBackLink={false}` in router-less setups. The back link's arrow
|
|
430
|
+
uses the Material Symbols icon font; the glyph span is `aria-hidden="true"`,
|
|
431
|
+
so the link's accessible name is its `t()` label alone. Form-state
|
|
432
|
+
persistence defaults to a
|
|
433
|
+
process-shared in-memory store (survives route swaps, not reloads) — inject
|
|
434
|
+
`createSessionStorageProvider()` for reload-safe, tab-scoped persistence.
|
|
435
|
+
Translations come from the companion `@molecule/app-locales-auth-shell`
|
|
436
|
+
locale bond.
|
|
437
|
+
|
|
438
|
+
## Translations
|
|
439
|
+
|
|
440
|
+
Translation strings are provided by `@molecule/app-locales-auth-shell`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AuthFormStateProvider: the Svelte counterpart of
|
|
3
|
+
`@molecule/app-auth-shell-react`'s `AuthFormStateProvider` — publishes one
|
|
4
|
+
shared auth-form state to descendants through Svelte context and renders its
|
|
5
|
+
children with no DOM of its own.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { setContext } from 'svelte'
|
|
9
|
+
|
|
10
|
+
import { AUTH_FORM_STATE_KEY } from './keys.js'
|
|
11
|
+
import type { AuthFormStateProviderProps } from './types.js'
|
|
12
|
+
import { useAuthFormState } from './useAuthFormState.js'
|
|
13
|
+
|
|
14
|
+
let { children, storage, storageKey, initialFields }: AuthFormStateProviderProps = $props()
|
|
15
|
+
|
|
16
|
+
setContext(
|
|
17
|
+
AUTH_FORM_STATE_KEY,
|
|
18
|
+
useAuthFormState(() => ({ storage, storageKey, initialFields })),
|
|
19
|
+
)
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{@render children?.()}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AuthFormStateProviderProps } from './types.js';
|
|
2
|
+
declare const AuthFormStateProvider: import("svelte").Component<AuthFormStateProviderProps, {}, "">;
|
|
3
|
+
type AuthFormStateProvider = ReturnType<typeof AuthFormStateProvider>;
|
|
4
|
+
export default AuthFormStateProvider;
|
|
5
|
+
//# sourceMappingURL=AuthFormStateProvider.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthFormStateProvider.svelte.d.ts","sourceRoot":"","sources":["../src/AuthFormStateProvider.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAuB5D,QAAA,MAAM,qBAAqB,gEAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
|