@molecule/app-svelte 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +226 -72
  2. package/dist/hooks/index.d.ts +1 -0
  3. package/dist/hooks/index.d.ts.map +1 -1
  4. package/dist/hooks/index.js +1 -0
  5. package/dist/hooks/live-store.d.ts +0 -8
  6. package/dist/hooks/live-store.d.ts.map +1 -1
  7. package/dist/hooks/live-store.js +0 -13
  8. package/dist/hooks/maybe-readable.d.ts +36 -0
  9. package/dist/hooks/maybe-readable.d.ts.map +1 -0
  10. package/dist/hooks/maybe-readable.js +36 -0
  11. package/dist/hooks/useAIModels.d.ts +8 -2
  12. package/dist/hooks/useAIModels.d.ts.map +1 -1
  13. package/dist/hooks/useAIModels.js +44 -17
  14. package/dist/hooks/useAuth.d.ts +10 -4
  15. package/dist/hooks/useAuth.d.ts.map +1 -1
  16. package/dist/hooks/useAuth.js +39 -13
  17. package/dist/hooks/useForm.d.ts +11 -3
  18. package/dist/hooks/useForm.d.ts.map +1 -1
  19. package/dist/hooks/useForm.js +89 -57
  20. package/dist/hooks/useHttp.d.ts +28 -22
  21. package/dist/hooks/useHttp.d.ts.map +1 -1
  22. package/dist/hooks/useHttp.js +67 -96
  23. package/dist/hooks/useOAuth.d.ts +23 -7
  24. package/dist/hooks/useOAuth.d.ts.map +1 -1
  25. package/dist/hooks/useOAuth.js +51 -18
  26. package/dist/hooks/useOptimisticValue.d.ts +11 -4
  27. package/dist/hooks/useOptimisticValue.d.ts.map +1 -1
  28. package/dist/hooks/useOptimisticValue.js +40 -49
  29. package/dist/hooks/usePush.d.ts +7 -3
  30. package/dist/hooks/usePush.d.ts.map +1 -1
  31. package/dist/hooks/usePush.js +26 -6
  32. package/dist/hooks/useRouter.d.ts +13 -7
  33. package/dist/hooks/useRouter.d.ts.map +1 -1
  34. package/dist/hooks/useRouter.js +39 -18
  35. package/dist/hooks/useStorage.d.ts +22 -9
  36. package/dist/hooks/useStorage.d.ts.map +1 -1
  37. package/dist/hooks/useStorage.js +146 -69
  38. package/dist/hooks/useStore.d.ts +14 -7
  39. package/dist/hooks/useStore.d.ts.map +1 -1
  40. package/dist/hooks/useStore.js +46 -9
  41. package/dist/hooks/useTranslation.d.ts +6 -2
  42. package/dist/hooks/useTranslation.d.ts.map +1 -1
  43. package/dist/hooks/useTranslation.js +11 -6
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +4 -0
  47. package/dist/link/Link.svelte +33 -0
  48. package/dist/link/Link.svelte.d.ts +12 -0
  49. package/dist/link/Link.svelte.d.ts.map +1 -0
  50. package/dist/link/index.d.ts +23 -0
  51. package/dist/link/index.d.ts.map +1 -0
  52. package/dist/link/index.js +22 -0
  53. package/dist/link/types.d.ts +26 -0
  54. package/dist/link/types.d.ts.map +1 -0
  55. package/dist/link/types.js +6 -0
  56. package/dist/stores/chat.d.ts +4 -3
  57. package/dist/stores/chat.d.ts.map +1 -1
  58. package/dist/stores/chat.js +14 -15
  59. package/package.json +3 -3
@@ -5,11 +5,10 @@
5
5
  * @module
6
6
  */
7
7
  import { onDestroy } from 'svelte';
8
- import { writable } from 'svelte/store';
8
+ import { get, writable } from 'svelte/store';
9
9
  import { createOptimisticValue, shallowEqual } from '@molecule/app-state';
10
10
  import { fieldStore } from './live-store.js';
11
- /** The previous host's handoff, alive until its disarm timer runs. */
12
- let optimisticHandoff = null;
11
+ import { toReadable } from './maybe-readable.js';
13
12
  /**
14
13
  * A server-backed value — a favorite, follow, like or bookmark button, a
15
14
  * rating, a quantity, a setting switch — that changes on the first render
@@ -24,70 +23,62 @@ let optimisticHandoff = null;
24
23
  * a favorite flag and its count, in the SAME value. Let commit reject on
25
24
  * failure: a catch that returns old data hides the failure.
26
25
  *
27
- * @param options - The server's current value and how to save a change.
26
+ * The options may be a plain value or a readable store of one: setting the
27
+ * store applies the new server value (and the new `commit`, `equals` and
28
+ * `onError`) on the same component, the way React's re-render does — the
29
+ * controller, and any save it is running, survive the change.
30
+ *
31
+ * @param options - The server's current value and how to save a change (or a store of them).
28
32
  * @returns The value to render, whether a save is pending, the newest failure,
29
33
  * and `set`/`update`.
30
34
  * @example
31
35
  * ```svelte
32
36
  * <script>
33
37
  * import { useOptimisticValue } from '@molecule/app-svelte'
34
- * const star = useOptimisticValue({
38
+ * // `value` is the store; the result itself is not, so take the store out to read it with `$`.
39
+ * const { value: star, update } = useOptimisticValue({
35
40
  * value: { starred: repository.starred, stars: repository.stars },
36
41
  * commit: async (next) => { /* save and return the server's value * },
37
42
  * })
38
43
  * </script>
39
44
  *
40
- * <button aria-pressed={$star.value.starred} onclick={() => star.update((on) => ({ ...on, starred: !on.starred }))}>
45
+ * <button aria-pressed={$star.starred} onclick={() => update((on) => ({ ...on, starred: !on.starred }))}>
41
46
  * ```
42
47
  */
43
48
  export const useOptimisticValue = (options) => {
44
- // Actions read the latest options, so an adopting mount re-arms them (React
45
- // publishes them from committed renders).
46
- const latest = options;
47
- // A mount in the same turn as the previous host's destroy is React's
48
- // re-render (an args step), not a new component: adopt its controller so the
49
- // pending save continues and the value does not flip.
50
- const adopted = optimisticHandoff;
51
- optimisticHandoff = null;
52
- if (adopted)
53
- adopted.adopted = true;
54
- const controller = (adopted?.controller ??
55
- createOptimisticValue({
56
- value: options.value,
57
- commit: (next, previous, confirm) => latest.commit(next, previous, confirm),
58
- equals: (a, b) => (latest.equals ?? shallowEqual)(a, b),
59
- onError: (error, value) => latest.onError?.(error, value),
60
- }));
61
- // The handoff carries the value type-erased (it outlives one generic
62
- // instantiation); the adopting mount is the same component, so its `T` is
63
- // the one the controller was created with.
64
- const received = {
65
- current: adopted ? adopted.received : options.value,
66
- };
49
+ const optionsStore = toReadable(options);
50
+ // Actions read the latest options (React publishes them from committed
51
+ // renders), so a changed source re-arms them at once.
52
+ const current = () => get(optionsStore);
53
+ const initial = current();
54
+ const controller = createOptimisticValue({
55
+ value: initial.value,
56
+ commit: (next, previous, confirm) => current().commit(next, previous, confirm),
57
+ equals: (a, b) => (current().equals ?? shallowEqual)(a, b),
58
+ onError: (error, value) => current().onError?.(error, value),
59
+ });
60
+ // The last server value the hook received (React's `received` ref); it
61
+ // survives an argument change, so only a genuinely different value syncs.
62
+ const received = { current: initial.value };
67
63
  const state = writable(controller.getState());
68
64
  const unsubscribe = controller.subscribe((next) => state.set(next));
69
- onDestroy(() => {
70
- unsubscribe();
71
- const offer = {
72
- adopted: false,
73
- controller: controller,
74
- received: received.current,
75
- };
76
- optimisticHandoff = offer;
77
- // An unadopted handoff was a real unmount; the timer drops it so the next
78
- // mount starts clean. A mount in the same turn adopts first.
79
- setTimeout(() => {
80
- if (optimisticHandoff === offer && !offer.adopted)
81
- optimisticHandoff = null;
82
- }, 0);
83
- });
65
+ onDestroy(unsubscribe);
84
66
  // A new server value is taken when it differs from the one last received
85
67
  // and nothing is being saved (the controller's `sync` decides that) —
86
- // React's value effect, which also runs only for a changed value.
87
- if (!(latest.equals ?? shallowEqual)(received.current, options.value)) {
88
- received.current = options.value;
89
- controller.sync(options.value);
90
- }
68
+ // React's value effect, which also runs only for a changed value. The
69
+ // store's immediate callback IS the mount check (with the options the
70
+ // controller was created from, it changes nothing).
71
+ const syncIfChanged = (optionsNow) => {
72
+ const { value, equals } = optionsNow;
73
+ if ((equals ?? shallowEqual)(received.current, value))
74
+ return;
75
+ received.current = value;
76
+ controller.sync(value);
77
+ };
78
+ const stopOptions = optionsStore.subscribe((next) => {
79
+ syncIfChanged(next);
80
+ });
81
+ onDestroy(stopOptions);
91
82
  return {
92
83
  value: fieldStore(state, 'value'),
93
84
  pending: fieldStore(state, 'pending'),
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { type Readable } from 'svelte/store';
7
7
  import type { NotificationActionListener, NotificationReceivedListener, PermissionStatus, PushRegisterOptions, PushToken, TokenChangeListener } from '@molecule/app-push';
8
+ import { type MaybeReadable } from './maybe-readable.js';
8
9
  /**
9
10
  * Hook return type.
10
11
  */
@@ -37,7 +38,8 @@ export interface UsePushResult {
37
38
  */
38
39
  export interface UsePushOptions {
39
40
  /**
40
- * Whether to check permission status on mount.
41
+ * Whether to check permission status on mount, and again when the flag turns
42
+ * on later on the same component.
41
43
  */
42
44
  checkOnMount?: boolean;
43
45
  }
@@ -50,7 +52,9 @@ export interface UsePushOptions {
50
52
  * context-provided. The provider's listeners are caller-managed: the returned
51
53
  * `on*` unsubscribes are the caller's to call, like React's.
52
54
  *
53
- * @param options - Hook options
55
+ * @param options - Hook options (or a store of them): setting `checkOnMount`
56
+ * later runs its check on the same component, the way React's re-render
57
+ * re-runs its effect.
54
58
  * @returns Push notification state and action methods
55
59
  * @example
56
60
  * ```svelte
@@ -64,5 +68,5 @@ export interface UsePushOptions {
64
68
  * {/if}
65
69
  * ```
66
70
  */
67
- export declare function usePush(options?: UsePushOptions): UsePushResult;
71
+ export declare function usePush(options?: MaybeReadable<UsePushOptions | undefined>): UsePushResult;
68
72
  //# sourceMappingURL=usePush.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePush.d.ts","sourceRoot":"","sources":["../../src/hooks/usePush.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAGtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,gBAAgB,EAEhB,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAG3B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mFAAmF;IACnF,UAAU,EAAE,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IAC7C,gEAAgE;IAChE,KAAK,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;IACjC,qDAAqD;IACrD,eAAe,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAChD,0DAA0D;IAC1D,iBAAiB,EAAE,MA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} from 'svelte/store';
7
8
  import { getLogger } from '@molecule/app-logger';
8
9
  import { getProvider } from '@molecule/app-push';
10
+ import { toReadable } from './maybe-readable.js';
9
11
  /**
10
12
  * Push notification state and actions, React's `usePush` in Svelte's idiom:
11
13
  * called during component init, `permission` and `token` are readable stores
@@ -15,7 +17,9 @@ import { getProvider } from '@molecule/app-push';
15
17
  * context-provided. The provider's listeners are caller-managed: the returned
16
18
  * `on*` unsubscribes are the caller's to call, like React's.
17
19
  *
18
- * @param options - Hook options
20
+ * @param options - Hook options (or a store of them): setting `checkOnMount`
21
+ * later runs its check on the same component, the way React's re-render
22
+ * re-runs its effect.
19
23
  * @returns Push notification state and action methods
20
24
  * @example
21
25
  * ```svelte
@@ -30,20 +34,36 @@ import { getProvider } from '@molecule/app-push';
30
34
  * ```
31
35
  */
32
36
  export function usePush(options) {
33
- const { checkOnMount = false } = options ?? {};
37
+ const optionsStore = toReadable(options);
34
38
  const provider = getProvider();
35
39
  const permission = writable(null);
36
40
  const token = writable(null);
37
- // React's mount effect: a failed mount check leaves the permission unknown
38
- // until checkPermission() runs again; the failure goes to the logger.
39
- if (checkOnMount) {
41
+ // React's mount effect ([checkOnMount]): a failed check leaves the
42
+ // permission unknown until checkPermission() runs again; the failure goes to
43
+ // the logger. Turning the flag on later checks once more; turning it off
44
+ // does nothing, exactly as the effect body's truthiness test.
45
+ const runCheck = () => {
40
46
  provider
41
47
  .checkPermission()
42
48
  .then((status) => permission.set(status))
43
49
  .catch((error) => {
50
+ // The permission stays unknown until checkPermission() is called again.
44
51
  getLogger('usePush').warn('Checking push permission on mount failed', { error });
45
52
  });
53
+ };
54
+ let lastCheckOnMount = get(optionsStore)?.checkOnMount ?? false;
55
+ if (lastCheckOnMount) {
56
+ runCheck();
46
57
  }
58
+ const stopOptions = optionsStore.subscribe(() => {
59
+ const next = get(optionsStore)?.checkOnMount ?? false;
60
+ if (Object.is(next, lastCheckOnMount))
61
+ return;
62
+ lastCheckOnMount = next;
63
+ if (next)
64
+ runCheck();
65
+ });
66
+ onDestroy(stopOptions);
47
67
  return {
48
68
  permission: { subscribe: permission.subscribe },
49
69
  token: { subscribe: token.subscribe },
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { type Readable } from 'svelte/store';
7
7
  import type { ListRouteOptions, ListRouteResult, NavigateOptions, QueryParams, RouteLocation, RouteParams, Router } from '@molecule/app-routing';
8
+ import { type MaybeReadable } from './maybe-readable.js';
8
9
  /** What {@link useRouter} returns. */
9
10
  export interface UseRouterResult {
10
11
  /** The current location. */
@@ -71,11 +72,15 @@ export declare function useNavigate(): (path: string, options?: NavigateOptions)
71
72
  * Whether a path is active, React's `useIsActive` in Svelte's idiom: a
72
73
  * readable store that re-evaluates on every route change.
73
74
  *
74
- * @param path - The path to check.
75
- * @param exact - Whether to match exactly (default: false).
75
+ * Both arguments may be a plain value or a readable store of one: the store
76
+ * re-evaluates when one changes (the way React's re-render re-reads its
77
+ * snapshot), so a navigation-driven nav link can take its path from a store.
78
+ *
79
+ * @param path - The path to check (or a store of it).
80
+ * @param exact - Whether to match exactly (default: false; or a store of it).
76
81
  * @returns A readable store of whether the path is active.
77
82
  */
78
- export declare function useIsActive(path: string, exact?: boolean): Readable<boolean>;
83
+ export declare function useIsActive(path: MaybeReadable<string>, exact?: MaybeReadable<boolean>): Readable<boolean>;
79
84
  /** What {@link useListRoute} returns: each list field as a readable store, the actions as plain functions. */
80
85
  export interface UseListRouteResult<Filter extends string = string, Selection extends string = string> {
81
86
  /** The current 1-indexed page. */
@@ -122,9 +127,10 @@ export type UseConsumedSearchParamStore = Readable<readonly [string, (value: str
122
127
  * `options.auth.redirectTo`, carrying `state.returnTo`; until auth is confirmed
123
128
  * `canLoad` is `false`.
124
129
  *
125
- * The options may be a readable store: an auth status moving from `loading` to
126
- * `unauthenticated` re-resolves the list — and performs the sign-in redirect —
127
- * on the same component, the way React re-renders `useListRoute`.
130
+ * The options may be a plain value or a readable store of one (a store holding
131
+ * `undefined` means the default options): an auth status moving from `loading`
132
+ * to `unauthenticated` re-resolves the list — and performs the sign-in
133
+ * redirect — on the same component, the way React re-renders `useListRoute`.
128
134
  *
129
135
  * @param options - Filter sources, view paths, pagination and optional auth readiness (or a store of them).
130
136
  * @returns Each list field as a readable store, and its link builder and navigation actions.
@@ -141,7 +147,7 @@ export type UseConsumedSearchParamStore = Readable<readonly [string, (value: str
141
147
  * <a href={href({ page: $page + 1 })}>Next</a>
142
148
  * ```
143
149
  */
144
- export declare function useListRoute<Filter extends string = string, Selection extends string = string>(options?: ListRouteOptions<Filter, Selection> | Readable<ListRouteOptions<Filter, Selection>>): UseListRouteResult<Filter, Selection>;
150
+ export declare function useListRoute<Filter extends string = string, Selection extends string = string>(options?: MaybeReadable<ListRouteOptions<Filter, Selection> | undefined>): UseListRouteResult<Filter, Selection>;
145
151
  /**
146
152
  * Takes a one-time credential (a reset `token`, an OAuth `code`) out of the URL
147
153
  * and keeps it in memory, React's `useConsumedSearchParam` in Svelte's idiom: a
@@ -1 +1 @@
1
- {"version":3,"file":"useRouter.d.ts","sourceRoot":"","sources":["../../src/hooks/useRouter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAO,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE3D,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,MAAM,EACP,MAAM,uBAAuB,CAAA;AAU9B,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;IACjC,2CAA2C;IAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACxC,oCAAoC;IACpC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAA;IAC5B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC5B,kCA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estroy, onMount } from 'svelte';
7
7
  import { get, writable } from 'svelte/store';
8
8
  import { createConsumedSearchParam, listRouteRedirect, resolveListRoute, } from '@molecule/app-routing';
9
9
  import { useRouterInstance } from '../context.js';
10
- import { fieldStore, isReadableStore, liveStore } from './live-store.js';
10
+ import { fieldStore, liveStore } from './live-store.js';
11
+ import { toReadable } from './maybe-readable.js';
11
12
  /**
12
13
  * Routing state and navigation, React's `useRouter` in Svelte's idiom: call it
13
14
  * during component init under `setMoleculeContext({ router })`.
@@ -84,13 +85,32 @@ export function useNavigate() {
84
85
  * Whether a path is active, React's `useIsActive` in Svelte's idiom: a
85
86
  * readable store that re-evaluates on every route change.
86
87
  *
87
- * @param path - The path to check.
88
- * @param exact - Whether to match exactly (default: false).
88
+ * Both arguments may be a plain value or a readable store of one: the store
89
+ * re-evaluates when one changes (the way React's re-render re-reads its
90
+ * snapshot), so a navigation-driven nav link can take its path from a store.
91
+ *
92
+ * @param path - The path to check (or a store of it).
93
+ * @param exact - Whether to match exactly (default: false; or a store of it).
89
94
  * @returns A readable store of whether the path is active.
90
95
  */
91
96
  export function useIsActive(path, exact = false) {
92
97
  const router = useRouterInstance();
93
- return liveStore(() => router.isActive(path, exact), (notify) => router.subscribe(notify));
98
+ const pathStore = toReadable(path);
99
+ const exactStore = toReadable(exact);
100
+ const active = writable(router.isActive(get(pathStore), get(exactStore)));
101
+ /** Re-reads the router with the arguments' current values. */
102
+ const evaluate = () => {
103
+ active.set(router.isActive(get(pathStore), get(exactStore)));
104
+ };
105
+ const stopRouter = router.subscribe(evaluate);
106
+ const stopPath = pathStore.subscribe(evaluate);
107
+ const stopExact = exactStore.subscribe(evaluate);
108
+ onDestroy(() => {
109
+ stopRouter();
110
+ stopPath();
111
+ stopExact();
112
+ });
113
+ return { subscribe: active.subscribe };
94
114
  }
95
115
  /**
96
116
  * URL-backed pagination, filters and selected views, React's `useListRoute` in
@@ -105,9 +125,10 @@ export function useIsActive(path, exact = false) {
105
125
  * `options.auth.redirectTo`, carrying `state.returnTo`; until auth is confirmed
106
126
  * `canLoad` is `false`.
107
127
  *
108
- * The options may be a readable store: an auth status moving from `loading` to
109
- * `unauthenticated` re-resolves the list — and performs the sign-in redirect —
110
- * on the same component, the way React re-renders `useListRoute`.
128
+ * The options may be a plain value or a readable store of one (a store holding
129
+ * `undefined` means the default options): an auth status moving from `loading`
130
+ * to `unauthenticated` re-resolves the list — and performs the sign-in
131
+ * redirect — on the same component, the way React re-renders `useListRoute`.
111
132
  *
112
133
  * @param options - Filter sources, view paths, pagination and optional auth readiness (or a store of them).
113
134
  * @returns Each list field as a readable store, and its link builder and navigation actions.
@@ -126,7 +147,8 @@ export function useIsActive(path, exact = false) {
126
147
  */
127
148
  export function useListRoute(options = {}) {
128
149
  const router = useRouterInstance();
129
- let currentOptions = isReadableStore(options) ? get(options) : options;
150
+ const optionsStore = toReadable(options);
151
+ let currentOptions = get(optionsStore) ?? {};
130
152
  const resolve = () => resolveListRoute({ location: router.getLocation(), routeParams: router.getParams() }, currentOptions, (path, navigateOptions) => router.navigate(path, navigateOptions));
131
153
  let latest = resolve();
132
154
  const state = writable(latest);
@@ -141,21 +163,20 @@ export function useListRoute(options = {}) {
141
163
  router.navigate(redirect.to, redirect.options);
142
164
  };
143
165
  const stopRouter = router.subscribe(() => update());
144
- let stopOptions = null;
145
- if (isReadableStore(options)) {
146
- stopOptions = options.subscribe((next) => {
147
- if (next === currentOptions)
148
- return;
149
- currentOptions = next;
150
- update();
151
- });
152
- }
166
+ // The options store calls back at once with the options already read, which
167
+ // changes nothing; a later set re-resolves the list.
168
+ const stopOptions = optionsStore.subscribe((next) => {
169
+ if (next === currentOptions)
170
+ return;
171
+ currentOptions = next ?? {};
172
+ update();
173
+ });
153
174
  // React's redirect effect also runs once mounted, for a list that opens
154
175
  // directly on a signed-out protected view.
155
176
  onMount(update);
156
177
  onDestroy(() => {
157
178
  stopRouter();
158
- stopOptions?.();
179
+ stopOptions();
159
180
  });
160
181
  return {
161
182
  page: fieldStore(state, 'page'),
@@ -4,6 +4,7 @@
4
4
  * @module
5
5
  */
6
6
  import { type Readable } from 'svelte/store';
7
+ import { type MaybeReadable } from './maybe-readable.js';
7
8
  /**
8
9
  * Options for {@link useStorageValue}.
9
10
  */
@@ -36,14 +37,21 @@ export interface UseStorageValueResult<T> {
36
37
  * One storage key as Svelte stores, React's `useStorageValue` in Svelte's
37
38
  * idiom: call it during component init under `setMoleculeContext({ storage })`.
38
39
  *
40
+ * Both arguments may be a plain value or a readable store of one (a store
41
+ * holding `undefined` means the argument was omitted): setting the `key` store
42
+ * starts the new key over — its value is unknown until its read lands, so the
43
+ * default shows and `loading` is true, exactly as a fresh mount — while writes
44
+ * go to the key the hook holds at the moment they run. The latest
45
+ * `defaultValue` and `sync` always apply.
46
+ *
39
47
  * A read that started before a newer local write keeps that write's value (it
40
48
  * still ends `loading`), and with `sync` an outside write reaches the hook
41
49
  * through the provider's own subscription — so a non-browser backend
42
50
  * (native, encrypted, memory) propagates the same way, not just the browser
43
51
  * `storage` event.
44
52
  *
45
- * @param key - Storage key
46
- * @param options - Hook options
53
+ * @param key - Storage key (or a store of it).
54
+ * @param options - Hook options (or a store of them).
47
55
  * @returns Storage value state (value, loading, error) and mutators (setValue, removeValue).
48
56
  * @example
49
57
  * ```svelte
@@ -58,7 +66,7 @@ export interface UseStorageValueResult<T> {
58
66
  * {:else}<select onchange={(e) => setTheme(e.currentTarget.value)}>…</select>{/if}
59
67
  * ```
60
68
  */
61
- export declare function useStorageValue<T>(key: string, options?: UseStorageValueOptions<T>): UseStorageValueResult<T>;
69
+ export declare function useStorageValue<T>(key: MaybeReadable<string>, options?: MaybeReadable<UseStorageValueOptions<T> | undefined>): UseStorageValueResult<T>;
62
70
  /**
63
71
  * Options for {@link useStoragePreference}.
64
72
  */
@@ -99,12 +107,17 @@ export interface UseStoragePreferenceResult<T> {
99
107
  * started before a newer write, remove or external change is discarded, so a
100
108
  * slow hydration never overwrites an edit the user already made.
101
109
  *
102
- * Pass `null` for `key` while the real key is unknown (no project selected
103
- * yet): the hook then behaves as local state around `defaultValue` and
104
- * persists nothing.
110
+ * Both arguments may be a plain value or a readable store of one (a store
111
+ * holding `undefined` means the argument was omitted): setting the `key` store
112
+ * re-reads, re-subscribes and re-hydrates the new key on the same component
113
+ * (a `null`/`undefined` key is local state around the default and persists
114
+ * nothing), and writes go to the key the hook holds at the moment they run.
115
+ * The latest `defaultValue` always applies.
105
116
  *
106
- * @param key - The storage key, or `null` when there is nothing to persist.
107
- * @param options - `defaultValue`, reported until the provider supplies one.
117
+ * @param key - The storage key, or `null` when there is nothing to persist
118
+ * (or a store of either).
119
+ * @param options - `defaultValue`, reported until the provider supplies one
120
+ * (or a store of them).
108
121
  * @returns The current value, its mutators, and whether it is definite yet.
109
122
  * @example
110
123
  * ```svelte
@@ -116,7 +129,7 @@ export interface UseStoragePreferenceResult<T> {
116
129
  * </script>
117
130
  * ```
118
131
  */
119
- export declare function useStoragePreference<T = unknown>(key: string | null | undefined, options?: UseStoragePreferenceOptions<T>): UseStoragePreferenceResult<T>;
132
+ export declare function useStoragePreference<T = unknown>(key: MaybeReadable<string | null | undefined>, options?: MaybeReadable<UseStoragePreferenceOptions<T> | undefined>): UseStoragePreferenceResult<T>;
120
133
  /**
121
134
  * Storage operations without local state sync, React's `useStorage` in
122
135
  * Svelte's idiom: plain passthroughs of the context provider.
@@ -1 +1 @@
1
- {"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAMtD;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,6DAA6D;IAC7D,KAAK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