@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.
- package/README.md +226 -72
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/live-store.d.ts +0 -8
- package/dist/hooks/live-store.d.ts.map +1 -1
- package/dist/hooks/live-store.js +0 -13
- package/dist/hooks/maybe-readable.d.ts +36 -0
- package/dist/hooks/maybe-readable.d.ts.map +1 -0
- package/dist/hooks/maybe-readable.js +36 -0
- package/dist/hooks/useAIModels.d.ts +8 -2
- package/dist/hooks/useAIModels.d.ts.map +1 -1
- package/dist/hooks/useAIModels.js +44 -17
- package/dist/hooks/useAuth.d.ts +10 -4
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +39 -13
- package/dist/hooks/useForm.d.ts +11 -3
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useForm.js +89 -57
- package/dist/hooks/useHttp.d.ts +28 -22
- package/dist/hooks/useHttp.d.ts.map +1 -1
- package/dist/hooks/useHttp.js +67 -96
- package/dist/hooks/useOAuth.d.ts +23 -7
- package/dist/hooks/useOAuth.d.ts.map +1 -1
- package/dist/hooks/useOAuth.js +51 -18
- package/dist/hooks/useOptimisticValue.d.ts +11 -4
- package/dist/hooks/useOptimisticValue.d.ts.map +1 -1
- package/dist/hooks/useOptimisticValue.js +40 -49
- package/dist/hooks/usePush.d.ts +7 -3
- package/dist/hooks/usePush.d.ts.map +1 -1
- package/dist/hooks/usePush.js +26 -6
- package/dist/hooks/useRouter.d.ts +13 -7
- package/dist/hooks/useRouter.d.ts.map +1 -1
- package/dist/hooks/useRouter.js +39 -18
- package/dist/hooks/useStorage.d.ts +22 -9
- package/dist/hooks/useStorage.d.ts.map +1 -1
- package/dist/hooks/useStorage.js +146 -69
- package/dist/hooks/useStore.d.ts +14 -7
- package/dist/hooks/useStore.d.ts.map +1 -1
- package/dist/hooks/useStore.js +46 -9
- package/dist/hooks/useTranslation.d.ts +6 -2
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/hooks/useTranslation.js +11 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/link/Link.svelte +33 -0
- package/dist/link/Link.svelte.d.ts +12 -0
- package/dist/link/Link.svelte.d.ts.map +1 -0
- package/dist/link/index.d.ts +23 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +22 -0
- package/dist/link/types.d.ts +26 -0
- package/dist/link/types.d.ts.map +1 -0
- package/dist/link/types.js +6 -0
- package/dist/stores/chat.d.ts +4 -3
- package/dist/stores/chat.d.ts.map +1 -1
- package/dist/stores/chat.js +14 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-14T17:17:26.808Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-svelte
|
|
@@ -1245,7 +1245,10 @@ Options for {@link useAuth}.
|
|
|
1245
1245
|
|
|
1246
1246
|
```typescript
|
|
1247
1247
|
interface UseAuthOptions {
|
|
1248
|
-
/**
|
|
1248
|
+
/**
|
|
1249
|
+
* Whether to automatically refresh the session on mount, and again whenever
|
|
1250
|
+
* the flag turns on or the session decision changes while it is on.
|
|
1251
|
+
*/
|
|
1249
1252
|
autoRefresh?: boolean
|
|
1250
1253
|
}
|
|
1251
1254
|
```
|
|
@@ -1547,8 +1550,14 @@ Return type for useOAuth hook.
|
|
|
1547
1550
|
|
|
1548
1551
|
```typescript
|
|
1549
1552
|
interface UseOAuthReturn {
|
|
1550
|
-
/**
|
|
1551
|
-
|
|
1553
|
+
/**
|
|
1554
|
+
* The configured provider names (React's `string[]`), read live: each read
|
|
1555
|
+
* returns the list the current config holds, and a read in markup or
|
|
1556
|
+
* `$derived` re-runs when a config store changes. Read it off the result
|
|
1557
|
+
* (`oauth.providers`); a destructured copy keeps the list of the moment it
|
|
1558
|
+
* was taken.
|
|
1559
|
+
*/
|
|
1560
|
+
readonly providers: string[]
|
|
1552
1561
|
/** Builds the provider's initiation URL (provider encoded as one path segment). */
|
|
1553
1562
|
getOAuthUrl: (provider: string) => string
|
|
1554
1563
|
/** Full-page redirect to the provider (default). The opener page navigates away. */
|
|
@@ -1816,7 +1825,8 @@ Options for the usePush hook (e.g. check permission on mount).
|
|
|
1816
1825
|
```typescript
|
|
1817
1826
|
interface UsePushOptions {
|
|
1818
1827
|
/**
|
|
1819
|
-
* Whether to check permission status on mount
|
|
1828
|
+
* Whether to check permission status on mount, and again when the flag turns
|
|
1829
|
+
* on later on the same component.
|
|
1820
1830
|
*/
|
|
1821
1831
|
checkOnMount?: boolean
|
|
1822
1832
|
}
|
|
@@ -2153,6 +2163,28 @@ interface UseWorkspaceResult {
|
|
|
2153
2163
|
}
|
|
2154
2164
|
```
|
|
2155
2165
|
|
|
2166
|
+
#### `LinkProps`
|
|
2167
|
+
|
|
2168
|
+
Props for `Link`. Every other anchor attribute (`class`, `target`, `rel`,
|
|
2169
|
+
`aria-*`, `data-*`, `onclick`) goes on the anchor.
|
|
2170
|
+
|
|
2171
|
+
```typescript
|
|
2172
|
+
interface LinkProps extends Omit<HTMLAnchorAttributes, 'href' | 'children'> {
|
|
2173
|
+
/** Destination: an app path (`/settings?tab=billing#plan`) or a URL. Rendered as the anchor's `href`. */
|
|
2174
|
+
to: string
|
|
2175
|
+
/**
|
|
2176
|
+
* Replace the current history entry instead of pushing one. When omitted, a
|
|
2177
|
+
* link to the location already shown replaces it and any other link pushes,
|
|
2178
|
+
* as with react-router's `<Link>`.
|
|
2179
|
+
*/
|
|
2180
|
+
replace?: boolean
|
|
2181
|
+
/** State stored with the new history entry (read back with `useLocation()`). */
|
|
2182
|
+
state?: unknown
|
|
2183
|
+
/** The link's content. */
|
|
2184
|
+
children?: Snippet
|
|
2185
|
+
}
|
|
2186
|
+
```
|
|
2187
|
+
|
|
2156
2188
|
#### `AsyncStateStore`
|
|
2157
2189
|
|
|
2158
2190
|
Async state store.
|
|
@@ -2342,6 +2374,16 @@ shared packages fall back to {@link DEFAULT_AGENT_IDENTITY} when it does not.
|
|
|
2342
2374
|
type AgentIdentity = ChatAgentIdentity
|
|
2343
2375
|
```
|
|
2344
2376
|
|
|
2377
|
+
#### `MaybeReadable`
|
|
2378
|
+
|
|
2379
|
+
A plain value or a readable store of one (a store of `undefined` stands for
|
|
2380
|
+
an omitted argument). Hooks read the current value when they use it and
|
|
2381
|
+
follow changes for as long as the component lives.
|
|
2382
|
+
|
|
2383
|
+
```typescript
|
|
2384
|
+
type MaybeReadable<T> = T | Readable<T>
|
|
2385
|
+
```
|
|
2386
|
+
|
|
2345
2387
|
#### `AsyncSetState`
|
|
2346
2388
|
|
|
2347
2389
|
Async-capable setState function.
|
|
@@ -2861,6 +2903,33 @@ function useStateProvider(): StateProvider
|
|
|
2861
2903
|
|
|
2862
2904
|
**Returns:** The state provider instance.
|
|
2863
2905
|
|
|
2906
|
+
#### `isReadable(value)`
|
|
2907
|
+
|
|
2908
|
+
Whether a value is a readable store. A molecule store (`@molecule/app-state`'s
|
|
2909
|
+
`Store`: it has `getState` AND `subscribe`) is a VALUE, never a source —
|
|
2910
|
+
`useStore` takes the store itself as its argument.
|
|
2911
|
+
|
|
2912
|
+
```typescript
|
|
2913
|
+
function isReadable(value: unknown): value is Readable<unknown>
|
|
2914
|
+
```
|
|
2915
|
+
|
|
2916
|
+
- `value` — A hook argument: a plain value or a store.
|
|
2917
|
+
|
|
2918
|
+
**Returns:** True for a Svelte readable store.
|
|
2919
|
+
|
|
2920
|
+
#### `toReadable(value)`
|
|
2921
|
+
|
|
2922
|
+
The readable-store view of a hook argument: the store itself when it is one,
|
|
2923
|
+
a constant store of the plain value otherwise.
|
|
2924
|
+
|
|
2925
|
+
```typescript
|
|
2926
|
+
function toReadable<T>(value: MaybeReadable<T>): Readable<T>
|
|
2927
|
+
```
|
|
2928
|
+
|
|
2929
|
+
- `value` — A plain value or a store of one.
|
|
2930
|
+
|
|
2931
|
+
**Returns:** A readable store of the value.
|
|
2932
|
+
|
|
2864
2933
|
#### `resetAIModelsCache()`
|
|
2865
2934
|
|
|
2866
2935
|
Test-only: drops every cached model list so the next `useAIModels` call
|
|
@@ -2878,11 +2947,16 @@ The first mount of a scope triggers a single `GET /ai/models` fetch;
|
|
|
2878
2947
|
subsequent mounts return the cached result, and a scope whose fetch failed
|
|
2879
2948
|
does not refetch on a later mount.
|
|
2880
2949
|
|
|
2950
|
+
The project id may be a plain value or a readable store of one (a store
|
|
2951
|
+
holding `undefined` means the unscoped catalog): setting it resubscribes to
|
|
2952
|
+
the new scope's cache and fetches it if nobody has yet, on the same
|
|
2953
|
+
component, the way React's re-render does.
|
|
2954
|
+
|
|
2881
2955
|
```typescript
|
|
2882
|
-
function useAIModels(projectId?: string): UseAIModelsResult
|
|
2956
|
+
function useAIModels(projectId?: MaybeReadable<string | undefined>): UseAIModelsResult
|
|
2883
2957
|
```
|
|
2884
2958
|
|
|
2885
|
-
- `projectId` — Optional project scope: includes that project's custom ("bring your own AI") models on servers that support them.
|
|
2959
|
+
- `projectId` — Optional project scope: includes that project's custom ("bring your own AI") models on servers that support them (or a store of it).
|
|
2886
2960
|
|
|
2887
2961
|
**Returns:** Models, free-tier model, loading flag, and error, as stores.
|
|
2888
2962
|
|
|
@@ -2921,10 +2995,10 @@ a sign-in the app itself runs, call `setSession({ accessToken, user })`.
|
|
|
2921
2995
|
function useAuth<
|
|
2922
2996
|
T = unknown,
|
|
2923
2997
|
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
2924
|
-
>(options?: UseAuthOptions): UseAuthResult<T, TRegister>
|
|
2998
|
+
>(options?: MaybeReadable<UseAuthOptions | undefined>): UseAuthResult<T, TRegister>
|
|
2925
2999
|
```
|
|
2926
3000
|
|
|
2927
|
-
- `options` — Hook options (`autoRefresh`).
|
|
3001
|
+
- `options` — Hook options (`autoRefresh`), or a store of them: setting `autoRefresh` later probes on the same component, the way React's re-render re-runs its effect.
|
|
2928
3002
|
|
|
2929
3003
|
**Returns:** Auth state as stores and the actions as functions.
|
|
2930
3004
|
|
|
@@ -3033,13 +3107,20 @@ picks it up. Passing `createForm` overrides that for one form. When the
|
|
|
3033
3107
|
take the loaded values. A changed `resetKey` starts a fresh form; fresh
|
|
3034
3108
|
`defaultValues` without one leave the drafts alone.
|
|
3035
3109
|
|
|
3110
|
+
The options may be a plain value or a readable store of one (a store holding
|
|
3111
|
+
`undefined` means the options were omitted): setting the store re-runs the
|
|
3112
|
+
work React's re-render does, on the same controller — a changed `values`
|
|
3113
|
+
object is applied (dirty fields kept by default) and a changed `resetKey`
|
|
3114
|
+
replaces the controller with a fresh one. Edits, touched fields and pending
|
|
3115
|
+
submits survive every other change.
|
|
3116
|
+
|
|
3036
3117
|
```typescript
|
|
3037
3118
|
function useForm<T extends FormValuesConstraint<T> = Record<string, unknown>>(
|
|
3038
|
-
options?: UseFormOptions<T>,
|
|
3119
|
+
options?: MaybeReadable<UseFormOptions<T> | undefined>,
|
|
3039
3120
|
): UseFormResult<T>
|
|
3040
3121
|
```
|
|
3041
3122
|
|
|
3042
|
-
- `options` — Form options. `defaultValues`, `mode` and the form-level `validate` are forwarded to the provider.
|
|
3123
|
+
- `options` — Form options (or a store of them). `defaultValues`, `mode` and the form-level `validate` are forwarded to the provider.
|
|
3043
3124
|
|
|
3044
3125
|
**Returns:** Form state stores and methods
|
|
3045
3126
|
|
|
@@ -3082,25 +3163,30 @@ function useFieldState<T extends FormValuesConstraint<T>>(
|
|
|
3082
3163
|
HTTP requests with state management, React's `useHttp` in Svelte's idiom:
|
|
3083
3164
|
call it during component init under `setMoleculeContext({ http })`.
|
|
3084
3165
|
|
|
3166
|
+
Every argument may be a plain value or a readable store of one (a store
|
|
3167
|
+
holding `undefined` means the argument was omitted): `method`, `url` and the
|
|
3168
|
+
request options are read at the moment `execute` runs, so setting the `url`
|
|
3169
|
+
store retargets the next `execute` on the same component, the way React's
|
|
3170
|
+
re-render does. `immediate` is read on mount only — its request runs once per
|
|
3171
|
+
component even when the arguments change later.
|
|
3172
|
+
|
|
3085
3173
|
The newest request owns the displayed state: an older response answering
|
|
3086
3174
|
after a newer `execute` or `reset` cannot touch it (callbacks still report
|
|
3087
3175
|
every request's own outcome). A failure resolves `null` — it never rejects
|
|
3088
3176
|
to the caller. `reset` takes ownership too, so a request it superseded
|
|
3089
|
-
cannot repopulate the state.
|
|
3090
|
-
options are read at call time. `immediate` runs its request once per host,
|
|
3091
|
-
on mount only, even when the host re-mounts the hook with new arguments.
|
|
3177
|
+
cannot repopulate the state.
|
|
3092
3178
|
|
|
3093
3179
|
```typescript
|
|
3094
3180
|
function useHttp<T>(
|
|
3095
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
3096
|
-
url: string
|
|
3097
|
-
options?: UseHttpOptions<T>,
|
|
3181
|
+
method: MaybeReadable<'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'>,
|
|
3182
|
+
url: MaybeReadable<string>,
|
|
3183
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3098
3184
|
): UseHttpResult<T>
|
|
3099
3185
|
```
|
|
3100
3186
|
|
|
3101
|
-
- `method` — HTTP method.
|
|
3102
|
-
- `url` — Request URL.
|
|
3103
|
-
- `options` — Request options, read at call time.
|
|
3187
|
+
- `method` — HTTP method (or a store of it).
|
|
3188
|
+
- `url` — Request URL (or a store of it).
|
|
3189
|
+
- `options` — Request options, read at call time (or a store of them).
|
|
3104
3190
|
|
|
3105
3191
|
**Returns:** Request state as stores and the controls.
|
|
3106
3192
|
|
|
@@ -3109,11 +3195,14 @@ function useHttp<T>(
|
|
|
3109
3195
|
GET requests, React's `useGet` in Svelte's idiom.
|
|
3110
3196
|
|
|
3111
3197
|
```typescript
|
|
3112
|
-
function useGet<T>(
|
|
3198
|
+
function useGet<T>(
|
|
3199
|
+
url: MaybeReadable<string>,
|
|
3200
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3201
|
+
): UseHttpResult<T>
|
|
3113
3202
|
```
|
|
3114
3203
|
|
|
3115
|
-
- `url` — Request URL to fetch from.
|
|
3116
|
-
- `options` — HTTP request options including callbacks and request config.
|
|
3204
|
+
- `url` — Request URL to fetch from (or a store of it).
|
|
3205
|
+
- `options` — HTTP request options including callbacks and request config (or a store of them).
|
|
3117
3206
|
|
|
3118
3207
|
**Returns:** Request state as stores and the controls.
|
|
3119
3208
|
|
|
@@ -3122,11 +3211,14 @@ function useGet<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
3122
3211
|
POST requests, React's `usePost` in Svelte's idiom.
|
|
3123
3212
|
|
|
3124
3213
|
```typescript
|
|
3125
|
-
function usePost<T>(
|
|
3214
|
+
function usePost<T>(
|
|
3215
|
+
url: MaybeReadable<string>,
|
|
3216
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3217
|
+
): UseHttpResult<T>
|
|
3126
3218
|
```
|
|
3127
3219
|
|
|
3128
|
-
- `url` — Request URL to post to.
|
|
3129
|
-
- `options` — HTTP request options including body data and callbacks.
|
|
3220
|
+
- `url` — Request URL to post to (or a store of it).
|
|
3221
|
+
- `options` — HTTP request options including body data and callbacks (or a store of them).
|
|
3130
3222
|
|
|
3131
3223
|
**Returns:** Request state as stores and the controls.
|
|
3132
3224
|
|
|
@@ -3135,11 +3227,14 @@ function usePost<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
3135
3227
|
PUT requests, React's `usePut` in Svelte's idiom.
|
|
3136
3228
|
|
|
3137
3229
|
```typescript
|
|
3138
|
-
function usePut<T>(
|
|
3230
|
+
function usePut<T>(
|
|
3231
|
+
url: MaybeReadable<string>,
|
|
3232
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3233
|
+
): UseHttpResult<T>
|
|
3139
3234
|
```
|
|
3140
3235
|
|
|
3141
|
-
- `url` — Request URL to send the PUT request to.
|
|
3142
|
-
- `options` — HTTP request options including body
|
|
3236
|
+
- `url` — Request URL to send the PUT request to (or a store of it).
|
|
3237
|
+
- `options` — HTTP request options including the replacement body (or a store of them).
|
|
3143
3238
|
|
|
3144
3239
|
**Returns:** Request state as stores and the controls.
|
|
3145
3240
|
|
|
@@ -3148,11 +3243,14 @@ function usePut<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
3148
3243
|
PATCH requests, React's `usePatch` in Svelte's idiom.
|
|
3149
3244
|
|
|
3150
3245
|
```typescript
|
|
3151
|
-
function usePatch<T>(
|
|
3246
|
+
function usePatch<T>(
|
|
3247
|
+
url: MaybeReadable<string>,
|
|
3248
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3249
|
+
): UseHttpResult<T>
|
|
3152
3250
|
```
|
|
3153
3251
|
|
|
3154
|
-
- `url` — Request URL to send the
|
|
3155
|
-
- `options` — HTTP request options including partial body
|
|
3252
|
+
- `url` — Request URL to send the partial body to (or a store of it).
|
|
3253
|
+
- `options` — HTTP request options including the partial body (or a store of them).
|
|
3156
3254
|
|
|
3157
3255
|
**Returns:** Request state as stores and the controls.
|
|
3158
3256
|
|
|
@@ -3161,11 +3259,14 @@ function usePatch<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
3161
3259
|
DELETE requests, React's `useDelete` in Svelte's idiom.
|
|
3162
3260
|
|
|
3163
3261
|
```typescript
|
|
3164
|
-
function useDelete<T>(
|
|
3262
|
+
function useDelete<T>(
|
|
3263
|
+
url: MaybeReadable<string>,
|
|
3264
|
+
options?: MaybeReadable<UseHttpOptions<T> | undefined>,
|
|
3265
|
+
): UseHttpResult<T>
|
|
3165
3266
|
```
|
|
3166
3267
|
|
|
3167
|
-
- `url` — Request URL of the resource to delete.
|
|
3168
|
-
- `options` — HTTP request options including callbacks.
|
|
3268
|
+
- `url` — Request URL of the resource to delete (or a store of it).
|
|
3269
|
+
- `options` — HTTP request options including callbacks (or a store of them).
|
|
3169
3270
|
|
|
3170
3271
|
**Returns:** Request state as stores and the controls.
|
|
3171
3272
|
|
|
@@ -3237,11 +3338,20 @@ configuration and provides helpers to build OAuth URLs and start a login
|
|
|
3237
3338
|
when the callback is running inside a popup we opened, relaying the result
|
|
3238
3339
|
to the opener instead.
|
|
3239
3340
|
|
|
3341
|
+
The config may be a plain value or a readable store of one (a store holding
|
|
3342
|
+
`undefined` means no config): every field — the provider list, the URL
|
|
3343
|
+
pieces, the callbacks, the `navigate` option — is read at the moment it is
|
|
3344
|
+
used, so setting the store retargets the next `getOAuthUrl`/`redirect`/popup
|
|
3345
|
+
flow on the same component, the way React's re-render does. `providers` is
|
|
3346
|
+
React's `string[]`, read live (see {@link UseOAuthReturn.providers}). The
|
|
3347
|
+
callback exchange, when it finds a `code` in the URL, runs once with the
|
|
3348
|
+
config the hook was called with.
|
|
3349
|
+
|
|
3240
3350
|
```typescript
|
|
3241
|
-
function useOAuth(config?: UseOAuthConfig): UseOAuthReturn
|
|
3351
|
+
function useOAuth(config?: MaybeReadable<UseOAuthConfig | undefined>): UseOAuthReturn
|
|
3242
3352
|
```
|
|
3243
3353
|
|
|
3244
|
-
- `config` — Optional OAuth configuration override.
|
|
3354
|
+
- `config` — Optional OAuth configuration override (or a store of it).
|
|
3245
3355
|
|
|
3246
3356
|
**Returns:** OAuth helpers: providers, getOAuthUrl, redirect, and loginViaPopup.
|
|
3247
3357
|
|
|
@@ -3260,11 +3370,18 @@ record's pending change never shows on another. Keep related fields, such as
|
|
|
3260
3370
|
a favorite flag and its count, in the SAME value. Let commit reject on
|
|
3261
3371
|
failure: a catch that returns old data hides the failure.
|
|
3262
3372
|
|
|
3373
|
+
The options may be a plain value or a readable store of one: setting the
|
|
3374
|
+
store applies the new server value (and the new `commit`, `equals` and
|
|
3375
|
+
`onError`) on the same component, the way React's re-render does — the
|
|
3376
|
+
controller, and any save it is running, survive the change.
|
|
3377
|
+
|
|
3263
3378
|
```typescript
|
|
3264
|
-
function useOptimisticValue<T>(
|
|
3379
|
+
function useOptimisticValue<T>(
|
|
3380
|
+
options: MaybeReadable<OptimisticValueOptions<T>>,
|
|
3381
|
+
): UseOptimisticValueResult<T>
|
|
3265
3382
|
```
|
|
3266
3383
|
|
|
3267
|
-
- `options` — The server's current value and how to save a change.
|
|
3384
|
+
- `options` — The server's current value and how to save a change (or a store of them).
|
|
3268
3385
|
|
|
3269
3386
|
**Returns:** The value to render, whether a save is pending, the newest failure, and `set`/`update`.
|
|
3270
3387
|
|
|
@@ -3379,10 +3496,10 @@ context-provided. The provider's listeners are caller-managed: the returned
|
|
|
3379
3496
|
`on*` unsubscribes are the caller's to call, like React's.
|
|
3380
3497
|
|
|
3381
3498
|
```typescript
|
|
3382
|
-
function usePush(options?: UsePushOptions): UsePushResult
|
|
3499
|
+
function usePush(options?: MaybeReadable<UsePushOptions | undefined>): UsePushResult
|
|
3383
3500
|
```
|
|
3384
3501
|
|
|
3385
|
-
- `options` — Hook options
|
|
3502
|
+
- `options` — Hook options (or a store of them): setting `checkOnMount` later runs its check on the same component, the way React's re-render re-runs its effect.
|
|
3386
3503
|
|
|
3387
3504
|
**Returns:** Push notification state and action methods
|
|
3388
3505
|
|
|
@@ -3446,12 +3563,16 @@ function useNavigate(): (path: string, options?: NavigateOptions) => void
|
|
|
3446
3563
|
Whether a path is active, React's `useIsActive` in Svelte's idiom: a
|
|
3447
3564
|
readable store that re-evaluates on every route change.
|
|
3448
3565
|
|
|
3566
|
+
Both arguments may be a plain value or a readable store of one: the store
|
|
3567
|
+
re-evaluates when one changes (the way React's re-render re-reads its
|
|
3568
|
+
snapshot), so a navigation-driven nav link can take its path from a store.
|
|
3569
|
+
|
|
3449
3570
|
```typescript
|
|
3450
|
-
function useIsActive(path: string
|
|
3571
|
+
function useIsActive(path: MaybeReadable<string>, exact?: MaybeReadable<boolean>): Readable<boolean>
|
|
3451
3572
|
```
|
|
3452
3573
|
|
|
3453
|
-
- `path` — The path to check.
|
|
3454
|
-
- `exact` — Whether to match exactly (default: false).
|
|
3574
|
+
- `path` — The path to check (or a store of it).
|
|
3575
|
+
- `exact` — Whether to match exactly (default: false; or a store of it).
|
|
3455
3576
|
|
|
3456
3577
|
**Returns:** A readable store of whether the path is active.
|
|
3457
3578
|
|
|
@@ -3469,13 +3590,14 @@ A signed-out visit to a view with `requiresAuth` replaces the entry with
|
|
|
3469
3590
|
`options.auth.redirectTo`, carrying `state.returnTo`; until auth is confirmed
|
|
3470
3591
|
`canLoad` is `false`.
|
|
3471
3592
|
|
|
3472
|
-
The options may be a readable store
|
|
3473
|
-
`
|
|
3474
|
-
|
|
3593
|
+
The options may be a plain value or a readable store of one (a store holding
|
|
3594
|
+
`undefined` means the default options): an auth status moving from `loading`
|
|
3595
|
+
to `unauthenticated` re-resolves the list — and performs the sign-in
|
|
3596
|
+
redirect — on the same component, the way React re-renders `useListRoute`.
|
|
3475
3597
|
|
|
3476
3598
|
```typescript
|
|
3477
3599
|
function useListRoute<Filter extends string = string, Selection extends string = string>(
|
|
3478
|
-
options?: ListRouteOptions<Filter, Selection> |
|
|
3600
|
+
options?: MaybeReadable<ListRouteOptions<Filter, Selection> | undefined>,
|
|
3479
3601
|
): UseListRouteResult<Filter, Selection>
|
|
3480
3602
|
```
|
|
3481
3603
|
|
|
@@ -3525,6 +3647,13 @@ function useSignup<
|
|
|
3525
3647
|
One storage key as Svelte stores, React's `useStorageValue` in Svelte's
|
|
3526
3648
|
idiom: call it during component init under `setMoleculeContext({ storage })`.
|
|
3527
3649
|
|
|
3650
|
+
Both arguments may be a plain value or a readable store of one (a store
|
|
3651
|
+
holding `undefined` means the argument was omitted): setting the `key` store
|
|
3652
|
+
starts the new key over — its value is unknown until its read lands, so the
|
|
3653
|
+
default shows and `loading` is true, exactly as a fresh mount — while writes
|
|
3654
|
+
go to the key the hook holds at the moment they run. The latest
|
|
3655
|
+
`defaultValue` and `sync` always apply.
|
|
3656
|
+
|
|
3528
3657
|
A read that started before a newer local write keeps that write's value (it
|
|
3529
3658
|
still ends `loading`), and with `sync` an outside write reaches the hook
|
|
3530
3659
|
through the provider's own subscription — so a non-browser backend
|
|
@@ -3533,13 +3662,13 @@ through the provider's own subscription — so a non-browser backend
|
|
|
3533
3662
|
|
|
3534
3663
|
```typescript
|
|
3535
3664
|
function useStorageValue<T>(
|
|
3536
|
-
key: string
|
|
3537
|
-
options?: UseStorageValueOptions<T>,
|
|
3665
|
+
key: MaybeReadable<string>,
|
|
3666
|
+
options?: MaybeReadable<UseStorageValueOptions<T> | undefined>,
|
|
3538
3667
|
): UseStorageValueResult<T>
|
|
3539
3668
|
```
|
|
3540
3669
|
|
|
3541
|
-
- `key` — Storage key
|
|
3542
|
-
- `options` — Hook options
|
|
3670
|
+
- `key` — Storage key (or a store of it).
|
|
3671
|
+
- `options` — Hook options (or a store of them).
|
|
3543
3672
|
|
|
3544
3673
|
**Returns:** Storage value state (value, loading, error) and mutators (setValue, removeValue).
|
|
3545
3674
|
|
|
@@ -3555,19 +3684,22 @@ same component without a remount. Ordering is the store's: a read that
|
|
|
3555
3684
|
started before a newer write, remove or external change is discarded, so a
|
|
3556
3685
|
slow hydration never overwrites an edit the user already made.
|
|
3557
3686
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3687
|
+
Both arguments may be a plain value or a readable store of one (a store
|
|
3688
|
+
holding `undefined` means the argument was omitted): setting the `key` store
|
|
3689
|
+
re-reads, re-subscribes and re-hydrates the new key on the same component
|
|
3690
|
+
(a `null`/`undefined` key is local state around the default and persists
|
|
3691
|
+
nothing), and writes go to the key the hook holds at the moment they run.
|
|
3692
|
+
The latest `defaultValue` always applies.
|
|
3561
3693
|
|
|
3562
3694
|
```typescript
|
|
3563
3695
|
function useStoragePreference<T = unknown>(
|
|
3564
|
-
key: string | null | undefined
|
|
3565
|
-
options?: UseStoragePreferenceOptions<T>,
|
|
3696
|
+
key: MaybeReadable<string | null | undefined>,
|
|
3697
|
+
options?: MaybeReadable<UseStoragePreferenceOptions<T> | undefined>,
|
|
3566
3698
|
): UseStoragePreferenceResult<T>
|
|
3567
3699
|
```
|
|
3568
3700
|
|
|
3569
|
-
- `key` — The storage key, or `null` when there is nothing to persist.
|
|
3570
|
-
- `options` — `defaultValue`, reported until the provider supplies one.
|
|
3701
|
+
- `key` — The storage key, or `null` when there is nothing to persist (or a store of either).
|
|
3702
|
+
- `options` — `defaultValue`, reported until the provider supplies one (or a store of them).
|
|
3571
3703
|
|
|
3572
3704
|
**Returns:** The current value, its mutators, and whether it is definite yet.
|
|
3573
3705
|
|
|
@@ -3593,21 +3725,30 @@ function useStorage(): {
|
|
|
3593
3725
|
Subscribes a store with an optional selector and equality function, React's
|
|
3594
3726
|
`useStore` in Svelte's idiom: a readable store of the selected value.
|
|
3595
3727
|
|
|
3728
|
+
The store argument may be the store itself (a molecule store has `getState`
|
|
3729
|
+
AND `subscribe`, and is always a VALUE, never a source) or a readable store
|
|
3730
|
+
OF a store: setting it re-subscribes to the new store and re-reads its
|
|
3731
|
+
snapshot on the same component, the way React's re-render does. The options
|
|
3732
|
+
(or a store of them) are read whenever the snapshot is.
|
|
3733
|
+
|
|
3596
3734
|
The store is the argument, so this hook needs NO state provider: it reads
|
|
3597
|
-
`store.getState()` and subscribes with `store.subscribe()`. When
|
|
3598
|
-
|
|
3599
|
-
|
|
3735
|
+
`store.getState()` and subscribes with `store.subscribe()`. When `equalityFn`
|
|
3736
|
+
says a new selected value equals the previous one, the previous result is
|
|
3737
|
+
kept (the same value, not a fresh object).
|
|
3600
3738
|
|
|
3601
3739
|
The selector and equality function run with the same cadence as React's
|
|
3602
3740
|
`useSyncExternalStore` binding, because React re-reads its snapshot around
|
|
3603
3741
|
every render; {@link useSyncExternalStore} documents the cadence.
|
|
3604
3742
|
|
|
3605
3743
|
```typescript
|
|
3606
|
-
function useStore<T, S = T>(
|
|
3744
|
+
function useStore<T, S = T>(
|
|
3745
|
+
store: MaybeReadable<Store<T>>,
|
|
3746
|
+
options?: MaybeReadable<UseStoreOptions<T, S> | undefined>,
|
|
3747
|
+
): Readable<S>
|
|
3607
3748
|
```
|
|
3608
3749
|
|
|
3609
|
-
- `store` — The store to subscribe to.
|
|
3610
|
-
- `options` — Hook options (selector, equalityFn).
|
|
3750
|
+
- `store` — The store to subscribe to (or a readable store of it).
|
|
3751
|
+
- `options` — Hook options (selector, equalityFn), or a store of them.
|
|
3611
3752
|
|
|
3612
3753
|
**Returns:** A readable store of the selected state.
|
|
3613
3754
|
|
|
@@ -3739,11 +3880,14 @@ directly leaves stale text after a locale switch. If `error` is an
|
|
|
3739
3880
|
using the current locale. For plain `Error` instances, `error.message` is
|
|
3740
3881
|
returned unchanged.
|
|
3741
3882
|
|
|
3883
|
+
The error may be a plain value or a readable store of one: setting the store
|
|
3884
|
+
replaces the message on the same component, the way React's re-render does.
|
|
3885
|
+
|
|
3742
3886
|
```typescript
|
|
3743
|
-
function useI18nError(error: Error | null | undefined): Readable<string | null>
|
|
3887
|
+
function useI18nError(error: MaybeReadable<Error | null | undefined>): Readable<string | null>
|
|
3744
3888
|
```
|
|
3745
3889
|
|
|
3746
|
-
- `error` — The error to translate, or `null`/`undefined
|
|
3890
|
+
- `error` — The error to translate, or `null`/`undefined` (or a store of either).
|
|
3747
3891
|
|
|
3748
3892
|
**Returns:** A readable store of the translated error string, or null.
|
|
3749
3893
|
|
|
@@ -3891,9 +4035,10 @@ AI chat with streaming: the transcript, loading and error state, mode, and
|
|
|
3891
4035
|
the controls (send, abort, queue edits, history). Call it during component
|
|
3892
4036
|
init.
|
|
3893
4037
|
|
|
3894
|
-
The options may be a readable store
|
|
3895
|
-
|
|
3896
|
-
|
|
4038
|
+
The options may be a plain value or a readable store of one (a store holding
|
|
4039
|
+
`undefined` means no options): a new `endpoint` switches conversation and a
|
|
4040
|
+
new `projectId` moves to that project's transcript, on the same component,
|
|
4041
|
+
the way React re-renders `useChat`.
|
|
3897
4042
|
|
|
3898
4043
|
```typescript
|
|
3899
4044
|
function useChat(options: UseChatOptions | Readable<UseChatOptions>): UseChatResult
|
|
@@ -4467,6 +4612,12 @@ function createVersionStores(): {
|
|
|
4467
4612
|
|
|
4468
4613
|
### Constants
|
|
4469
4614
|
|
|
4615
|
+
#### `Link`
|
|
4616
|
+
|
|
4617
|
+
```typescript
|
|
4618
|
+
const Link: LegacyComponentType
|
|
4619
|
+
```
|
|
4620
|
+
|
|
4470
4621
|
#### `SessionReady`
|
|
4471
4622
|
|
|
4472
4623
|
```typescript
|
|
@@ -4555,14 +4706,14 @@ Peer dependencies:
|
|
|
4555
4706
|
- `@molecule/app-logger` ^1.0.1
|
|
4556
4707
|
- `@molecule/app-platform` ^1.0.1
|
|
4557
4708
|
- `@molecule/app-push` ^1.0.1
|
|
4558
|
-
- `@molecule/app-routing` ^1.
|
|
4709
|
+
- `@molecule/app-routing` ^1.3.0
|
|
4559
4710
|
- `@molecule/app-state` ^1.2.0
|
|
4560
4711
|
- `@molecule/app-storage` ^1.1.1
|
|
4561
4712
|
- `@molecule/app-theme` ^1.0.1
|
|
4562
4713
|
- `@molecule/app-ui` ^1.0.1
|
|
4563
4714
|
- `@molecule/app-utilities` ^1.0.1
|
|
4564
4715
|
- `@molecule/app-version` ^1.0.1
|
|
4565
|
-
- `svelte` ^
|
|
4716
|
+
- `svelte` ^5.7.0
|
|
4566
4717
|
|
|
4567
4718
|
### Runtime Dependencies
|
|
4568
4719
|
|
|
@@ -4597,6 +4748,9 @@ Peer dependencies:
|
|
|
4597
4748
|
config; don't wrap in try/catch.
|
|
4598
4749
|
- Results are Svelte stores — read them with the `$` prefix (`$isAuthenticated`, `$theme`);
|
|
4599
4750
|
actions (`logout`, `toggleTheme`, `setTheme`) are plain functions.
|
|
4751
|
+
- In-app links are `Link` (`<Link to="/settings">`): it navigates through the router with
|
|
4752
|
+
react-router `<Link>`'s click rules. A hand-written click handler that calls `navigate()`
|
|
4753
|
+
breaks ctrl/cmd-click (new tab) unless it repeats those rules.
|
|
4600
4754
|
|
|
4601
4755
|
## Translations
|
|
4602
4756
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -34,14 +34,6 @@ export declare function liveStore<T>(read: () => T, subscribe: (notify: () => vo
|
|
|
34
34
|
* @returns A readable store of that field's current value.
|
|
35
35
|
*/
|
|
36
36
|
export declare function fieldStore<T, K extends keyof T>(state: Readable<T>, key: K): Readable<T[K]>;
|
|
37
|
-
/**
|
|
38
|
-
* Whether a hook's options were passed as a readable store (options that change
|
|
39
|
-
* without a remount) rather than as a plain value.
|
|
40
|
-
*
|
|
41
|
-
* @param value - The options, or a store of them.
|
|
42
|
-
* @returns True for a store.
|
|
43
|
-
*/
|
|
44
|
-
export declare function isReadableStore<T>(value: T | Readable<T>): value is Readable<T>;
|
|
45
37
|
/** The field-by-field view of a `usePromise` tracker, for hooks built on it. */
|
|
46
38
|
export interface PromiseTrackerFields<T, A extends unknown[]> {
|
|
47
39
|
/** The latest call's status. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-store.d.ts","sourceRoot":"","sources":["../../src/hooks/live-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAgB,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,CAAC,EACb,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,GAC5C,QAAQ,CAAC,CAAC,CAAC,CAKb;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAE3F;AAED
|
|
1
|
+
{"version":3,"file":"live-store.d.ts","sourceRoot":"","sources":["../../src/hooks/live-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAgB,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,CAAC,EACb,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,GAC5C,QAAQ,CAAC,CAAC,CAAC,CAKb;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAE3F;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE;IAC1D,gCAAgC;IAChC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;IAC/B,6EAA6E;IAC7E,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IACzB,mCAAmC;IACnC,KAAK,EAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;IAC7B,oEAAoE;IACpE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;IAChC,mCAAmC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAClD,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAW5B"}
|
package/dist/hooks/live-store.js
CHANGED
|
@@ -40,19 +40,6 @@ export function liveStore(read, subscribe) {
|
|
|
40
40
|
export function fieldStore(state, key) {
|
|
41
41
|
return derived(state, (current) => current[key]);
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Whether a hook's options were passed as a readable store (options that change
|
|
45
|
-
* without a remount) rather than as a plain value.
|
|
46
|
-
*
|
|
47
|
-
* @param value - The options, or a store of them.
|
|
48
|
-
* @returns True for a store.
|
|
49
|
-
*/
|
|
50
|
-
export function isReadableStore(value) {
|
|
51
|
-
return (typeof value === 'object' &&
|
|
52
|
-
value !== null &&
|
|
53
|
-
'subscribe' in value &&
|
|
54
|
-
typeof value.subscribe === 'function');
|
|
55
|
-
}
|
|
56
43
|
/**
|
|
57
44
|
* Reads a `usePromise` tracker's fields as individual stores and functions,
|
|
58
45
|
* for hooks built on it (`useLogin`, `useSignup`, …).
|