atom.io 0.13.0 → 0.14.1
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/data/dist/index.cjs +1473 -52
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.cts +315 -16
- package/data/dist/index.js +10 -267
- package/data/dist/index.js.map +1 -1
- package/data/package.json +5 -5
- package/data/src/join.ts +3 -3
- package/dist/chunk-5VJ77LZE.js +176 -0
- package/dist/chunk-5VJ77LZE.js.map +1 -0
- package/dist/chunk-CK7GNCU5.js +309 -0
- package/dist/chunk-CK7GNCU5.js.map +1 -0
- package/dist/chunk-KW7RA7IM.js +67 -0
- package/dist/chunk-KW7RA7IM.js.map +1 -0
- package/dist/chunk-LFXB7Y6M.js +68 -0
- package/dist/chunk-LFXB7Y6M.js.map +1 -0
- package/dist/chunk-NYCVSXQB.js +181 -0
- package/dist/chunk-NYCVSXQB.js.map +1 -0
- package/dist/chunk-TE3ZSTQ6.js +2516 -0
- package/dist/chunk-TE3ZSTQ6.js.map +1 -0
- package/dist/index.cjs +2250 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +272 -25
- package/dist/index.js +1 -215
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/internal/dist/index.cjs +885 -684
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +230 -24
- package/internal/dist/index.js +1 -2171
- package/internal/dist/index.js.map +1 -1
- package/internal/package.json +5 -5
- package/internal/src/atom/create-atom.ts +3 -2
- package/internal/src/mutable/create-mutable-atom.ts +3 -2
- package/internal/src/mutable/tracker.ts +6 -4
- package/internal/src/selector/register-selector.ts +1 -1
- package/internal/src/selector/update-selector-atoms.ts +3 -3
- package/internal/src/subscribe/index.ts +3 -0
- package/internal/src/subscribe/recall-state.ts +0 -6
- package/internal/src/subscribe/subscribe-to-state.ts +47 -0
- package/internal/src/subscribe/subscribe-to-timeline.ts +28 -0
- package/internal/src/subscribe/subscribe-to-transaction.ts +33 -0
- package/introspection/dist/index.cjs +1618 -46
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.cts +374 -4
- package/introspection/dist/index.js +2 -316
- package/introspection/dist/index.js.map +1 -1
- package/introspection/package.json +5 -5
- package/json/dist/index.cjs +1560 -8
- package/json/dist/index.cjs.map +1 -1
- package/json/dist/index.d.cts +371 -7
- package/json/dist/index.js +1 -76
- package/json/dist/index.js.map +1 -1
- package/json/package.json +5 -5
- package/package.json +10 -9
- package/react/dist/index.cjs +1638 -10
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +383 -5
- package/react/dist/index.js +2 -31
- package/react/dist/index.js.map +1 -1
- package/react/package.json +5 -5
- package/react/src/store-hooks.ts +52 -3
- package/react-devtools/dist/index.cjs +2268 -198
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.css +2 -2
- package/react-devtools/dist/index.d.cts +148 -24
- package/react-devtools/dist/index.js +57 -297
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/package.json +5 -5
- package/realtime-client/dist/index.cjs +1585 -34
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.cts +382 -11
- package/realtime-client/dist/index.js +2 -164
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/package.json +5 -5
- package/realtime-client/src/use-push.ts +4 -4
- package/realtime-client/src/use-server-action.ts +4 -4
- package/realtime-react/dist/index.cjs +1782 -35
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.cts +49 -9
- package/realtime-react/dist/index.js +4 -66
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/package.json +5 -5
- package/realtime-server/dist/index.cjs +1627 -60
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.cts +391 -11
- package/realtime-server/dist/index.js +59 -32
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/package.json +6 -6
- package/realtime-server/src/hook-composition/expose-family.ts +7 -3
- package/realtime-server/src/hook-composition/expose-mutable-family.ts +13 -5
- package/realtime-server/src/hook-composition/expose-mutable.ts +11 -3
- package/realtime-server/src/hook-composition/expose-single.ts +6 -2
- package/realtime-server/src/hook-composition/receive-transaction.ts +14 -5
- package/realtime-testing/dist/index.cjs +2352 -16
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.cts +486 -3
- package/realtime-testing/dist/index.js +10 -31
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/package.json +5 -5
- package/src/subscribe.ts +37 -91
- package/transceivers/set-rtx/dist/index.cjs +31 -10
- package/transceivers/set-rtx/dist/index.cjs.map +1 -1
- package/transceivers/set-rtx/dist/index.d.cts +29 -3
- package/transceivers/set-rtx/dist/index.js +2 -3
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/transceivers/set-rtx/package.json +6 -6
- package/data/dist/index.d.ts +0 -158
- package/data/dist/metafile-cjs.json +0 -1
- package/data/dist/metafile-esm.json +0 -1
- package/dist/index.d.ts +0 -243
- package/dist/metafile-esm.json +0 -1
- package/internal/dist/index.d.ts +0 -414
- package/internal/dist/metafile-cjs.json +0 -1
- package/internal/dist/metafile-esm.json +0 -1
- package/introspection/dist/index.d.ts +0 -24
- package/introspection/dist/metafile-cjs.json +0 -1
- package/introspection/dist/metafile-esm.json +0 -1
- package/json/dist/index.d.ts +0 -51
- package/json/dist/metafile-cjs.json +0 -1
- package/json/dist/metafile-esm.json +0 -1
- package/react/dist/index.d.ts +0 -16
- package/react/dist/metafile-cjs.json +0 -1
- package/react/dist/metafile-esm.json +0 -1
- package/react-devtools/dist/index.d.ts +0 -341
- package/react-devtools/dist/metafile-cjs.json +0 -1
- package/react-devtools/dist/metafile-esm.json +0 -1
- package/realtime-client/dist/index.d.ts +0 -21
- package/realtime-client/dist/metafile-cjs.json +0 -1
- package/realtime-client/dist/metafile-esm.json +0 -1
- package/realtime-react/dist/index.d.ts +0 -27
- package/realtime-react/dist/metafile-cjs.json +0 -1
- package/realtime-react/dist/metafile-esm.json +0 -1
- package/realtime-server/dist/index.d.ts +0 -25
- package/realtime-server/dist/metafile-cjs.json +0 -1
- package/realtime-server/dist/metafile-esm.json +0 -1
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/metafile-cjs.json +0 -1
- package/realtime-testing/dist/metafile-esm.json +0 -1
- package/transceivers/set-rtx/dist/index.d.ts +0 -40
- package/transceivers/set-rtx/dist/metafile-cjs.json +0 -1
- package/transceivers/set-rtx/dist/metafile-esm.json +0 -1
|
@@ -1,5 +1,212 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
2
|
+
toJson: (t: T) => J;
|
|
3
|
+
fromJson: (json: J) => T;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type primitive = boolean | number | string | null;
|
|
7
|
+
|
|
8
|
+
type Serializable = primitive | Readonly<{
|
|
9
|
+
[key: string]: Serializable;
|
|
10
|
+
}> | ReadonlyArray<Serializable>;
|
|
11
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
12
|
+
|
|
13
|
+
type Effectors<T> = {
|
|
14
|
+
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
|
|
15
|
+
onSet: (callback: (options: {
|
|
16
|
+
newValue: T;
|
|
17
|
+
oldValue: T;
|
|
18
|
+
}) => void) => void;
|
|
19
|
+
};
|
|
20
|
+
type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
|
|
21
|
+
type AtomOptions<T> = {
|
|
22
|
+
key: string;
|
|
23
|
+
default: T | (() => T);
|
|
24
|
+
effects?: AtomEffect<T>[];
|
|
25
|
+
};
|
|
26
|
+
type MutableAtomOptions<T extends Transceiver<any>, J extends Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
|
|
27
|
+
default: () => T;
|
|
28
|
+
mutable: true;
|
|
29
|
+
};
|
|
30
|
+
type AtomFamilyOptions<T, K extends Serializable> = {
|
|
31
|
+
key: string;
|
|
32
|
+
default: T | ((key: K) => T);
|
|
33
|
+
effects?: (key: K) => AtomEffect<T>[];
|
|
34
|
+
};
|
|
35
|
+
type AtomFamily<T, K extends Serializable = Serializable> = ((key: K) => AtomToken<T>) & {
|
|
36
|
+
key: string;
|
|
37
|
+
type: `atom_family`;
|
|
38
|
+
subject: Subject<AtomToken<T>>;
|
|
39
|
+
};
|
|
40
|
+
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Serializable, K extends Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
41
|
+
mutable: true;
|
|
42
|
+
};
|
|
43
|
+
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
44
|
+
key: `${string}::mutable`;
|
|
45
|
+
type: `atom_family`;
|
|
46
|
+
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare const LoggerIconDictionary: {
|
|
50
|
+
readonly "\u231B": "Timeline event fully captured";
|
|
51
|
+
readonly "\u23E9": "Timeline redo";
|
|
52
|
+
readonly "\u23EA": "Timeline undo";
|
|
53
|
+
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
54
|
+
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
55
|
+
readonly "\u23F3": "Timeline event partially captured";
|
|
56
|
+
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
57
|
+
readonly "\uD83D\uDC81": "Notice";
|
|
58
|
+
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
59
|
+
readonly "\u2705": "Realtime transaction success";
|
|
60
|
+
readonly "\u2728": "Computation complete";
|
|
61
|
+
readonly "\u274C": "Conflict prevents attempted action";
|
|
62
|
+
readonly "\u2B55": "Operation start";
|
|
63
|
+
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
64
|
+
readonly "\uD83D\uDC40": "Subscription added";
|
|
65
|
+
readonly "\uD83D\uDC6A": "Family member added";
|
|
66
|
+
readonly "\uD83D\uDCC1": "Stow update";
|
|
67
|
+
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
68
|
+
readonly "\uD83D\uDCD6": "Read state";
|
|
69
|
+
readonly "\uD83D\uDCDD": "Write state";
|
|
70
|
+
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
71
|
+
readonly "\uD83D\uDD0C": "Register dependency";
|
|
72
|
+
readonly "\uD83D\uDD0D": "Discover root";
|
|
73
|
+
readonly "\uD83D\uDD25": "Delete state";
|
|
74
|
+
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
75
|
+
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
76
|
+
readonly "\uD83D\uDD34": "Operation complete";
|
|
77
|
+
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
78
|
+
readonly "\uD83D\uDCA5": "Caught";
|
|
79
|
+
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
80
|
+
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
81
|
+
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
82
|
+
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
83
|
+
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
84
|
+
readonly "\uD83E\uDDEE": "Computing selector";
|
|
85
|
+
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
86
|
+
readonly "\uD83E\uDE82": "Abort transaction";
|
|
87
|
+
};
|
|
88
|
+
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
89
|
+
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
90
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
91
|
+
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
92
|
+
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
93
|
+
type Logger = Record<LogLevel, LogFn>;
|
|
94
|
+
declare class AtomIOLogger implements Logger {
|
|
95
|
+
logLevel: `error` | `info` | `warn` | null;
|
|
96
|
+
private readonly filter?;
|
|
97
|
+
private readonly logger;
|
|
98
|
+
constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
|
|
99
|
+
error: LogFn;
|
|
100
|
+
info: LogFn;
|
|
101
|
+
warn: LogFn;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type TransactionToken<_> = {
|
|
105
|
+
key: string;
|
|
106
|
+
type: `transaction`;
|
|
107
|
+
__brand?: _;
|
|
108
|
+
};
|
|
109
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
110
|
+
key: string;
|
|
111
|
+
updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
|
|
112
|
+
params: Parameters<ƒ>;
|
|
113
|
+
output: ReturnType<ƒ>;
|
|
114
|
+
};
|
|
115
|
+
type Transactors = {
|
|
116
|
+
get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
|
|
117
|
+
set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
|
|
118
|
+
};
|
|
119
|
+
type ReadonlyTransactors = Pick<Transactors, `get`>;
|
|
120
|
+
type Read<ƒ extends ƒn> = (transactors: ReadonlyTransactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
121
|
+
type Write<ƒ extends ƒn> = (transactors: Transactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
122
|
+
type Act<ƒ extends ƒn> = (transactors: Transactors & {
|
|
123
|
+
run: typeof runTransaction;
|
|
124
|
+
}, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
125
|
+
type TransactionOptions<ƒ extends ƒn> = {
|
|
126
|
+
key: string;
|
|
127
|
+
do: Act<ƒ>;
|
|
128
|
+
};
|
|
129
|
+
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
130
|
+
|
|
131
|
+
type SelectorOptions<T> = {
|
|
132
|
+
key: string;
|
|
133
|
+
get: Read<() => T>;
|
|
134
|
+
set: Write<(newValue: T) => void>;
|
|
135
|
+
};
|
|
136
|
+
type ReadonlySelectorOptions<T> = {
|
|
137
|
+
key: string;
|
|
138
|
+
get: Read<() => T>;
|
|
139
|
+
};
|
|
140
|
+
type SelectorFamilyOptions<T, K extends Serializable> = {
|
|
141
|
+
key: string;
|
|
142
|
+
get: (key: K) => Read<() => T>;
|
|
143
|
+
set: (key: K) => Write<(newValue: T) => void>;
|
|
144
|
+
};
|
|
145
|
+
type ReadonlySelectorFamilyOptions<T, K extends Serializable> = {
|
|
146
|
+
key: string;
|
|
147
|
+
get: (key: K) => Read<() => T>;
|
|
148
|
+
};
|
|
149
|
+
type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
150
|
+
key: string;
|
|
151
|
+
type: `selector_family`;
|
|
152
|
+
subject: Subject<SelectorToken<T>>;
|
|
153
|
+
};
|
|
154
|
+
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
155
|
+
key: string;
|
|
156
|
+
type: `readonly_selector_family`;
|
|
157
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
type StateUpdate<T> = {
|
|
161
|
+
newValue: T;
|
|
162
|
+
oldValue: T;
|
|
163
|
+
};
|
|
164
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
165
|
+
key: string;
|
|
166
|
+
family?: FamilyMetadata;
|
|
167
|
+
};
|
|
168
|
+
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
169
|
+
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
170
|
+
|
|
171
|
+
type TimelineToken = {
|
|
172
|
+
key: string;
|
|
173
|
+
type: `timeline`;
|
|
174
|
+
};
|
|
175
|
+
type TimelineOptions = {
|
|
176
|
+
key: string;
|
|
177
|
+
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
178
|
+
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
179
|
+
};
|
|
180
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
181
|
+
|
|
182
|
+
type ƒn = (...parameters: any[]) => any;
|
|
183
|
+
type AtomToken<_> = {
|
|
184
|
+
key: string;
|
|
185
|
+
type: `atom`;
|
|
186
|
+
family?: FamilyMetadata;
|
|
187
|
+
__brand?: _;
|
|
188
|
+
};
|
|
189
|
+
interface MutableAtomToken<T extends Transceiver<any>, J extends Serializable> extends AtomToken<T> {
|
|
190
|
+
__asJSON?: J;
|
|
191
|
+
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
192
|
+
}
|
|
193
|
+
type SelectorToken<_> = {
|
|
194
|
+
key: string;
|
|
195
|
+
type: `selector`;
|
|
196
|
+
family?: FamilyMetadata;
|
|
197
|
+
__brand?: _;
|
|
198
|
+
};
|
|
199
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
200
|
+
type ReadonlySelectorToken<_> = {
|
|
201
|
+
key: string;
|
|
202
|
+
type: `readonly_selector`;
|
|
203
|
+
family?: FamilyMetadata;
|
|
204
|
+
__brand?: _;
|
|
205
|
+
};
|
|
206
|
+
type FamilyMetadata = {
|
|
207
|
+
key: string;
|
|
208
|
+
subKey: string;
|
|
209
|
+
};
|
|
3
210
|
|
|
4
211
|
declare class Subject<T> {
|
|
5
212
|
Subscriber: (value: T) => void;
|
|
@@ -103,13 +310,6 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
103
310
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
104
311
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
105
312
|
|
|
106
|
-
type primitive = boolean | number | string | null;
|
|
107
|
-
|
|
108
|
-
type Serializable = primitive | Readonly<{
|
|
109
|
-
[key: string]: Serializable;
|
|
110
|
-
}> | ReadonlyArray<Serializable>;
|
|
111
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
112
|
-
|
|
113
313
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
114
314
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
115
315
|
|
|
@@ -184,26 +384,26 @@ interface Lineage {
|
|
|
184
384
|
declare function newest<T extends Lineage>(scion: T): T;
|
|
185
385
|
declare function eldest<T extends Lineage>(scion: T): T;
|
|
186
386
|
|
|
187
|
-
interface Transceiver<Signal extends
|
|
387
|
+
interface Transceiver<Signal extends Serializable> {
|
|
188
388
|
do: (update: Signal) => void;
|
|
189
389
|
undo: (update: Signal) => void;
|
|
190
390
|
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
191
391
|
cacheUpdateNumber: number;
|
|
192
392
|
getUpdateNumber: (update: Signal) => number;
|
|
193
393
|
}
|
|
194
|
-
declare function isTransceiver(value: unknown): value is Transceiver<
|
|
394
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Serializable>;
|
|
195
395
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
196
396
|
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
197
397
|
|
|
198
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends
|
|
398
|
+
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
199
399
|
|
|
200
|
-
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends
|
|
400
|
+
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
|
|
201
401
|
|
|
202
|
-
declare const getJsonFamily: <Core extends Transceiver<
|
|
402
|
+
declare const getJsonFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
203
403
|
|
|
204
|
-
declare const getJsonToken: <Core extends Transceiver<
|
|
404
|
+
declare const getJsonToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
205
405
|
|
|
206
|
-
declare const getUpdateToken: <Core extends Transceiver<
|
|
406
|
+
declare const getUpdateToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
207
407
|
|
|
208
408
|
declare function isAtomTokenMutable(token: AtomToken<any>): token is MutableAtomToken<any, any>;
|
|
209
409
|
|
|
@@ -218,12 +418,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
218
418
|
private unsubscribeFromInnerValue;
|
|
219
419
|
private observeCore;
|
|
220
420
|
private updateCore;
|
|
221
|
-
mutableState: MutableAtomToken<Mutable,
|
|
421
|
+
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
222
422
|
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
223
|
-
constructor(mutableState: MutableAtomToken<Mutable,
|
|
423
|
+
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
224
424
|
}
|
|
225
425
|
|
|
226
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends
|
|
426
|
+
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Serializable> {
|
|
227
427
|
private readonly Update;
|
|
228
428
|
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
229
429
|
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
@@ -380,12 +580,12 @@ declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
|
380
580
|
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
381
581
|
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
382
582
|
|
|
383
|
-
declare function createAtomFamily<T, K extends
|
|
583
|
+
declare function createAtomFamily<T, K extends Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
384
584
|
|
|
385
|
-
declare function createReadonlySelectorFamily<T, K extends
|
|
585
|
+
declare function createReadonlySelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
386
586
|
|
|
387
|
-
declare function createSelectorFamily<T, K extends
|
|
388
|
-
declare function createSelectorFamily<T, K extends
|
|
587
|
+
declare function createSelectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
588
|
+
declare function createSelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
389
589
|
|
|
390
590
|
declare class LazyMap<K, V> extends Map<K, V> {
|
|
391
591
|
protected readonly source: Map<K, V>;
|
|
@@ -411,4 +611,10 @@ declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((
|
|
|
411
611
|
|
|
412
612
|
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
413
613
|
|
|
414
|
-
|
|
614
|
+
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
615
|
+
|
|
616
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
617
|
+
|
|
618
|
+
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
619
|
+
|
|
620
|
+
export { type Atom, type AtomKey, FamilyTracker, Future, IMPLICIT, LazyMap, type Lineage, type Modify, type MutableAtom, NotFoundError, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionMeta, type TransactionPhase, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, createTimeline, createTransaction, deleteAtom, deleteSelector, deposit, eldest, evictCachedValue, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, redoTransactionUpdate, registerSelector, setAtomOrSelector, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, undoTransactionUpdate, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
|