atom.io 0.14.6 → 0.14.7
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/package.json +2 -2
- package/react/dist/index.cjs +4 -4
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.js +4 -4
- package/react/dist/index.js.map +1 -1
- package/react/src/store-hooks.ts +4 -4
- package/data/dist/index.d.cts +0 -158
- package/dist/index.d.cts +0 -245
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
- package/internal/dist/index.d.cts +0 -421
- package/introspection/dist/index.d.cts +0 -24
- package/json/dist/index.d.cts +0 -51
- package/react/dist/index.d.cts +0 -23
- package/react-devtools/dist/index.d.cts +0 -342
- package/realtime-client/dist/index.d.cts +0 -22
- package/realtime-react/dist/index.d.cts +0 -27
- package/realtime-server/dist/index.d.cts +0 -25
- package/realtime-testing/dist/index.d.cts +0 -49
- package/transceivers/set-rtx/dist/index.d.cts +0 -40
|
@@ -1,421 +0,0 @@
|
|
|
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';
|
|
4
|
-
|
|
5
|
-
declare class Subject<T> {
|
|
6
|
-
Subscriber: (value: T) => void;
|
|
7
|
-
subscribers: Map<string, this[`Subscriber`]>;
|
|
8
|
-
subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
|
|
9
|
-
private unsubscribe;
|
|
10
|
-
next(value: T): void;
|
|
11
|
-
}
|
|
12
|
-
declare class StatefulSubject<T> extends Subject<T> {
|
|
13
|
-
state: T;
|
|
14
|
-
constructor(initialState: T);
|
|
15
|
-
next(value: T): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type Selector<T> = {
|
|
19
|
-
key: string;
|
|
20
|
-
type: `selector`;
|
|
21
|
-
family?: FamilyMetadata;
|
|
22
|
-
install: (store: Store) => void;
|
|
23
|
-
subject: Subject<{
|
|
24
|
-
newValue: T;
|
|
25
|
-
oldValue: T;
|
|
26
|
-
}>;
|
|
27
|
-
get: () => T;
|
|
28
|
-
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
29
|
-
};
|
|
30
|
-
type ReadonlySelector<T> = {
|
|
31
|
-
key: string;
|
|
32
|
-
type: `readonly_selector`;
|
|
33
|
-
family?: FamilyMetadata;
|
|
34
|
-
install: (store: Store) => void;
|
|
35
|
-
subject: Subject<{
|
|
36
|
-
newValue: T;
|
|
37
|
-
oldValue: T;
|
|
38
|
-
}>;
|
|
39
|
-
get: () => T;
|
|
40
|
-
};
|
|
41
|
-
declare function createSelector<T>(options: SelectorOptions<T>, family: FamilyMetadata | undefined, store: Store): SelectorToken<T>;
|
|
42
|
-
declare function createSelector<T>(options: ReadonlySelectorOptions<T>, family: FamilyMetadata | undefined, store: Store): ReadonlySelectorToken<T>;
|
|
43
|
-
|
|
44
|
-
declare function deleteSelector(selectorToken: ReadonlySelectorToken<unknown> | SelectorToken<unknown>, store: Store): void;
|
|
45
|
-
|
|
46
|
-
type AtomKey<T> = string & {
|
|
47
|
-
__atomKey?: never;
|
|
48
|
-
__brand?: T;
|
|
49
|
-
};
|
|
50
|
-
type SelectorKey<T> = string & {
|
|
51
|
-
__selectorKey?: never;
|
|
52
|
-
__brand?: T;
|
|
53
|
-
};
|
|
54
|
-
type ReadonlySelectorKey<T> = string & {
|
|
55
|
-
__readonlySelectorKey?: never;
|
|
56
|
-
__brand?: T;
|
|
57
|
-
};
|
|
58
|
-
declare const isAtomKey: (key: string, store: Store) => key is AtomKey<unknown>;
|
|
59
|
-
declare const isSelectorKey: (key: string, store: Store) => key is SelectorKey<unknown>;
|
|
60
|
-
declare const isReadonlySelectorKey: (key: string, store: Store) => key is ReadonlySelectorKey<unknown>;
|
|
61
|
-
type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
|
|
62
|
-
declare const isStateKey: (key: string, store: Store) => key is StateKey<unknown>;
|
|
63
|
-
|
|
64
|
-
declare const getSelectorDependencyKeys: (key: string, store: Store) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
|
|
65
|
-
|
|
66
|
-
declare const registerSelector: (selectorKey: string, store: Store) => Transactors;
|
|
67
|
-
|
|
68
|
-
declare const traceSelectorAtoms: (selectorKey: string, directDependencyKey: StateKey<unknown>, store: Store) => AtomKey<unknown>[];
|
|
69
|
-
declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomKey<unknown>[];
|
|
70
|
-
|
|
71
|
-
declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => void;
|
|
72
|
-
|
|
73
|
-
declare const abortTransaction: (store: Store) => void;
|
|
74
|
-
|
|
75
|
-
declare const applyTransaction: <ƒ extends ƒn>(output: ReturnType<ƒ>, store: Store) => void;
|
|
76
|
-
|
|
77
|
-
declare const buildTransaction: (key: string, params: any[], store: Store) => void;
|
|
78
|
-
|
|
79
|
-
type Transaction<ƒ extends ƒn> = {
|
|
80
|
-
key: string;
|
|
81
|
-
type: `transaction`;
|
|
82
|
-
install: (store: Store) => void;
|
|
83
|
-
subject: Subject<TransactionUpdate<ƒ>>;
|
|
84
|
-
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
85
|
-
};
|
|
86
|
-
declare function createTransaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>, store: Store): TransactionToken<ƒ>;
|
|
87
|
-
|
|
88
|
-
declare const redoTransactionUpdate: <ƒ extends ƒn>(transactionUpdate: TransactionUpdate<ƒ>, store: Store) => void;
|
|
89
|
-
|
|
90
|
-
declare const undoTransactionUpdate: <ƒ extends ƒn>(transactionUpdate: TransactionUpdate<ƒ>, store: Store) => void;
|
|
91
|
-
|
|
92
|
-
declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
|
|
93
|
-
type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
|
|
94
|
-
type TransactionMeta<ƒ extends ƒn> = {
|
|
95
|
-
phase: `applying` | `building`;
|
|
96
|
-
time: number;
|
|
97
|
-
update: TransactionUpdate<ƒ>;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
declare function deposit<T>(state: Atom<T>): AtomToken<T>;
|
|
101
|
-
declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
|
|
102
|
-
declare function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>;
|
|
103
|
-
declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
|
|
104
|
-
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
105
|
-
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
106
|
-
|
|
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
|
-
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
115
|
-
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
116
|
-
|
|
117
|
-
interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
|
|
118
|
-
readonly relations: [string, string[]][];
|
|
119
|
-
readonly contents: [string, Content][];
|
|
120
|
-
}
|
|
121
|
-
interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
|
|
122
|
-
readonly between: [a: ASide, b: BSide];
|
|
123
|
-
readonly cardinality: Cardinality;
|
|
124
|
-
}
|
|
125
|
-
type BaseExternalStoreConfiguration = {
|
|
126
|
-
addRelation: (a: string, b: string) => void;
|
|
127
|
-
deleteRelation: (a: string, b: string) => void;
|
|
128
|
-
replaceRelationsSafely: (a: string, bs: string[]) => void;
|
|
129
|
-
replaceRelationsUnsafely: (a: string, bs: string[]) => void;
|
|
130
|
-
getRelatedKeys: (key: string) => Set<string> | undefined;
|
|
131
|
-
has: (a: string, b?: string) => boolean;
|
|
132
|
-
};
|
|
133
|
-
type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
|
|
134
|
-
getContent: (contentKey: string) => Content | undefined;
|
|
135
|
-
setContent: (contentKey: string, content: Content) => void;
|
|
136
|
-
deleteContent: (contentKey: string) => void;
|
|
137
|
-
};
|
|
138
|
-
type Empty<Obj extends object> = {
|
|
139
|
-
[Key in keyof Obj]?: undefined;
|
|
140
|
-
};
|
|
141
|
-
type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
|
|
142
|
-
type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
|
|
143
|
-
externalStore?: ExternalStoreConfiguration<Content>;
|
|
144
|
-
isContent?: Refinement<unknown, Content>;
|
|
145
|
-
makeContentKey?: (a: string, b: string) => string;
|
|
146
|
-
};
|
|
147
|
-
type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
|
|
148
|
-
declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
|
|
149
|
-
readonly a: ASide;
|
|
150
|
-
readonly b: BSide;
|
|
151
|
-
readonly cardinality: Cardinality;
|
|
152
|
-
readonly relations: Map<string, Set<string>>;
|
|
153
|
-
readonly contents: Map<string, Content>;
|
|
154
|
-
isContent: Refinement<unknown, Content> | null;
|
|
155
|
-
makeContentKey: (a: string, b: string) => string;
|
|
156
|
-
getRelatedKeys(key: string): Set<string> | undefined;
|
|
157
|
-
protected addRelation(a: string, b: string): void;
|
|
158
|
-
protected deleteRelation(a: string, b: string): void;
|
|
159
|
-
protected replaceRelationsUnsafely(a: string, bs: string[]): void;
|
|
160
|
-
protected replaceRelationsSafely(a: string, bs: string[]): void;
|
|
161
|
-
protected getContentInternal(contentKey: string): Content | undefined;
|
|
162
|
-
protected setContent(contentKey: string, content: Content): void;
|
|
163
|
-
protected deleteContent(contentKey: string): void;
|
|
164
|
-
constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
|
|
165
|
-
toJSON(): JunctionJSON<ASide, BSide, Content>;
|
|
166
|
-
set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
|
|
167
|
-
set(relation: {
|
|
168
|
-
[Key in ASide | BSide]: string;
|
|
169
|
-
}, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
|
|
170
|
-
delete(a: string, b?: string): this;
|
|
171
|
-
delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
|
|
172
|
-
getRelatedKey(key: string): string | undefined;
|
|
173
|
-
replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
|
|
174
|
-
reckless: boolean;
|
|
175
|
-
}): this;
|
|
176
|
-
getContent(a: string, b: string): Content | undefined;
|
|
177
|
-
getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
|
|
178
|
-
has(a: string, b?: string): boolean;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface Lineage {
|
|
182
|
-
parent: typeof this | null;
|
|
183
|
-
child: typeof this | null;
|
|
184
|
-
}
|
|
185
|
-
declare function newest<T extends Lineage>(scion: T): T;
|
|
186
|
-
declare function eldest<T extends Lineage>(scion: T): T;
|
|
187
|
-
|
|
188
|
-
interface Transceiver<Signal extends Json.Serializable> {
|
|
189
|
-
do: (update: Signal) => void;
|
|
190
|
-
undo: (update: Signal) => void;
|
|
191
|
-
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
192
|
-
cacheUpdateNumber: number;
|
|
193
|
-
getUpdateNumber: (update: Signal) => number;
|
|
194
|
-
}
|
|
195
|
-
declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable>;
|
|
196
|
-
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
197
|
-
type Signal<TVR extends Transceiver<any>> = TVR extends Transceiver<infer Signal> ? Signal : never;
|
|
198
|
-
|
|
199
|
-
declare function createMutableAtom<Core extends Transceiver<any>, SerializableCore extends Json.Serializable>(options: MutableAtomOptions<Core, SerializableCore>, store: Store): MutableAtomToken<Core, SerializableCore>;
|
|
200
|
-
|
|
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>;
|
|
202
|
-
|
|
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>;
|
|
204
|
-
|
|
205
|
-
declare const getJsonToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => SelectorToken<SerializableCore>;
|
|
206
|
-
|
|
207
|
-
declare const getUpdateToken: <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(mutableAtomToken: MutableAtomToken<Core, SerializableCore>) => AtomToken<Signal<Core>>;
|
|
208
|
-
|
|
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>;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* @internal Give the tracker a transceiver state and a store, and it will
|
|
213
|
-
* subscribe to the transceiver's inner value. When the inner value changes,
|
|
214
|
-
* the tracker will update its own state to reflect the change.
|
|
215
|
-
*/
|
|
216
|
-
declare class Tracker<Mutable extends Transceiver<any>> {
|
|
217
|
-
private Update;
|
|
218
|
-
private initializeState;
|
|
219
|
-
private unsubscribeFromInnerValue;
|
|
220
|
-
private observeCore;
|
|
221
|
-
private updateCore;
|
|
222
|
-
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
223
|
-
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
224
|
-
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
declare class FamilyTracker<Core extends Transceiver<any>, FamilyMemberKey extends Json.Serializable> {
|
|
228
|
-
private readonly Update;
|
|
229
|
-
readonly findLatestUpdateState: AtomFamily<typeof this.Update | null, FamilyMemberKey>;
|
|
230
|
-
readonly findMutableState: AtomFamily<Core, FamilyMemberKey>;
|
|
231
|
-
constructor(findMutableState: AtomFamily<Core, FamilyMemberKey>, store: Store);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
interface MutableAtom<T> extends Atom<T> {
|
|
235
|
-
mutable: true;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
type OperationProgress = {
|
|
239
|
-
open: false;
|
|
240
|
-
} | {
|
|
241
|
-
open: true;
|
|
242
|
-
done: Set<string>;
|
|
243
|
-
prev: Map<string, any>;
|
|
244
|
-
time: number;
|
|
245
|
-
token: StateToken<any>;
|
|
246
|
-
};
|
|
247
|
-
declare const openOperation: (token: StateToken<any>, store: Store) => `rejection` | undefined;
|
|
248
|
-
declare const closeOperation: (store: Store) => void;
|
|
249
|
-
declare const isDone: (key: string, store: Store) => boolean;
|
|
250
|
-
declare const markDone: (key: string, store: Store) => void;
|
|
251
|
-
|
|
252
|
-
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
253
|
-
key: string;
|
|
254
|
-
type: `atom_update`;
|
|
255
|
-
timestamp: number;
|
|
256
|
-
family?: FamilyMetadata;
|
|
257
|
-
};
|
|
258
|
-
type TimelineSelectorUpdate = {
|
|
259
|
-
key: string;
|
|
260
|
-
type: `selector_update`;
|
|
261
|
-
timestamp: number;
|
|
262
|
-
atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
|
|
263
|
-
};
|
|
264
|
-
type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
265
|
-
key: string;
|
|
266
|
-
type: `transaction_update`;
|
|
267
|
-
timestamp: number;
|
|
268
|
-
};
|
|
269
|
-
type Timeline = {
|
|
270
|
-
type: `timeline`;
|
|
271
|
-
key: string;
|
|
272
|
-
at: number;
|
|
273
|
-
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
274
|
-
timeTraveling: `into_future` | `into_past` | null;
|
|
275
|
-
history: TimelineUpdate[];
|
|
276
|
-
selectorTime: number | null;
|
|
277
|
-
transactionKey: string | null;
|
|
278
|
-
install: (store: Store) => void;
|
|
279
|
-
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
280
|
-
};
|
|
281
|
-
declare function createTimeline(options: TimelineOptions, store: Store, data?: Timeline): TimelineToken;
|
|
282
|
-
|
|
283
|
-
declare const addAtomToTimeline: (atomToken: AtomToken<any>, tl: Timeline, store: Store) => void;
|
|
284
|
-
|
|
285
|
-
declare const timeTravel: (direction: `backward` | `forward`, token: TimelineToken, store: Store) => void;
|
|
286
|
-
|
|
287
|
-
declare class Store implements Lineage {
|
|
288
|
-
parent: Store | null;
|
|
289
|
-
child: Store | null;
|
|
290
|
-
valueMap: Map<string, any>;
|
|
291
|
-
atoms: Map<string, Atom<any> | MutableAtom<any>>;
|
|
292
|
-
selectors: Map<string, Selector<any>>;
|
|
293
|
-
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
294
|
-
trackers: Map<string, Tracker<Transceiver<any>>>;
|
|
295
|
-
families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
|
|
296
|
-
timelines: Map<string, Timeline>;
|
|
297
|
-
transactions: Map<string, Transaction<ƒn>>;
|
|
298
|
-
atomsThatAreDefault: Set<string>;
|
|
299
|
-
timelineAtoms: Junction<"timelineKey", "atomKey", null>;
|
|
300
|
-
selectorAtoms: Junction<"selectorKey", "atomKey", null>;
|
|
301
|
-
selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
|
|
302
|
-
source: string;
|
|
303
|
-
}>;
|
|
304
|
-
subject: {
|
|
305
|
-
atomCreation: Subject<AtomToken<unknown>>;
|
|
306
|
-
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
307
|
-
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
308
|
-
timelineCreation: Subject<TimelineToken>;
|
|
309
|
-
transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
|
|
310
|
-
operationStatus: Subject<OperationProgress>;
|
|
311
|
-
};
|
|
312
|
-
operation: OperationProgress;
|
|
313
|
-
transactionMeta: TransactionMeta<ƒn> | null;
|
|
314
|
-
config: {
|
|
315
|
-
name: string;
|
|
316
|
-
};
|
|
317
|
-
loggers: AtomIOLogger[];
|
|
318
|
-
logger: Logger;
|
|
319
|
-
constructor(name: string, store?: Store | null);
|
|
320
|
-
}
|
|
321
|
-
declare const IMPLICIT: {
|
|
322
|
-
STORE_INTERNAL: Store | undefined;
|
|
323
|
-
readonly STORE: Store;
|
|
324
|
-
};
|
|
325
|
-
declare const clearStore: (store: Store) => void;
|
|
326
|
-
|
|
327
|
-
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
|
|
328
|
-
declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
|
|
329
|
-
declare function withdraw<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
|
|
330
|
-
declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
|
|
331
|
-
declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends ƒn ? T : never> | undefined;
|
|
332
|
-
declare function withdraw<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
|
|
333
|
-
declare function withdraw<T>(token: TimelineToken, store: Store): Timeline | undefined;
|
|
334
|
-
|
|
335
|
-
declare function withdrawNewFamilyMember<T>(token: AtomToken<T>, store: Store): Atom<T> | undefined;
|
|
336
|
-
declare function withdrawNewFamilyMember<T>(token: SelectorToken<T>, store: Store): Selector<T> | undefined;
|
|
337
|
-
declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T> | undefined;
|
|
338
|
-
declare function withdrawNewFamilyMember<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T> | undefined;
|
|
339
|
-
declare function withdrawNewFamilyMember<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T> | undefined;
|
|
340
|
-
|
|
341
|
-
type Atom<T> = {
|
|
342
|
-
key: string;
|
|
343
|
-
type: `atom`;
|
|
344
|
-
mutable?: boolean;
|
|
345
|
-
family?: FamilyMetadata;
|
|
346
|
-
install: (store: Store) => void;
|
|
347
|
-
subject: Subject<{
|
|
348
|
-
newValue: T;
|
|
349
|
-
oldValue: T;
|
|
350
|
-
}>;
|
|
351
|
-
default: T | (() => T);
|
|
352
|
-
cleanup?: () => void;
|
|
353
|
-
};
|
|
354
|
-
declare function createAtom<T>(options: AtomOptions<T> | MutableAtomOptions<any, any>, family: FamilyMetadata | undefined, store: Store): AtomToken<T>;
|
|
355
|
-
|
|
356
|
-
declare function deleteAtom(atomToken: AtomToken<unknown>, store: Store): void;
|
|
357
|
-
|
|
358
|
-
declare const isAtomDefault: (key: string, store: Store) => boolean;
|
|
359
|
-
declare const markAtomAsDefault: (key: string, store: Store) => void;
|
|
360
|
-
declare const markAtomAsNotDefault: (key: string, store: Store) => void;
|
|
361
|
-
declare const isSelectorDefault: (key: string, store: Store) => boolean;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* A Promise that can be canceled.
|
|
365
|
-
* @internal
|
|
366
|
-
* @private
|
|
367
|
-
* @typeParam T The type of the value that the promise will resolve to.
|
|
368
|
-
*
|
|
369
|
-
* @remarks
|
|
370
|
-
* Can be constructed like a Promise, or from an existing Promise.
|
|
371
|
-
*/
|
|
372
|
-
declare class Future<T> extends Promise<T> {
|
|
373
|
-
isCanceled: boolean;
|
|
374
|
-
constructor(executor: Promise<T> | ((resolve: (value: T) => void, reject: (reason?: any) => void) => void));
|
|
375
|
-
cancel(): void;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
declare function cacheValue<T>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): T;
|
|
379
|
-
declare function cacheValue<T extends Promise<any>>(key: string, value: T, subject: Subject<StateUpdate<unknown>>, store: Store): Future<T>;
|
|
380
|
-
declare const readCachedValue: <T>(key: string, store: Store) => T;
|
|
381
|
-
declare const isValueCached: (key: string, store: Store) => boolean;
|
|
382
|
-
declare const evictCachedValue: (key: string, store: Store) => void;
|
|
383
|
-
|
|
384
|
-
declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store: Store): AtomFamily<T, K>;
|
|
385
|
-
|
|
386
|
-
declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store: Store): ReadonlySelectorFamily<T, K>;
|
|
387
|
-
|
|
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>;
|
|
390
|
-
|
|
391
|
-
declare class LazyMap<K, V> extends Map<K, V> {
|
|
392
|
-
protected readonly source: Map<K, V>;
|
|
393
|
-
deleted: Set<K>;
|
|
394
|
-
constructor(source: Map<K, V>);
|
|
395
|
-
get(key: K): V | undefined;
|
|
396
|
-
set(key: K, value: V): this;
|
|
397
|
-
hasOwn(key: K): boolean;
|
|
398
|
-
has(key: K): boolean;
|
|
399
|
-
delete(key: K): boolean;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
declare class NotFoundError extends Error {
|
|
403
|
-
constructor(token: ReadonlySelectorToken<any> | StateToken<any>, store: Store);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
declare const readOrComputeValue: <T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>, store: Store) => T;
|
|
407
|
-
|
|
408
|
-
type Modify<T> = (thing: T) => T;
|
|
409
|
-
declare const become: <T>(nextVersionOfThing: T | Modify<T>) => (originalThing: T) => T;
|
|
410
|
-
|
|
411
|
-
declare const setAtomOrSelector: <T>(state: Atom<T> | Selector<T>, value: T | ((oldValue: T) => T), store: Store) => void;
|
|
412
|
-
|
|
413
|
-
declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
|
|
414
|
-
|
|
415
|
-
declare function subscribeToState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, key: string, store: Store$1): () => void;
|
|
416
|
-
|
|
417
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, key: string, store: Store$1) => (() => void);
|
|
418
|
-
|
|
419
|
-
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, key: string, store: Store$1) => (() => void);
|
|
420
|
-
|
|
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 };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AtomToken, ReadonlySelectorToken, SelectorToken, TransactionToken, ƒn, ReadonlySelectorFamily, TransactionUpdate, TimelineToken } from 'atom.io';
|
|
2
|
-
import * as Internal from 'atom.io/internal';
|
|
3
|
-
import { Timeline } from 'atom.io/internal';
|
|
4
|
-
|
|
5
|
-
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
6
|
-
|
|
7
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
8
|
-
|
|
9
|
-
declare const attachIntrospectionStates: (store?: Internal.Store) => {
|
|
10
|
-
atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
11
|
-
selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
12
|
-
transactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>;
|
|
13
|
-
findTransactionLogState: ReadonlySelectorFamily<TransactionUpdate<ƒn>[]>;
|
|
14
|
-
timelineIndex: ReadonlySelectorToken<TimelineToken[]>;
|
|
15
|
-
findTimelineState: ReadonlySelectorFamily<Timeline>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = {
|
|
19
|
-
key: string;
|
|
20
|
-
familyMembers: Record<string, Token>;
|
|
21
|
-
};
|
|
22
|
-
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
|
|
23
|
-
|
|
24
|
-
export { type FamilyNode, type StateTokenIndex, attachIntrospectionStates };
|
package/json/dist/index.d.cts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as AtomIO from 'atom.io';
|
|
2
|
-
import { Store } from 'atom.io/internal';
|
|
3
|
-
|
|
4
|
-
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
5
|
-
toJson: (t: T) => J;
|
|
6
|
-
fromJson: (json: J) => T;
|
|
7
|
-
};
|
|
8
|
-
declare const stringSetJsonInterface: JsonInterface<Set<string>, Array<string>>;
|
|
9
|
-
|
|
10
|
-
type primitive = boolean | number | string | null;
|
|
11
|
-
declare const isString: (input: unknown) => input is string;
|
|
12
|
-
declare const isNumber: (input: unknown) => input is number;
|
|
13
|
-
declare const isBoolean: (input: unknown) => input is boolean;
|
|
14
|
-
declare const isNull: (input: unknown) => input is null;
|
|
15
|
-
declare const isPrimitive: (input: unknown) => input is primitive;
|
|
16
|
-
|
|
17
|
-
type Serializable = primitive | Readonly<{
|
|
18
|
-
[key: string]: Serializable;
|
|
19
|
-
}> | ReadonlyArray<Serializable>;
|
|
20
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
21
|
-
type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
22
|
-
|
|
23
|
-
type json_Array<Element extends Serializable = Serializable> = Array<Element>;
|
|
24
|
-
type json_Serializable = Serializable;
|
|
25
|
-
declare namespace json {
|
|
26
|
-
export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare const parseJson: <S extends Stringified<Serializable>>(str: string | S) => S extends Stringified<infer J extends Serializable> ? J : Serializable;
|
|
30
|
-
type Stringified<J extends Serializable> = string & {
|
|
31
|
-
__json: J;
|
|
32
|
-
};
|
|
33
|
-
declare const stringifyJson: <J extends Serializable>(json: J) => Stringified<J>;
|
|
34
|
-
type Empty = Record<string, never>;
|
|
35
|
-
declare const JSON_TYPE_NAMES: readonly ["array", "boolean", "null", "number", "object", "string"];
|
|
36
|
-
type JsonTypeName = (typeof JSON_TYPE_NAMES)[number];
|
|
37
|
-
interface JsonTypes extends Record<JsonTypeName, Serializable> {
|
|
38
|
-
array: Array;
|
|
39
|
-
boolean: boolean;
|
|
40
|
-
null: null;
|
|
41
|
-
number: number;
|
|
42
|
-
object: Object$1;
|
|
43
|
-
string: string;
|
|
44
|
-
}
|
|
45
|
-
declare const JSON_DEFAULTS: JsonTypes;
|
|
46
|
-
|
|
47
|
-
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.SelectorToken<J>;
|
|
48
|
-
|
|
49
|
-
declare const selectJsonFamily: <T, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.AtomFamily<T, K>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.SelectorFamily<J, K>;
|
|
50
|
-
|
|
51
|
-
export { type Empty, JSON_DEFAULTS, JSON_TYPE_NAMES, json as Json, type JsonInterface, type JsonTypeName, type JsonTypes, type Stringified, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, type primitive, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson };
|
package/react/dist/index.d.cts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Store } from 'atom.io/internal';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { StateToken, ReadonlySelectorToken, MutableAtomToken, TimelineToken } from 'atom.io';
|
|
4
|
-
import { Json } from 'atom.io/json';
|
|
5
|
-
|
|
6
|
-
declare const StoreContext: React.Context<Store>;
|
|
7
|
-
declare const StoreProvider: React.FC<{
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
store?: Store;
|
|
10
|
-
}>;
|
|
11
|
-
|
|
12
|
-
declare function useI<T>(token: StateToken<T>): <New extends T>(next: New | ((old: T) => New)) => void;
|
|
13
|
-
declare function useO<T>(token: ReadonlySelectorToken<T> | StateToken<T>): T;
|
|
14
|
-
declare function useJSON<Serializable extends Json.Serializable>(token: MutableAtomToken<any, Serializable>): Serializable;
|
|
15
|
-
type TimelineMeta = {
|
|
16
|
-
at: number;
|
|
17
|
-
length: number;
|
|
18
|
-
undo: () => void;
|
|
19
|
-
redo: () => void;
|
|
20
|
-
};
|
|
21
|
-
declare function useTL(token: TimelineToken): TimelineMeta;
|
|
22
|
-
|
|
23
|
-
export { StoreContext, StoreProvider, type TimelineMeta, useI, useJSON, useO, useTL };
|