@kdeveloper/kvark 0.18.0 → 1.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 +98 -10
- package/dist/family.d.ts +5 -2
- package/dist/family.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/preact/index.d.ts +1 -1
- package/dist/preact/index.js +2 -28
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -28
- package/dist/react/index.js.map +1 -1
- package/dist/{store-CTGJpxoI.js → store-DeTRbkBP.js} +174 -14
- package/dist/store-DeTRbkBP.js.map +1 -0
- package/dist/{types-DOyqUVX8.d.ts → types-CV8Xn30e.d.ts} +70 -6
- package/dist/use-atom-value-BhGvD9Vf.js +35 -0
- package/dist/use-atom-value-BhGvD9Vf.js.map +1 -0
- package/dist/vue/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/store-CTGJpxoI.js.map +0 -1
package/README.md
CHANGED
|
@@ -247,6 +247,51 @@ const doubleAtom = atom({
|
|
|
247
247
|
});
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
+
#### Streaming reads
|
|
251
|
+
|
|
252
|
+
For APIs that deliver line-by-line or chunked responses, use `stream` instead of `read`.
|
|
253
|
+
The stream must return an `AsyncIterable`; Kvark does not parse `Response.body` itself, so
|
|
254
|
+
your app stays in control of decoding and splitting bytes into domain chunks.
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
import { atom } from "@kdeveloper/kvark";
|
|
258
|
+
|
|
259
|
+
async function* lines(response: Response): AsyncGenerator<string> {
|
|
260
|
+
const reader = response.body?.pipeThrough(new TextDecoderStream()).getReader();
|
|
261
|
+
if (reader == null) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
let buffer = "";
|
|
266
|
+
while (true) {
|
|
267
|
+
const { done, value } = await reader.read();
|
|
268
|
+
if (done) {
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
buffer += value;
|
|
272
|
+
const parts = buffer.split("\n");
|
|
273
|
+
buffer = parts.pop() ?? "";
|
|
274
|
+
yield* parts;
|
|
275
|
+
}
|
|
276
|
+
if (buffer !== "") {
|
|
277
|
+
yield buffer;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const logAtom = atom({
|
|
282
|
+
initialValue: [] as string[],
|
|
283
|
+
stream: async (ctx) => {
|
|
284
|
+
const response = await fetch("/api/logs", { signal: ctx.signal });
|
|
285
|
+
return lines(response);
|
|
286
|
+
},
|
|
287
|
+
reduce: (prev, line) => [...prev, line],
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Each yielded chunk is folded into a new full atom value with `reduce`, and subscribers
|
|
292
|
+
see those intermediate values immediately. `store.read(logAtom)` still resolves only
|
|
293
|
+
after the stream closes, with the final accumulated value.
|
|
294
|
+
|
|
250
295
|
#### Simple primitive atom (`atom(initialValue)`)
|
|
251
296
|
|
|
252
297
|
For purely client-side state — counters, toggles, draft fields — there is a shorthand: pass an initial value directly. The result is a `WritableAtom` whose apply function accepts either the next value or an updater function `(prev) => next`. Both `store.apply(atom, value)` and `store.write(atom, value)` are supported: `apply` runs the atom's `write` callback, while `write` pushes straight into the cache. React/Preact/Vue hooks (`useAtomValue`, `useApplyAtom`, `useAtom`) work as usual.
|
|
@@ -452,11 +497,11 @@ const runAddItem = useMutation(addItem);
|
|
|
452
497
|
|
|
453
498
|
Both can update an atom's cached value, but they serve different purposes:
|
|
454
499
|
|
|
455
|
-
| | `write`
|
|
456
|
-
| ---------------- |
|
|
457
|
-
| **Triggered by** | Explicit call (`store.apply`, `useApplyAtom`)
|
|
458
|
-
| **After update** | `invalidate` → refetch via `read`
|
|
459
|
-
| **Use case** | Mutations, API calls, optimistic updates
|
|
500
|
+
| | `write` | `onMount` |
|
|
501
|
+
| ---------------- | --------------------------------------------- | -------------------------------------- |
|
|
502
|
+
| **Triggered by** | Explicit call (`store.apply`, `useApplyAtom`) | First subscriber mounts |
|
|
503
|
+
| **After update** | `invalidate` → refetch via `read` | No refetch — value stays as-is |
|
|
504
|
+
| **Use case** | Mutations, API calls, optimistic updates | Timers, subscriptions, imperative push |
|
|
460
505
|
|
|
461
506
|
### `onMount`
|
|
462
507
|
|
|
@@ -581,8 +626,16 @@ postFamily.invalidate(42);
|
|
|
581
626
|
|
|
582
627
|
// Invalidate everything (e.g. on logout)
|
|
583
628
|
postFamily.invalidateAll();
|
|
629
|
+
|
|
630
|
+
// Cache helpers
|
|
631
|
+
postFamily.has(42);
|
|
632
|
+
postFamily.peek(42); // Atom<Post> | undefined, does not create a member
|
|
633
|
+
postFamily.remove(42);
|
|
634
|
+
postFamily.clear();
|
|
584
635
|
```
|
|
585
636
|
|
|
637
|
+
`atomFamily` and `infinityAtomFamily` expose the same cache helper shape: `has(param)`, `peek(param)`, `remove(param)`, `clear()`, and `getCache()`. `peek`/`has` inspect the current cache without creating a new atom; calling the family itself still creates or touches the member and updates LRU order.
|
|
638
|
+
|
|
586
639
|
### `atomFamily` as a dependency
|
|
587
640
|
|
|
588
641
|
A `dependencies` entry can be either a regular `Atom` or an `atomFamily`. When the entry is a family, supply the param at the call site as the **second positional argument** to `ctx.read`. Each unique param maps to its own family member; reverse-dependency edges are wired up automatically, so invalidating any read member (or the whole family) propagates `stale` to the consumer.
|
|
@@ -609,8 +662,8 @@ userFamily.invalidate(7); // marks profileAtom stale
|
|
|
609
662
|
|
|
610
663
|
The signature of `ctx.read` is keyed on the dependency entry:
|
|
611
664
|
|
|
612
|
-
| Entry | Call form
|
|
613
|
-
| ------------ |
|
|
665
|
+
| Entry | Call form | Compile-time errors |
|
|
666
|
+
| ------------ | ---------------------- | ---------------------------------------------------- |
|
|
614
667
|
| `Atom<V>` | `ctx.read(key)` | passing a second arg → error |
|
|
615
668
|
| `atomFamily` | `ctx.read(key, param)` | omitting `param` → error; wrong `param` type → error |
|
|
616
669
|
|
|
@@ -980,6 +1033,20 @@ const unsub = client.subscribe(userAtom, (state) => {
|
|
|
980
1033
|
});
|
|
981
1034
|
```
|
|
982
1035
|
|
|
1036
|
+
`client.observe(atom, listener)` is an explicit alias for state-bearing external subscriptions. `client.subscribe` remains available for compatibility and has the same state-bearing callback shape on `StoreClient`.
|
|
1037
|
+
|
|
1038
|
+
### Cache-first reads
|
|
1039
|
+
|
|
1040
|
+
Use `read(atom)` when you want Kvark's normal async read semantics. For imperative code that prefers cached data when available, use:
|
|
1041
|
+
|
|
1042
|
+
```ts
|
|
1043
|
+
const state = client.get(userAtom); // AtomState<User>, sync
|
|
1044
|
+
const cached = client.peek(userAtom); // User | undefined, sync
|
|
1045
|
+
const user = await client.ensure(userAtom); // cached fresh/stale value, otherwise read()
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
`get(atom)` mirrors `getSnapshot(atom)`. `peek(atom)` returns the current cached value from `fresh`, `stale`, or retained `error` states without starting a read. `ensure(atom)` resolves immediately for cached `fresh`/`stale` values, or for an `error` state that retained a non-`undefined` value; otherwise it delegates to `read(atom)`.
|
|
1049
|
+
|
|
983
1050
|
### Direct Write
|
|
984
1051
|
|
|
985
1052
|
When the server pushes a complete, authoritative value (e.g. via WebSocket or SSE), use `store.write` / `client.write` to store it directly — no refetch through `read` is triggered, and the atom's `write` callback is not invoked. Any in-flight `read` for the atom is aborted, and derived atoms that depend on it are marked `stale` so they re-compute.
|
|
@@ -1003,22 +1070,43 @@ client.write(counterAtom, (prev) => (prev ?? 0) + 1);
|
|
|
1003
1070
|
|
|
1004
1071
|
`write` works on any `Atom<V>` — the atom does not need a `write` config. This makes it the right tool when you already have the final value and want to skip a redundant network round-trip. Use `apply` when you want to run the atom's async `write` callback instead.
|
|
1005
1072
|
|
|
1073
|
+
`set(atom, value | mutator)` is an alias for `write(atom, ...)`; `run(atom, ...args)` is an alias for `apply(atom, ...args)`; `runMutation(m, ...args)` is an alias for `mutate(m, ...args)`.
|
|
1074
|
+
|
|
1075
|
+
### Inspect and dispose
|
|
1076
|
+
|
|
1077
|
+
For devtools and diagnostics, `inspect(atom)` returns lightweight metadata: label, current status, dependency counts, listener count, mount count, and whether a read promise is in flight.
|
|
1078
|
+
|
|
1079
|
+
Call `dispose()` when a store is scoped to a request, test, or worker lifetime. It aborts in-flight reads, calls active `onMount` cleanups, clears listeners, and unregisters family invalidation hooks. After disposal, store methods throw `Store has been disposed`; calling `dispose()` again is a no-op.
|
|
1080
|
+
|
|
1006
1081
|
### `StoreClient` interface
|
|
1007
1082
|
|
|
1008
1083
|
The concrete `Store` class exposes the same surface as `getClient()` — e.g. `store.read(atom)` / `client.read(atom)`, `store.apply(atom, ...args)` / `client.apply(atom, ...args)`, and `store.mutate(m, ...args)` / `client.mutate(m, ...args)`.
|
|
1009
1084
|
|
|
1010
1085
|
```ts
|
|
1011
|
-
import type { Atom, WritableAtom, AtomState, Mutation } from "@kdeveloper/kvark";
|
|
1086
|
+
import type { Atom, WritableAtom, AtomState, Mutation, StoreInspection } from "@kdeveloper/kvark";
|
|
1012
1087
|
|
|
1013
1088
|
interface StoreClient {
|
|
1089
|
+
get<V>(atom: Atom<V>): AtomState<V>;
|
|
1090
|
+
peek<V>(atom: Atom<V>): V | undefined;
|
|
1091
|
+
ensure<V>(atom: Atom<V>): Promise<V>;
|
|
1014
1092
|
read<V>(atom: Atom<V>): Promise<V>;
|
|
1093
|
+
run<V, A extends readonly unknown[]>(atom: WritableAtom<V, A>, ...args: A): Promise<void>;
|
|
1015
1094
|
apply<V, A extends readonly unknown[]>(atom: WritableAtom<V, A>, ...args: A): Promise<void>;
|
|
1095
|
+
runMutation<Args extends readonly unknown[]>(
|
|
1096
|
+
mutation: Mutation<Args>,
|
|
1097
|
+
...args: Args
|
|
1098
|
+
): Promise<void>;
|
|
1016
1099
|
mutate<Args extends readonly unknown[]>(mutation: Mutation<Args>, ...args: Args): Promise<void>;
|
|
1100
|
+
set<V>(atom: Atom<V>, value: V): void;
|
|
1101
|
+
set<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
1017
1102
|
write<V>(atom: Atom<V>, value: V): void;
|
|
1018
1103
|
write<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
1019
1104
|
invalidate(atom: Atom<unknown>): void;
|
|
1020
1105
|
invalidateMany(atoms: ReadonlyArray<Atom<unknown>>): void;
|
|
1106
|
+
observe<V>(atom: Atom<V>, listener: (state: AtomState<V>) => void): () => void;
|
|
1021
1107
|
subscribe<V>(atom: Atom<V>, listener: (state: AtomState<V>) => void): () => void;
|
|
1108
|
+
inspect(atom: Atom<unknown>): StoreInspection;
|
|
1109
|
+
dispose(): void;
|
|
1022
1110
|
}
|
|
1023
1111
|
```
|
|
1024
1112
|
|
|
@@ -1077,10 +1165,10 @@ type Writable = IsWritable<typeof countAtom>; // → true | false
|
|
|
1077
1165
|
|
|
1078
1166
|
| Import | Contents |
|
|
1079
1167
|
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1080
|
-
| `@kdeveloper/kvark` | `atom`, `infinityAtom`, `infinityAtomFamily`, `mutation`, `createStore`, all types (including `Mutation`, `MutationContext`)
|
|
1168
|
+
| `@kdeveloper/kvark` | `atom`, `infinityAtom`, `infinityAtomFamily`, `mutation`, `createStore`, all types (including `Store`, `StoreClient`, `StoreInspection`, `Mutation`, `MutationContext`) |
|
|
1081
1169
|
| `@kdeveloper/kvark/react` | `Provider`, `useStore`, `useAtomValue`, `useApplyAtom`, `useMutation`, `useAtom`, `useAtomContext` |
|
|
1082
1170
|
| `@kdeveloper/kvark/preact` | `Provider`, `useStore`, `useAtomValue`, `useApplyAtom`, `useMutation`, `useAtom`, `useAtomContext` |
|
|
1083
|
-
| `@kdeveloper/kvark/vue` | `Provider`, `useStore`, `useAtomValue`, `useApplyAtom`, `useMutation`, `useAtom`, `useAtomContext`; types `ThenableShallowRef`, `ThenableObservedShallowRef`, `ObservedValue`
|
|
1171
|
+
| `@kdeveloper/kvark/vue` | `Provider`, `useStore`, `useAtomValue`, `useApplyAtom`, `useMutation`, `useAtom`, `useAtomContext`; types `ThenableShallowRef`, `ThenableObservedShallowRef`, `ObservedValue` |
|
|
1084
1172
|
| `@kdeveloper/kvark/family` | `atomFamily`, `infinityAtomFamily`, `stableFamilyKey`, `microtaskScheduler`, `windowScheduler`, `maxBatchSizeScheduler`, `windowedFiniteBatchScheduler`, re-exports `atom`, `infinityAtom`, `mutation`, `createStore`; types include `AtomFamily`, `InfinityAtomFamily`, `BatchScheduler`, `BatchFetchInput`, `Mutation`, `MutationContext`, and core atom types |
|
|
1085
1173
|
|
|
1086
1174
|
The core (`@kdeveloper/kvark`) has **zero runtime dependencies**. **React**, **Preact**, and **Vue** are optional peer dependencies — install the framework you use and import from `/react`, `/preact`, or `/vue`.
|
package/dist/family.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as InfinityAtomOptions, C as Mutation, D as InfinityFamilyAtom, E as InfinityAtomFamilyOptions, O as infinityAtomFamily, P as atom, S as createStore, T as InfinityAtomFamily, _ as RegisteredContext, a as AtomState, b as StoreInspection, d as RetryDelay, f as StalePolicy, g as Register, h as WritableAtomContext, i as AtomContext, j as infinityAtom, k as InfiniteData, l as MutationContext, m as WritableAtom, o as AtomValue, r as AtomConfig, s as DependencyEntry, t as Atom, v as Store, w as mutation, x as StoreOptions, y as StoreClient } from "./types-CV8Xn30e.js";
|
|
2
2
|
|
|
3
3
|
//#region src/internal/family-batch-schedulers.d.ts
|
|
4
4
|
type BatchSchedulerContext = {
|
|
@@ -74,7 +74,10 @@ interface AtomFamily<Param, Value, Key = Param> {
|
|
|
74
74
|
(param: Param): Atom<Value>;
|
|
75
75
|
invalidate(param: Param): void;
|
|
76
76
|
invalidateAll(): void;
|
|
77
|
+
has(param: Param): boolean;
|
|
78
|
+
peek(param: Param): Atom<Value> | undefined;
|
|
77
79
|
remove(param: Param): void;
|
|
80
|
+
clear(): void;
|
|
78
81
|
getCache(): ReadonlyMap<Key, Atom<Value>>;
|
|
79
82
|
}
|
|
80
83
|
declare function atomFamily<Param, Value, Deps extends Record<string, DependencyEntry> = Record<never, never>, Args extends readonly unknown[] = readonly [], Key = Param>(options: AtomFamilyOptions<Param, Value, Deps, Args, Key>): AtomFamily<Param, Value, Key>;
|
|
@@ -93,5 +96,5 @@ declare function atomFamily<Param, Value, Deps extends Record<string, Dependency
|
|
|
93
96
|
*/
|
|
94
97
|
declare function stableFamilyKey(value: unknown): string;
|
|
95
98
|
//#endregion
|
|
96
|
-
export { type Atom, type AtomConfig, type AtomContext, type AtomFamily, type AtomFamilyBatchOptions, type AtomFamilyGetOptions, type AtomFamilyOptions, type AtomState, type AtomValue, type BatchFetchInput, type BatchScheduler, type BatchSchedulerContext, type InfiniteData, type InfinityAtomFamily, type InfinityAtomFamilyOptions, type InfinityAtomOptions, type InfinityFamilyAtom, type Mutation, type MutationContext, type Register, type RegisteredContext, type StalePolicy, type WritableAtom, atom, atomFamily, createStore, infinityAtom, infinityAtomFamily, maxBatchSizeScheduler, microtaskScheduler, mutation, stableFamilyKey, windowScheduler, windowedFiniteBatchScheduler };
|
|
99
|
+
export { type Atom, type AtomConfig, type AtomContext, type AtomFamily, type AtomFamilyBatchOptions, type AtomFamilyGetOptions, type AtomFamilyOptions, type AtomState, type AtomValue, type BatchFetchInput, type BatchScheduler, type BatchSchedulerContext, type InfiniteData, type InfinityAtomFamily, type InfinityAtomFamilyOptions, type InfinityAtomOptions, type InfinityFamilyAtom, type Mutation, type MutationContext, type Register, type RegisteredContext, type StalePolicy, type Store, type StoreClient, type StoreInspection, type StoreOptions, type WritableAtom, atom, atomFamily, createStore, infinityAtom, infinityAtomFamily, maxBatchSizeScheduler, microtaskScheduler, mutation, stableFamilyKey, windowScheduler, windowedFiniteBatchScheduler };
|
|
97
100
|
//# sourceMappingURL=family.d.ts.map
|
package/dist/family.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as microtaskScheduler, c as infinityAtomFamily, i as maxBatchSizeScheduler, l as infinityAtom, n as mutation, o as windowScheduler, r as atomFamily, s as windowedFiniteBatchScheduler, t as createStore, u as atom } from "./store-
|
|
1
|
+
import { a as microtaskScheduler, c as infinityAtomFamily, i as maxBatchSizeScheduler, l as infinityAtom, n as mutation, o as windowScheduler, r as atomFamily, s as windowedFiniteBatchScheduler, t as createStore, u as atom } from "./store-DeTRbkBP.js";
|
|
2
2
|
//#region src/internal/stable-family-key.ts
|
|
3
3
|
/**
|
|
4
4
|
* Produces a deterministic string key for plain-object/array/primitive values.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { Atom, AtomArgs, AtomConfig, AtomContext, AtomState, AtomValue, InfiniteData, InfinityAtomFamily, InfinityAtomFamilyOptions, InfinityAtomOptions, InfinityFamilyAtom, IsWritable, Mutation, MutationContext, Register, RegisteredContext, RetryDelay, SimpleAtomOptions, SimpleAtomWriteArg, StalePolicy, StoreClient, WritableAtom, WritableAtomContext, atom, createStore, infinityAtom, infinityAtomFamily, mutation };
|
|
1
|
+
import { A as InfinityAtomOptions, C as Mutation, D as InfinityFamilyAtom, E as InfinityAtomFamilyOptions, M as SimpleAtomOptions, N as SimpleAtomWriteArg, O as infinityAtomFamily, P as atom, S as createStore, T as InfinityAtomFamily, _ as RegisteredContext, a as AtomState, b as StoreInspection, c as IsWritable, d as RetryDelay, f as StalePolicy, g as Register, h as WritableAtomContext, i as AtomContext, j as infinityAtom, k as InfiniteData, l as MutationContext, m as WritableAtom, n as AtomArgs, o as AtomValue, p as StreamAtomConfig, r as AtomConfig, t as Atom, u as ReadAtomConfig, v as Store, w as mutation, x as StoreOptions, y as StoreClient } from "./types-CV8Xn30e.js";
|
|
2
|
+
export { Atom, AtomArgs, AtomConfig, AtomContext, AtomState, AtomValue, InfiniteData, InfinityAtomFamily, InfinityAtomFamilyOptions, InfinityAtomOptions, InfinityFamilyAtom, IsWritable, Mutation, MutationContext, ReadAtomConfig, Register, RegisteredContext, RetryDelay, SimpleAtomOptions, SimpleAtomWriteArg, StalePolicy, Store, StoreClient, StoreInspection, StoreOptions, StreamAtomConfig, WritableAtom, WritableAtomContext, atom, createStore, infinityAtom, infinityAtomFamily, mutation };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as infinityAtomFamily, l as infinityAtom, n as mutation, t as createStore, u as atom } from "./store-
|
|
1
|
+
import { c as infinityAtomFamily, l as infinityAtom, n as mutation, t as createStore, u as atom } from "./store-DeTRbkBP.js";
|
|
2
2
|
export { atom, createStore, infinityAtom, infinityAtomFamily, mutation };
|
package/dist/preact/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Mutation, m as WritableAtom, t as Atom, v as Store, y as StoreClient } from "../types-CV8Xn30e.js";
|
|
2
2
|
import { ComponentChildren, VNode } from "preact";
|
|
3
3
|
|
|
4
4
|
//#region src/preact/provider.d.ts
|
package/dist/preact/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as getAtomValueResult } from "../use-atom-value-BhGvD9Vf.js";
|
|
2
2
|
import { createContext } from "preact";
|
|
3
3
|
import { useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
|
4
4
|
import { jsx } from "preact/jsx-runtime";
|
|
@@ -63,33 +63,7 @@ function useAtomValue(atom, opts) {
|
|
|
63
63
|
const initialRenderRef = useRef(true);
|
|
64
64
|
const isInitialRender = initialRenderRef.current;
|
|
65
65
|
initialRenderRef.current = false;
|
|
66
|
-
|
|
67
|
-
if (snapshot.status === "pending") throw store.read(atom);
|
|
68
|
-
if (snapshot.status === "stale") {
|
|
69
|
-
if (stalePolicy === "suspend") throw store.read(atom);
|
|
70
|
-
store.read(atom);
|
|
71
|
-
if (opts?.observe === true) return {
|
|
72
|
-
value: snapshot.value,
|
|
73
|
-
isStale: true,
|
|
74
|
-
error: void 0
|
|
75
|
-
};
|
|
76
|
-
return snapshot.value;
|
|
77
|
-
}
|
|
78
|
-
if (snapshot.status === "error") {
|
|
79
|
-
if (opts?.observe === true && snapshot.value !== void 0) return {
|
|
80
|
-
value: snapshot.value,
|
|
81
|
-
isStale: false,
|
|
82
|
-
error: snapshot.error
|
|
83
|
-
};
|
|
84
|
-
if (isInitialRender) store.read(atom);
|
|
85
|
-
throw snapshot.error;
|
|
86
|
-
}
|
|
87
|
-
if (opts?.observe === true) return {
|
|
88
|
-
value: snapshot.value,
|
|
89
|
-
isStale: false,
|
|
90
|
-
error: void 0
|
|
91
|
-
};
|
|
92
|
-
return snapshot.value;
|
|
66
|
+
return getAtomValueResult(store, atom, snapshot, opts?.observe === true, isInitialRender);
|
|
93
67
|
}
|
|
94
68
|
//#endregion
|
|
95
69
|
//#region src/preact/use-apply-atom.ts
|
package/dist/preact/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/preact/provider.tsx","../../src/preact/use-sync-external-store.ts","../../src/preact/use-stable-fn.ts","../../src/preact/use-atom-value.ts","../../src/preact/use-apply-atom.ts","../../src/preact/use-mutation.ts","../../src/preact/use-atom.ts","../../src/preact/use-atom-context.ts"],"mappings":";;;;;;AAKA,MAAM,eAAe,cAA4B,KAAK;AAOtD,SAAgB,SAAS,EAAE,OAAO,YAAkC;CAClE,OAAO,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAQ;EAAiC,CAAA;;AAGhF,SAAgB,WAAkB;CAChC,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,SAAS,MACX,MAAM,IAAI,MAAM,4CAA4C;CAE9D,OAAO;;;;ACdT,SAAS,kBAAqB,MAAiC;CAC7D,IAAI;EACF,OAAO,CAAC,OAAO,GAAG,KAAK,QAAQ,KAAK,cAAc,CAAC;SAC7C;EACN,OAAO;;;AAIX,SAAgB,qBACd,WACA,aACG;CACH,MAAM,QAAQ,aAAa;CAE3B,MAAM,CAAC,EAAE,aAAa,eAAe,gBAAgB,EACnD,WAAW;EAAE,QAAQ;EAAO,cAAc;EAAa,EACxD,EAAE;CAEH,sBAAsB;EACpB,UAAU,SAAS;EACnB,UAAU,eAAe;EAEzB,IAAI,kBAAkB,UAAU,EAC9B,YAAY,EAAE,WAAW,CAAC;IAE3B;EAAC;EAAW;EAAO;EAAY,CAAC;CAEnC,gBAAgB;EACd,IAAI,kBAAkB,UAAU,EAC9B,YAAY,EAAE,WAAW,CAAC;EAG5B,OAAO,gBAAgB;GACrB,IAAI,kBAAkB,UAAU,EAC9B,YAAY,EAAE,WAAW,CAAC;IAE5B;IACD,CAAC,UAAU,CAAC;CAEf,OAAO;;;;AC5CT,SAAgB,YACd,IACsB;CACtB,MAAM,MAAM,OAAO,GAAG;CACtB,IAAI,UAAU;CAEd,OAAO,aAAa,GAAG,SAAe,IAAI,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC;;;;ACOjE,SAAgB,aAAgB,MAAe,MAAgD;CAC7F,MAAM,QAAQ,UAAU;CAKxB,MAAM,WAAyB,qBAHb,aAAa,WAAuB,MAAM,UAAU,MAAM,OAAO,CAGtB,EAFzC,kBAAkB,MAAM,YAAY,KAAK,CAEa,CAAC;CAK3E,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,kBAAkB,iBAAiB;CACzC,iBAAiB,UAAU;CAE3B,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/preact/provider.tsx","../../src/preact/use-sync-external-store.ts","../../src/preact/use-stable-fn.ts","../../src/preact/use-atom-value.ts","../../src/preact/use-apply-atom.ts","../../src/preact/use-mutation.ts","../../src/preact/use-atom.ts","../../src/preact/use-atom-context.ts"],"mappings":";;;;;;AAKA,MAAM,eAAe,cAA4B,KAAK;AAOtD,SAAgB,SAAS,EAAE,OAAO,YAAkC;CAClE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B,OAAO,MAAM,UAAU,MAAM,YAAY,MAAM,gBAAgB;;;;AC1B3F,SAAgB,aACd,MAC+B;CAC/B,MAAM,QAAQ,UAAU;CACxB,OAAO,aAAa,GAAG,SAA2B,MAAM,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC;;;;ACJ9F,SAAgB,YACd,UACkC;CAClC,MAAM,QAAQ,UAAU;CACxB,OAAO,aACJ,GAAG,SAA8B,MAAM,OAAO,UAAU,GAAG,KAAK,EACjE,CAAC,OAAO,SAAS,CAClB;;;;ACPH,SAAgB,QACd,MAC6C;CAG7C,OAAO,CAFO,aAAa,KAEd,EADE,aAAa,KACP,CAAC;;;;ACLxB,SAAgB,eAAkB,UAA8D;CAC9F,MAAM,QAAQ,UAAU;CACxB,OAAO,kBAA8B,SAAS,MAAM,WAAW,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Mutation, m as WritableAtom, t as Atom, v as Store, y as StoreClient } from "../types-CV8Xn30e.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/react/provider.d.ts
|
package/dist/react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as getAtomValueResult } from "../use-atom-value-BhGvD9Vf.js";
|
|
2
2
|
import { createContext, useCallback, useContext, useRef, useSyncExternalStore } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/react/provider.tsx
|
|
@@ -29,33 +29,7 @@ function useAtomValue(atom, opts) {
|
|
|
29
29
|
const initialRenderRef = useRef(true);
|
|
30
30
|
const isInitialRender = initialRenderRef.current;
|
|
31
31
|
initialRenderRef.current = false;
|
|
32
|
-
|
|
33
|
-
if (snapshot.status === "pending") throw store.read(atom);
|
|
34
|
-
if (snapshot.status === "stale") {
|
|
35
|
-
if (stalePolicy === "suspend") throw store.read(atom);
|
|
36
|
-
store.read(atom);
|
|
37
|
-
if (opts?.observe === true) return {
|
|
38
|
-
value: snapshot.value,
|
|
39
|
-
isStale: true,
|
|
40
|
-
error: void 0
|
|
41
|
-
};
|
|
42
|
-
return snapshot.value;
|
|
43
|
-
}
|
|
44
|
-
if (snapshot.status === "error") {
|
|
45
|
-
if (opts?.observe === true && snapshot.value !== void 0) return {
|
|
46
|
-
value: snapshot.value,
|
|
47
|
-
isStale: false,
|
|
48
|
-
error: snapshot.error
|
|
49
|
-
};
|
|
50
|
-
if (isInitialRender) store.read(atom);
|
|
51
|
-
throw snapshot.error;
|
|
52
|
-
}
|
|
53
|
-
if (opts?.observe === true) return {
|
|
54
|
-
value: snapshot.value,
|
|
55
|
-
isStale: false,
|
|
56
|
-
error: void 0
|
|
57
|
-
};
|
|
58
|
-
return snapshot.value;
|
|
32
|
+
return getAtomValueResult(store, atom, snapshot, opts?.observe === true, isInitialRender);
|
|
59
33
|
}
|
|
60
34
|
//#endregion
|
|
61
35
|
//#region src/react/use-apply-atom.ts
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/react/provider.tsx","../../src/react/use-stable-fn.ts","../../src/react/use-atom-value.ts","../../src/react/use-apply-atom.ts","../../src/react/use-mutation.ts","../../src/react/use-atom.ts","../../src/react/use-atom-context.ts"],"mappings":";;;;AAGA,MAAM,eAAe,cAA4B,KAAK;AAOtD,SAAgB,SAAS,EAAE,OAAO,YAAsC;CACtE,OAAO,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAQ;EAAiC,CAAA;;AAGhF,SAAgB,WAAkB;CAChC,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,SAAS,MACX,MAAM,IAAI,MAAM,4CAA4C;CAE9D,OAAO;;;;ACjBT,SAAgB,YACd,IACsB;CACtB,MAAM,MAAM,OAAO,GAAG;CACtB,IAAI,UAAU;CAEd,OAAO,aAAa,GAAG,SAAe,IAAI,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC;;;;ACMjE,SAAgB,aAAgB,MAAe,MAAgD;CAC7F,MAAM,QAAQ,UAAU;CAMxB,MAAM,WAAyB,qBAJb,aAAa,WAAuB,MAAM,UAAU,MAAM,OAAO,CAItB,EAHzC,kBAAkB,MAAM,YAAY,KAAK,CAGa,EAFhD,kBAAkB,MAAM,kBAAkB,KAAK,CAEoB,CAAC;CAK9F,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,kBAAkB,iBAAiB;CACzC,iBAAiB,UAAU;CAE3B,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/react/provider.tsx","../../src/react/use-stable-fn.ts","../../src/react/use-atom-value.ts","../../src/react/use-apply-atom.ts","../../src/react/use-mutation.ts","../../src/react/use-atom.ts","../../src/react/use-atom-context.ts"],"mappings":";;;;AAGA,MAAM,eAAe,cAA4B,KAAK;AAOtD,SAAgB,SAAS,EAAE,OAAO,YAAsC;CACtE,OAAO,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAQ;EAAiC,CAAA;;AAGhF,SAAgB,WAAkB;CAChC,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,SAAS,MACX,MAAM,IAAI,MAAM,4CAA4C;CAE9D,OAAO;;;;ACjBT,SAAgB,YACd,IACsB;CACtB,MAAM,MAAM,OAAO,GAAG;CACtB,IAAI,UAAU;CAEd,OAAO,aAAa,GAAG,SAAe,IAAI,QAAQ,GAAG,KAAK,EAAE,EAAE,CAAC;;;;ACMjE,SAAgB,aAAgB,MAAe,MAAgD;CAC7F,MAAM,QAAQ,UAAU;CAMxB,MAAM,WAAyB,qBAJb,aAAa,WAAuB,MAAM,UAAU,MAAM,OAAO,CAItB,EAHzC,kBAAkB,MAAM,YAAY,KAAK,CAGa,EAFhD,kBAAkB,MAAM,kBAAkB,KAAK,CAEoB,CAAC;CAK9F,MAAM,mBAAmB,OAAO,KAAK;CACrC,MAAM,kBAAkB,iBAAiB;CACzC,iBAAiB,UAAU;CAE3B,OAAO,mBAAmB,OAAO,MAAM,UAAU,MAAM,YAAY,MAAM,gBAAgB;;;;AC1B3F,SAAgB,aACd,MAC+B;CAC/B,MAAM,QAAQ,UAAU;CACxB,OAAO,aAAa,GAAG,SAA2B,MAAM,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,OAAO,KAAK,CAAC;;;;ACJ9F,SAAgB,YACd,UACkC;CAClC,MAAM,QAAQ,UAAU;CACxB,OAAO,aACJ,GAAG,SAA8B,MAAM,OAAO,UAAU,GAAG,KAAK,EACjE,CAAC,OAAO,SAAS,CAClB;;;;ACPH,SAAgB,QACd,MAC6C;CAG7C,OAAO,CAFO,aAAa,KAEd,EADE,aAAa,KACP,CAAC;;;;ACLxB,SAAgB,eAAkB,UAA8D;CAC9F,MAAM,QAAQ,UAAU;CACxB,OAAO,kBAA8B,SAAS,MAAM,WAAW,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC"}
|
|
@@ -5,11 +5,16 @@ function atom(configOrInitial, options) {
|
|
|
5
5
|
return fromInitialValue(configOrInitial, options);
|
|
6
6
|
}
|
|
7
7
|
function isAtomConfig(value) {
|
|
8
|
-
return typeof value === "object" && value !== null && typeof value.read === "function";
|
|
8
|
+
return typeof value === "object" && value !== null && (typeof value.read === "function" || typeof value.stream === "function");
|
|
9
9
|
}
|
|
10
10
|
function fromConfig(config) {
|
|
11
11
|
const internal = Object.create(null);
|
|
12
|
-
internal.read = config.read;
|
|
12
|
+
if (config.read != null) internal.read = config.read;
|
|
13
|
+
if (config.stream != null) {
|
|
14
|
+
internal.initialValue = config.initialValue;
|
|
15
|
+
internal.stream = config.stream;
|
|
16
|
+
internal.reduce = config.reduce;
|
|
17
|
+
}
|
|
13
18
|
if (config.debugLabel != null) internal.debugLabel = config.debugLabel;
|
|
14
19
|
if (config.dependencies != null) internal.dependencies = config.dependencies;
|
|
15
20
|
if (config.stalePolicy != null) internal.stalePolicy = config.stalePolicy;
|
|
@@ -144,7 +149,7 @@ var LruCache = class {
|
|
|
144
149
|
#head;
|
|
145
150
|
#tail;
|
|
146
151
|
constructor(maxSize) {
|
|
147
|
-
this.#maxSize = maxSize;
|
|
152
|
+
this.#maxSize = normalizeMaxSize(maxSize);
|
|
148
153
|
this.#head = {
|
|
149
154
|
key: void 0,
|
|
150
155
|
prev: null,
|
|
@@ -193,6 +198,12 @@ var LruCache = class {
|
|
|
193
198
|
this.#nodeMap.delete(key);
|
|
194
199
|
this.#valueMap.delete(key);
|
|
195
200
|
}
|
|
201
|
+
clear() {
|
|
202
|
+
this.#nodeMap.clear();
|
|
203
|
+
this.#valueMap.clear();
|
|
204
|
+
this.#head.next = this.#tail;
|
|
205
|
+
this.#tail.prev = this.#head;
|
|
206
|
+
}
|
|
196
207
|
values() {
|
|
197
208
|
return this.#valueMap.values();
|
|
198
209
|
}
|
|
@@ -222,13 +233,17 @@ var LruCache = class {
|
|
|
222
233
|
if (!Number.isFinite(this.#maxSize)) return;
|
|
223
234
|
while (this.#nodeMap.size > this.#maxSize) {
|
|
224
235
|
const oldest = this.#head.next;
|
|
225
|
-
if (oldest == null) break;
|
|
236
|
+
if (oldest == null || oldest === this.#tail) break;
|
|
226
237
|
this.#detach(oldest);
|
|
227
238
|
this.#nodeMap.delete(oldest.key);
|
|
228
239
|
this.#valueMap.delete(oldest.key);
|
|
229
240
|
}
|
|
230
241
|
}
|
|
231
242
|
};
|
|
243
|
+
function normalizeMaxSize(maxSize) {
|
|
244
|
+
if (!Number.isFinite(maxSize)) return Infinity;
|
|
245
|
+
return Math.max(0, Math.floor(maxSize));
|
|
246
|
+
}
|
|
232
247
|
//#endregion
|
|
233
248
|
//#region src/internal/infinity-atom-family.ts
|
|
234
249
|
function infinityAtomFamily(options) {
|
|
@@ -285,9 +300,14 @@ function infinityAtomFamily(options) {
|
|
|
285
300
|
family.invalidateAll = () => {
|
|
286
301
|
for (const cached of cache.values()) link.invalidateAtom(cached);
|
|
287
302
|
};
|
|
303
|
+
family.has = (param) => cache.peek(keyOf(param)) != null;
|
|
304
|
+
family.peek = (param) => cache.peek(keyOf(param));
|
|
288
305
|
family.remove = (param) => {
|
|
289
306
|
cache.delete(keyOf(param));
|
|
290
307
|
};
|
|
308
|
+
family.clear = () => {
|
|
309
|
+
cache.clear();
|
|
310
|
+
};
|
|
291
311
|
family.getCache = () => cache.asReadonlyMap();
|
|
292
312
|
return family;
|
|
293
313
|
}
|
|
@@ -486,9 +506,14 @@ function atomFamily(options) {
|
|
|
486
506
|
family.invalidateAll = () => {
|
|
487
507
|
for (const cached of cache.values()) link.invalidateAtom(cached);
|
|
488
508
|
};
|
|
509
|
+
family.has = (param) => cache.peek(keyOf(param)) != null;
|
|
510
|
+
family.peek = (param) => cache.peek(keyOf(param));
|
|
489
511
|
family.remove = (param) => {
|
|
490
512
|
cache.delete(keyOf(param));
|
|
491
513
|
};
|
|
514
|
+
family.clear = () => {
|
|
515
|
+
cache.clear();
|
|
516
|
+
};
|
|
492
517
|
family.getCache = () => cache.asReadonlyMap();
|
|
493
518
|
return family;
|
|
494
519
|
}
|
|
@@ -507,14 +532,15 @@ const PENDING_STATE = {
|
|
|
507
532
|
};
|
|
508
533
|
var Store = class {
|
|
509
534
|
#atoms = /* @__PURE__ */ new WeakMap();
|
|
535
|
+
#entries = /* @__PURE__ */ new Set();
|
|
510
536
|
#rdeps = /* @__PURE__ */ new Map();
|
|
511
537
|
#pending = /* @__PURE__ */ new Set();
|
|
512
|
-
#controllers = /* @__PURE__ */ new WeakMap();
|
|
513
538
|
#familyUnsubs = /* @__PURE__ */ new Set();
|
|
514
539
|
#registeredFamilies = /* @__PURE__ */ new WeakSet();
|
|
515
540
|
#context;
|
|
516
541
|
#client = null;
|
|
517
542
|
#flushScheduled = false;
|
|
543
|
+
#disposed = false;
|
|
518
544
|
constructor(...args) {
|
|
519
545
|
const [options] = args;
|
|
520
546
|
this.#context = options?.context;
|
|
@@ -526,15 +552,46 @@ var Store = class {
|
|
|
526
552
|
state: PENDING_STATE,
|
|
527
553
|
version: 0,
|
|
528
554
|
promise: null,
|
|
555
|
+
controller: null,
|
|
529
556
|
listeners: /* @__PURE__ */ new Set(),
|
|
530
557
|
mountCount: 0,
|
|
531
558
|
unmount: null
|
|
532
559
|
};
|
|
533
560
|
this.#atoms.set(atom, entry);
|
|
561
|
+
this.#entries.add(entry);
|
|
534
562
|
}
|
|
535
563
|
return entry;
|
|
536
564
|
}
|
|
565
|
+
#assertActive() {
|
|
566
|
+
if (this.#disposed) throw new Error("Store has been disposed");
|
|
567
|
+
}
|
|
568
|
+
#abortRead(atom) {
|
|
569
|
+
const entry = this.#atoms.get(atom);
|
|
570
|
+
if (entry?.controller != null) {
|
|
571
|
+
entry.controller.abort();
|
|
572
|
+
entry.controller = null;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
get(atom) {
|
|
576
|
+
return this.getSnapshot(atom);
|
|
577
|
+
}
|
|
578
|
+
peek(atom) {
|
|
579
|
+
this.#assertActive();
|
|
580
|
+
const entry = this.#atoms.get(atom);
|
|
581
|
+
if (entry == null) return;
|
|
582
|
+
return extractPreviousValue(entry.state);
|
|
583
|
+
}
|
|
584
|
+
ensure(atom) {
|
|
585
|
+
this.#assertActive();
|
|
586
|
+
const entry = this.#atoms.get(atom);
|
|
587
|
+
if (entry != null) {
|
|
588
|
+
if (entry.state.status === "fresh" || entry.state.status === "stale") return Promise.resolve(entry.state.value);
|
|
589
|
+
if (entry.state.status === "error" && entry.state.value !== void 0) return Promise.resolve(entry.state.value);
|
|
590
|
+
}
|
|
591
|
+
return this.read(atom);
|
|
592
|
+
}
|
|
537
593
|
read(atom) {
|
|
594
|
+
this.#assertActive();
|
|
538
595
|
const entry = this.#getOrCreate(atom);
|
|
539
596
|
if (entry.promise != null) return entry.promise;
|
|
540
597
|
const promise = this.#runRead(atom).finally(() => {
|
|
@@ -570,6 +627,11 @@ var Store = class {
|
|
|
570
627
|
}
|
|
571
628
|
try {
|
|
572
629
|
if (depPromises.size > 0) await Promise.all(depPromises.values());
|
|
630
|
+
if (config.read == null) {
|
|
631
|
+
const value = await this.#runStreamRead(atom, config, ctx);
|
|
632
|
+
if (ctx.signal.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
633
|
+
return value;
|
|
634
|
+
}
|
|
573
635
|
const value = await config.read(ctx);
|
|
574
636
|
if (ctx.signal.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
575
637
|
entry.state = {
|
|
@@ -595,12 +657,42 @@ var Store = class {
|
|
|
595
657
|
this.#scheduleNotify(atom);
|
|
596
658
|
throw lastError;
|
|
597
659
|
}
|
|
660
|
+
async #runStreamRead(atom, config, ctx) {
|
|
661
|
+
const stream = config.stream;
|
|
662
|
+
const reduce = config.reduce;
|
|
663
|
+
if (stream == null || reduce == null || !("initialValue" in config)) throw new Error("Atom is missing a read or stream function");
|
|
664
|
+
const entry = this.#getOrCreate(atom);
|
|
665
|
+
let value = config.initialValue;
|
|
666
|
+
entry.state = {
|
|
667
|
+
status: "fresh",
|
|
668
|
+
value,
|
|
669
|
+
error: void 0
|
|
670
|
+
};
|
|
671
|
+
entry.version++;
|
|
672
|
+
this.#scheduleNotify(atom);
|
|
673
|
+
const iterable = await stream(ctx);
|
|
674
|
+
for await (const chunk of iterable) {
|
|
675
|
+
if (ctx.signal.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
676
|
+
value = await reduce(value, chunk, ctx);
|
|
677
|
+
if (ctx.signal.aborted) throw new DOMException("The operation was aborted", "AbortError");
|
|
678
|
+
entry.state = {
|
|
679
|
+
status: "fresh",
|
|
680
|
+
value,
|
|
681
|
+
error: void 0
|
|
682
|
+
};
|
|
683
|
+
entry.version++;
|
|
684
|
+
this.#scheduleNotify(atom);
|
|
685
|
+
}
|
|
686
|
+
return value;
|
|
687
|
+
}
|
|
598
688
|
invalidate(atom) {
|
|
689
|
+
this.#assertActive();
|
|
599
690
|
this.#markStale(atom);
|
|
600
691
|
this.#pending.add(atom);
|
|
601
692
|
this.#schedulePendingFlush();
|
|
602
693
|
}
|
|
603
694
|
invalidateMany(atoms) {
|
|
695
|
+
this.#assertActive();
|
|
604
696
|
for (const a of atoms) {
|
|
605
697
|
this.#markStale(a);
|
|
606
698
|
this.#pending.add(a);
|
|
@@ -619,7 +711,7 @@ var Store = class {
|
|
|
619
711
|
status: "stale"
|
|
620
712
|
};
|
|
621
713
|
entry.promise = null;
|
|
622
|
-
this.#
|
|
714
|
+
this.#abortRead(atom);
|
|
623
715
|
}
|
|
624
716
|
const rdeps = this.#rdeps.get(atom);
|
|
625
717
|
if (rdeps != null) for (const dep of rdeps) this.#markStale(dep, visited);
|
|
@@ -648,6 +740,11 @@ var Store = class {
|
|
|
648
740
|
if (!this.#flushScheduled) {
|
|
649
741
|
this.#flushScheduled = true;
|
|
650
742
|
queueMicrotask(() => {
|
|
743
|
+
if (this.#disposed) {
|
|
744
|
+
this.#flushScheduled = false;
|
|
745
|
+
this.#pending.clear();
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
651
748
|
this.#flushScheduled = false;
|
|
652
749
|
this.#flushPending();
|
|
653
750
|
});
|
|
@@ -663,7 +760,7 @@ var Store = class {
|
|
|
663
760
|
state: targetEntry.state,
|
|
664
761
|
version: targetEntry.version
|
|
665
762
|
});
|
|
666
|
-
this.#
|
|
763
|
+
this.#abortRead(target);
|
|
667
764
|
targetEntry.promise = null;
|
|
668
765
|
targetEntry.state = {
|
|
669
766
|
status: "fresh",
|
|
@@ -699,9 +796,9 @@ var Store = class {
|
|
|
699
796
|
set.add(atom);
|
|
700
797
|
}
|
|
701
798
|
#makeCtx(atom, deps, depPromises) {
|
|
702
|
-
this.#
|
|
799
|
+
this.#abortRead(atom);
|
|
703
800
|
const controller = new AbortController();
|
|
704
|
-
this.#
|
|
801
|
+
this.#getOrCreate(atom).controller = controller;
|
|
705
802
|
const read = async (key, ...rest) => {
|
|
706
803
|
const dep = deps[key];
|
|
707
804
|
if (dep == null) throw new Error(`Unknown dependency key: "${String(key)}"`);
|
|
@@ -727,6 +824,7 @@ var Store = class {
|
|
|
727
824
|
};
|
|
728
825
|
}
|
|
729
826
|
subscribe(atom, listener) {
|
|
827
|
+
this.#assertActive();
|
|
730
828
|
const entry = this.#getOrCreate(atom);
|
|
731
829
|
entry.listeners.add(listener);
|
|
732
830
|
this.#autoRegisterFamily(atom);
|
|
@@ -748,7 +846,11 @@ var Store = class {
|
|
|
748
846
|
if (typeof cleanup === "function") entry.unmount = cleanup;
|
|
749
847
|
}
|
|
750
848
|
}
|
|
849
|
+
let active = true;
|
|
751
850
|
return () => {
|
|
851
|
+
if (!active) return;
|
|
852
|
+
active = false;
|
|
853
|
+
if (this.#disposed) return;
|
|
752
854
|
entry.listeners.delete(listener);
|
|
753
855
|
entry.mountCount--;
|
|
754
856
|
if (entry.mountCount === 0 && entry.unmount != null) {
|
|
@@ -768,14 +870,17 @@ var Store = class {
|
|
|
768
870
|
this.#familyUnsubs.add(unsub);
|
|
769
871
|
}
|
|
770
872
|
getSnapshot(atom) {
|
|
873
|
+
this.#assertActive();
|
|
771
874
|
return this.#getOrCreate(atom).state;
|
|
772
875
|
}
|
|
773
876
|
getServerSnapshot(atom) {
|
|
877
|
+
this.#assertActive();
|
|
774
878
|
const entry = this.#atoms.get(atom);
|
|
775
879
|
if (entry != null) return entry.state;
|
|
776
880
|
return PENDING_STATE;
|
|
777
881
|
}
|
|
778
882
|
async apply(atom, ...args) {
|
|
883
|
+
this.#assertActive();
|
|
779
884
|
const config = atom[CONFIG];
|
|
780
885
|
if (config.write == null) throw new Error(`Atom${atom.debugLabel != null ? ` "${atom.debugLabel}"` : ""} is not writable`);
|
|
781
886
|
const deps = config.dependencies ?? {};
|
|
@@ -823,6 +928,7 @@ var Store = class {
|
|
|
823
928
|
if (config.invalidateAfterWrite !== false) this.invalidate(atom);
|
|
824
929
|
}
|
|
825
930
|
async mutate(mutation, ...args) {
|
|
931
|
+
this.#assertActive();
|
|
826
932
|
const relatedSnapshots = /* @__PURE__ */ new Map();
|
|
827
933
|
const ctx = {
|
|
828
934
|
global: this.#context,
|
|
@@ -841,8 +947,9 @@ var Store = class {
|
|
|
841
947
|
}
|
|
842
948
|
}
|
|
843
949
|
write(atom, valueOrMutate) {
|
|
950
|
+
this.#assertActive();
|
|
844
951
|
const entry = this.#getOrCreate(atom);
|
|
845
|
-
this.#
|
|
952
|
+
this.#abortRead(atom);
|
|
846
953
|
entry.promise = null;
|
|
847
954
|
entry.state = {
|
|
848
955
|
status: "fresh",
|
|
@@ -853,18 +960,71 @@ var Store = class {
|
|
|
853
960
|
this.#scheduleNotify(atom);
|
|
854
961
|
this.#markReverseDependentsStale(atom);
|
|
855
962
|
}
|
|
963
|
+
run(atom, ...args) {
|
|
964
|
+
return this.apply(atom, ...args);
|
|
965
|
+
}
|
|
966
|
+
runMutation(mutation, ...args) {
|
|
967
|
+
return this.mutate(mutation, ...args);
|
|
968
|
+
}
|
|
969
|
+
set(atom, valueOrMutate) {
|
|
970
|
+
this.write(atom, valueOrMutate);
|
|
971
|
+
}
|
|
972
|
+
observe(atom, listener) {
|
|
973
|
+
return this.subscribe(atom, () => {
|
|
974
|
+
listener(this.getSnapshot(atom));
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
inspect(atom) {
|
|
978
|
+
this.#assertActive();
|
|
979
|
+
const entry = this.#atoms.get(atom);
|
|
980
|
+
return {
|
|
981
|
+
debugLabel: atom.debugLabel,
|
|
982
|
+
status: entry?.state.status ?? "pending",
|
|
983
|
+
dependencyCount: Object.keys(atom[CONFIG].dependencies ?? {}).length,
|
|
984
|
+
reverseDependentCount: this.#rdeps.get(atom)?.size ?? 0,
|
|
985
|
+
listenerCount: entry?.listeners.size ?? 0,
|
|
986
|
+
mountCount: entry?.mountCount ?? 0,
|
|
987
|
+
hasPromise: entry?.promise != null
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
dispose() {
|
|
991
|
+
if (this.#disposed) return;
|
|
992
|
+
this.#disposed = true;
|
|
993
|
+
this.#pending.clear();
|
|
994
|
+
for (const unsub of this.#familyUnsubs) unsub();
|
|
995
|
+
this.#familyUnsubs.clear();
|
|
996
|
+
for (const entry of this.#entries) {
|
|
997
|
+
entry.controller?.abort();
|
|
998
|
+
entry.controller = null;
|
|
999
|
+
entry.promise = null;
|
|
1000
|
+
entry.listeners.clear();
|
|
1001
|
+
entry.mountCount = 0;
|
|
1002
|
+
if (entry.unmount != null) {
|
|
1003
|
+
entry.unmount();
|
|
1004
|
+
entry.unmount = null;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
856
1008
|
getClient() {
|
|
1009
|
+
this.#assertActive();
|
|
857
1010
|
if (this.#client != null) return this.#client;
|
|
858
1011
|
this.#client = {
|
|
1012
|
+
get: (atom) => this.get(atom),
|
|
1013
|
+
peek: (atom) => this.peek(atom),
|
|
1014
|
+
ensure: (atom) => this.ensure(atom),
|
|
859
1015
|
read: (atom) => this.read(atom),
|
|
1016
|
+
run: (atom, ...args) => this.run(atom, ...args),
|
|
860
1017
|
apply: (atom, ...args) => this.apply(atom, ...args),
|
|
1018
|
+
runMutation: (m, ...args) => this.runMutation(m, ...args),
|
|
861
1019
|
mutate: (m, ...args) => this.mutate(m, ...args),
|
|
1020
|
+
set: (atom, valueOrMutate) => this.set(atom, valueOrMutate),
|
|
862
1021
|
write: (atom, valueOrMutate) => this.write(atom, valueOrMutate),
|
|
863
1022
|
invalidate: (atom) => this.invalidate(atom),
|
|
864
1023
|
invalidateMany: (atoms) => this.invalidateMany(atoms),
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1024
|
+
observe: (atom, listener) => this.observe(atom, listener),
|
|
1025
|
+
subscribe: (atom, listener) => this.observe(atom, listener),
|
|
1026
|
+
inspect: (atom) => this.inspect(atom),
|
|
1027
|
+
dispose: () => this.dispose()
|
|
868
1028
|
};
|
|
869
1029
|
return this.#client;
|
|
870
1030
|
}
|
|
@@ -906,4 +1066,4 @@ function extractPreviousValue(state) {
|
|
|
906
1066
|
//#endregion
|
|
907
1067
|
export { microtaskScheduler as a, infinityAtomFamily as c, maxBatchSizeScheduler as i, infinityAtom as l, mutation as n, windowScheduler as o, atomFamily as r, windowedFiniteBatchScheduler as s, createStore as t, atom as u };
|
|
908
1068
|
|
|
909
|
-
//# sourceMappingURL=store-
|
|
1069
|
+
//# sourceMappingURL=store-DeTRbkBP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-DeTRbkBP.js","names":["#maxSize","#nodeMap","#valueMap","#head","#tail","#moveToMru","#insertBeforeTail","#evict","#detach","#fetch","#scheduler","#queue","#keySet","#flush","#atoms","#entries","#rdeps","#pending","#familyUnsubs","#registeredFamilies","#context","#disposed","#assertActive","#getOrCreate","#runRead","#registerRdeps","#makeCtx","#runStreamRead","#scheduleNotify","#markStale","#schedulePendingFlush","#abortRead","#flushScheduled","#flushPending","#markReverseDependentsStale","#registerSingleRdep","#autoRegisterFamily","#relatedOptimisticWrite","#rollbackRelatedSnapshots","#client"],"sources":["../src/internal/atom.ts","../src/internal/infinity-atom.ts","../src/internal/lru-cache.ts","../src/internal/infinity-atom-family.ts","../src/internal/family-batch-schedulers.ts","../src/internal/family-batch.ts","../src/internal/family.ts","../src/internal/mutation.ts","../src/internal/store.ts"],"mappings":";;AA8FA,SAAgB,KAKd,iBACA,SACa;CACb,IAAI,aAAgC,gBAAgB,EAClD,OAAO,WAAW,gBAAgB;CAEpC,OAAO,iBAAiB,iBAAiB,QAAQ;;AAGnD,SAAS,aAIP,OAAsF;CACtF,OACE,OAAO,UAAU,YACjB,UAAU,SACT,OAAQ,MAA6B,SAAS,cAC7C,OAAQ,MAA+B,WAAW;;AAIxD,SAAS,WAIP,QAAoD;CACpD,MAAM,WAAsC,OAAO,OAAO,KAAK;CAC/D,IAAI,OAAO,QAAQ,MACjB,SAAS,OAAO,OAAO;CAEzB,IAAI,OAAO,UAAU,MAAM;EACzB,SAAS,eAAe,OA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AO,SAAS;GAClB,OAAO,IAAI,aAAa,6BAA6B,aAAa,CAAC;GACnE;;EAEF,MAAM,QAAQ,WAAW,SAAS,GAAG;EACrC,OAAO,iBACL,eACM;GACJ,aAAa,MAAM;GACnB,OAAO,IAAI,aAAa,6BAA6B,aAAa,CAAC;KAErE,EAAE,MAAM,MAAM,CACf;GACD;;AAGJ,SAAS,aAAa,GAAqB;CACzC,OAAO,aAAa,gBAAgB,EAAE,SAAS;;AAGjD,SAAS,aAAa,KAAuD;CAC3E,IAAI,OAAO,QAAQ,YACjB,OAAO;CAET,MAAM,IAAI;CACV,OAAO,OAAO,EAAE,eAAe,cAAc,OAAO,EAAE,kBAAkB;;AAG1E,SAAS,qBAAwB,OAAoC;CACnE,IAAI,MAAM,WAAW,WAAW,MAAM,WAAW,SAC/C,OAAO,MAAM;CAEf,IAAI,MAAM,WAAW,SACnB,OAAO,MAAM"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
//#region src/internal/atom.d.ts
|
|
2
|
-
type WritableConfig<Value, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> =
|
|
2
|
+
type WritableConfig<Value, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> = ReadAtomConfig<Value, Deps, Args> & {
|
|
3
3
|
write: (ctx: WritableAtomContext<Deps, Value>, ...args: Args) => Promise<void>;
|
|
4
4
|
};
|
|
5
|
-
type ReadonlyConfig<Value, Deps extends Record<string, DependencyEntry>> =
|
|
5
|
+
type ReadonlyConfig<Value, Deps extends Record<string, DependencyEntry>> = ReadAtomConfig<Value, Deps, readonly []>;
|
|
6
|
+
type WritableStreamConfig<Value, Chunk, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> = StreamAtomConfig<Value, Chunk, Deps, Args> & {
|
|
7
|
+
write: (ctx: WritableAtomContext<Deps, Value>, ...args: Args) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
type ReadonlyStreamConfig<Value, Chunk, Deps extends Record<string, DependencyEntry>> = StreamAtomConfig<Value, Chunk, Deps, readonly []>;
|
|
6
10
|
type SimpleAtomOptions<Value> = {
|
|
7
11
|
debugLabel?: string;
|
|
8
12
|
onMount?: (set: (value: Value) => void, ctx: {
|
|
@@ -12,9 +16,14 @@ type SimpleAtomOptions<Value> = {
|
|
|
12
16
|
type SimpleAtomWriteArg<Value> = Value | ((prev: Value) => Value);
|
|
13
17
|
type LooksLikeAtomConfig = {
|
|
14
18
|
read: (ctx: never) => Promise<unknown>;
|
|
19
|
+
} | {
|
|
20
|
+
stream: (ctx: never) => AsyncIterable<unknown> | Promise<AsyncIterable<unknown>>;
|
|
15
21
|
};
|
|
16
22
|
declare function atom<Value, Deps extends Record<string, DependencyEntry> = Record<never, never>, Args extends readonly unknown[] = readonly []>(config: WritableConfig<Value, Deps, Args>): WritableAtom<Value, Args>;
|
|
17
23
|
declare function atom<Value, Deps extends Record<string, DependencyEntry> = Record<never, never>>(config: ReadonlyConfig<Value, Deps>): Atom<Value>;
|
|
24
|
+
declare function atom<Value, Chunk, Deps extends Record<string, DependencyEntry> = Record<never, never>, Args extends readonly unknown[] = readonly []>(config: WritableStreamConfig<Value, Chunk, Deps, Args>): WritableAtom<Value, Args>;
|
|
25
|
+
declare function atom<Value, Chunk, Deps extends Record<string, DependencyEntry> = Record<never, never>>(config: ReadonlyStreamConfig<Value, Chunk, Deps>): Atom<Value>;
|
|
26
|
+
declare function atom<Value, Deps extends Record<string, DependencyEntry> = Record<never, never>, Args extends readonly unknown[] = readonly [], Chunk = never>(config: AtomConfig<Value, Deps, Args, Chunk>): Atom<Value> | WritableAtom<Value, Args>;
|
|
18
27
|
declare function atom<Value>(initialValue: Value extends LooksLikeAtomConfig ? never : Value, options?: SimpleAtomOptions<Value>): WritableAtom<Value, readonly [SimpleAtomWriteArg<Value>]>;
|
|
19
28
|
//#endregion
|
|
20
29
|
//#region src/internal/infinity-atom.d.ts
|
|
@@ -77,7 +86,10 @@ interface InfinityAtomFamily<Param, Page, Cursor, Key = Param> {
|
|
|
77
86
|
(param: Param): InfinityFamilyAtom<Page, Cursor>;
|
|
78
87
|
invalidate(param: Param): void;
|
|
79
88
|
invalidateAll(): void;
|
|
89
|
+
has(param: Param): boolean;
|
|
90
|
+
peek(param: Param): InfinityFamilyAtom<Page, Cursor> | undefined;
|
|
80
91
|
remove(param: Param): void;
|
|
92
|
+
clear(): void;
|
|
81
93
|
getCache(): ReadonlyMap<Key, InfinityFamilyAtom<Page, Cursor>>;
|
|
82
94
|
}
|
|
83
95
|
declare function infinityAtomFamily<Param, Page, Cursor, Key = Param>(options: InfinityAtomFamilyOptions<Param, Page, Cursor, Key>): InfinityAtomFamily<Param, Page, Cursor, Key>;
|
|
@@ -90,15 +102,34 @@ type Mutation<in out Args extends readonly unknown[]> = {
|
|
|
90
102
|
declare function mutation<const Args extends readonly unknown[]>(fn: (ctx: MutationContext, ...args: Args) => Promise<void>): Mutation<Args>;
|
|
91
103
|
//#endregion
|
|
92
104
|
//#region src/internal/store.d.ts
|
|
105
|
+
type StoreInspection = {
|
|
106
|
+
debugLabel: string | undefined;
|
|
107
|
+
status: AtomState<unknown>["status"];
|
|
108
|
+
dependencyCount: number;
|
|
109
|
+
reverseDependentCount: number;
|
|
110
|
+
listenerCount: number;
|
|
111
|
+
mountCount: number;
|
|
112
|
+
hasPromise: boolean;
|
|
113
|
+
};
|
|
93
114
|
interface StoreClient {
|
|
115
|
+
get<V>(atom: Atom<V>): AtomState<V>;
|
|
116
|
+
peek<V>(atom: Atom<V>): V | undefined;
|
|
117
|
+
ensure<V>(atom: Atom<V>): Promise<V>;
|
|
94
118
|
read<V>(atom: Atom<V>): Promise<V>;
|
|
119
|
+
run<V, A extends readonly unknown[]>(atom: WritableAtom<V, A>, ...args: NoInfer<A>): Promise<void>;
|
|
95
120
|
apply<V, A extends readonly unknown[]>(atom: WritableAtom<V, A>, ...args: NoInfer<A>): Promise<void>;
|
|
121
|
+
runMutation<Args extends readonly unknown[]>(mutation: Mutation<Args>, ...args: Args): Promise<void>;
|
|
96
122
|
mutate<Args extends readonly unknown[]>(mutation: Mutation<Args>, ...args: Args): Promise<void>;
|
|
123
|
+
set<V>(atom: Atom<V>, value: V): void;
|
|
124
|
+
set<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
97
125
|
write<V>(atom: Atom<V>, value: V): void;
|
|
98
126
|
write<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
99
127
|
invalidate(atom: Atom<unknown>): void;
|
|
100
128
|
invalidateMany(atoms: ReadonlyArray<Atom<unknown>>): void;
|
|
129
|
+
observe<V>(atom: Atom<V>, listener: (state: AtomState<V>) => void): () => void;
|
|
101
130
|
subscribe<V>(atom: Atom<V>, listener: (state: AtomState<V>) => void): () => void;
|
|
131
|
+
inspect(atom: Atom<unknown>): StoreInspection;
|
|
132
|
+
dispose(): void;
|
|
102
133
|
}
|
|
103
134
|
type StoreOptions = unknown extends RegisteredContext ? {
|
|
104
135
|
context?: RegisteredContext;
|
|
@@ -108,6 +139,9 @@ type StoreOptions = unknown extends RegisteredContext ? {
|
|
|
108
139
|
declare class Store {
|
|
109
140
|
#private;
|
|
110
141
|
constructor(...args: unknown extends RegisteredContext ? [options?: StoreOptions] : [options: StoreOptions]);
|
|
142
|
+
get<V>(atom: Atom<V>): AtomState<V>;
|
|
143
|
+
peek<V>(atom: Atom<V>): V | undefined;
|
|
144
|
+
ensure<V>(atom: Atom<V>): Promise<V>;
|
|
111
145
|
read<V>(atom: Atom<V>): Promise<V>;
|
|
112
146
|
invalidate(atom: Atom<unknown>): void;
|
|
113
147
|
invalidateMany(atoms: ReadonlyArray<Atom<unknown>>): void;
|
|
@@ -118,6 +152,13 @@ declare class Store {
|
|
|
118
152
|
mutate<Args extends readonly unknown[]>(mutation: Mutation<Args>, ...args: Args): Promise<void>;
|
|
119
153
|
write<V>(atom: Atom<V>, value: V): void;
|
|
120
154
|
write<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
155
|
+
run<V, A extends readonly unknown[]>(atom: WritableAtom<V, A>, ...args: NoInfer<A>): Promise<void>;
|
|
156
|
+
runMutation<Args extends readonly unknown[]>(mutation: Mutation<Args>, ...args: Args): Promise<void>;
|
|
157
|
+
set<V>(atom: Atom<V>, value: V): void;
|
|
158
|
+
set<V>(atom: Atom<V>, mutate: (prev: V | undefined) => V): void;
|
|
159
|
+
observe<V>(atom: Atom<V>, listener: (state: AtomState<V>) => void): () => void;
|
|
160
|
+
inspect(atom: Atom<unknown>): StoreInspection;
|
|
161
|
+
dispose(): void;
|
|
121
162
|
getClient(): StoreClient;
|
|
122
163
|
}
|
|
123
164
|
declare function createStore(...args: unknown extends RegisteredContext ? [options?: StoreOptions] : [options: StoreOptions]): Store;
|
|
@@ -197,7 +238,7 @@ interface WritableAtomContext<Deps extends Record<string, DependencyEntry>, Valu
|
|
|
197
238
|
getPreviousValue(): Value | undefined;
|
|
198
239
|
}
|
|
199
240
|
type RetryDelay = number | ((attemptIndex: number) => number);
|
|
200
|
-
type
|
|
241
|
+
type AtomBaseConfig<Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> = {
|
|
201
242
|
dependencies?: Deps;
|
|
202
243
|
stalePolicy?: StalePolicy;
|
|
203
244
|
retry?: boolean | number;
|
|
@@ -210,12 +251,32 @@ type AtomConfig<Value, Deps extends Record<string, DependencyEntry>, Args extend
|
|
|
210
251
|
* to avoid an automatic stale-revalidation that would re-run `read`.
|
|
211
252
|
*/
|
|
212
253
|
invalidateAfterWrite?: boolean;
|
|
254
|
+
write?: (ctx: WritableAtomContext<Deps, unknown>, ...args: Args) => Promise<void>;
|
|
255
|
+
onMount?: (set: (value: unknown) => void, ctx: {
|
|
256
|
+
global: RegisteredContext;
|
|
257
|
+
}) => (() => void) | void;
|
|
258
|
+
};
|
|
259
|
+
type ReadAtomConfig<Value, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> = Omit<AtomBaseConfig<Deps, Args>, "write" | "onMount"> & {
|
|
213
260
|
read: (ctx: AtomContext<Deps>) => Promise<Value>;
|
|
261
|
+
stream?: never;
|
|
262
|
+
initialValue?: never;
|
|
263
|
+
reduce?: never;
|
|
264
|
+
write?: (ctx: WritableAtomContext<Deps, Value>, ...args: Args) => Promise<void>;
|
|
265
|
+
onMount?: (set: (value: Value) => void, ctx: {
|
|
266
|
+
global: RegisteredContext;
|
|
267
|
+
}) => (() => void) | void;
|
|
268
|
+
};
|
|
269
|
+
type StreamAtomConfig<Value, Chunk, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[]> = Omit<AtomBaseConfig<Deps, Args>, "write" | "onMount"> & {
|
|
270
|
+
initialValue: Value;
|
|
271
|
+
stream: (ctx: AtomContext<Deps>) => AsyncIterable<Chunk> | Promise<AsyncIterable<Chunk>>;
|
|
272
|
+
reduce: (value: Value, chunk: Chunk, ctx: AtomContext<Deps>) => Value | Promise<Value>;
|
|
273
|
+
read?: never;
|
|
214
274
|
write?: (ctx: WritableAtomContext<Deps, Value>, ...args: Args) => Promise<void>;
|
|
215
275
|
onMount?: (set: (value: Value) => void, ctx: {
|
|
216
276
|
global: RegisteredContext;
|
|
217
277
|
}) => (() => void) | void;
|
|
218
278
|
};
|
|
279
|
+
type AtomConfig<Value, Deps extends Record<string, DependencyEntry>, Args extends readonly unknown[], Chunk = never> = ReadAtomConfig<Value, Deps, Args> | StreamAtomConfig<Value, Chunk, Deps, Args>;
|
|
219
280
|
interface InternalAtomConfig<Value> {
|
|
220
281
|
dependencies?: Record<string, DependencyEntry>;
|
|
221
282
|
stalePolicy?: StalePolicy;
|
|
@@ -223,8 +284,11 @@ interface InternalAtomConfig<Value> {
|
|
|
223
284
|
retryDelay?: RetryDelay;
|
|
224
285
|
debugLabel?: string;
|
|
225
286
|
invalidateAfterWrite?: boolean;
|
|
226
|
-
read
|
|
287
|
+
read?: (ctx: AtomContext<Record<string, DependencyEntry>>) => Promise<Value>;
|
|
227
288
|
write?: (ctx: WritableAtomContext<Record<string, DependencyEntry>, any>, ...args: readonly unknown[]) => Promise<void>;
|
|
289
|
+
initialValue?: unknown;
|
|
290
|
+
stream?: (ctx: AtomContext<Record<string, DependencyEntry>>) => AsyncIterable<unknown> | Promise<AsyncIterable<unknown>>;
|
|
291
|
+
reduce?: (value: unknown, chunk: unknown, ctx: AtomContext<Record<string, DependencyEntry>>) => unknown;
|
|
228
292
|
onMount?: (set: (value: unknown) => void, ctx: {
|
|
229
293
|
global: RegisteredContext;
|
|
230
294
|
}) => (() => void) | void;
|
|
@@ -240,5 +304,5 @@ type AtomValue<A> = A extends Atom<infer V> ? V : never;
|
|
|
240
304
|
type IsWritable<A> = A extends WritableAtom<unknown, readonly unknown[]> ? true : false;
|
|
241
305
|
type AtomArgs<A> = A extends WritableAtom<unknown, infer Args> ? Args : never;
|
|
242
306
|
//#endregion
|
|
243
|
-
export {
|
|
244
|
-
//# sourceMappingURL=types-
|
|
307
|
+
export { InfinityAtomOptions as A, Mutation as C, InfinityFamilyAtom as D, InfinityAtomFamilyOptions as E, SimpleAtomOptions as M, SimpleAtomWriteArg as N, infinityAtomFamily as O, atom as P, createStore as S, InfinityAtomFamily as T, RegisteredContext as _, AtomState as a, StoreInspection as b, IsWritable as c, RetryDelay as d, StalePolicy as f, Register as g, WritableAtomContext as h, AtomContext as i, infinityAtom as j, InfiniteData as k, MutationContext as l, WritableAtom as m, AtomArgs as n, AtomValue as o, StreamAtomConfig as p, AtomConfig as r, DependencyEntry as s, Atom as t, ReadAtomConfig as u, Store as v, mutation as w, StoreOptions as x, StoreClient as y };
|
|
308
|
+
//# sourceMappingURL=types-CV8Xn30e.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as CONFIG } from "./types-B2mzc3A5.js";
|
|
2
|
+
//#region src/internal/use-atom-value.ts
|
|
3
|
+
function getAtomValueResult(store, atom, snapshot, observe, isInitialRender) {
|
|
4
|
+
const stalePolicy = atom[CONFIG].stalePolicy ?? "keep";
|
|
5
|
+
if (snapshot.status === "pending") throw store.read(atom);
|
|
6
|
+
if (snapshot.status === "stale") {
|
|
7
|
+
if (stalePolicy === "suspend") throw store.read(atom);
|
|
8
|
+
store.read(atom);
|
|
9
|
+
if (observe) return {
|
|
10
|
+
value: snapshot.value,
|
|
11
|
+
isStale: true,
|
|
12
|
+
error: void 0
|
|
13
|
+
};
|
|
14
|
+
return snapshot.value;
|
|
15
|
+
}
|
|
16
|
+
if (snapshot.status === "error") {
|
|
17
|
+
if (observe && snapshot.value !== void 0) return {
|
|
18
|
+
value: snapshot.value,
|
|
19
|
+
isStale: false,
|
|
20
|
+
error: snapshot.error
|
|
21
|
+
};
|
|
22
|
+
if (isInitialRender) store.read(atom);
|
|
23
|
+
throw snapshot.error;
|
|
24
|
+
}
|
|
25
|
+
if (observe) return {
|
|
26
|
+
value: snapshot.value,
|
|
27
|
+
isStale: false,
|
|
28
|
+
error: void 0
|
|
29
|
+
};
|
|
30
|
+
return snapshot.value;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { getAtomValueResult as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=use-atom-value-BhGvD9Vf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-atom-value-BhGvD9Vf.js","names":[],"sources":["../src/internal/use-atom-value.ts"],"mappings":";;AAUA,SAAgB,mBACd,OACA,MACA,UACA,SACA,iBACsB;CACtB,MAAM,cAA2B,KAAK,QAAQ,eAAe;CAE7D,IAAI,SAAS,WAAW,WACtB,MAAM,MAAM,KAAK,KAAK;CAGxB,IAAI,SAAS,WAAW,SAAS;EAC/B,IAAI,gBAAgB,WAClB,MAAM,MAAM,KAAK,KAAK;EAExB,MAAW,KAAK,KAAK;EAErB,IAAI,SACF,OAAO;GAAE,OAAO,SAAS;GAAO,SAAS;GAAM,OAAO,KAAA;GAAW;EAEnE,OAAO,SAAS;;CAGlB,IAAI,SAAS,WAAW,SAAS;EAC/B,IAAI,WAAW,SAAS,UAAU,KAAA,GAChC,OAAO;GACL,OAAO,SAAS;GAChB,SAAS;GACT,OAAO,SAAS;GACjB;EAEH,IAAI,iBACF,MAAW,KAAK,KAAK;EAEvB,MAAM,SAAS;;CAGjB,IAAI,SACF,OAAO;EAAE,OAAO,SAAS;EAAO,SAAS;EAAO,OAAO,KAAA;EAAW;CAEpE,OAAO,SAAS"}
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Mutation, m as WritableAtom, t as Atom, v as Store, y as StoreClient } from "../types-CV8Xn30e.js";
|
|
2
2
|
import * as _$vue from "vue";
|
|
3
3
|
import { PropType, ShallowRef } from "vue";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-CTGJpxoI.js","names":["#maxSize","#nodeMap","#valueMap","#head","#tail","#moveToMru","#insertBeforeTail","#evict","#detach","#fetch","#scheduler","#queue","#keySet","#flush","#atoms","#rdeps","#pending","#controllers","#familyUnsubs","#registeredFamilies","#context","#getOrCreate","#runRead","#registerRdeps","#makeCtx","#scheduleNotify","#markStale","#schedulePendingFlush","#flushScheduled","#flushPending","#markReverseDependentsStale","#registerSingleRdep","#autoRegisterFamily","#relatedOptimisticWrite","#rollbackRelatedSnapshots","#client"],"sources":["../src/internal/atom.ts","../src/internal/infinity-atom.ts","../src/internal/lru-cache.ts","../src/internal/infinity-atom-family.ts","../src/internal/family-batch-schedulers.ts","../src/internal/family-batch.ts","../src/internal/family.ts","../src/internal/mutation.ts","../src/internal/store.ts"],"mappings":";;AAsDA,SAAgB,KAKd,iBACA,SACa;CACb,IAAI,aAAgC,gBAAgB,EAClD,OAAO,WAAW,gBAAgB;CAEpC,OAAO,iBAAiB,iBAAiB,QAAQ;;AAGnD,SAAS,aAIP,OAAsF;CACtF,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;;AAIlD,SAAS,WAIP,QAAoD;CACpD,MAAM,WAAsC,OAAO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