@effect/atom-react 4.0.0-beta.7 → 4.0.0-beta.71

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/dist/Hooks.d.ts CHANGED
@@ -3,78 +3,279 @@ import type * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
3
3
  import * as Atom from "effect/unstable/reactivity/Atom";
4
4
  import type * as AtomRef from "effect/unstable/reactivity/AtomRef";
5
5
  /**
6
- * @since 1.0.0
6
+ * Seeds initial atom values in the current React atom registry.
7
+ *
8
+ * **When to use**
9
+ *
10
+ * Use to seed atom values from a React component after the current registry
11
+ * already exists.
12
+ *
13
+ * **Gotchas**
14
+ *
15
+ * Each atom is initialized at most once for a given registry by this hook, so
16
+ * later calls for the same atom in that registry are ignored.
17
+ *
7
18
  * @category hooks
19
+ * @since 4.0.0
8
20
  */
9
21
  export declare const useAtomInitialValues: (initialValues: Iterable<readonly [Atom.Atom<any>, any]>) => void;
10
22
  /**
11
- * @since 1.0.0
23
+ * Subscribes to an atom in the current React registry and returns its current
24
+ * value, optionally mapped through a selector.
25
+ *
26
+ * **When to use**
27
+ *
28
+ * Use when a React component needs to render from an atom value without also
29
+ * returning a setter.
30
+ *
31
+ * **Details**
32
+ *
33
+ * When a selector is provided, the hook maps the atom before subscribing so the
34
+ * component reads the selected value from the current `RegistryContext`.
35
+ *
36
+ * @see {@link useAtom} for reading and updating a writable atom from one component
37
+ * @see {@link useAtomRef} for reading an `AtomRef` directly
38
+ *
12
39
  * @category hooks
40
+ * @since 4.0.0
13
41
  */
14
42
  export declare const useAtomValue: {
15
43
  /**
16
- * @since 1.0.0
44
+ * Subscribes to an atom in the current React registry and returns its current
45
+ * value, optionally mapped through a selector.
46
+ *
47
+ * **When to use**
48
+ *
49
+ * Use when a React component needs to render from an atom value without also
50
+ * returning a setter.
51
+ *
52
+ * **Details**
53
+ *
54
+ * When a selector is provided, the hook maps the atom before subscribing so the
55
+ * component reads the selected value from the current `RegistryContext`.
56
+ *
57
+ * @see {@link useAtom} for reading and updating a writable atom from one component
58
+ * @see {@link useAtomRef} for reading an `AtomRef` directly
59
+ *
17
60
  * @category hooks
61
+ * @since 4.0.0
18
62
  */
19
63
  <A>(atom: Atom.Atom<A>): A;
20
64
  /**
21
- * @since 1.0.0
65
+ * Subscribes to an atom in the current React registry and returns its current
66
+ * value, optionally mapped through a selector.
67
+ *
68
+ * **When to use**
69
+ *
70
+ * Use when a React component needs to render from an atom value without also
71
+ * returning a setter.
72
+ *
73
+ * **Details**
74
+ *
75
+ * When a selector is provided, the hook maps the atom before subscribing so the
76
+ * component reads the selected value from the current `RegistryContext`.
77
+ *
78
+ * @see {@link useAtom} for reading and updating a writable atom from one component
79
+ * @see {@link useAtomRef} for reading an `AtomRef` directly
80
+ *
22
81
  * @category hooks
82
+ * @since 4.0.0
23
83
  */
24
84
  <A, B>(atom: Atom.Atom<A>, f: (_: A) => B): B;
25
85
  };
26
86
  /**
27
- * @since 1.0.0
87
+ * Mounts an atom in the current React registry for the lifetime of the
88
+ * component.
89
+ *
90
+ * **When to use**
91
+ *
92
+ * Use to keep an atom mounted from a React component without reading, writing,
93
+ * or refreshing it.
94
+ *
95
+ * **Details**
96
+ *
97
+ * The hook uses the current `RegistryContext` and releases the mount through
98
+ * React effect cleanup when the component unmounts or when the registry or atom
99
+ * dependency changes.
100
+ *
101
+ * @see {@link useAtomSet} for mounting a writable atom while returning a setter
102
+ * @see {@link useAtomRefresh} for mounting an atom while returning a refresh callback
103
+ *
28
104
  * @category hooks
105
+ * @since 4.0.0
29
106
  */
30
107
  export declare const useAtomMount: <A>(atom: Atom.Atom<A>) => void;
31
108
  /**
32
- * @since 1.0.0
109
+ * Mounts a writable atom and returns a setter without subscribing to its value.
110
+ *
111
+ * **When to use**
112
+ *
113
+ * Use when a React component needs to update a writable atom without rendering
114
+ * from that atom's value.
115
+ *
116
+ * **Details**
117
+ *
118
+ * The hook mounts the atom and returns a setter. In value mode the setter
119
+ * accepts a write value or updater function; for `AsyncResult` atoms, `promise`
120
+ * and `promiseExit` modes return a promise for the success value or full `Exit`.
121
+ *
122
+ * @see {@link useAtom} for reading and updating the same writable atom
123
+ *
33
124
  * @category hooks
125
+ * @since 4.0.0
34
126
  */
35
127
  export declare const useAtomSet: <R, W, Mode extends "value" | "promise" | "promiseExit" = never>(atom: Atom.Writable<R, W>, options?: {
36
128
  readonly mode?: ([R] extends [AsyncResult.AsyncResult<any, any>] ? Mode : "value") | undefined;
37
129
  }) => "promise" extends Mode ? ((value: W) => Promise<AsyncResult.AsyncResult.Success<R>>) : "promiseExit" extends Mode ? ((value: W) => Promise<Exit.Exit<AsyncResult.AsyncResult.Success<R>, AsyncResult.AsyncResult.Failure<R>>>) : ((value: W | ((value: R) => W)) => void);
38
130
  /**
39
- * @since 1.0.0
131
+ * Mounts an atom and returns a callback that refreshes it in the current React
132
+ * registry.
133
+ *
134
+ * **When to use**
135
+ *
136
+ * Use to expose a React callback that requests a refresh for an atom without
137
+ * reading or writing its value.
138
+ *
139
+ * **Details**
140
+ *
141
+ * The hook uses the current `RegistryContext`, mounts the atom for the
142
+ * component lifetime, and returns a callback that calls `registry.refresh`.
143
+ *
144
+ * @see {@link useAtomMount} for mounting an atom without returning a refresh callback
145
+ *
40
146
  * @category hooks
147
+ * @since 4.0.0
41
148
  */
42
149
  export declare const useAtomRefresh: <A>(atom: Atom.Atom<A>) => () => void;
43
150
  /**
44
- * @since 1.0.0
151
+ * Subscribes to a writable atom and returns its current value together with a
152
+ * setter for updating it.
153
+ *
154
+ * **When to use**
155
+ *
156
+ * Use when a React component needs both to render the current value of a
157
+ * writable atom and update it from the same component.
158
+ *
159
+ * @see {@link useAtomValue} for subscribing to an atom without a setter
160
+ * @see {@link useAtomSet} for updating a writable atom without subscribing to its value
161
+ *
45
162
  * @category hooks
163
+ * @since 4.0.0
46
164
  */
47
165
  export declare const useAtom: <R, W, const Mode extends "value" | "promise" | "promiseExit" = never>(atom: Atom.Writable<R, W>, options?: {
48
166
  readonly mode?: ([R] extends [AsyncResult.AsyncResult<any, any>] ? Mode : "value") | undefined;
49
167
  }) => readonly [value: R, write: "promise" extends Mode ? ((value: W) => Promise<AsyncResult.AsyncResult.Success<R>>) : "promiseExit" extends Mode ? ((value: W) => Promise<Exit.Exit<AsyncResult.AsyncResult.Success<R>, AsyncResult.AsyncResult.Failure<R>>>) : ((value: W | ((value: R) => W)) => void)];
50
168
  /**
51
- * @since 1.0.0
169
+ * Reads an `AsyncResult` atom through React Suspense, suspending while the
170
+ * result is initial or configured as waiting.
171
+ *
172
+ * **When to use**
173
+ *
174
+ * Use when a React component should render only after an `AsyncResult` atom has
175
+ * left its initial state, with loading delegated to a Suspense boundary.
176
+ *
177
+ * **Details**
178
+ *
179
+ * `suspendOnWaiting` defaults to `false`. When `includeFailure` is `true`, a
180
+ * failure result is returned instead of being thrown.
181
+ *
182
+ * **Gotchas**
183
+ *
184
+ * Without `includeFailure`, failure results are thrown with
185
+ * `Cause.squash(result.cause)`, so callers need an error boundary for failures.
186
+ *
187
+ * @see {@link useAtomValue} for reading the raw `AsyncResult` value without Suspense
188
+ *
52
189
  * @category hooks
190
+ * @since 4.0.0
53
191
  */
54
192
  export declare const useAtomSuspense: <A, E, const IncludeFailure extends boolean = false>(atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>, options?: {
55
193
  readonly suspendOnWaiting?: boolean | undefined;
56
194
  readonly includeFailure?: IncludeFailure | undefined;
57
195
  }) => AsyncResult.Success<A, E> | (IncludeFailure extends true ? AsyncResult.Failure<A, E> : never);
58
196
  /**
59
- * @since 1.0.0
197
+ * Subscribes a callback to an atom in the current React registry for the
198
+ * component lifetime.
199
+ *
200
+ * **When to use**
201
+ *
202
+ * Use when a React component needs to run a callback for atom changes without
203
+ * reading the atom value during render.
204
+ *
205
+ * **Details**
206
+ *
207
+ * The subscription is installed in a React effect and cleaned up on unmount or
208
+ * dependency change. When `options.immediate` is enabled, the callback receives
209
+ * the current value when the effect subscribes.
210
+ *
211
+ * @see {@link useAtomValue} for reading an atom value during render instead of running a callback
212
+ *
60
213
  * @category hooks
214
+ * @since 4.0.0
61
215
  */
62
216
  export declare const useAtomSubscribe: <A>(atom: Atom.Atom<A>, f: (_: A) => void, options?: {
63
217
  readonly immediate?: boolean;
64
218
  }) => void;
65
219
  /**
66
- * @since 1.0.0
220
+ * Subscribes to an atom ref and returns its latest value.
221
+ *
222
+ * **When to use**
223
+ *
224
+ * Use when a React component should render from an `AtomRef.ReadonlyRef`
225
+ * directly instead of reading an atom through the current registry.
226
+ *
227
+ * **Details**
228
+ *
229
+ * The hook subscribes with `ref.subscribe`, triggers re-renders through React
230
+ * state, and returns the current `ref.value`.
231
+ *
232
+ * @see {@link useAtomValue} for reading an `Atom` from the current registry
233
+ * @see {@link useAtomRefPropValue} for reading a property ref value
234
+ *
67
235
  * @category hooks
236
+ * @since 4.0.0
68
237
  */
69
238
  export declare const useAtomRef: <A>(ref: AtomRef.ReadonlyRef<A>) => A;
70
239
  /**
71
- * @since 1.0.0
240
+ * Returns a memoized atom ref for a property of another atom ref.
241
+ *
242
+ * **When to use**
243
+ *
244
+ * Use to derive an `AtomRef` for one property of an object-shaped atom ref.
245
+ *
246
+ * **Details**
247
+ *
248
+ * The hook memoizes `ref.prop(prop)` for the `[ref, prop]` dependency pair and
249
+ * returns the property ref so callers can read, set, update, or subscribe to
250
+ * that nested property.
251
+ *
252
+ * @see {@link useAtomRef} for subscribing to an atom ref value
253
+ * @see {@link useAtomRefPropValue} for subscribing directly to a property value
254
+ *
72
255
  * @category hooks
256
+ * @since 4.0.0
73
257
  */
74
258
  export declare const useAtomRefProp: <A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K) => AtomRef.AtomRef<A[K]>;
75
259
  /**
76
- * @since 1.0.0
260
+ * Subscribes to a property ref derived from an atom ref and returns its current
261
+ * value.
262
+ *
263
+ * **When to use**
264
+ *
265
+ * Use when a React component needs only the current value of one property from
266
+ * an object-shaped `AtomRef`.
267
+ *
268
+ * **Details**
269
+ *
270
+ * The hook composes `useAtomRefProp(ref, prop)` with `useAtomRef`, so the
271
+ * property ref is memoized for the `[ref, prop]` pair and then subscribed
272
+ * through `ref.subscribe`.
273
+ *
274
+ * @see {@link useAtomRefProp} for returning the property ref directly
275
+ * @see {@link useAtomRef} for subscribing to a whole atom ref value
276
+ *
77
277
  * @category hooks
278
+ * @since 4.0.0
78
279
  */
79
280
  export declare const useAtomRefPropValue: <A, K extends keyof A>(ref: AtomRef.AtomRef<A>, prop: K) => A[K];
80
281
  //# sourceMappingURL=Hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../src/Hooks.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,KAAK,WAAW,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,IAAI,MAAM,iCAAiC,CAAA;AACvD,OAAO,KAAK,KAAK,OAAO,MAAM,oCAAoC,CAAA;AA8ClE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,eAAe,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,KAAG,IAa9F,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE;IACzB;;;OAGG;IACH,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC1B;;;OAGG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;CAQ9C,CAAA;AAyCD;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAG,IAGpD,CAA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D,CAAA"}
package/dist/Hooks.js CHANGED
@@ -1,5 +1,23 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * React hooks for reading, writing, mounting, refreshing, and subscribing to
3
+ * Effect atoms from the registry provided by `RegistryContext`.
4
+ *
5
+ * **Common tasks**
6
+ *
7
+ * - Read atom values in React components with {@link useAtomValue}
8
+ * - Read and write writable atoms with {@link useAtom}
9
+ * - Write without subscribing to the value with {@link useAtomSet}
10
+ * - Seed registry-local initial values with {@link useAtomInitialValues}
11
+ * - Integrate `AsyncResult` atoms with React Suspense through {@link useAtomSuspense}
12
+ * - Subscribe to atom changes or derive stable `AtomRef` properties
13
+ *
14
+ * **Gotchas**
15
+ *
16
+ * - Hooks use the current `RegistryContext`, so each provider has an independent atom registry
17
+ * - Writable atoms are mounted by the write-oriented hooks before updates are sent
18
+ * - Suspense support throws promises for initial or waiting `AsyncResult` values and defects for failures unless `includeFailure` is enabled
19
+ *
20
+ * @since 4.0.0
3
21
  */
4
22
  "use client";
5
23
 
@@ -41,8 +59,20 @@ function useStore(registry, atom) {
41
59
  }
42
60
  const initialValuesSet = /*#__PURE__*/new WeakMap();
43
61
  /**
44
- * @since 1.0.0
62
+ * Seeds initial atom values in the current React atom registry.
63
+ *
64
+ * **When to use**
65
+ *
66
+ * Use to seed atom values from a React component after the current registry
67
+ * already exists.
68
+ *
69
+ * **Gotchas**
70
+ *
71
+ * Each atom is initialized at most once for a given registry by this hook, so
72
+ * later calls for the same atom in that registry are ignored.
73
+ *
45
74
  * @category hooks
75
+ * @since 4.0.0
46
76
  */
47
77
  export const useAtomInitialValues = initialValues => {
48
78
  const registry = React.useContext(RegistryContext);
@@ -59,8 +89,24 @@ export const useAtomInitialValues = initialValues => {
59
89
  }
60
90
  };
61
91
  /**
62
- * @since 1.0.0
92
+ * Subscribes to an atom in the current React registry and returns its current
93
+ * value, optionally mapped through a selector.
94
+ *
95
+ * **When to use**
96
+ *
97
+ * Use when a React component needs to render from an atom value without also
98
+ * returning a setter.
99
+ *
100
+ * **Details**
101
+ *
102
+ * When a selector is provided, the hook maps the atom before subscribing so the
103
+ * component reads the selected value from the current `RegistryContext`.
104
+ *
105
+ * @see {@link useAtom} for reading and updating a writable atom from one component
106
+ * @see {@link useAtomRef} for reading an `AtomRef` directly
107
+ *
63
108
  * @category hooks
109
+ * @since 4.0.0
64
110
  */
65
111
  export const useAtomValue = (atom, f) => {
66
112
  const registry = React.useContext(RegistryContext);
@@ -92,16 +138,48 @@ const flattenExit = exit => {
92
138
  throw Cause.squash(exit.cause);
93
139
  };
94
140
  /**
95
- * @since 1.0.0
141
+ * Mounts an atom in the current React registry for the lifetime of the
142
+ * component.
143
+ *
144
+ * **When to use**
145
+ *
146
+ * Use to keep an atom mounted from a React component without reading, writing,
147
+ * or refreshing it.
148
+ *
149
+ * **Details**
150
+ *
151
+ * The hook uses the current `RegistryContext` and releases the mount through
152
+ * React effect cleanup when the component unmounts or when the registry or atom
153
+ * dependency changes.
154
+ *
155
+ * @see {@link useAtomSet} for mounting a writable atom while returning a setter
156
+ * @see {@link useAtomRefresh} for mounting an atom while returning a refresh callback
157
+ *
96
158
  * @category hooks
159
+ * @since 4.0.0
97
160
  */
98
161
  export const useAtomMount = atom => {
99
162
  const registry = React.useContext(RegistryContext);
100
163
  mountAtom(registry, atom);
101
164
  };
102
165
  /**
103
- * @since 1.0.0
166
+ * Mounts a writable atom and returns a setter without subscribing to its value.
167
+ *
168
+ * **When to use**
169
+ *
170
+ * Use when a React component needs to update a writable atom without rendering
171
+ * from that atom's value.
172
+ *
173
+ * **Details**
174
+ *
175
+ * The hook mounts the atom and returns a setter. In value mode the setter
176
+ * accepts a write value or updater function; for `AsyncResult` atoms, `promise`
177
+ * and `promiseExit` modes return a promise for the success value or full `Exit`.
178
+ *
179
+ * @see {@link useAtom} for reading and updating the same writable atom
180
+ *
104
181
  * @category hooks
182
+ * @since 4.0.0
105
183
  */
106
184
  export const useAtomSet = (atom, options) => {
107
185
  const registry = React.useContext(RegistryContext);
@@ -109,8 +187,23 @@ export const useAtomSet = (atom, options) => {
109
187
  return setAtom(registry, atom, options);
110
188
  };
111
189
  /**
112
- * @since 1.0.0
190
+ * Mounts an atom and returns a callback that refreshes it in the current React
191
+ * registry.
192
+ *
193
+ * **When to use**
194
+ *
195
+ * Use to expose a React callback that requests a refresh for an atom without
196
+ * reading or writing its value.
197
+ *
198
+ * **Details**
199
+ *
200
+ * The hook uses the current `RegistryContext`, mounts the atom for the
201
+ * component lifetime, and returns a callback that calls `registry.refresh`.
202
+ *
203
+ * @see {@link useAtomMount} for mounting an atom without returning a refresh callback
204
+ *
113
205
  * @category hooks
206
+ * @since 4.0.0
114
207
  */
115
208
  export const useAtomRefresh = atom => {
116
209
  const registry = React.useContext(RegistryContext);
@@ -120,8 +213,19 @@ export const useAtomRefresh = atom => {
120
213
  }, [registry, atom]);
121
214
  };
122
215
  /**
123
- * @since 1.0.0
216
+ * Subscribes to a writable atom and returns its current value together with a
217
+ * setter for updating it.
218
+ *
219
+ * **When to use**
220
+ *
221
+ * Use when a React component needs both to render the current value of a
222
+ * writable atom and update it from the same component.
223
+ *
224
+ * @see {@link useAtomValue} for subscribing to an atom without a setter
225
+ * @see {@link useAtomSet} for updating a writable atom without subscribing to its value
226
+ *
124
227
  * @category hooks
228
+ * @since 4.0.0
125
229
  */
126
230
  export const useAtom = (atom, options) => {
127
231
  const registry = React.useContext(RegistryContext);
@@ -158,8 +262,28 @@ function atomResultOrSuspend(registry, atom, suspendOnWaiting) {
158
262
  return value;
159
263
  }
160
264
  /**
161
- * @since 1.0.0
265
+ * Reads an `AsyncResult` atom through React Suspense, suspending while the
266
+ * result is initial or configured as waiting.
267
+ *
268
+ * **When to use**
269
+ *
270
+ * Use when a React component should render only after an `AsyncResult` atom has
271
+ * left its initial state, with loading delegated to a Suspense boundary.
272
+ *
273
+ * **Details**
274
+ *
275
+ * `suspendOnWaiting` defaults to `false`. When `includeFailure` is `true`, a
276
+ * failure result is returned instead of being thrown.
277
+ *
278
+ * **Gotchas**
279
+ *
280
+ * Without `includeFailure`, failure results are thrown with
281
+ * `Cause.squash(result.cause)`, so callers need an error boundary for failures.
282
+ *
283
+ * @see {@link useAtomValue} for reading the raw `AsyncResult` value without Suspense
284
+ *
162
285
  * @category hooks
286
+ * @since 4.0.0
163
287
  */
164
288
  export const useAtomSuspense = (atom, options) => {
165
289
  const registry = React.useContext(RegistryContext);
@@ -170,16 +294,47 @@ export const useAtomSuspense = (atom, options) => {
170
294
  return result;
171
295
  };
172
296
  /**
173
- * @since 1.0.0
297
+ * Subscribes a callback to an atom in the current React registry for the
298
+ * component lifetime.
299
+ *
300
+ * **When to use**
301
+ *
302
+ * Use when a React component needs to run a callback for atom changes without
303
+ * reading the atom value during render.
304
+ *
305
+ * **Details**
306
+ *
307
+ * The subscription is installed in a React effect and cleaned up on unmount or
308
+ * dependency change. When `options.immediate` is enabled, the callback receives
309
+ * the current value when the effect subscribes.
310
+ *
311
+ * @see {@link useAtomValue} for reading an atom value during render instead of running a callback
312
+ *
174
313
  * @category hooks
314
+ * @since 4.0.0
175
315
  */
176
316
  export const useAtomSubscribe = (atom, f, options) => {
177
317
  const registry = React.useContext(RegistryContext);
178
318
  React.useEffect(() => registry.subscribe(atom, f, options), [registry, atom, f, options?.immediate]);
179
319
  };
180
320
  /**
181
- * @since 1.0.0
321
+ * Subscribes to an atom ref and returns its latest value.
322
+ *
323
+ * **When to use**
324
+ *
325
+ * Use when a React component should render from an `AtomRef.ReadonlyRef`
326
+ * directly instead of reading an atom through the current registry.
327
+ *
328
+ * **Details**
329
+ *
330
+ * The hook subscribes with `ref.subscribe`, triggers re-renders through React
331
+ * state, and returns the current `ref.value`.
332
+ *
333
+ * @see {@link useAtomValue} for reading an `Atom` from the current registry
334
+ * @see {@link useAtomRefPropValue} for reading a property ref value
335
+ *
182
336
  * @category hooks
337
+ * @since 4.0.0
183
338
  */
184
339
  export const useAtomRef = ref => {
185
340
  const [, setValue] = React.useState(ref.value);
@@ -187,13 +342,45 @@ export const useAtomRef = ref => {
187
342
  return ref.value;
188
343
  };
189
344
  /**
190
- * @since 1.0.0
345
+ * Returns a memoized atom ref for a property of another atom ref.
346
+ *
347
+ * **When to use**
348
+ *
349
+ * Use to derive an `AtomRef` for one property of an object-shaped atom ref.
350
+ *
351
+ * **Details**
352
+ *
353
+ * The hook memoizes `ref.prop(prop)` for the `[ref, prop]` dependency pair and
354
+ * returns the property ref so callers can read, set, update, or subscribe to
355
+ * that nested property.
356
+ *
357
+ * @see {@link useAtomRef} for subscribing to an atom ref value
358
+ * @see {@link useAtomRefPropValue} for subscribing directly to a property value
359
+ *
191
360
  * @category hooks
361
+ * @since 4.0.0
192
362
  */
193
363
  export const useAtomRefProp = (ref, prop) => React.useMemo(() => ref.prop(prop), [ref, prop]);
194
364
  /**
195
- * @since 1.0.0
365
+ * Subscribes to a property ref derived from an atom ref and returns its current
366
+ * value.
367
+ *
368
+ * **When to use**
369
+ *
370
+ * Use when a React component needs only the current value of one property from
371
+ * an object-shaped `AtomRef`.
372
+ *
373
+ * **Details**
374
+ *
375
+ * The hook composes `useAtomRefProp(ref, prop)` with `useAtomRef`, so the
376
+ * property ref is memoized for the `[ref, prop]` pair and then subscribed
377
+ * through `ref.subscribe`.
378
+ *
379
+ * @see {@link useAtomRefProp} for returning the property ref directly
380
+ * @see {@link useAtomRef} for subscribing to a whole atom ref value
381
+ *
196
382
  * @category hooks
383
+ * @since 4.0.0
197
384
  */
198
385
  export const useAtomRefPropValue = (ref, prop) => useAtomRef(useAtomRefProp(ref, prop));
199
386
  //# sourceMappingURL=Hooks.js.map
package/dist/Hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Hooks.js","names":["Cause","Effect","Exit","Atom","AtomRegistry","React","RegistryContext","storeRegistry","WeakMap","makeStore","registry","atom","stores","get","undefined","set","store","newStore","subscribe","f","snapshot","getServerSnapshot","getServerValue","useStore","useSyncExternalStore","initialValuesSet","useAtomInitialValues","initialValues","useContext","WeakSet","value","has","add","ensureNode","setValue","useAtomValue","atomB","useMemo","map","mountAtom","useEffect","mount","setAtom","options","mode","useCallback","promise","runPromiseExit","getResult","suspendOnWaiting","then","flattenExit","exit","isSuccess","squash","cause","useAtomMount","useAtomSet","useAtomRefresh","refresh","useAtom","atomPromiseMap","Map","default","atomToPromise","Promise","resolve","dispose","result","_tag","waiting","setTimeout","delete","atomResultOrSuspend","useAtomSuspense","includeFailure","useAtomSubscribe","immediate","useAtomRef","ref","useState","useAtomRefProp","prop","useAtomRefPropValue"],"sources":["../src/Hooks.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AAEnC,OAAO,KAAKC,IAAI,MAAM,iCAAiC;AAEvD,OAAO,KAAKC,YAAY,MAAM,yCAAyC;AACvE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,sBAAsB;AAQtD,MAAMC,aAAa,gBAAG,IAAIC,OAAO,EAAsE;AAEvG,SAASC,SAASA,CAAIC,QAAmC,EAAEC,IAAkB;EAC3E,IAAIC,MAAM,GAAGL,aAAa,CAACM,GAAG,CAACH,QAAQ,CAAC;EACxC,IAAIE,MAAM,KAAKE,SAAS,EAAE;IACxBF,MAAM,GAAG,IAAIJ,OAAO,EAAE;IACtBD,aAAa,CAACQ,GAAG,CAACL,QAAQ,EAAEE,MAAM,CAAC;EACrC;EACA,MAAMI,KAAK,GAAGJ,MAAM,CAACC,GAAG,CAACF,IAAI,CAAC;EAC9B,IAAIK,KAAK,KAAKF,SAAS,EAAE;IACvB,OAAOE,KAAK;EACd;EACA,MAAMC,QAAQ,GAAiB;IAC7BC,SAASA,CAACC,CAAC;MACT,OAAOT,QAAQ,CAACQ,SAAS,CAACP,IAAI,EAAEQ,CAAC,CAAC;IACpC,CAAC;IACDC,QAAQA,CAAA;MACN,OAAOV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,MAAMuC,GAAG,CAAC7D,SAAS,CAACgB,QAAQ,CAAC,EAAE,CAAC6C,GAAG,CAAC,CAAC;EACrD,OAAOA,GAAG,CAACjD,KAAK;AAClB,CAAC;AAED;;;;AAIA,OAAO,MAAMmD,cAAc,GAAGA,CAAuBF,GAAuB,EAAEG,IAAO,KACnF7E,KAAK,CAACgC,OAAO,CAAC,MAAM0C,GAAG,CAACG,IAAI,CAACA,IAAI,CAAC,EAAE,CAACH,GAAG,EAAEG,IAAI,CAAC,CAAC;AAElD;;;;AAIA,OAAO,MAAMC,mBAAmB,GAAGA,CAAuBJ,GAAuB,EAAEG,IAAO,KACxFJ,UAAU,CAACG,cAAc,CAACF,GAAG,EAAEG,IAAI,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Hooks.js","names":["Cause","Effect","Exit","Atom","AtomRegistry","React","RegistryContext","storeRegistry","WeakMap","makeStore","registry","atom","stores","get","undefined","set","store","newStore","subscribe","f","snapshot","getServerSnapshot","getServerValue","useStore","useSyncExternalStore","initialValuesSet","useAtomInitialValues","initialValues","useContext","WeakSet","value","has","add","ensureNode","setValue","useAtomValue","atomB","useMemo","map","mountAtom","useEffect","mount","setAtom","options","mode","useCallback","promise","runPromiseExit","getResult","suspendOnWaiting","then","flattenExit","exit","isSuccess","squash","cause","useAtomMount","useAtomSet","useAtomRefresh","refresh","useAtom","atomPromiseMap","Map","default","atomToPromise","Promise","resolve","dispose","result","_tag","waiting","setTimeout","delete","atomResultOrSuspend","useAtomSuspense","includeFailure","useAtomSubscribe","immediate","useAtomRef","ref","useState","useAtomRefProp","prop","useAtomRefPropValue"],"sources":["../src/Hooks.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,IAAI,MAAM,aAAa;AAEnC,OAAO,KAAKC,IAAI,MA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AElD;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,mBAAmB,GAAGA,CAAuBJ,GAAuB,EAAEG,IAAO,KACxFJ,UAAU,CAACG,cAAc,CAACF,GAAG,EAAEG,IAAI,CAAC,CAAC","ignoreList":[]}
@@ -1,16 +1,36 @@
1
1
  import * as Hydration from "effect/unstable/reactivity/Hydration";
2
2
  import * as React from "react";
3
3
  /**
4
- * @since 1.0.0
4
+ * Props for a boundary that applies dehydrated Atom values to the nearest
5
+ * {@link RegistryContext} while rendering its children.
6
+ *
5
7
  * @category components
8
+ * @since 4.0.0
6
9
  */
7
10
  export interface HydrationBoundaryProps {
8
11
  state?: Iterable<Hydration.DehydratedAtom>;
9
12
  children?: React.ReactNode;
10
13
  }
11
14
  /**
12
- * @since 1.0.0
15
+ * Hydrates dehydrated Atom values into the current Atom registry for a React
16
+ * subtree.
17
+ *
18
+ * **When to use**
19
+ *
20
+ * Use to apply dehydrated Atom state to a React subtree that reads from the
21
+ * nearest `RegistryContext`.
22
+ *
23
+ * **Details**
24
+ *
25
+ * New Atom values are hydrated during render so descendants can read them
26
+ * immediately, while values for existing Atoms are deferred until after commit
27
+ * so transition data does not update the current UI before React accepts it.
28
+ *
29
+ * @see {@link Hydration.dehydrate} for producing dehydrated Atom state
30
+ * @see {@link Hydration.hydrate} for lower-level non-React hydration
31
+ *
13
32
  * @category components
33
+ * @since 4.0.0
14
34
  */
15
35
  export declare const HydrationBoundary: React.FC<HydrationBoundaryProps>;
16
36
  //# sourceMappingURL=ReactHydration.d.ts.map