@molecule/app-angular 3.3.1 → 3.5.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/README.md +3880 -1264
- package/dist/hooks/external-store.d.ts +32 -0
- package/dist/hooks/external-store.d.ts.map +1 -0
- package/dist/hooks/external-store.js +62 -0
- package/dist/hooks/external-store.js.map +1 -0
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +24 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-ai-models.d.ts +46 -0
- package/dist/hooks/use-ai-models.d.ts.map +1 -0
- package/dist/hooks/use-ai-models.js +142 -0
- package/dist/hooks/use-ai-models.js.map +1 -0
- package/dist/hooks/use-async.d.ts +125 -0
- package/dist/hooks/use-async.d.ts.map +1 -0
- package/dist/hooks/use-async.js +189 -0
- package/dist/hooks/use-async.js.map +1 -0
- package/dist/hooks/use-auth-flows.d.ts +207 -0
- package/dist/hooks/use-auth-flows.d.ts.map +1 -0
- package/dist/hooks/use-auth-flows.js +460 -0
- package/dist/hooks/use-auth-flows.js.map +1 -0
- package/dist/hooks/use-auth.d.ts +80 -0
- package/dist/hooks/use-auth.d.ts.map +1 -0
- package/dist/hooks/use-auth.js +89 -0
- package/dist/hooks/use-auth.js.map +1 -0
- package/dist/hooks/use-forms.d.ts +177 -0
- package/dist/hooks/use-forms.d.ts.map +1 -0
- package/dist/hooks/use-forms.js +185 -0
- package/dist/hooks/use-forms.js.map +1 -0
- package/dist/hooks/use-http.d.ts +155 -0
- package/dist/hooks/use-http.d.ts.map +1 -0
- package/dist/hooks/use-http.js +212 -0
- package/dist/hooks/use-http.js.map +1 -0
- package/dist/hooks/use-ide.d.ts +208 -0
- package/dist/hooks/use-ide.d.ts.map +1 -0
- package/dist/hooks/use-ide.js +217 -0
- package/dist/hooks/use-ide.js.map +1 -0
- package/dist/hooks/use-logger.d.ts +40 -0
- package/dist/hooks/use-logger.d.ts.map +1 -0
- package/dist/hooks/use-logger.js +56 -0
- package/dist/hooks/use-logger.js.map +1 -0
- package/dist/hooks/use-native.d.ts +213 -0
- package/dist/hooks/use-native.d.ts.map +1 -0
- package/dist/hooks/use-native.js +158 -0
- package/dist/hooks/use-native.js.map +1 -0
- package/dist/hooks/use-profile-form.d.ts +113 -0
- package/dist/hooks/use-profile-form.d.ts.map +1 -0
- package/dist/hooks/use-profile-form.js +253 -0
- package/dist/hooks/use-profile-form.js.map +1 -0
- package/dist/hooks/use-router.d.ts +212 -0
- package/dist/hooks/use-router.d.ts.map +1 -0
- package/dist/hooks/use-router.js +251 -0
- package/dist/hooks/use-router.js.map +1 -0
- package/dist/hooks/use-storage.d.ts +128 -0
- package/dist/hooks/use-storage.d.ts.map +1 -0
- package/dist/hooks/use-storage.js +217 -0
- package/dist/hooks/use-storage.js.map +1 -0
- package/dist/hooks/use-store.d.ts +74 -0
- package/dist/hooks/use-store.d.ts.map +1 -0
- package/dist/hooks/use-store.js +103 -0
- package/dist/hooks/use-store.js.map +1 -0
- package/dist/hooks/use-theme.d.ts +59 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +117 -0
- package/dist/hooks/use-theme.js.map +1 -0
- package/dist/hooks/use-translation.d.ts +86 -0
- package/dist/hooks/use-translation.d.ts.map +1 -0
- package/dist/hooks/use-translation.js +146 -0
- package/dist/hooks/use-translation.js.map +1 -0
- package/dist/hooks/use-verify-payment-return.d.ts +86 -0
- package/dist/hooks/use-verify-payment-return.d.ts.map +1 -0
- package/dist/hooks/use-verify-payment-return.js +167 -0
- package/dist/hooks/use-verify-payment-return.js.map +1 -0
- package/dist/hooks/use-version.d.ts +49 -0
- package/dist/hooks/use-version.d.ts.map +1 -0
- package/dist/hooks/use-version.js +70 -0
- package/dist/hooks/use-version.js.map +1 -0
- package/dist/i18n-reactive.d.ts +2 -5
- package/dist/i18n-reactive.d.ts.map +1 -1
- package/dist/i18n-reactive.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inject.d.ts +24 -0
- package/dist/inject.d.ts.map +1 -0
- package/dist/inject.js +33 -0
- package/dist/inject.js.map +1 -0
- package/dist/providers.d.ts +24 -0
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +44 -3
- package/dist/providers.js.map +1 -1
- package/dist/session-ready.d.ts +41 -0
- package/dist/session-ready.d.ts.map +1 -0
- package/dist/session-ready.js +79 -0
- package/dist/session-ready.js.map +1 -0
- package/dist/site.d.ts +51 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +69 -0
- package/dist/site.js.map +1 -0
- package/dist/tokens.d.ts +15 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -0
- package/dist/tokens.js.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile editing over the app's bonded form and auth clients, mirroring
|
|
3
|
+
* `useProfileForm` from `@molecule/app-react`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { computed, DestroyRef, effect, inject, signal } from '@angular/core';
|
|
8
|
+
import { formValuesEqual, snapshotFormValue } from '@molecule/app-forms';
|
|
9
|
+
import { useAuth, useAuthClient } from './use-auth.js';
|
|
10
|
+
import { useForm } from './use-forms.js';
|
|
11
|
+
/**
|
|
12
|
+
* Detaches the value snapshot the hook keeps as its baseline.
|
|
13
|
+
*
|
|
14
|
+
* Form values are a plain string-keyed object at runtime; the caller's values
|
|
15
|
+
* TYPE may be an `interface`, which has no index signature to spread from, so
|
|
16
|
+
* the copy goes through the record view and comes back as `TValues`.
|
|
17
|
+
*
|
|
18
|
+
* @param values - The values object to snapshot.
|
|
19
|
+
* @returns A detached form-value snapshot.
|
|
20
|
+
*/
|
|
21
|
+
function copyValues(values) {
|
|
22
|
+
return snapshotFormValue(values);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Owns load → edit → submit → publish for the signed-in user's profile. Call
|
|
26
|
+
* it in an injection context (a component field initializer or constructor).
|
|
27
|
+
*
|
|
28
|
+
* Same-account background updates refresh untouched fields but preserve dirty
|
|
29
|
+
* controls. Session ownership comes from the auth client, independently of
|
|
30
|
+
* mutable profile fields; an explicit getIdentity adds the caller's identity
|
|
31
|
+
* check. Submission snapshots the registered values before asynchronous
|
|
32
|
+
* validation, sends only changed fields through `toPatch`, and uses the auth
|
|
33
|
+
* client's configured updateProfile transport. The saved server response
|
|
34
|
+
* becomes the clean baseline; edits made while saving remain dirty. No request
|
|
35
|
+
* is made for a patch with no fields. A failed request retains the edits and
|
|
36
|
+
* shared user.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Controlled defaults, identity and wire adapters, optional
|
|
39
|
+
* cache/navigation callback.
|
|
40
|
+
* @returns Form state, typed control bindings, native submit binding and save
|
|
41
|
+
* error.
|
|
42
|
+
*/
|
|
43
|
+
export function useProfileForm(options) {
|
|
44
|
+
const { defaultValues, getIdentity, toValues, toPatch, onSaved, ...formOptions } = options;
|
|
45
|
+
const form = useForm({ ...formOptions, defaultValues });
|
|
46
|
+
const client = useAuthClient();
|
|
47
|
+
const { user } = useAuth();
|
|
48
|
+
const destroyRef = inject(DestroyRef);
|
|
49
|
+
const error = signal(undefined, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
51
|
+
const isSaving = signal(false, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "isSaving" }] : /* istanbul ignore next */ []));
|
|
53
|
+
// The rest of the mutable state is React's refs: plain closure variables,
|
|
54
|
+
// read and written by the load effect and the submit flow without ever
|
|
55
|
+
// re-triggering the effect (only the auth user signal does that).
|
|
56
|
+
let baseline = copyValues(defaultValues);
|
|
57
|
+
// A late same-account record must not undo fields the person edited, even
|
|
58
|
+
// after those edits became the clean baseline of a completed save.
|
|
59
|
+
const editedFields = new Set();
|
|
60
|
+
let owner = null;
|
|
61
|
+
let activeSave = null;
|
|
62
|
+
let pendingPropagation = undefined;
|
|
63
|
+
let mounted = true;
|
|
64
|
+
destroyRef.onDestroy(() => {
|
|
65
|
+
mounted = false;
|
|
66
|
+
});
|
|
67
|
+
const readValues = () => {
|
|
68
|
+
const values = copyValues(baseline);
|
|
69
|
+
for (const key of Object.keys(values))
|
|
70
|
+
values[key] = form.getValue(key);
|
|
71
|
+
return values;
|
|
72
|
+
};
|
|
73
|
+
const rebase = (next, preserveAgainst) => {
|
|
74
|
+
const current = readValues();
|
|
75
|
+
baseline = copyValues(next);
|
|
76
|
+
if (preserveAgainst) {
|
|
77
|
+
form.updateValues(next, { keepDirtyValues: true });
|
|
78
|
+
for (const key of Object.keys(current)) {
|
|
79
|
+
if (editedFields.has(key) || !formValuesEqual(current[key], preserveAgainst[key])) {
|
|
80
|
+
form.setValue(key, current[key]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
form.reset(next);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
// The load effect: React's useLayoutEffect over [user, client, rebase]. In
|
|
89
|
+
// Angular the user arrives through the auth signal, so the effect tracks it.
|
|
90
|
+
effect(() => {
|
|
91
|
+
const currentUser = user();
|
|
92
|
+
if (!currentUser) {
|
|
93
|
+
if (owner !== null) {
|
|
94
|
+
owner = null;
|
|
95
|
+
pendingPropagation = undefined;
|
|
96
|
+
editedFields.clear();
|
|
97
|
+
rebase(copyValues(defaultValues));
|
|
98
|
+
error.set(undefined);
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const revision = client.getSessionRevision?.();
|
|
103
|
+
const identity = getIdentity?.(currentUser);
|
|
104
|
+
if (revision === undefined && !getIdentity) {
|
|
105
|
+
throw new Error('useProfileForm: provide getIdentity when the auth client has no session revision');
|
|
106
|
+
}
|
|
107
|
+
const previous = owner;
|
|
108
|
+
const sameAccount = !previous ||
|
|
109
|
+
(previous.client === client &&
|
|
110
|
+
previous.revision === revision &&
|
|
111
|
+
previous.identity === identity);
|
|
112
|
+
const previousBaseline = baseline;
|
|
113
|
+
// Keep this token across same-account hydration, but replace it when the
|
|
114
|
+
// account/client changes. A pending validation belongs to that exact owner.
|
|
115
|
+
if (!previous || !sameAccount) {
|
|
116
|
+
owner = { client, revision, identity };
|
|
117
|
+
editedFields.clear();
|
|
118
|
+
}
|
|
119
|
+
rebase(toValues(currentUser), sameAccount ? previousBaseline : undefined);
|
|
120
|
+
if (!sameAccount) {
|
|
121
|
+
pendingPropagation = undefined;
|
|
122
|
+
error.set(undefined);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const submit = () => {
|
|
126
|
+
if (activeSave)
|
|
127
|
+
return activeSave;
|
|
128
|
+
const currentUser = client.getUser();
|
|
129
|
+
if (!mounted || !currentUser)
|
|
130
|
+
return Promise.resolve(undefined);
|
|
131
|
+
const revision = client.getSessionRevision?.();
|
|
132
|
+
const identity = getIdentity?.(currentUser);
|
|
133
|
+
const submissionOwner = owner;
|
|
134
|
+
const ownsProfile = () => {
|
|
135
|
+
const current = client.getUser();
|
|
136
|
+
return (mounted &&
|
|
137
|
+
owner === submissionOwner &&
|
|
138
|
+
current !== null &&
|
|
139
|
+
client.getSessionRevision?.() === revision &&
|
|
140
|
+
getIdentity?.(current) === identity);
|
|
141
|
+
};
|
|
142
|
+
const snapshot = readValues();
|
|
143
|
+
const before = copyValues(baseline);
|
|
144
|
+
const changes = {};
|
|
145
|
+
for (const key of Object.keys(snapshot)) {
|
|
146
|
+
if (!formValuesEqual(snapshot[key], before[key]))
|
|
147
|
+
changes[key] = snapshot[key];
|
|
148
|
+
}
|
|
149
|
+
error.set(undefined);
|
|
150
|
+
isSaving.set(true);
|
|
151
|
+
let saved;
|
|
152
|
+
const run = async () => {
|
|
153
|
+
try {
|
|
154
|
+
await form.handleSubmit(async () => {
|
|
155
|
+
// Validation can await arbitrary app work. Check BEFORE toPatch and
|
|
156
|
+
// again immediately before the mutation: its credentials are read by
|
|
157
|
+
// updateProfile now, not when the reader originally clicked Save.
|
|
158
|
+
if (!ownsProfile())
|
|
159
|
+
return;
|
|
160
|
+
const patch = toPatch(changes, snapshot);
|
|
161
|
+
if (Object.keys(patch).length > 0) {
|
|
162
|
+
if (!ownsProfile())
|
|
163
|
+
return;
|
|
164
|
+
saved = await client.updateProfile(patch);
|
|
165
|
+
if (!ownsProfile()) {
|
|
166
|
+
saved = undefined;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (mounted) {
|
|
170
|
+
const savedValues = toValues(saved);
|
|
171
|
+
const current = readValues();
|
|
172
|
+
for (const key of editedFields) {
|
|
173
|
+
if (formValuesEqual(current[key], snapshot[key]) &&
|
|
174
|
+
!formValuesEqual(savedValues[key], snapshot[key])) {
|
|
175
|
+
// The accepted response intentionally transformed or cleared
|
|
176
|
+
// this field (for example, a write-only password).
|
|
177
|
+
editedFields.delete(key);
|
|
178
|
+
form.setValue(key, savedValues[key]);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
rebase(savedValues, snapshot);
|
|
182
|
+
}
|
|
183
|
+
pendingPropagation = saved;
|
|
184
|
+
}
|
|
185
|
+
if (pendingPropagation !== undefined) {
|
|
186
|
+
if (!ownsProfile()) {
|
|
187
|
+
saved = undefined;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const propagated = pendingPropagation;
|
|
191
|
+
await onSaved?.(propagated);
|
|
192
|
+
pendingPropagation = undefined;
|
|
193
|
+
saved = propagated;
|
|
194
|
+
}
|
|
195
|
+
})();
|
|
196
|
+
return saved;
|
|
197
|
+
}
|
|
198
|
+
catch (failure) {
|
|
199
|
+
if (mounted)
|
|
200
|
+
error.set(failure);
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
activeSave = null;
|
|
205
|
+
if (mounted)
|
|
206
|
+
isSaving.set(false);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const save = run();
|
|
210
|
+
activeSave = save;
|
|
211
|
+
return save;
|
|
212
|
+
};
|
|
213
|
+
const register = (name, registerOptions) => {
|
|
214
|
+
const registration = form.register(name, registerOptions);
|
|
215
|
+
return {
|
|
216
|
+
...registration,
|
|
217
|
+
onChange: (event) => {
|
|
218
|
+
editedFields.add(name);
|
|
219
|
+
registration.onChange(event);
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
const setValue = (name, value) => {
|
|
224
|
+
editedFields.add(name);
|
|
225
|
+
form.setValue(name, value);
|
|
226
|
+
};
|
|
227
|
+
const reset = () => {
|
|
228
|
+
editedFields.clear();
|
|
229
|
+
form.reset(baseline);
|
|
230
|
+
error.set(undefined);
|
|
231
|
+
};
|
|
232
|
+
const onSubmit = (event) => {
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
void submit();
|
|
235
|
+
};
|
|
236
|
+
return {
|
|
237
|
+
...form,
|
|
238
|
+
formState: computed(() => ({
|
|
239
|
+
...form.formState(),
|
|
240
|
+
isSubmitting: isSaving() || form.formState().isSubmitting,
|
|
241
|
+
})),
|
|
242
|
+
isSubmitting: computed(() => isSaving() || form.isSubmitting()),
|
|
243
|
+
user,
|
|
244
|
+
ready: computed(() => user() !== null),
|
|
245
|
+
error: error.asReadonly(),
|
|
246
|
+
register,
|
|
247
|
+
setValue,
|
|
248
|
+
reset,
|
|
249
|
+
submit,
|
|
250
|
+
formProps: { onSubmit },
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=use-profile-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-profile-form.js","sourceRoot":"","sources":["../../src/hooks/use-profile-form.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,Q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,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC,CAAA;IAED,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,YAAY,CAAC,KAAK,EAAE,CAAA;QACpB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACpB,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,CAAC,KAAqC,EAAQ,EAAE;QAC/D,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,MAAM,EAAE,CAAA;IACf,CAAC,CAAA;IAED,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;YACzB,GAAG,IAAI,CAAC,SAAS,EAAE;YACnB,YAAY,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,YAAY;SAC1D,CAAC,CAAC;QACH,YAAY,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/D,IAAI;QACJ,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC;QACtC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE;QACzB,QAAQ;QACR,QAAQ;QACR,KAAK;QACL,MAAM;QACN,SAAS,EAAE,EAAE,QAAQ,EAAE;KACxB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular functions for routing, mirroring `useRouter`, `useRouterInstance`,
|
|
3
|
+
* `useLocation`, `useParams`, `useQuery`, `useNavigate`, `useIsActive`,
|
|
4
|
+
* `useListRoute` and `useConsumedSearchParam` from `@molecule/app-react`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { type Signal } from '@angular/core';
|
|
9
|
+
import type { ListRouteChange, ListRouteOptions, ListRouteResult, NavigateOptions, QueryParams, RouteLocation, RouteParams, Router } from '@molecule/app-routing';
|
|
10
|
+
/**
|
|
11
|
+
* The router registered by `provideMolecule({ router })` or `provideRouter`.
|
|
12
|
+
* Call it in an injection context.
|
|
13
|
+
*
|
|
14
|
+
* @returns The router instance.
|
|
15
|
+
* @throws {Error} When no router is registered.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useRouterInstance(): Router;
|
|
18
|
+
/**
|
|
19
|
+
* What {@link useRouter} returns.
|
|
20
|
+
*/
|
|
21
|
+
export interface UseRouterResult {
|
|
22
|
+
/** The current route location. */
|
|
23
|
+
readonly location: Signal<RouteLocation>;
|
|
24
|
+
/** The current route's path parameters. */
|
|
25
|
+
readonly params: Signal<RouteParams>;
|
|
26
|
+
/** The current query parameters. */
|
|
27
|
+
readonly query: Signal<QueryParams>;
|
|
28
|
+
/** Navigates to a path. */
|
|
29
|
+
navigate: (path: string, options?: NavigateOptions) => void;
|
|
30
|
+
/** Navigates to a named route. */
|
|
31
|
+
navigateTo: (name: string, params?: RouteParams, query?: QueryParams, options?: NavigateOptions) => void;
|
|
32
|
+
/** Goes back one history entry. */
|
|
33
|
+
back: () => void;
|
|
34
|
+
/** Goes forward one history entry. */
|
|
35
|
+
forward: () => void;
|
|
36
|
+
/** Whether a path matches the current route. */
|
|
37
|
+
isActive: (path: string, exact?: boolean) => boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Routing state and actions. Call it in an injection context (a component
|
|
41
|
+
* field initializer or constructor).
|
|
42
|
+
*
|
|
43
|
+
* @returns The location, params and query as signals, and the navigation actions.
|
|
44
|
+
*/
|
|
45
|
+
export declare function useRouter(): UseRouterResult;
|
|
46
|
+
/**
|
|
47
|
+
* The current location alone. Call it in an injection context.
|
|
48
|
+
*
|
|
49
|
+
* @returns A signal of the current route location.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useLocation(): Signal<RouteLocation>;
|
|
52
|
+
/**
|
|
53
|
+
* The current path parameters alone. Call it in an injection context.
|
|
54
|
+
*
|
|
55
|
+
* @returns A signal of the current path parameters.
|
|
56
|
+
*/
|
|
57
|
+
export declare function useParams<T extends Record<string, string> = RouteParams>(): Signal<T>;
|
|
58
|
+
/**
|
|
59
|
+
* The current query parameters alone. Call it in an injection context.
|
|
60
|
+
*
|
|
61
|
+
* @returns A signal of the current query parameters.
|
|
62
|
+
*/
|
|
63
|
+
export declare function useQuery<T extends QueryParams = QueryParams>(): Signal<T>;
|
|
64
|
+
/**
|
|
65
|
+
* A navigate function alone. Call it in an injection context.
|
|
66
|
+
*
|
|
67
|
+
* @returns The navigate function.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useNavigate(): (path: string, options?: NavigateOptions) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Whether a path is active, re-evaluated on every route change. Call it in an
|
|
72
|
+
* injection context.
|
|
73
|
+
*
|
|
74
|
+
* @param path - The path to check.
|
|
75
|
+
* @param exact - Whether to match exactly (default: `false`).
|
|
76
|
+
* @returns A signal of whether the path is active.
|
|
77
|
+
*/
|
|
78
|
+
export declare function useIsActive(path: string, exact?: boolean): Signal<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* What {@link useListRoute} returns: each list state field as a signal (the
|
|
81
|
+
* same fields React's result carries as plain values) and the list's link
|
|
82
|
+
* builder and navigation actions.
|
|
83
|
+
*
|
|
84
|
+
* @template Filter - The filter names.
|
|
85
|
+
* @template Selection - The selection names.
|
|
86
|
+
*/
|
|
87
|
+
export interface UseListRouteResult<Filter extends string = string, Selection extends string = string> {
|
|
88
|
+
/** The current 1-indexed page (malformed and non-positive URL values read as page one). */
|
|
89
|
+
readonly page: Signal<number>;
|
|
90
|
+
/** The configured items per page. */
|
|
91
|
+
readonly pageSize: Signal<number>;
|
|
92
|
+
/** The zero-indexed item offset for an API request. */
|
|
93
|
+
readonly offset: Signal<number>;
|
|
94
|
+
/** The current URL filter values, including values supplied by path parameters. */
|
|
95
|
+
readonly filters: Signal<Record<Filter, string | undefined>>;
|
|
96
|
+
/** The matching view, or the configured fallback. */
|
|
97
|
+
readonly selection: Signal<Selection | undefined>;
|
|
98
|
+
/** The decoded current path parameters, also usable as API-only filters. */
|
|
99
|
+
readonly params: Signal<RouteParams>;
|
|
100
|
+
/** Whether the current view may load; a protected view waits for auth. */
|
|
101
|
+
readonly canLoad: Signal<boolean>;
|
|
102
|
+
/** Readiness for the current view; a public view always stays ready. */
|
|
103
|
+
readonly status: Signal<ListRouteResult<Filter, Selection>['status']>;
|
|
104
|
+
/** The sign-in destination while a signed-out protected view is being redirected. */
|
|
105
|
+
readonly redirectTo: Signal<string | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* Builds a real link target, preserving the current pathname, unrelated query
|
|
108
|
+
* values and hash.
|
|
109
|
+
*
|
|
110
|
+
* @param change - The page, filter, selection and path-parameter changes.
|
|
111
|
+
* @returns The link target for the change.
|
|
112
|
+
*/
|
|
113
|
+
readonly href: (change?: ListRouteChange<Filter, Selection>) => string;
|
|
114
|
+
/**
|
|
115
|
+
* Navigates atomically; location state is preserved unless options replace it.
|
|
116
|
+
*
|
|
117
|
+
* @param change - The page, filter, selection and path-parameter changes.
|
|
118
|
+
* @param options - Navigation options.
|
|
119
|
+
*/
|
|
120
|
+
readonly navigate: (change: ListRouteChange<Filter, Selection>, options?: NavigateOptions) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Changes only the page, retaining the current filters and view.
|
|
123
|
+
*
|
|
124
|
+
* @param page - The target page, starting at one.
|
|
125
|
+
* @param options - Navigation options.
|
|
126
|
+
*/
|
|
127
|
+
readonly setPage: (page: number, options?: NavigateOptions) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Patches URL filters and returns to page one.
|
|
130
|
+
*
|
|
131
|
+
* @param filters - The filter values to write (`undefined` removes one).
|
|
132
|
+
* @param options - Navigation options.
|
|
133
|
+
*/
|
|
134
|
+
readonly setFilters: (filters: Partial<Record<Filter, string | undefined>>, options?: NavigateOptions) => void;
|
|
135
|
+
/**
|
|
136
|
+
* Selects a configured view at page one, preserving current route parameters.
|
|
137
|
+
*
|
|
138
|
+
* @param selection - The view to select.
|
|
139
|
+
* @param options - Navigation options.
|
|
140
|
+
*/
|
|
141
|
+
readonly select: (selection: Selection, options?: NavigateOptions) => void;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* URL-backed pagination, filters and selected views, through whichever routing
|
|
145
|
+
* bond the app wired: the page, the filters and the view live in the URL only,
|
|
146
|
+
* so a reload, a shared link and Back all show the same list. Built on
|
|
147
|
+
* `resolveListRoute` from `@molecule/app-routing`, so every framework binding
|
|
148
|
+
* returns the same result. Call it in an injection context (a component field
|
|
149
|
+
* initializer or constructor).
|
|
150
|
+
*
|
|
151
|
+
* The options may be a signal: an auth status going from `loading` to
|
|
152
|
+
* `unauthenticated` reaches the list on the same component, the way React
|
|
153
|
+
* re-renders `useListRoute` with new options.
|
|
154
|
+
*
|
|
155
|
+
* A signed-out visit to a view with `requiresAuth` replaces the entry with
|
|
156
|
+
* `options.auth.redirectTo`, carrying `state.returnTo`; until auth is confirmed
|
|
157
|
+
* `canLoad` is `false`.
|
|
158
|
+
*
|
|
159
|
+
* @param options - Filter sources, view paths, pagination and optional auth
|
|
160
|
+
* readiness (or a signal of them).
|
|
161
|
+
* @returns The list state (`page`, `offset`, `filters`, `selection`, `canLoad`)
|
|
162
|
+
* as signals, and the list's link builder and navigation actions.
|
|
163
|
+
* @throws {Error} When `pageSize` is not a positive safe integer, or a protected
|
|
164
|
+
* view has no `auth`.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* @Component({
|
|
169
|
+
* selector: 'app-articles',
|
|
170
|
+
* template: `
|
|
171
|
+
* <a [href]="list.href({ page: list.page() + 1 })">{{ i18n.t('list.nextPage') }}</a>
|
|
172
|
+
* `,
|
|
173
|
+
* })
|
|
174
|
+
* export class ArticlesComponent {
|
|
175
|
+
* readonly i18n = useTranslation()
|
|
176
|
+
* // Load items from list.offset(); the page and filters come from the URL.
|
|
177
|
+
* readonly list = useListRoute({ pageSize: 10, filters: { tag: {} } })
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export declare function useListRoute<Filter extends string = string, Selection extends string = string>(options?: ListRouteOptions<Filter, Selection> | Signal<ListRouteOptions<Filter, Selection>>): UseListRouteResult<Filter, Selection>;
|
|
182
|
+
/**
|
|
183
|
+
* Takes a one-time credential (a reset `token`, an OAuth `code`) out of the URL
|
|
184
|
+
* and keeps it in memory, through whichever routing bond the app wired. The
|
|
185
|
+
* parameter is removed with a replace navigation that keeps the path, the hash,
|
|
186
|
+
* the other query values and the location state; the value survives the
|
|
187
|
+
* component's lifetime, and Back to an entry restores the value consumed there.
|
|
188
|
+
* Call it in an injection context (a component field initializer or
|
|
189
|
+
* constructor).
|
|
190
|
+
*
|
|
191
|
+
* @param name - The query key to consume, for example `token` or `code`.
|
|
192
|
+
* @returns The consumed value (`''` before the parameter was ever present) and
|
|
193
|
+
* a setter (a form clears it after a successful submit).
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* @Component({
|
|
198
|
+
* selector: 'app-reset',
|
|
199
|
+
* template: `<input [placeholder]="i18n.t('auth.resetPassword.token')" />`,
|
|
200
|
+
* })
|
|
201
|
+
* export class ResetComponent {
|
|
202
|
+
* readonly i18n = useTranslation()
|
|
203
|
+
* readonly token = useConsumedSearchParam('token')
|
|
204
|
+
* submit(password: string): void {
|
|
205
|
+
* // token[0] holds the value after the address no longer contains it;
|
|
206
|
+
* // token[1]('') clears it after a successful submit.
|
|
207
|
+
* }
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export declare function useConsumedSearchParam(name: string): readonly [string, (value: string) => void];
|
|
212
|
+
//# sourceMappingURL=use-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
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