@molecule/app-react 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -74
- package/dist/hooks/useStorage.d.ts +59 -1
- package/dist/hooks/useStorage.d.ts.map +1 -1
- package/dist/hooks/useStorage.js +108 -20
- package/dist/hooks/useStorage.js.map +1 -1
- package/package.json +2 -2
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-10-
|
|
6
|
+
Generated: 2026-10-27T17:48:51.379Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-react
|
|
@@ -1171,6 +1171,43 @@ interface UseStorageValueResult<T> {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
```
|
|
1173
1173
|
|
|
1174
|
+
#### `UseStoragePreferenceOptions`
|
|
1175
|
+
|
|
1176
|
+
Options for {@link useStoragePreference}.
|
|
1177
|
+
|
|
1178
|
+
```typescript
|
|
1179
|
+
interface UseStoragePreferenceOptions<T> {
|
|
1180
|
+
/**
|
|
1181
|
+
* Value reported until the provider supplies one. It is NEVER written to
|
|
1182
|
+
* storage: a default is a display fallback, not a decision the user made.
|
|
1183
|
+
*/
|
|
1184
|
+
defaultValue?: T
|
|
1185
|
+
}
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
#### `UseStoragePreferenceResult`
|
|
1189
|
+
|
|
1190
|
+
Result of {@link useStoragePreference}.
|
|
1191
|
+
|
|
1192
|
+
```typescript
|
|
1193
|
+
interface UseStoragePreferenceResult<T> {
|
|
1194
|
+
/** The persisted value, or `defaultValue` while none is known. */
|
|
1195
|
+
value: T | undefined
|
|
1196
|
+
/**
|
|
1197
|
+
* Writes the value through the preference store: subscribers update
|
|
1198
|
+
* immediately and persistence is best-effort.
|
|
1199
|
+
*/
|
|
1200
|
+
setValue: (next: T | ((previous: T | undefined) => T)) => void
|
|
1201
|
+
/** Removes the key through the preference store. */
|
|
1202
|
+
removeValue: () => void
|
|
1203
|
+
/**
|
|
1204
|
+
* `true` once the store has a definite answer — the synchronous snapshot on
|
|
1205
|
+
* a synchronous provider, or the hydration result on an asynchronous one.
|
|
1206
|
+
*/
|
|
1207
|
+
ready: boolean
|
|
1208
|
+
}
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1174
1211
|
#### `UseVerifyPaymentReturnOptions`
|
|
1175
1212
|
|
|
1176
1213
|
Options for {@link useVerifyPaymentReturn}.
|
|
@@ -1912,7 +1949,7 @@ function useAIModels(projectId?: string): UseAIModelsResult
|
|
|
1912
1949
|
Hook like useState but accepts Promises and supports partial state extension.
|
|
1913
1950
|
|
|
1914
1951
|
```typescript
|
|
1915
|
-
function useAsyncState(initialState: T): [T, AsyncSetState<T>, AsyncExtendState<T>]
|
|
1952
|
+
function useAsyncState<T>(initialState: T): [T, AsyncSetState<T>, AsyncExtendState<T>]
|
|
1916
1953
|
```
|
|
1917
1954
|
|
|
1918
1955
|
- `initialState` — Initial state value
|
|
@@ -1928,7 +1965,10 @@ Pass the same generics the client was created with —
|
|
|
1928
1965
|
the app's own fields.
|
|
1929
1966
|
|
|
1930
1967
|
```typescript
|
|
1931
|
-
function useAuthClient
|
|
1968
|
+
function useAuthClient<
|
|
1969
|
+
T = unknown,
|
|
1970
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1971
|
+
>(): AuthClient<T, TRegister>
|
|
1932
1972
|
```
|
|
1933
1973
|
|
|
1934
1974
|
**Returns:** The auth client from context
|
|
@@ -1958,7 +1998,10 @@ call (and `requestBody` receives the same payload). Without it, `register`
|
|
|
1958
1998
|
accepts only the base fields.
|
|
1959
1999
|
|
|
1960
2000
|
```typescript
|
|
1961
|
-
function useAuth
|
|
2001
|
+
function useAuth<
|
|
2002
|
+
T = unknown,
|
|
2003
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
2004
|
+
>(options?: UseAuthOptions): UseAuthResult<T, TRegister>
|
|
1962
2005
|
```
|
|
1963
2006
|
|
|
1964
2007
|
- `options` — Hook options
|
|
@@ -1970,7 +2013,7 @@ function useAuth(options?: UseAuthOptions): UseAuthResult<T, TRegister>
|
|
|
1970
2013
|
Hook to get just the authenticated user.
|
|
1971
2014
|
|
|
1972
2015
|
```typescript
|
|
1973
|
-
function useUser(): T | null
|
|
2016
|
+
function useUser<T = unknown>(): T | null
|
|
1974
2017
|
```
|
|
1975
2018
|
|
|
1976
2019
|
**Returns:** The authenticated user or null
|
|
@@ -2132,7 +2175,7 @@ wires a form library once (`setProvider` from `@molecule/app-forms`) and
|
|
|
2132
2175
|
every form picks it up. Passing `createForm` overrides that for one form.
|
|
2133
2176
|
|
|
2134
2177
|
```typescript
|
|
2135
|
-
function useForm(options?: UseFormOptions<T>): UseFormResult<T>
|
|
2178
|
+
function useForm<T extends Record<string, unknown>>(options?: UseFormOptions<T>): UseFormResult<T>
|
|
2136
2179
|
```
|
|
2137
2180
|
|
|
2138
2181
|
- `options` — Form options. `defaultValues`, `mode` and the form-level `validate` are forwarded to the provider; omit the options entirely for a form whose fields are registered with their own defaults.
|
|
@@ -2144,7 +2187,10 @@ function useForm(options?: UseFormOptions<T>): UseFormResult<T>
|
|
|
2144
2187
|
Hook to watch a specific field value.
|
|
2145
2188
|
|
|
2146
2189
|
```typescript
|
|
2147
|
-
function useWatch
|
|
2190
|
+
function useWatch<T extends Record<string, unknown>, K extends keyof T>(
|
|
2191
|
+
form: FormController<T>,
|
|
2192
|
+
name: K,
|
|
2193
|
+
): T[K]
|
|
2148
2194
|
```
|
|
2149
2195
|
|
|
2150
2196
|
- `form` — Form controller
|
|
@@ -2157,7 +2203,10 @@ function useWatch(form: FormController<T>, name: K): T[K]
|
|
|
2157
2203
|
Hook to get field-level state.
|
|
2158
2204
|
|
|
2159
2205
|
```typescript
|
|
2160
|
-
function useFieldState
|
|
2206
|
+
function useFieldState<T extends Record<string, unknown>>(
|
|
2207
|
+
form: FormController<T>,
|
|
2208
|
+
name: keyof T,
|
|
2209
|
+
): FieldState<T[keyof T]>
|
|
2161
2210
|
```
|
|
2162
2211
|
|
|
2163
2212
|
- `form` — Form controller
|
|
@@ -2189,7 +2238,7 @@ the client does replace `execute` (it selects a different request) and
|
|
|
2189
2238
|
re-runs such an effect.
|
|
2190
2239
|
|
|
2191
2240
|
```typescript
|
|
2192
|
-
function useHttp(
|
|
2241
|
+
function useHttp<T>(
|
|
2193
2242
|
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
|
2194
2243
|
url: string,
|
|
2195
2244
|
options?: UseHttpOptions<T>,
|
|
@@ -2207,7 +2256,7 @@ function useHttp(
|
|
|
2207
2256
|
Hook for GET requests.
|
|
2208
2257
|
|
|
2209
2258
|
```typescript
|
|
2210
|
-
function useGet(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2259
|
+
function useGet<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2211
2260
|
```
|
|
2212
2261
|
|
|
2213
2262
|
- `url` — Request URL to fetch from.
|
|
@@ -2220,7 +2269,7 @@ function useGet(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
2220
2269
|
Hook for POST requests.
|
|
2221
2270
|
|
|
2222
2271
|
```typescript
|
|
2223
|
-
function usePost(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2272
|
+
function usePost<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2224
2273
|
```
|
|
2225
2274
|
|
|
2226
2275
|
- `url` — Request URL to post to.
|
|
@@ -2233,7 +2282,7 @@ function usePost(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
2233
2282
|
Hook for PUT requests.
|
|
2234
2283
|
|
|
2235
2284
|
```typescript
|
|
2236
|
-
function usePut(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2285
|
+
function usePut<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2237
2286
|
```
|
|
2238
2287
|
|
|
2239
2288
|
- `url` — Request URL to send the PUT request to.
|
|
@@ -2246,7 +2295,7 @@ function usePut(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
2246
2295
|
Hook for PATCH requests.
|
|
2247
2296
|
|
|
2248
2297
|
```typescript
|
|
2249
|
-
function usePatch(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2298
|
+
function usePatch<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2250
2299
|
```
|
|
2251
2300
|
|
|
2252
2301
|
- `url` — Request URL to send the PATCH request to.
|
|
@@ -2259,7 +2308,7 @@ function usePatch(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
|
2259
2308
|
Hook for DELETE requests.
|
|
2260
2309
|
|
|
2261
2310
|
```typescript
|
|
2262
|
-
function useDelete(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2311
|
+
function useDelete<T>(url: string, options?: UseHttpOptions<T>): UseHttpResult<T>
|
|
2263
2312
|
```
|
|
2264
2313
|
|
|
2265
2314
|
- `url` — Request URL of the resource to delete.
|
|
@@ -2322,7 +2371,7 @@ no separate `useRegister` hook. Use `usePromise(register)` when the form
|
|
|
2322
2371
|
needs the same pending/error tracking as this login hook.
|
|
2323
2372
|
|
|
2324
2373
|
```typescript
|
|
2325
|
-
function useLogin(): UseLoginReturn<T>
|
|
2374
|
+
function useLogin<T = unknown>(): UseLoginReturn<T>
|
|
2326
2375
|
```
|
|
2327
2376
|
|
|
2328
2377
|
**Returns:** Login state and action
|
|
@@ -2417,7 +2466,7 @@ the clean baseline; edits made while saving remain dirty. No request is made
|
|
|
2417
2466
|
for a patch with no fields. A failed request retains the edits and shared user.
|
|
2418
2467
|
|
|
2419
2468
|
```typescript
|
|
2420
|
-
function useProfileForm(
|
|
2469
|
+
function useProfileForm<TUser, TValues extends Record<string, unknown>>(
|
|
2421
2470
|
options: UseProfileFormOptions<TUser, TValues>,
|
|
2422
2471
|
): UseProfileFormResult<TUser, TValues>
|
|
2423
2472
|
```
|
|
@@ -2431,7 +2480,7 @@ function useProfileForm(
|
|
|
2431
2480
|
Hook that wraps an async function with state tracking.
|
|
2432
2481
|
|
|
2433
2482
|
```typescript
|
|
2434
|
-
function usePromise(
|
|
2483
|
+
function usePromise<T extends (...args: any[]) => Promise<any>>(
|
|
2435
2484
|
asyncFn: T,
|
|
2436
2485
|
): [
|
|
2437
2486
|
UsePromiseState<Awaited<ReturnType<T>>>,
|
|
@@ -2492,7 +2541,7 @@ function useLocation(): RouteLocation
|
|
|
2492
2541
|
Hook to get route parameters.
|
|
2493
2542
|
|
|
2494
2543
|
```typescript
|
|
2495
|
-
function useParams(): T
|
|
2544
|
+
function useParams<T extends Record<string, string> = RouteParams>(): T
|
|
2496
2545
|
```
|
|
2497
2546
|
|
|
2498
2547
|
**Returns:** The current route parameters
|
|
@@ -2502,7 +2551,7 @@ function useParams(): T
|
|
|
2502
2551
|
Hook to get query parameters.
|
|
2503
2552
|
|
|
2504
2553
|
```typescript
|
|
2505
|
-
function useQuery(): T
|
|
2554
|
+
function useQuery<T extends QueryParams = QueryParams>(): T
|
|
2506
2555
|
```
|
|
2507
2556
|
|
|
2508
2557
|
**Returns:** The current query parameters
|
|
@@ -2535,7 +2584,10 @@ function useIsActive(path: string, exact?: boolean): boolean
|
|
|
2535
2584
|
Hook for user registration with async state tracking.
|
|
2536
2585
|
|
|
2537
2586
|
```typescript
|
|
2538
|
-
function useSignup
|
|
2587
|
+
function useSignup<
|
|
2588
|
+
T = unknown,
|
|
2589
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
2590
|
+
>(): UseSignupReturn<T, TRegister>
|
|
2539
2591
|
```
|
|
2540
2592
|
|
|
2541
2593
|
**Returns:** Signup state and action
|
|
@@ -2555,7 +2607,10 @@ function useStorageProvider(): StorageProvider
|
|
|
2555
2607
|
Hook to manage a single storage value with React state sync.
|
|
2556
2608
|
|
|
2557
2609
|
```typescript
|
|
2558
|
-
function useStorageValue
|
|
2610
|
+
function useStorageValue<T>(
|
|
2611
|
+
key: string,
|
|
2612
|
+
options?: UseStorageValueOptions<T>,
|
|
2613
|
+
): UseStorageValueResult<T>
|
|
2559
2614
|
```
|
|
2560
2615
|
|
|
2561
2616
|
- `key` — Storage key
|
|
@@ -2563,6 +2618,33 @@ function useStorageValue(key: string, options?: UseStorageValueOptions<T>): UseS
|
|
|
2563
2618
|
|
|
2564
2619
|
**Returns:** Storage value state (value, loading, error) and mutators (setValue, removeValue).
|
|
2565
2620
|
|
|
2621
|
+
#### `useStoragePreference(key, options)`
|
|
2622
|
+
|
|
2623
|
+
Subscribes React state to ONE persisted preference.
|
|
2624
|
+
|
|
2625
|
+
This is the component-side half of `getPreferenceStore()`: a render-time value
|
|
2626
|
+
is available immediately when the bonded provider can answer synchronously,
|
|
2627
|
+
and an asynchronous provider's hydration CONVERGES onto the same component
|
|
2628
|
+
without a remount. Ordering is the store's: a read that started before a
|
|
2629
|
+
newer write, remove or external change is discarded, so a slow hydration
|
|
2630
|
+
never overwrites an edit the user already made.
|
|
2631
|
+
|
|
2632
|
+
Pass `null` for `key` while the real key is unknown (no project selected
|
|
2633
|
+
yet): the hook then behaves as local state around `defaultValue` and persists
|
|
2634
|
+
nothing.
|
|
2635
|
+
|
|
2636
|
+
```typescript
|
|
2637
|
+
function useStoragePreference<T = unknown>(
|
|
2638
|
+
key: string | null | undefined,
|
|
2639
|
+
options?: UseStoragePreferenceOptions<T>,
|
|
2640
|
+
): UseStoragePreferenceResult<T>
|
|
2641
|
+
```
|
|
2642
|
+
|
|
2643
|
+
- `key` — The storage key, or `null` when there is nothing to persist.
|
|
2644
|
+
- `options` — `defaultValue`, reported until the provider supplies one.
|
|
2645
|
+
|
|
2646
|
+
**Returns:** The current value, its mutators, and whether it is definite yet.
|
|
2647
|
+
|
|
2566
2648
|
#### `useStorage()`
|
|
2567
2649
|
|
|
2568
2650
|
Hook for simple storage operations without React state sync.
|
|
@@ -2607,7 +2689,7 @@ the state context. A store minted outside the `state` bond — the direct
|
|
|
2607
2689
|
therefore as valid here as one `@molecule/app-state`'s `createStore()` made.
|
|
2608
2690
|
|
|
2609
2691
|
```typescript
|
|
2610
|
-
function useStore(store: Store<T>, options?: UseStoreOptions<T, S>): S
|
|
2692
|
+
function useStore<T, S = T>(store: Store<T>, options?: UseStoreOptions<T, S>): S
|
|
2611
2693
|
```
|
|
2612
2694
|
|
|
2613
2695
|
- `store` — The store to subscribe to
|
|
@@ -2620,7 +2702,7 @@ function useStore(store: Store<T>, options?: UseStoreOptions<T, S>): S
|
|
|
2620
2702
|
Hook to get the store's setState function.
|
|
2621
2703
|
|
|
2622
2704
|
```typescript
|
|
2623
|
-
function useSetStore(store: Store<T>):
|
|
2705
|
+
function useSetStore<T>(store: Store<T>): Store<T>['setState']
|
|
2624
2706
|
```
|
|
2625
2707
|
|
|
2626
2708
|
- `store` — The store to get setState from
|
|
@@ -2632,7 +2714,7 @@ function useSetStore(store: Store<T>): (partial: Partial<T> | ((state: T) => Par
|
|
|
2632
2714
|
Hook to create a bound action for a store.
|
|
2633
2715
|
|
|
2634
2716
|
```typescript
|
|
2635
|
-
function useStoreAction(
|
|
2717
|
+
function useStoreAction<T, Args extends unknown[], R>(
|
|
2636
2718
|
store: Store<T>,
|
|
2637
2719
|
action: (setState: Store<T>['setState'], getState: Store<T>['getState']) => (...args: Args) => R,
|
|
2638
2720
|
): (...args: Args) => R
|
|
@@ -2688,7 +2770,7 @@ function useThemeMode(): 'light' | 'dark'
|
|
|
2688
2770
|
Hook to get theme colors.
|
|
2689
2771
|
|
|
2690
2772
|
```typescript
|
|
2691
|
-
function useThemeColors():
|
|
2773
|
+
function useThemeColors(): Theme['colors']
|
|
2692
2774
|
```
|
|
2693
2775
|
|
|
2694
2776
|
**Returns:** The current theme colors
|
|
@@ -2849,10 +2931,7 @@ function useWorkspace(): UseWorkspaceResult
|
|
|
2849
2931
|
Provider for state management.
|
|
2850
2932
|
|
|
2851
2933
|
```typescript
|
|
2852
|
-
function StateProvider({
|
|
2853
|
-
provider,
|
|
2854
|
-
children,
|
|
2855
|
-
}: StateProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2934
|
+
function StateProvider({ provider, children }: StateProviderProps): React.ReactElement
|
|
2856
2935
|
```
|
|
2857
2936
|
|
|
2858
2937
|
- `props` — Component props (see {@link StateProviderProps}).
|
|
@@ -2864,10 +2943,7 @@ function StateProvider({
|
|
|
2864
2943
|
Provider for authentication.
|
|
2865
2944
|
|
|
2866
2945
|
```typescript
|
|
2867
|
-
function AuthProvider({
|
|
2868
|
-
client,
|
|
2869
|
-
children,
|
|
2870
|
-
}: AuthProviderProps<T>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2946
|
+
function AuthProvider<T = unknown>({ client, children }: AuthProviderProps<T>): React.ReactElement
|
|
2871
2947
|
```
|
|
2872
2948
|
|
|
2873
2949
|
- `props` — Component props (see {@link AuthProviderProps}).
|
|
@@ -2879,10 +2955,7 @@ function AuthProvider({
|
|
|
2879
2955
|
Provider for theming.
|
|
2880
2956
|
|
|
2881
2957
|
```typescript
|
|
2882
|
-
function ThemeProvider({
|
|
2883
|
-
provider,
|
|
2884
|
-
children,
|
|
2885
|
-
}: ThemeProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2958
|
+
function ThemeProvider({ provider, children }: ThemeProviderProps): React.ReactElement
|
|
2886
2959
|
```
|
|
2887
2960
|
|
|
2888
2961
|
- `props` — Component props (see {@link ThemeProviderProps}).
|
|
@@ -2894,10 +2967,7 @@ function ThemeProvider({
|
|
|
2894
2967
|
Provider for routing.
|
|
2895
2968
|
|
|
2896
2969
|
```typescript
|
|
2897
|
-
function RouterProvider({
|
|
2898
|
-
router,
|
|
2899
|
-
children,
|
|
2900
|
-
}: RouterProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2970
|
+
function RouterProvider({ router, children }: RouterProviderProps): React.ReactElement
|
|
2901
2971
|
```
|
|
2902
2972
|
|
|
2903
2973
|
- `props` — Component props (see {@link RouterProviderProps}).
|
|
@@ -2909,10 +2979,7 @@ function RouterProvider({
|
|
|
2909
2979
|
Provider for internationalization.
|
|
2910
2980
|
|
|
2911
2981
|
```typescript
|
|
2912
|
-
function I18nProvider({
|
|
2913
|
-
provider,
|
|
2914
|
-
children,
|
|
2915
|
-
}: I18nProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2982
|
+
function I18nProvider({ provider, children }: I18nProviderProps): React.ReactElement
|
|
2916
2983
|
```
|
|
2917
2984
|
|
|
2918
2985
|
- `props` — Component props (see {@link I18nProviderProps}).
|
|
@@ -2924,10 +2991,7 @@ function I18nProvider({
|
|
|
2924
2991
|
Provider for HTTP client.
|
|
2925
2992
|
|
|
2926
2993
|
```typescript
|
|
2927
|
-
function HttpProvider({
|
|
2928
|
-
client,
|
|
2929
|
-
children,
|
|
2930
|
-
}: HttpProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
2994
|
+
function HttpProvider({ client, children }: HttpProviderProps): React.ReactElement
|
|
2931
2995
|
```
|
|
2932
2996
|
|
|
2933
2997
|
- `props` — Component props (see {@link HttpProviderProps}).
|
|
@@ -2939,10 +3003,7 @@ function HttpProvider({
|
|
|
2939
3003
|
Provider for storage.
|
|
2940
3004
|
|
|
2941
3005
|
```typescript
|
|
2942
|
-
function StorageProvider({
|
|
2943
|
-
provider,
|
|
2944
|
-
children,
|
|
2945
|
-
}: StorageProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3006
|
+
function StorageProvider({ provider, children }: StorageProviderProps): React.ReactElement
|
|
2946
3007
|
```
|
|
2947
3008
|
|
|
2948
3009
|
- `props` — Component props (see {@link StorageProviderProps}).
|
|
@@ -2954,10 +3015,7 @@ function StorageProvider({
|
|
|
2954
3015
|
Provider for logging.
|
|
2955
3016
|
|
|
2956
3017
|
```typescript
|
|
2957
|
-
function LoggerProvider({
|
|
2958
|
-
provider,
|
|
2959
|
-
children,
|
|
2960
|
-
}: LoggerProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3018
|
+
function LoggerProvider({ provider, children }: LoggerProviderProps): React.ReactElement
|
|
2961
3019
|
```
|
|
2962
3020
|
|
|
2963
3021
|
- `props` — Component props (see {@link LoggerProviderProps}).
|
|
@@ -2969,10 +3027,7 @@ function LoggerProvider({
|
|
|
2969
3027
|
Provider for AI chat.
|
|
2970
3028
|
|
|
2971
3029
|
```typescript
|
|
2972
|
-
function ChatProvider({
|
|
2973
|
-
provider,
|
|
2974
|
-
children,
|
|
2975
|
-
}: ChatProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3030
|
+
function ChatProvider({ provider, children }: ChatProviderProps): React.ReactElement
|
|
2976
3031
|
```
|
|
2977
3032
|
|
|
2978
3033
|
- `props` — Component props (see {@link ChatProviderProps}).
|
|
@@ -2984,10 +3039,7 @@ function ChatProvider({
|
|
|
2984
3039
|
Provider for IDE workspace.
|
|
2985
3040
|
|
|
2986
3041
|
```typescript
|
|
2987
|
-
function WorkspaceProvider({
|
|
2988
|
-
provider,
|
|
2989
|
-
children,
|
|
2990
|
-
}: WorkspaceProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3042
|
+
function WorkspaceProvider({ provider, children }: WorkspaceProviderProps): React.ReactElement
|
|
2991
3043
|
```
|
|
2992
3044
|
|
|
2993
3045
|
- `props` — Component props (see {@link WorkspaceProviderProps}).
|
|
@@ -2999,10 +3051,7 @@ function WorkspaceProvider({
|
|
|
2999
3051
|
Provider for code editor.
|
|
3000
3052
|
|
|
3001
3053
|
```typescript
|
|
3002
|
-
function EditorProvider({
|
|
3003
|
-
provider,
|
|
3004
|
-
children,
|
|
3005
|
-
}: EditorProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3054
|
+
function EditorProvider({ provider, children }: EditorProviderProps): React.ReactElement
|
|
3006
3055
|
```
|
|
3007
3056
|
|
|
3008
3057
|
- `props` — Component props (see {@link EditorProviderProps}).
|
|
@@ -3014,10 +3063,7 @@ function EditorProvider({
|
|
|
3014
3063
|
Provider for live preview.
|
|
3015
3064
|
|
|
3016
3065
|
```typescript
|
|
3017
|
-
function PreviewProvider({
|
|
3018
|
-
provider,
|
|
3019
|
-
children,
|
|
3020
|
-
}: PreviewProviderProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
|
|
3066
|
+
function PreviewProvider({ provider, children }: PreviewProviderProps): React.ReactElement
|
|
3021
3067
|
```
|
|
3022
3068
|
|
|
3023
3069
|
- `props` — Component props (see {@link PreviewProviderProps}).
|
|
@@ -3049,7 +3095,7 @@ function MoleculeProvider({
|
|
|
3049
3095
|
workspace,
|
|
3050
3096
|
editor,
|
|
3051
3097
|
preview,
|
|
3052
|
-
}: MoleculeProviderProps): React.ReactElement
|
|
3098
|
+
}: MoleculeProviderProps): React.ReactElement
|
|
3053
3099
|
```
|
|
3054
3100
|
|
|
3055
3101
|
- `props` — Component props (see {@link MoleculeProviderProps}) — each service is optional, and ONLY the services passed are provided to the tree.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
6
|
+
import { type StorageProvider } from '@molecule/app-storage';
|
|
7
7
|
/**
|
|
8
8
|
* Hook to access the storage provider from context.
|
|
9
9
|
*
|
|
@@ -57,6 +57,64 @@ export interface UseStorageValueResult<T> {
|
|
|
57
57
|
* @returns Storage value state (value, loading, error) and mutators (setValue, removeValue).
|
|
58
58
|
*/
|
|
59
59
|
export declare function useStorageValue<T>(key: string, options?: UseStorageValueOptions<T>): UseStorageValueResult<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Options for {@link useStoragePreference}.
|
|
62
|
+
*/
|
|
63
|
+
export interface UseStoragePreferenceOptions<T> {
|
|
64
|
+
/**
|
|
65
|
+
* Value reported until the provider supplies one. It is NEVER written to
|
|
66
|
+
* storage: a default is a display fallback, not a decision the user made.
|
|
67
|
+
*/
|
|
68
|
+
defaultValue?: T;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Result of {@link useStoragePreference}.
|
|
72
|
+
*/
|
|
73
|
+
export interface UseStoragePreferenceResult<T> {
|
|
74
|
+
/** The persisted value, or `defaultValue` while none is known. */
|
|
75
|
+
value: T | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Writes the value through the preference store: subscribers update
|
|
78
|
+
* immediately and persistence is best-effort.
|
|
79
|
+
*/
|
|
80
|
+
setValue: (next: T | ((previous: T | undefined) => T)) => void;
|
|
81
|
+
/** Removes the key through the preference store. */
|
|
82
|
+
removeValue: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* `true` once the store has a definite answer — the synchronous snapshot on
|
|
85
|
+
* a synchronous provider, or the hydration result on an asynchronous one.
|
|
86
|
+
*/
|
|
87
|
+
ready: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Subscribes React state to ONE persisted preference.
|
|
91
|
+
*
|
|
92
|
+
* This is the component-side half of `getPreferenceStore()`: a render-time value
|
|
93
|
+
* is available immediately when the bonded provider can answer synchronously,
|
|
94
|
+
* and an asynchronous provider's hydration CONVERGES onto the same component
|
|
95
|
+
* without a remount. Ordering is the store's: a read that started before a
|
|
96
|
+
* newer write, remove or external change is discarded, so a slow hydration
|
|
97
|
+
* never overwrites an edit the user already made.
|
|
98
|
+
*
|
|
99
|
+
* Pass `null` for `key` while the real key is unknown (no project selected
|
|
100
|
+
* yet): the hook then behaves as local state around `defaultValue` and persists
|
|
101
|
+
* nothing.
|
|
102
|
+
*
|
|
103
|
+
* @param key - The storage key, or `null` when there is nothing to persist.
|
|
104
|
+
* @param options - `defaultValue`, reported until the provider supplies one.
|
|
105
|
+
* @returns The current value, its mutators, and whether it is definite yet.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* const { value: width, setValue: setWidth, ready } = useStoragePreference<number>(key, {
|
|
110
|
+
* defaultValue: 280,
|
|
111
|
+
* })
|
|
112
|
+
* // A drag calls setWidth(320): the UI updates now and the write persists.
|
|
113
|
+
* // `ready` is false until hydration lands, so an effect must not persist the
|
|
114
|
+
* // fallback before then.
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare function useStoragePreference<T = unknown>(key: string | null | undefined, options?: UseStoragePreferenceOptions<T>): UseStoragePreferenceResult<T>;
|
|
60
118
|
/**
|
|
61
119
|
* Hook for simple storage operations without React state sync.
|
|
62
120
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAIhF;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAUpD;AAED;;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,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,C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C,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC9B,CAoBA"}
|
package/dist/hooks/useStorage.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { useCallback, useContext, useEffect, useState } from 'react';
|
|
6
|
+
import { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { t } from '@molecule/app-i18n';
|
|
8
|
+
import { getPreferenceStore } from '@molecule/app-storage';
|
|
8
9
|
import { StorageContext } from '../contexts.js';
|
|
9
10
|
/**
|
|
10
11
|
* Hook to access the storage provider from context.
|
|
@@ -49,19 +50,26 @@ export function useStorageValue(key, options) {
|
|
|
49
50
|
const [value, setValueState] = useState(defaultValue);
|
|
50
51
|
const [loading, setLoading] = useState(true);
|
|
51
52
|
const [error, setError] = useState(null);
|
|
53
|
+
/**
|
|
54
|
+
* Incremented by every local write. A read that started before it must not
|
|
55
|
+
* replace the newer value — the user editing before the first read lands is
|
|
56
|
+
* the common case on a slow (native, encrypted) backend.
|
|
57
|
+
*/
|
|
58
|
+
const writeVersion = useRef(0);
|
|
52
59
|
// Load initial value
|
|
53
60
|
useEffect(() => {
|
|
54
61
|
let mounted = true;
|
|
62
|
+
const version = writeVersion.current;
|
|
55
63
|
const loadValue = async () => {
|
|
56
64
|
try {
|
|
57
65
|
const stored = await storage.get(key);
|
|
58
|
-
if (mounted) {
|
|
66
|
+
if (mounted && writeVersion.current === version) {
|
|
59
67
|
setValueState(stored ?? defaultValue);
|
|
60
68
|
setLoading(false);
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
catch (err) {
|
|
64
|
-
if (mounted) {
|
|
72
|
+
if (mounted && writeVersion.current === version) {
|
|
65
73
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
66
74
|
setLoading(false);
|
|
67
75
|
}
|
|
@@ -72,26 +80,19 @@ export function useStorageValue(key, options) {
|
|
|
72
80
|
mounted = false;
|
|
73
81
|
};
|
|
74
82
|
}, [key, storage, defaultValue]);
|
|
75
|
-
// Sync across tabs if supported
|
|
83
|
+
// Sync across tabs if supported — through the PROVIDER's own subscription, so
|
|
84
|
+
// a non-browser backend (native, encrypted, memory) propagates the same way
|
|
85
|
+
// instead of being limited to the browser `storage` event.
|
|
76
86
|
useEffect(() => {
|
|
77
|
-
if (!sync)
|
|
87
|
+
if (!sync || !storage.subscribe)
|
|
78
88
|
return;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
catch (_error) {
|
|
86
|
-
// JSON.parse failed on newValue — the cross-tab sync is best-effort and the
|
|
87
|
-
// local state already holds the last good value, so ignoring is safe here.
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
window.addEventListener('storage', handleStorageChange);
|
|
92
|
-
return () => window.removeEventListener('storage', handleStorageChange);
|
|
93
|
-
}, [key, sync]);
|
|
89
|
+
return storage.subscribe(key, (next) => {
|
|
90
|
+
writeVersion.current += 1;
|
|
91
|
+
setValueState(next === null ? defaultValue : next);
|
|
92
|
+
});
|
|
93
|
+
}, [key, sync, storage, defaultValue]);
|
|
94
94
|
const setValue = useCallback(async (newValue) => {
|
|
95
|
+
writeVersion.current += 1;
|
|
95
96
|
try {
|
|
96
97
|
await storage.set(key, newValue);
|
|
97
98
|
setValueState(newValue);
|
|
@@ -103,6 +104,7 @@ export function useStorageValue(key, options) {
|
|
|
103
104
|
}
|
|
104
105
|
}, [key, storage]);
|
|
105
106
|
const removeValue = useCallback(async () => {
|
|
107
|
+
writeVersion.current += 1;
|
|
106
108
|
try {
|
|
107
109
|
await storage.remove(key);
|
|
108
110
|
setValueState(defaultValue);
|
|
@@ -121,6 +123,92 @@ export function useStorageValue(key, options) {
|
|
|
121
123
|
error,
|
|
122
124
|
};
|
|
123
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Subscribes React state to ONE persisted preference.
|
|
128
|
+
*
|
|
129
|
+
* This is the component-side half of `getPreferenceStore()`: a render-time value
|
|
130
|
+
* is available immediately when the bonded provider can answer synchronously,
|
|
131
|
+
* and an asynchronous provider's hydration CONVERGES onto the same component
|
|
132
|
+
* without a remount. Ordering is the store's: a read that started before a
|
|
133
|
+
* newer write, remove or external change is discarded, so a slow hydration
|
|
134
|
+
* never overwrites an edit the user already made.
|
|
135
|
+
*
|
|
136
|
+
* Pass `null` for `key` while the real key is unknown (no project selected
|
|
137
|
+
* yet): the hook then behaves as local state around `defaultValue` and persists
|
|
138
|
+
* nothing.
|
|
139
|
+
*
|
|
140
|
+
* @param key - The storage key, or `null` when there is nothing to persist.
|
|
141
|
+
* @param options - `defaultValue`, reported until the provider supplies one.
|
|
142
|
+
* @returns The current value, its mutators, and whether it is definite yet.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* const { value: width, setValue: setWidth, ready } = useStoragePreference<number>(key, {
|
|
147
|
+
* defaultValue: 280,
|
|
148
|
+
* })
|
|
149
|
+
* // A drag calls setWidth(320): the UI updates now and the write persists.
|
|
150
|
+
* // `ready` is false until hydration lands, so an effect must not persist the
|
|
151
|
+
* // fallback before then.
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export function useStoragePreference(key, options) {
|
|
155
|
+
const store = getPreferenceStore();
|
|
156
|
+
const defaultValueRef = useRef(options?.defaultValue);
|
|
157
|
+
defaultValueRef.current = options?.defaultValue;
|
|
158
|
+
const read = useCallback(() => {
|
|
159
|
+
if (!key)
|
|
160
|
+
return defaultValueRef.current;
|
|
161
|
+
const stored = store.get(key);
|
|
162
|
+
return stored === null ? defaultValueRef.current : stored;
|
|
163
|
+
}, [store, key]);
|
|
164
|
+
const [value, setValueState] = useState(read);
|
|
165
|
+
const [ready, setReady] = useState(!key);
|
|
166
|
+
const valueRef = useRef(value);
|
|
167
|
+
valueRef.current = value;
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (!key) {
|
|
170
|
+
setReady(true);
|
|
171
|
+
setValueState(defaultValueRef.current);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
let cancelled = false;
|
|
175
|
+
const sync = () => {
|
|
176
|
+
if (!cancelled)
|
|
177
|
+
setValueState(read());
|
|
178
|
+
};
|
|
179
|
+
// Seed from whatever the store already knows, then let hydration converge
|
|
180
|
+
// it. With a synchronous provider this is a no-op change.
|
|
181
|
+
sync();
|
|
182
|
+
setReady(false);
|
|
183
|
+
const stop = store.subscribe(key, sync);
|
|
184
|
+
void store.hydrate([key]).then(() => {
|
|
185
|
+
if (cancelled)
|
|
186
|
+
return;
|
|
187
|
+
sync();
|
|
188
|
+
setReady(true);
|
|
189
|
+
});
|
|
190
|
+
return () => {
|
|
191
|
+
cancelled = true;
|
|
192
|
+
stop();
|
|
193
|
+
};
|
|
194
|
+
}, [store, key, read]);
|
|
195
|
+
const setValue = useCallback((next) => {
|
|
196
|
+
const resolved = typeof next === 'function'
|
|
197
|
+
? next(valueRef.current)
|
|
198
|
+
: next;
|
|
199
|
+
valueRef.current = resolved;
|
|
200
|
+
setValueState(resolved);
|
|
201
|
+
if (key)
|
|
202
|
+
store.set(key, resolved);
|
|
203
|
+
}, [store, key]);
|
|
204
|
+
const removeValue = useCallback(() => {
|
|
205
|
+
valueRef.current = defaultValueRef.current;
|
|
206
|
+
setValueState(defaultValueRef.current);
|
|
207
|
+
if (key)
|
|
208
|
+
store.remove(key);
|
|
209
|
+
}, [store, key]);
|
|
210
|
+
return { value, setValue, removeValue, ready };
|
|
211
|
+
}
|
|
124
212
|
/**
|
|
125
213
|
* Hook for simple storage operations without React state sync.
|
|
126
214
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAwB,MAAM,uBAAuB,CAAA;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,CAAC,CAAC,uCAAuC,EAAE,SAAS,EAAE;YACpD,YAAY,EAAE,0DAA0D;SACzE,CAAC,CACH,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,OAAmC;IAEnC,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAA;IACpC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IAEpD,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,YAAY,CAAC,CAAA;IACpE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,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react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "React framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@molecule/app-ai-models": "1.4.3",
|
|
64
64
|
"@molecule/app-bonds-default-react": "3.0.0",
|
|
65
|
-
"@molecule/app-i18n": "1.1.
|
|
65
|
+
"@molecule/app-i18n": "1.1.1",
|
|
66
66
|
"@testing-library/dom": "10.4.2",
|
|
67
67
|
"@testing-library/react": "16.3.3",
|
|
68
68
|
"@types/node": "26.6.5",
|