atom.io 0.14.5 → 0.14.6
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.d.cts +11 -186
- package/data/dist/index.d.ts +11 -186
- package/dist/index.d.cts +245 -0
- package/dist/index.d.ts +245 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/internal/dist/index.d.cts +20 -18
- package/internal/dist/index.d.ts +20 -18
- package/introspection/dist/index.d.cts +4 -249
- package/introspection/dist/index.d.ts +4 -249
- package/json/dist/index.d.cts +3 -243
- package/json/dist/index.d.ts +3 -243
- package/package.json +2 -1
- package/react/dist/index.d.cts +4 -249
- package/react/dist/index.d.ts +4 -249
- package/react-devtools/dist/index.d.cts +4 -3
- package/react-devtools/dist/index.d.ts +4 -3
- package/realtime-client/dist/index.d.cts +9 -254
- package/realtime-client/dist/index.d.ts +9 -254
- package/realtime-react/dist/index.d.cts +7 -19
- package/realtime-react/dist/index.d.ts +7 -19
- package/realtime-server/dist/index.d.cts +9 -254
- package/realtime-server/dist/index.d.ts +9 -254
- package/transceivers/set-rtx/dist/index.d.cts +3 -29
- package/transceivers/set-rtx/dist/index.d.ts +3 -29
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import * as Internal from 'atom.io/internal';
|
|
2
|
+
import { Transceiver, Subject, Store, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate } from 'atom.io/internal';
|
|
3
|
+
import { Json, JsonInterface } from 'atom.io/json';
|
|
4
|
+
|
|
5
|
+
type Effectors<T> = {
|
|
6
|
+
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
|
|
7
|
+
onSet: (callback: (options: {
|
|
8
|
+
newValue: T;
|
|
9
|
+
oldValue: T;
|
|
10
|
+
}) => void) => void;
|
|
11
|
+
};
|
|
12
|
+
type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
|
|
13
|
+
type AtomOptions<T> = {
|
|
14
|
+
key: string;
|
|
15
|
+
default: T | (() => T);
|
|
16
|
+
effects?: AtomEffect<T>[];
|
|
17
|
+
};
|
|
18
|
+
type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
|
|
19
|
+
default: () => T;
|
|
20
|
+
mutable: true;
|
|
21
|
+
};
|
|
22
|
+
declare function atom<T extends Transceiver<any>, J extends Json.Serializable>(options: MutableAtomOptions<T, J>): MutableAtomToken<T, J>;
|
|
23
|
+
declare function atom<T>(options: AtomOptions<T>): AtomToken<T>;
|
|
24
|
+
type AtomFamilyOptions<T, K extends Json.Serializable> = {
|
|
25
|
+
key: string;
|
|
26
|
+
default: T | ((key: K) => T);
|
|
27
|
+
effects?: (key: K) => AtomEffect<T>[];
|
|
28
|
+
};
|
|
29
|
+
type AtomFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => AtomToken<T>) & {
|
|
30
|
+
key: string;
|
|
31
|
+
type: `atom_family`;
|
|
32
|
+
subject: Subject<AtomToken<T>>;
|
|
33
|
+
mutable?: boolean;
|
|
34
|
+
};
|
|
35
|
+
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
36
|
+
mutable: true;
|
|
37
|
+
};
|
|
38
|
+
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Json.Serializable, Key extends Json.Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
39
|
+
key: `${string}`;
|
|
40
|
+
type: `atom_family`;
|
|
41
|
+
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
42
|
+
mutable: true;
|
|
43
|
+
};
|
|
44
|
+
declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>;
|
|
45
|
+
declare function atomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>): AtomFamily<T, K>;
|
|
46
|
+
|
|
47
|
+
declare function dispose(token: ReadonlySelectorToken<any> | StateToken<any>, store?: Internal.Store): void;
|
|
48
|
+
|
|
49
|
+
declare function getState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store): T;
|
|
50
|
+
|
|
51
|
+
declare const LoggerIconDictionary: {
|
|
52
|
+
readonly "\u231B": "Timeline event fully captured";
|
|
53
|
+
readonly "\u23E9": "Timeline redo";
|
|
54
|
+
readonly "\u23EA": "Timeline undo";
|
|
55
|
+
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
56
|
+
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
57
|
+
readonly "\u23F3": "Timeline event partially captured";
|
|
58
|
+
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
59
|
+
readonly "\uD83D\uDC81": "Notice";
|
|
60
|
+
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
61
|
+
readonly "\u2705": "Realtime transaction success";
|
|
62
|
+
readonly "\u2728": "Computation complete";
|
|
63
|
+
readonly "\u274C": "Conflict prevents attempted action";
|
|
64
|
+
readonly "\u2B55": "Operation start";
|
|
65
|
+
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
66
|
+
readonly "\uD83D\uDC40": "Subscription added";
|
|
67
|
+
readonly "\uD83D\uDC6A": "Family member added";
|
|
68
|
+
readonly "\uD83D\uDCC1": "Stow update";
|
|
69
|
+
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
70
|
+
readonly "\uD83D\uDCD6": "Read state";
|
|
71
|
+
readonly "\uD83D\uDCDD": "Write state";
|
|
72
|
+
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
73
|
+
readonly "\uD83D\uDD0C": "Register dependency";
|
|
74
|
+
readonly "\uD83D\uDD0D": "Discover root";
|
|
75
|
+
readonly "\uD83D\uDD25": "Delete state";
|
|
76
|
+
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
77
|
+
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
78
|
+
readonly "\uD83D\uDD34": "Operation complete";
|
|
79
|
+
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
80
|
+
readonly "\uD83D\uDCA5": "Caught";
|
|
81
|
+
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
82
|
+
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
83
|
+
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
84
|
+
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
85
|
+
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
86
|
+
readonly "\uD83E\uDDEE": "Computing selector";
|
|
87
|
+
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
88
|
+
readonly "\uD83E\uDE82": "Abort transaction";
|
|
89
|
+
};
|
|
90
|
+
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
91
|
+
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
92
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
93
|
+
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
94
|
+
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
95
|
+
type Logger = Record<LogLevel, LogFn>;
|
|
96
|
+
declare const simpleLog: (logLevel: keyof Logger) => LogFn;
|
|
97
|
+
declare const simpleLogger: Logger;
|
|
98
|
+
declare class AtomIOLogger implements Logger {
|
|
99
|
+
logLevel: `error` | `info` | `warn` | null;
|
|
100
|
+
private readonly filter?;
|
|
101
|
+
private readonly logger;
|
|
102
|
+
constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
|
|
103
|
+
error: LogFn;
|
|
104
|
+
info: LogFn;
|
|
105
|
+
warn: LogFn;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type TransactionToken<_> = {
|
|
109
|
+
key: string;
|
|
110
|
+
type: `transaction`;
|
|
111
|
+
__brand?: _;
|
|
112
|
+
};
|
|
113
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
114
|
+
key: string;
|
|
115
|
+
updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
|
|
116
|
+
params: Parameters<ƒ>;
|
|
117
|
+
output: ReturnType<ƒ>;
|
|
118
|
+
};
|
|
119
|
+
type Transactors = {
|
|
120
|
+
get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
|
|
121
|
+
set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
|
|
122
|
+
};
|
|
123
|
+
type ReadonlyTransactors = Pick<Transactors, `get`>;
|
|
124
|
+
type Read<ƒ extends ƒn> = (transactors: ReadonlyTransactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
125
|
+
type Write<ƒ extends ƒn> = (transactors: Transactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
126
|
+
type Act<ƒ extends ƒn> = (transactors: Transactors & {
|
|
127
|
+
run: typeof runTransaction;
|
|
128
|
+
}, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
129
|
+
type TransactionOptions<ƒ extends ƒn> = {
|
|
130
|
+
key: string;
|
|
131
|
+
do: Act<ƒ>;
|
|
132
|
+
};
|
|
133
|
+
type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer ƒ> ? ƒ : never;
|
|
134
|
+
declare function transaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>): TransactionToken<ƒ>;
|
|
135
|
+
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
136
|
+
|
|
137
|
+
type SelectorOptions<T> = {
|
|
138
|
+
key: string;
|
|
139
|
+
get: Read<() => T>;
|
|
140
|
+
set: Write<(newValue: T) => void>;
|
|
141
|
+
};
|
|
142
|
+
type ReadonlySelectorOptions<T> = {
|
|
143
|
+
key: string;
|
|
144
|
+
get: Read<() => T>;
|
|
145
|
+
};
|
|
146
|
+
declare function selector<T>(options: SelectorOptions<T>): SelectorToken<T>;
|
|
147
|
+
declare function selector<T>(options: ReadonlySelectorOptions<T>): ReadonlySelectorToken<T>;
|
|
148
|
+
type SelectorFamilyOptions<T, K extends Json.Serializable> = {
|
|
149
|
+
key: string;
|
|
150
|
+
get: (key: K) => Read<() => T>;
|
|
151
|
+
set: (key: K) => Write<(newValue: T) => void>;
|
|
152
|
+
};
|
|
153
|
+
type ReadonlySelectorFamilyOptions<T, K extends Json.Serializable> = {
|
|
154
|
+
key: string;
|
|
155
|
+
get: (key: K) => Read<() => T>;
|
|
156
|
+
};
|
|
157
|
+
type SelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
158
|
+
key: string;
|
|
159
|
+
type: `selector_family`;
|
|
160
|
+
subject: Subject<SelectorToken<T>>;
|
|
161
|
+
};
|
|
162
|
+
type ReadonlySelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
163
|
+
key: string;
|
|
164
|
+
type: `readonly_selector_family`;
|
|
165
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
166
|
+
};
|
|
167
|
+
declare function selectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
|
|
168
|
+
declare function selectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
|
|
169
|
+
|
|
170
|
+
declare function setState<T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store): void;
|
|
171
|
+
|
|
172
|
+
declare class Silo {
|
|
173
|
+
store: Store;
|
|
174
|
+
atom: typeof atom;
|
|
175
|
+
atomFamily: typeof atomFamily;
|
|
176
|
+
selector: typeof selector;
|
|
177
|
+
selectorFamily: typeof selectorFamily;
|
|
178
|
+
transaction: typeof transaction;
|
|
179
|
+
timeline: typeof timeline;
|
|
180
|
+
getState: typeof getState;
|
|
181
|
+
setState: typeof setState;
|
|
182
|
+
subscribe: typeof subscribe;
|
|
183
|
+
undo: typeof undo;
|
|
184
|
+
redo: typeof redo;
|
|
185
|
+
constructor(name: string, fromStore?: Store | null);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
type StateUpdate<T> = {
|
|
189
|
+
newValue: T;
|
|
190
|
+
oldValue: T;
|
|
191
|
+
};
|
|
192
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
193
|
+
key: string;
|
|
194
|
+
family?: FamilyMetadata;
|
|
195
|
+
};
|
|
196
|
+
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
197
|
+
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
198
|
+
declare function subscribe<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key?: string, store?: Store): () => void;
|
|
199
|
+
declare function subscribe<ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key?: string, store?: Store): () => void;
|
|
200
|
+
declare function subscribe(token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key?: string, store?: Store): () => void;
|
|
201
|
+
|
|
202
|
+
type TimelineToken = {
|
|
203
|
+
key: string;
|
|
204
|
+
type: `timeline`;
|
|
205
|
+
};
|
|
206
|
+
type TimelineOptions = {
|
|
207
|
+
key: string;
|
|
208
|
+
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
209
|
+
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
210
|
+
};
|
|
211
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
212
|
+
declare const timeline: (options: TimelineOptions) => TimelineToken;
|
|
213
|
+
declare const redo: (timeline: TimelineToken) => void;
|
|
214
|
+
declare const undo: (timeline: TimelineToken) => void;
|
|
215
|
+
|
|
216
|
+
type ƒn = (...parameters: any[]) => any;
|
|
217
|
+
type AtomToken<_> = {
|
|
218
|
+
key: string;
|
|
219
|
+
type: `atom`;
|
|
220
|
+
family?: FamilyMetadata;
|
|
221
|
+
__brand?: _;
|
|
222
|
+
};
|
|
223
|
+
interface MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable> extends AtomToken<T> {
|
|
224
|
+
__asJSON?: J;
|
|
225
|
+
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
226
|
+
}
|
|
227
|
+
type SelectorToken<_> = {
|
|
228
|
+
key: string;
|
|
229
|
+
type: `selector`;
|
|
230
|
+
family?: FamilyMetadata;
|
|
231
|
+
__brand?: _;
|
|
232
|
+
};
|
|
233
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
234
|
+
type ReadonlySelectorToken<_> = {
|
|
235
|
+
key: string;
|
|
236
|
+
type: `readonly_selector`;
|
|
237
|
+
family?: FamilyMetadata;
|
|
238
|
+
__brand?: _;
|
|
239
|
+
};
|
|
240
|
+
type FamilyMetadata = {
|
|
241
|
+
key: string;
|
|
242
|
+
subKey: string;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export { type Act, type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, dispose, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo, type ƒn };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import * as Internal from 'atom.io/internal';
|
|
2
|
+
import { Transceiver, Subject, Store, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate } from 'atom.io/internal';
|
|
3
|
+
import { Json, JsonInterface } from 'atom.io/json';
|
|
4
|
+
|
|
5
|
+
type Effectors<T> = {
|
|
6
|
+
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void;
|
|
7
|
+
onSet: (callback: (options: {
|
|
8
|
+
newValue: T;
|
|
9
|
+
oldValue: T;
|
|
10
|
+
}) => void) => void;
|
|
11
|
+
};
|
|
12
|
+
type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
|
|
13
|
+
type AtomOptions<T> = {
|
|
14
|
+
key: string;
|
|
15
|
+
default: T | (() => T);
|
|
16
|
+
effects?: AtomEffect<T>[];
|
|
17
|
+
};
|
|
18
|
+
type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<AtomOptions<T>, `default`> & {
|
|
19
|
+
default: () => T;
|
|
20
|
+
mutable: true;
|
|
21
|
+
};
|
|
22
|
+
declare function atom<T extends Transceiver<any>, J extends Json.Serializable>(options: MutableAtomOptions<T, J>): MutableAtomToken<T, J>;
|
|
23
|
+
declare function atom<T>(options: AtomOptions<T>): AtomToken<T>;
|
|
24
|
+
type AtomFamilyOptions<T, K extends Json.Serializable> = {
|
|
25
|
+
key: string;
|
|
26
|
+
default: T | ((key: K) => T);
|
|
27
|
+
effects?: (key: K) => AtomEffect<T>[];
|
|
28
|
+
};
|
|
29
|
+
type AtomFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => AtomToken<T>) & {
|
|
30
|
+
key: string;
|
|
31
|
+
type: `atom_family`;
|
|
32
|
+
subject: Subject<AtomToken<T>>;
|
|
33
|
+
mutable?: boolean;
|
|
34
|
+
};
|
|
35
|
+
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
36
|
+
mutable: true;
|
|
37
|
+
};
|
|
38
|
+
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Json.Serializable, Key extends Json.Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
39
|
+
key: `${string}`;
|
|
40
|
+
type: `atom_family`;
|
|
41
|
+
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
42
|
+
mutable: true;
|
|
43
|
+
};
|
|
44
|
+
declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>;
|
|
45
|
+
declare function atomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>): AtomFamily<T, K>;
|
|
46
|
+
|
|
47
|
+
declare function dispose(token: ReadonlySelectorToken<any> | StateToken<any>, store?: Internal.Store): void;
|
|
48
|
+
|
|
49
|
+
declare function getState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store): T;
|
|
50
|
+
|
|
51
|
+
declare const LoggerIconDictionary: {
|
|
52
|
+
readonly "\u231B": "Timeline event fully captured";
|
|
53
|
+
readonly "\u23E9": "Timeline redo";
|
|
54
|
+
readonly "\u23EA": "Timeline undo";
|
|
55
|
+
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
56
|
+
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
57
|
+
readonly "\u23F3": "Timeline event partially captured";
|
|
58
|
+
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
59
|
+
readonly "\uD83D\uDC81": "Notice";
|
|
60
|
+
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
61
|
+
readonly "\u2705": "Realtime transaction success";
|
|
62
|
+
readonly "\u2728": "Computation complete";
|
|
63
|
+
readonly "\u274C": "Conflict prevents attempted action";
|
|
64
|
+
readonly "\u2B55": "Operation start";
|
|
65
|
+
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
66
|
+
readonly "\uD83D\uDC40": "Subscription added";
|
|
67
|
+
readonly "\uD83D\uDC6A": "Family member added";
|
|
68
|
+
readonly "\uD83D\uDCC1": "Stow update";
|
|
69
|
+
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
70
|
+
readonly "\uD83D\uDCD6": "Read state";
|
|
71
|
+
readonly "\uD83D\uDCDD": "Write state";
|
|
72
|
+
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
73
|
+
readonly "\uD83D\uDD0C": "Register dependency";
|
|
74
|
+
readonly "\uD83D\uDD0D": "Discover root";
|
|
75
|
+
readonly "\uD83D\uDD25": "Delete state";
|
|
76
|
+
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
77
|
+
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
78
|
+
readonly "\uD83D\uDD34": "Operation complete";
|
|
79
|
+
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
80
|
+
readonly "\uD83D\uDCA5": "Caught";
|
|
81
|
+
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
82
|
+
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
83
|
+
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
84
|
+
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
85
|
+
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
86
|
+
readonly "\uD83E\uDDEE": "Computing selector";
|
|
87
|
+
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
88
|
+
readonly "\uD83E\uDE82": "Abort transaction";
|
|
89
|
+
};
|
|
90
|
+
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
91
|
+
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
92
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
93
|
+
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
94
|
+
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
95
|
+
type Logger = Record<LogLevel, LogFn>;
|
|
96
|
+
declare const simpleLog: (logLevel: keyof Logger) => LogFn;
|
|
97
|
+
declare const simpleLogger: Logger;
|
|
98
|
+
declare class AtomIOLogger implements Logger {
|
|
99
|
+
logLevel: `error` | `info` | `warn` | null;
|
|
100
|
+
private readonly filter?;
|
|
101
|
+
private readonly logger;
|
|
102
|
+
constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
|
|
103
|
+
error: LogFn;
|
|
104
|
+
info: LogFn;
|
|
105
|
+
warn: LogFn;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type TransactionToken<_> = {
|
|
109
|
+
key: string;
|
|
110
|
+
type: `transaction`;
|
|
111
|
+
__brand?: _;
|
|
112
|
+
};
|
|
113
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
114
|
+
key: string;
|
|
115
|
+
updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
|
|
116
|
+
params: Parameters<ƒ>;
|
|
117
|
+
output: ReturnType<ƒ>;
|
|
118
|
+
};
|
|
119
|
+
type Transactors = {
|
|
120
|
+
get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
|
|
121
|
+
set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
|
|
122
|
+
};
|
|
123
|
+
type ReadonlyTransactors = Pick<Transactors, `get`>;
|
|
124
|
+
type Read<ƒ extends ƒn> = (transactors: ReadonlyTransactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
125
|
+
type Write<ƒ extends ƒn> = (transactors: Transactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
126
|
+
type Act<ƒ extends ƒn> = (transactors: Transactors & {
|
|
127
|
+
run: typeof runTransaction;
|
|
128
|
+
}, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
129
|
+
type TransactionOptions<ƒ extends ƒn> = {
|
|
130
|
+
key: string;
|
|
131
|
+
do: Act<ƒ>;
|
|
132
|
+
};
|
|
133
|
+
type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer ƒ> ? ƒ : never;
|
|
134
|
+
declare function transaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>): TransactionToken<ƒ>;
|
|
135
|
+
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
136
|
+
|
|
137
|
+
type SelectorOptions<T> = {
|
|
138
|
+
key: string;
|
|
139
|
+
get: Read<() => T>;
|
|
140
|
+
set: Write<(newValue: T) => void>;
|
|
141
|
+
};
|
|
142
|
+
type ReadonlySelectorOptions<T> = {
|
|
143
|
+
key: string;
|
|
144
|
+
get: Read<() => T>;
|
|
145
|
+
};
|
|
146
|
+
declare function selector<T>(options: SelectorOptions<T>): SelectorToken<T>;
|
|
147
|
+
declare function selector<T>(options: ReadonlySelectorOptions<T>): ReadonlySelectorToken<T>;
|
|
148
|
+
type SelectorFamilyOptions<T, K extends Json.Serializable> = {
|
|
149
|
+
key: string;
|
|
150
|
+
get: (key: K) => Read<() => T>;
|
|
151
|
+
set: (key: K) => Write<(newValue: T) => void>;
|
|
152
|
+
};
|
|
153
|
+
type ReadonlySelectorFamilyOptions<T, K extends Json.Serializable> = {
|
|
154
|
+
key: string;
|
|
155
|
+
get: (key: K) => Read<() => T>;
|
|
156
|
+
};
|
|
157
|
+
type SelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
158
|
+
key: string;
|
|
159
|
+
type: `selector_family`;
|
|
160
|
+
subject: Subject<SelectorToken<T>>;
|
|
161
|
+
};
|
|
162
|
+
type ReadonlySelectorFamily<T, K extends Json.Serializable = Json.Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
163
|
+
key: string;
|
|
164
|
+
type: `readonly_selector_family`;
|
|
165
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
166
|
+
};
|
|
167
|
+
declare function selectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
|
|
168
|
+
declare function selectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
|
|
169
|
+
|
|
170
|
+
declare function setState<T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store): void;
|
|
171
|
+
|
|
172
|
+
declare class Silo {
|
|
173
|
+
store: Store;
|
|
174
|
+
atom: typeof atom;
|
|
175
|
+
atomFamily: typeof atomFamily;
|
|
176
|
+
selector: typeof selector;
|
|
177
|
+
selectorFamily: typeof selectorFamily;
|
|
178
|
+
transaction: typeof transaction;
|
|
179
|
+
timeline: typeof timeline;
|
|
180
|
+
getState: typeof getState;
|
|
181
|
+
setState: typeof setState;
|
|
182
|
+
subscribe: typeof subscribe;
|
|
183
|
+
undo: typeof undo;
|
|
184
|
+
redo: typeof redo;
|
|
185
|
+
constructor(name: string, fromStore?: Store | null);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
type StateUpdate<T> = {
|
|
189
|
+
newValue: T;
|
|
190
|
+
oldValue: T;
|
|
191
|
+
};
|
|
192
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
193
|
+
key: string;
|
|
194
|
+
family?: FamilyMetadata;
|
|
195
|
+
};
|
|
196
|
+
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
197
|
+
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
198
|
+
declare function subscribe<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key?: string, store?: Store): () => void;
|
|
199
|
+
declare function subscribe<ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key?: string, store?: Store): () => void;
|
|
200
|
+
declare function subscribe(token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key?: string, store?: Store): () => void;
|
|
201
|
+
|
|
202
|
+
type TimelineToken = {
|
|
203
|
+
key: string;
|
|
204
|
+
type: `timeline`;
|
|
205
|
+
};
|
|
206
|
+
type TimelineOptions = {
|
|
207
|
+
key: string;
|
|
208
|
+
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
209
|
+
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
210
|
+
};
|
|
211
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
212
|
+
declare const timeline: (options: TimelineOptions) => TimelineToken;
|
|
213
|
+
declare const redo: (timeline: TimelineToken) => void;
|
|
214
|
+
declare const undo: (timeline: TimelineToken) => void;
|
|
215
|
+
|
|
216
|
+
type ƒn = (...parameters: any[]) => any;
|
|
217
|
+
type AtomToken<_> = {
|
|
218
|
+
key: string;
|
|
219
|
+
type: `atom`;
|
|
220
|
+
family?: FamilyMetadata;
|
|
221
|
+
__brand?: _;
|
|
222
|
+
};
|
|
223
|
+
interface MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable> extends AtomToken<T> {
|
|
224
|
+
__asJSON?: J;
|
|
225
|
+
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
226
|
+
}
|
|
227
|
+
type SelectorToken<_> = {
|
|
228
|
+
key: string;
|
|
229
|
+
type: `selector`;
|
|
230
|
+
family?: FamilyMetadata;
|
|
231
|
+
__brand?: _;
|
|
232
|
+
};
|
|
233
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
234
|
+
type ReadonlySelectorToken<_> = {
|
|
235
|
+
key: string;
|
|
236
|
+
type: `readonly_selector`;
|
|
237
|
+
family?: FamilyMetadata;
|
|
238
|
+
__brand?: _;
|
|
239
|
+
};
|
|
240
|
+
type FamilyMetadata = {
|
|
241
|
+
key: string;
|
|
242
|
+
subKey: string;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export { type Act, type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, dispose, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo, type ƒn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/atom.ts":{"bytes":2990,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/dispose.ts":{"bytes":431,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/get-state.ts":{"bytes":475,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/logger.ts":{"bytes":2714,"imports":[],"format":"esm"},"src/selector.ts":{"bytes":2080,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/set-state.ts":{"bytes":598,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/silo.ts":{"bytes":1914,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"src/index.ts","kind":"import-statement","original":"."}],"format":"esm"},"src/subscribe.ts":{"bytes":1696,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/timeline.ts":{"bytes":928,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/transaction.ts":{"bytes":1822,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1053,"imports":[{"path":"src/atom.ts","kind":"import-statement","original":"./atom"},{"path":"src/dispose.ts","kind":"import-statement","original":"./dispose"},{"path":"src/get-state.ts","kind":"import-statement","original":"./get-state"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"},{"path":"src/selector.ts","kind":"import-statement","original":"./selector"},{"path":"src/set-state.ts","kind":"import-statement","original":"./set-state"},{"path":"src/silo.ts","kind":"import-statement","original":"./silo"},{"path":"src/subscribe.ts","kind":"import-statement","original":"./subscribe"},{"path":"src/timeline.ts","kind":"import-statement","original":"./timeline"},{"path":"src/transaction.ts","kind":"import-statement","original":"./transaction"}],"format":"esm"}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":21949},"dist/index.cjs":{"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true}],"exports":["AtomIOLogger","LOG_LEVELS","Silo","atom","atomFamily","dispose","getState","redo","runTransaction","selector","selectorFamily","setState","simpleLog","simpleLogger","subscribe","timeline","transaction","undo"],"entryPoint":"src/index.ts","inputs":{"src/atom.ts":{"bytesInOutput":479},"src/index.ts":{"bytesInOutput":0},"src/dispose.ts":{"bytesInOutput":315},"src/get-state.ts":{"bytesInOutput":376},"src/logger.ts":{"bytesInOutput":1203},"src/selector.ts":{"bytesInOutput":280},"src/set-state.ts":{"bytesInOutput":511},"src/silo.ts":{"bytesInOutput":1431},"src/subscribe.ts":{"bytesInOutput":583},"src/timeline.ts":{"bytesInOutput":376},"src/transaction.ts":{"bytesInOutput":504}},"bytes":6491}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/atom.ts":{"bytes":2990,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/dispose.ts":{"bytes":431,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/get-state.ts":{"bytes":475,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/logger.ts":{"bytes":2714,"imports":[],"format":"esm"},"src/selector.ts":{"bytes":2080,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/set-state.ts":{"bytes":598,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/silo.ts":{"bytes":1914,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"src/index.ts","kind":"import-statement","original":"."}],"format":"esm"},"src/subscribe.ts":{"bytes":1696,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/timeline.ts":{"bytes":928,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/transaction.ts":{"bytes":1822,"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1053,"imports":[{"path":"src/atom.ts","kind":"import-statement","original":"./atom"},{"path":"src/dispose.ts","kind":"import-statement","original":"./dispose"},{"path":"src/get-state.ts","kind":"import-statement","original":"./get-state"},{"path":"src/logger.ts","kind":"import-statement","original":"./logger"},{"path":"src/selector.ts","kind":"import-statement","original":"./selector"},{"path":"src/set-state.ts","kind":"import-statement","original":"./set-state"},{"path":"src/silo.ts","kind":"import-statement","original":"./silo"},{"path":"src/subscribe.ts","kind":"import-statement","original":"./subscribe"},{"path":"src/timeline.ts","kind":"import-statement","original":"./timeline"},{"path":"src/transaction.ts","kind":"import-statement","original":"./transaction"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":21949},"dist/index.js":{"imports":[{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true},{"path":"atom.io/internal","kind":"import-statement","external":true}],"exports":["AtomIOLogger","LOG_LEVELS","Silo","atom","atomFamily","dispose","getState","redo","runTransaction","selector","selectorFamily","setState","simpleLog","simpleLogger","subscribe","timeline","transaction","undo"],"entryPoint":"src/index.ts","inputs":{"src/atom.ts":{"bytesInOutput":479},"src/index.ts":{"bytesInOutput":0},"src/dispose.ts":{"bytesInOutput":315},"src/get-state.ts":{"bytesInOutput":376},"src/logger.ts":{"bytesInOutput":1203},"src/selector.ts":{"bytesInOutput":280},"src/set-state.ts":{"bytesInOutput":511},"src/silo.ts":{"bytesInOutput":1431},"src/subscribe.ts":{"bytesInOutput":583},"src/timeline.ts":{"bytesInOutput":376},"src/transaction.ts":{"bytesInOutput":504}},"bytes":6491}}}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { FamilyMetadata, SelectorOptions, SelectorToken, ReadonlySelectorOptions, ReadonlySelectorToken, Transactors, StateToken, ƒn, TransactionUpdate, TransactionOptions, TransactionToken, AtomToken, MutableAtomOptions, MutableAtomToken, MutableAtomFamilyOptions, MutableAtomFamily, SelectorFamily, AtomFamily, StateUpdate, TimelineUpdate, TimelineOptions, TimelineToken, ReadonlySelectorFamily, AtomIOLogger, Logger, AtomOptions, AtomFamilyOptions, ReadonlySelectorFamilyOptions, SelectorFamilyOptions, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
|
|
2
|
+
import { Json } from 'atom.io/json';
|
|
3
|
+
import { Store as Store$1 } from 'atom.io/internal';
|
|
2
4
|
|
|
3
5
|
declare class Subject<T> {
|
|
4
6
|
Subscriber: (value: T) => void;
|
|
@@ -183,28 +185,28 @@ interface Lineage {
|
|
|
183
185
|
declare function newest<T extends Lineage>(scion: T): T;
|
|
184
186
|
declare function eldest<T extends Lineage>(scion: T): T;
|
|
185
187
|
|
|
186
|
-
interface Transceiver<Signal extends Serializable> {
|
|
188
|
+
interface Transceiver<Signal extends Json.Serializable> {
|
|
187
189
|
do: (update: Signal) => void;
|
|
188
190
|
undo: (update: Signal) => void;
|
|
189
191
|
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
190
192
|
cacheUpdateNumber: number;
|
|
191
193
|
getUpdateNumber: (update: Signal) => number;
|
|
192
194
|
}
|
|
193
|
-
declare function isTransceiver(value: unknown): value is Transceiver<Serializable>;
|
|
195
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable>;
|
|
194
196
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
195
197
|
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
196
198
|
|
|
197
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
199
|
+
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Json.Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
198
200
|
|
|
199
|
-
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
|
+
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Json.Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
|
|
200
202
|
|
|
201
|
-
declare const getJsonFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
203
|
+
declare const getJsonFamily: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
202
204
|
|
|
203
|
-
declare const getJsonToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
205
|
+
declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
204
206
|
|
|
205
|
-
declare const getUpdateToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
207
|
+
declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
206
208
|
|
|
207
|
-
declare const getUpdateFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
209
|
+
declare const getUpdateFamily: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => AtomFamily<Signal<Core> | null, Key>;
|
|
208
210
|
|
|
209
211
|
/**
|
|
210
212
|
* @internal Give the tracker a transceiver state and a store, and it will
|
|
@@ -217,12 +219,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
217
219
|
private unsubscribeFromInnerValue;
|
|
218
220
|
private observeCore;
|
|
219
221
|
private updateCore;
|
|
220
|
-
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
222
|
+
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
221
223
|
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
222
|
-
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
224
|
+
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Serializable> {
|
|
227
|
+
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Json.Serializable> {
|
|
226
228
|
private readonly Update;
|
|
227
229
|
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
228
230
|
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
@@ -379,12 +381,12 @@ declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
|
379
381
|
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
380
382
|
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
381
383
|
|
|
382
|
-
declare function createAtomFamily<T, K extends Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
384
|
+
declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
383
385
|
|
|
384
|
-
declare function createReadonlySelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
386
|
+
declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
385
387
|
|
|
386
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
387
|
-
declare function createSelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
388
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
389
|
+
declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
388
390
|
|
|
389
391
|
declare class LazyMap<K, V> extends Map<K, V> {
|
|
390
392
|
protected readonly source: Map<K, V>;
|
|
@@ -410,10 +412,10 @@ declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((
|
|
|
410
412
|
|
|
411
413
|
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
412
414
|
|
|
413
|
-
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
415
|
+
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store$1): () => void;
|
|
414
416
|
|
|
415
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
417
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store$1) => (() => void);
|
|
416
418
|
|
|
417
|
-
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
419
|
+
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store$1) => (() => void);
|
|
418
420
|
|
|
419
421
|
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, getUpdateFamily, getUpdateToken, isAtomDefault, isAtomKey, 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 };
|