atom.io 0.14.0 → 0.14.2
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 +1421 -52
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.cts +317 -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-C4YZZNRH.js +67 -0
- package/dist/chunk-C4YZZNRH.js.map +1 -0
- package/dist/chunk-CWKKQKVQ.js +68 -0
- package/dist/chunk-CWKKQKVQ.js.map +1 -0
- package/dist/chunk-GMN5KH6A.js +309 -0
- package/dist/chunk-GMN5KH6A.js.map +1 -0
- package/dist/chunk-N7ADBQJG.js +176 -0
- package/dist/chunk-N7ADBQJG.js.map +1 -0
- package/dist/chunk-NYCVSXQB.js +181 -0
- package/dist/chunk-NYCVSXQB.js.map +1 -0
- package/dist/chunk-PURABO5G.js +2581 -0
- package/dist/chunk-PURABO5G.js.map +1 -0
- package/dist/index.cjs +2330 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +272 -22
- package/dist/index.js +1 -152
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/internal/dist/index.cjs +299 -106
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +231 -30
- package/internal/dist/index.js +1 -2240
- package/internal/dist/index.js.map +1 -1
- package/internal/package.json +5 -5
- package/internal/src/atom/create-atom.ts +3 -1
- package/internal/src/families/create-atom-family.ts +3 -4
- package/internal/src/mutable/get-update-family.ts +23 -0
- package/internal/src/mutable/index.ts +1 -4
- package/internal/src/mutable/is-mutable.ts +44 -0
- package/internal/src/mutable/tracker.ts +9 -2
- package/internal/src/subject.ts +2 -1
- package/internal/src/timeline/add-atom-to-timeline.ts +10 -1
- package/internal/src/timeline/create-timeline.ts +44 -16
- package/introspection/dist/index.cjs +1566 -46
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.cts +376 -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 +1505 -8
- package/json/dist/index.cjs.map +1 -1
- package/json/dist/index.d.cts +373 -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 +5 -4
- package/react/dist/index.cjs +1549 -14
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +377 -4
- package/react/dist/index.js +2 -68
- package/react/dist/index.js.map +1 -1
- package/react/package.json +5 -5
- package/react-devtools/dist/index.cjs +2216 -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 +150 -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 +1530 -35
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.cts +384 -12
- package/realtime-client/dist/index.js +2 -165
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/package.json +5 -5
- package/realtime-react/dist/index.cjs +1727 -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 +1549 -58
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.cts +394 -11
- package/realtime-server/dist/index.js +27 -21
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/package.json +6 -6
- package/realtime-testing/dist/index.cjs +2377 -16
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.cts +489 -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/atom.ts +3 -1
- package/transceivers/set-rtx/dist/index.cjs +32 -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 -421
- package/internal/dist/metafile-cjs.json +0 -1
- package/internal/dist/metafile-esm.json +0 -1
- package/internal/src/mutable/is-atom-token-mutable.ts +0 -7
- 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 -23
- 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 -22
- 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,6 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
mutable?: boolean;
|
|
40
|
+
};
|
|
41
|
+
type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Serializable, K extends Serializable> = AtomFamilyOptions<T, K> & JsonInterface<T, J> & {
|
|
42
|
+
mutable: true;
|
|
43
|
+
};
|
|
44
|
+
type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends Serializable> = JsonInterface<Core, SerializableCore> & ((key: Key) => MutableAtomToken<Core, SerializableCore>) & {
|
|
45
|
+
key: `${string}`;
|
|
46
|
+
type: `atom_family`;
|
|
47
|
+
subject: Subject<MutableAtomToken<Core, SerializableCore>>;
|
|
48
|
+
mutable: true;
|
|
49
|
+
};
|
|
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 class AtomIOLogger implements Logger {
|
|
97
|
+
logLevel: `error` | `info` | `warn` | null;
|
|
98
|
+
private readonly filter?;
|
|
99
|
+
private readonly logger;
|
|
100
|
+
constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
|
|
101
|
+
error: LogFn;
|
|
102
|
+
info: LogFn;
|
|
103
|
+
warn: LogFn;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type TransactionToken<_> = {
|
|
107
|
+
key: string;
|
|
108
|
+
type: `transaction`;
|
|
109
|
+
__brand?: _;
|
|
110
|
+
};
|
|
111
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
112
|
+
key: string;
|
|
113
|
+
updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
|
|
114
|
+
params: Parameters<ƒ>;
|
|
115
|
+
output: ReturnType<ƒ>;
|
|
116
|
+
};
|
|
117
|
+
type Transactors = {
|
|
118
|
+
get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
|
|
119
|
+
set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
|
|
120
|
+
};
|
|
121
|
+
type ReadonlyTransactors = Pick<Transactors, `get`>;
|
|
122
|
+
type Read<ƒ extends ƒn> = (transactors: ReadonlyTransactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
123
|
+
type Write<ƒ extends ƒn> = (transactors: Transactors, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
124
|
+
type Act<ƒ extends ƒn> = (transactors: Transactors & {
|
|
125
|
+
run: typeof runTransaction;
|
|
126
|
+
}, ...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
127
|
+
type TransactionOptions<ƒ extends ƒn> = {
|
|
128
|
+
key: string;
|
|
129
|
+
do: Act<ƒ>;
|
|
130
|
+
};
|
|
131
|
+
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
132
|
+
|
|
133
|
+
type SelectorOptions<T> = {
|
|
134
|
+
key: string;
|
|
135
|
+
get: Read<() => T>;
|
|
136
|
+
set: Write<(newValue: T) => void>;
|
|
137
|
+
};
|
|
138
|
+
type ReadonlySelectorOptions<T> = {
|
|
139
|
+
key: string;
|
|
140
|
+
get: Read<() => T>;
|
|
141
|
+
};
|
|
142
|
+
type SelectorFamilyOptions<T, K extends Serializable> = {
|
|
143
|
+
key: string;
|
|
144
|
+
get: (key: K) => Read<() => T>;
|
|
145
|
+
set: (key: K) => Write<(newValue: T) => void>;
|
|
146
|
+
};
|
|
147
|
+
type ReadonlySelectorFamilyOptions<T, K extends Serializable> = {
|
|
148
|
+
key: string;
|
|
149
|
+
get: (key: K) => Read<() => T>;
|
|
150
|
+
};
|
|
151
|
+
type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
152
|
+
key: string;
|
|
153
|
+
type: `selector_family`;
|
|
154
|
+
subject: Subject<SelectorToken<T>>;
|
|
155
|
+
};
|
|
156
|
+
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
157
|
+
key: string;
|
|
158
|
+
type: `readonly_selector_family`;
|
|
159
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type StateUpdate<T> = {
|
|
163
|
+
newValue: T;
|
|
164
|
+
oldValue: T;
|
|
165
|
+
};
|
|
166
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
167
|
+
key: string;
|
|
168
|
+
family?: FamilyMetadata;
|
|
169
|
+
};
|
|
170
|
+
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
171
|
+
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
172
|
+
|
|
173
|
+
type TimelineToken = {
|
|
174
|
+
key: string;
|
|
175
|
+
type: `timeline`;
|
|
176
|
+
};
|
|
177
|
+
type TimelineOptions = {
|
|
178
|
+
key: string;
|
|
179
|
+
atoms: (AtomFamily<any, any> | AtomToken<any>)[];
|
|
180
|
+
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
181
|
+
};
|
|
182
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
183
|
+
|
|
184
|
+
type ƒn = (...parameters: any[]) => any;
|
|
185
|
+
type AtomToken<_> = {
|
|
186
|
+
key: string;
|
|
187
|
+
type: `atom`;
|
|
188
|
+
family?: FamilyMetadata;
|
|
189
|
+
__brand?: _;
|
|
190
|
+
};
|
|
191
|
+
interface MutableAtomToken<T extends Transceiver<any>, J extends Serializable> extends AtomToken<T> {
|
|
192
|
+
__asJSON?: J;
|
|
193
|
+
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
194
|
+
}
|
|
195
|
+
type SelectorToken<_> = {
|
|
196
|
+
key: string;
|
|
197
|
+
type: `selector`;
|
|
198
|
+
family?: FamilyMetadata;
|
|
199
|
+
__brand?: _;
|
|
200
|
+
};
|
|
201
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
202
|
+
type ReadonlySelectorToken<_> = {
|
|
203
|
+
key: string;
|
|
204
|
+
type: `readonly_selector`;
|
|
205
|
+
family?: FamilyMetadata;
|
|
206
|
+
__brand?: _;
|
|
207
|
+
};
|
|
208
|
+
type FamilyMetadata = {
|
|
209
|
+
key: string;
|
|
210
|
+
subKey: string;
|
|
211
|
+
};
|
|
4
212
|
|
|
5
213
|
declare class Subject<T> {
|
|
6
214
|
Subscriber: (value: T) => void;
|
|
@@ -104,13 +312,6 @@ declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T
|
|
|
104
312
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
105
313
|
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
106
314
|
|
|
107
|
-
type primitive = boolean | number | string | null;
|
|
108
|
-
|
|
109
|
-
type Serializable = primitive | Readonly<{
|
|
110
|
-
[key: string]: Serializable;
|
|
111
|
-
}> | ReadonlyArray<Serializable>;
|
|
112
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
113
|
-
|
|
114
315
|
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
115
316
|
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
116
317
|
|
|
@@ -185,28 +386,28 @@ interface Lineage {
|
|
|
185
386
|
declare function newest<T extends Lineage>(scion: T): T;
|
|
186
387
|
declare function eldest<T extends Lineage>(scion: T): T;
|
|
187
388
|
|
|
188
|
-
interface Transceiver<Signal extends
|
|
389
|
+
interface Transceiver<Signal extends Serializable> {
|
|
189
390
|
do: (update: Signal) => void;
|
|
190
391
|
undo: (update: Signal) => void;
|
|
191
392
|
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
192
393
|
cacheUpdateNumber: number;
|
|
193
394
|
getUpdateNumber: (update: Signal) => number;
|
|
194
395
|
}
|
|
195
|
-
declare function isTransceiver(value: unknown): value is Transceiver<
|
|
396
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Serializable>;
|
|
196
397
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
197
398
|
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
198
399
|
|
|
199
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends
|
|
400
|
+
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
200
401
|
|
|
201
|
-
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends
|
|
402
|
+
declare function createMutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends Serializable, Key extends string>(options: MutableAtomFamilyOptions<Core, SerializableCore, Key>, store: Store): MutableAtomFamily<Core, SerializableCore, Key>;
|
|
202
403
|
|
|
203
|
-
declare const getJsonFamily: <Core extends Transceiver<
|
|
404
|
+
declare const getJsonFamily: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable, Key extends string>(mutableAtomFamily: MutableAtomFamily<Core, SerializableCore, Key>, store: Store) => SelectorFamily<SerializableCore, Key>;
|
|
204
405
|
|
|
205
|
-
declare const getJsonToken: <Core extends Transceiver<
|
|
406
|
+
declare const getJsonToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
206
407
|
|
|
207
|
-
declare const getUpdateToken: <Core extends Transceiver<
|
|
408
|
+
declare const getUpdateToken: <Core extends Transceiver<Serializable>, SerializableCore extends Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
208
409
|
|
|
209
|
-
declare
|
|
410
|
+
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>;
|
|
210
411
|
|
|
211
412
|
/**
|
|
212
413
|
* @internal Give the tracker a transceiver state and a store, and it will
|
|
@@ -219,12 +420,12 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
219
420
|
private unsubscribeFromInnerValue;
|
|
220
421
|
private observeCore;
|
|
221
422
|
private updateCore;
|
|
222
|
-
mutableState: MutableAtomToken<Mutable,
|
|
423
|
+
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
223
424
|
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
224
|
-
constructor(mutableState: MutableAtomToken<Mutable,
|
|
425
|
+
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
225
426
|
}
|
|
226
427
|
|
|
227
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends
|
|
428
|
+
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Serializable> {
|
|
228
429
|
private readonly Update;
|
|
229
430
|
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
230
431
|
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
@@ -234,7 +435,6 @@ declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey exten
|
|
|
234
435
|
interface MutableAtom<T> extends Atom<T> {
|
|
235
436
|
mutable: true;
|
|
236
437
|
}
|
|
237
|
-
declare const isAtomMutable: <T>(atom: Atom<T>) => atom is MutableAtom<T>;
|
|
238
438
|
|
|
239
439
|
type OperationProgress = {
|
|
240
440
|
open: false;
|
|
@@ -342,6 +542,7 @@ declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T> | St
|
|
|
342
542
|
type Atom<T> = {
|
|
343
543
|
key: string;
|
|
344
544
|
type: `atom`;
|
|
545
|
+
mutable?: boolean;
|
|
345
546
|
family?: FamilyMetadata;
|
|
346
547
|
install: (store: Store) => void;
|
|
347
548
|
subject: Subject<{
|
|
@@ -381,12 +582,12 @@ declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
|
381
582
|
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
382
583
|
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
383
584
|
|
|
384
|
-
declare function createAtomFamily<T, K extends
|
|
585
|
+
declare function createAtomFamily<T, K extends Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
385
586
|
|
|
386
|
-
declare function createReadonlySelectorFamily<T, K extends
|
|
587
|
+
declare function createReadonlySelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
387
588
|
|
|
388
|
-
declare function createSelectorFamily<T, K extends
|
|
389
|
-
declare function createSelectorFamily<T, K extends
|
|
589
|
+
declare function createSelectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>, store: Store): SelectorFamily<T, K>;
|
|
590
|
+
declare function createSelectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
390
591
|
|
|
391
592
|
declare class LazyMap<K, V> extends Map<K, V> {
|
|
392
593
|
protected readonly source: Map<K, V>;
|
|
@@ -412,10 +613,10 @@ declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((
|
|
|
412
613
|
|
|
413
614
|
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
414
615
|
|
|
415
|
-
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store
|
|
616
|
+
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store): () => void;
|
|
416
617
|
|
|
417
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store
|
|
618
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store) => (() => void);
|
|
418
619
|
|
|
419
|
-
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store
|
|
620
|
+
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store) => (() => void);
|
|
420
621
|
|
|
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, getUpdateToken, isAtomDefault, isAtomKey,
|
|
622
|
+
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 };
|