atom.io 0.14.5 → 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.
@@ -1,268 +0,0 @@
1
- import { FamilyMetadata, ƒn, TransactionUpdate, MutableAtomToken, AtomToken, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, AtomIOLogger, Logger } from 'atom.io';
2
- import * as React from 'react';
3
-
4
- declare class Subject<T> {
5
- Subscriber: (value: T) => void;
6
- subscribers: Map<string, this[`Subscriber`]>;
7
- subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
8
- private unsubscribe;
9
- next(value: T): void;
10
- }
11
- declare class StatefulSubject<T> extends Subject<T> {
12
- state: T;
13
- constructor(initialState: T);
14
- next(value: T): void;
15
- }
16
-
17
- type Selector<T> = {
18
- key: string;
19
- type: `selector`;
20
- family?: FamilyMetadata;
21
- install: (store: Store) => void;
22
- subject: Subject<{
23
- newValue: T;
24
- oldValue: T;
25
- }>;
26
- get: () => T;
27
- set: (newValue: T | ((oldValue: T) => T)) => void;
28
- };
29
- type ReadonlySelector<T> = {
30
- key: string;
31
- type: `readonly_selector`;
32
- family?: FamilyMetadata;
33
- install: (store: Store) => void;
34
- subject: Subject<{
35
- newValue: T;
36
- oldValue: T;
37
- }>;
38
- get: () => T;
39
- };
40
-
41
- type Transaction<ƒ extends ƒn> = {
42
- key: string;
43
- type: `transaction`;
44
- install: (store: Store) => void;
45
- subject: Subject<TransactionUpdate<ƒ>>;
46
- run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
47
- };
48
-
49
- type TransactionMeta<ƒ extends ƒn> = {
50
- phase: `applying` | `building`;
51
- time: number;
52
- update: TransactionUpdate<ƒ>;
53
- };
54
-
55
- type primitive = boolean | number | string | null;
56
-
57
- type Serializable = primitive | Readonly<{
58
- [key: string]: Serializable;
59
- }> | ReadonlyArray<Serializable>;
60
- type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
61
-
62
- type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
63
- type Cardinality = `1:1` | `1:n` | `n:n`;
64
-
65
- interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
66
- readonly relations: [string, string[]][];
67
- readonly contents: [string, Content][];
68
- }
69
- interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
70
- readonly between: [a: ASide, b: BSide];
71
- readonly cardinality: Cardinality;
72
- }
73
- type BaseExternalStoreConfiguration = {
74
- addRelation: (a: string, b: string) => void;
75
- deleteRelation: (a: string, b: string) => void;
76
- replaceRelationsSafely: (a: string, bs: string[]) => void;
77
- replaceRelationsUnsafely: (a: string, bs: string[]) => void;
78
- getRelatedKeys: (key: string) => Set<string> | undefined;
79
- has: (a: string, b?: string) => boolean;
80
- };
81
- type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
82
- getContent: (contentKey: string) => Content | undefined;
83
- setContent: (contentKey: string, content: Content) => void;
84
- deleteContent: (contentKey: string) => void;
85
- };
86
- type Empty<Obj extends object> = {
87
- [Key in keyof Obj]?: undefined;
88
- };
89
- type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
90
- type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
91
- externalStore?: ExternalStoreConfiguration<Content>;
92
- isContent?: Refinement<unknown, Content>;
93
- makeContentKey?: (a: string, b: string) => string;
94
- };
95
- type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
96
- declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
97
- readonly a: ASide;
98
- readonly b: BSide;
99
- readonly cardinality: Cardinality;
100
- readonly relations: Map<string, Set<string>>;
101
- readonly contents: Map<string, Content>;
102
- isContent: Refinement<unknown, Content> | null;
103
- makeContentKey: (a: string, b: string) => string;
104
- getRelatedKeys(key: string): Set<string> | undefined;
105
- protected addRelation(a: string, b: string): void;
106
- protected deleteRelation(a: string, b: string): void;
107
- protected replaceRelationsUnsafely(a: string, bs: string[]): void;
108
- protected replaceRelationsSafely(a: string, bs: string[]): void;
109
- protected getContentInternal(contentKey: string): Content | undefined;
110
- protected setContent(contentKey: string, content: Content): void;
111
- protected deleteContent(contentKey: string): void;
112
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
113
- toJSON(): JunctionJSON<ASide, BSide, Content>;
114
- set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
115
- set(relation: {
116
- [Key in ASide | BSide]: string;
117
- }, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
118
- delete(a: string, b?: string): this;
119
- delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
120
- getRelatedKey(key: string): string | undefined;
121
- replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
122
- reckless: boolean;
123
- }): this;
124
- getContent(a: string, b: string): Content | undefined;
125
- getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
126
- has(a: string, b?: string): boolean;
127
- }
128
-
129
- interface Lineage {
130
- parent: typeof this | null;
131
- child: typeof this | null;
132
- }
133
-
134
- interface Transceiver<Signal extends Serializable> {
135
- do: (update: Signal) => void;
136
- undo: (update: Signal) => void;
137
- subscribe: (key: string, fn: (update: Signal) => void) => () => void;
138
- cacheUpdateNumber: number;
139
- getUpdateNumber: (update: Signal) => number;
140
- }
141
-
142
- /**
143
- * @internal Give the tracker a transceiver state and a store, and it will
144
- * subscribe to the transceiver's inner value. When the inner value changes,
145
- * the tracker will update its own state to reflect the change.
146
- */
147
- declare class Tracker<Mutable extends Transceiver<any>> {
148
- private Update;
149
- private initializeState;
150
- private unsubscribeFromInnerValue;
151
- private observeCore;
152
- private updateCore;
153
- mutableState: MutableAtomToken<Mutable, Serializable>;
154
- latestUpdateState: AtomToken<typeof this.Update | null>;
155
- constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
156
- }
157
-
158
- interface MutableAtom<T> extends Atom<T> {
159
- mutable: true;
160
- }
161
-
162
- type OperationProgress = {
163
- open: false;
164
- } | {
165
- open: true;
166
- done: Set<string>;
167
- prev: Map<string, any>;
168
- time: number;
169
- token: StateToken<any>;
170
- };
171
-
172
- type TimelineAtomUpdate = StateUpdate<unknown> & {
173
- key: string;
174
- type: `atom_update`;
175
- timestamp: number;
176
- family?: FamilyMetadata;
177
- };
178
- type TimelineSelectorUpdate = {
179
- key: string;
180
- type: `selector_update`;
181
- timestamp: number;
182
- atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
183
- };
184
- type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
185
- key: string;
186
- type: `transaction_update`;
187
- timestamp: number;
188
- };
189
- type Timeline = {
190
- type: `timeline`;
191
- key: string;
192
- at: number;
193
- shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
194
- timeTraveling: `into_future` | `into_past` | null;
195
- history: TimelineUpdate[];
196
- selectorTime: number | null;
197
- transactionKey: string | null;
198
- install: (store: Store) => void;
199
- subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
200
- };
201
-
202
- declare class Store implements Lineage {
203
- parent: Store | null;
204
- child: Store | null;
205
- valueMap: Map<string, any>;
206
- atoms: Map<string, Atom<any> | MutableAtom<any>>;
207
- selectors: Map<string, Selector<any>>;
208
- readonlySelectors: Map<string, ReadonlySelector<any>>;
209
- trackers: Map<string, Tracker<Transceiver<any>>>;
210
- families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
211
- timelines: Map<string, Timeline>;
212
- transactions: Map<string, Transaction<ƒn>>;
213
- atomsThatAreDefault: Set<string>;
214
- timelineAtoms: Junction<"timelineKey", "atomKey", null>;
215
- selectorAtoms: Junction<"selectorKey", "atomKey", null>;
216
- selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
217
- source: string;
218
- }>;
219
- subject: {
220
- atomCreation: Subject<AtomToken<unknown>>;
221
- selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
222
- transactionCreation: Subject<TransactionToken<ƒn>>;
223
- timelineCreation: Subject<TimelineToken>;
224
- transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
225
- operationStatus: Subject<OperationProgress>;
226
- };
227
- operation: OperationProgress;
228
- transactionMeta: TransactionMeta<ƒn> | null;
229
- config: {
230
- name: string;
231
- };
232
- loggers: AtomIOLogger[];
233
- logger: Logger;
234
- constructor(name: string, store?: Store | null);
235
- }
236
-
237
- type Atom<T> = {
238
- key: string;
239
- type: `atom`;
240
- mutable?: boolean;
241
- family?: FamilyMetadata;
242
- install: (store: Store) => void;
243
- subject: Subject<{
244
- newValue: T;
245
- oldValue: T;
246
- }>;
247
- default: T | (() => T);
248
- cleanup?: () => void;
249
- };
250
-
251
- declare const StoreContext: React.Context<Store>;
252
- declare const StoreProvider: React.FC<{
253
- children: React.ReactNode;
254
- store?: Store;
255
- }>;
256
-
257
- declare function useI<T>(token: StateToken<T>): <New extends T>(next: New | ((old: T) => New)) => void;
258
- declare function useO<T>(token: ReadonlySelectorToken<T> | StateToken<T>): T;
259
- declare function useJSON<Serializable extends Serializable>(token: MutableAtomToken<any, Serializable>): Serializable;
260
- type TimelineMeta = {
261
- at: number;
262
- length: number;
263
- undo: () => void;
264
- redo: () => void;
265
- };
266
- declare function useTL(token: TimelineToken): TimelineMeta;
267
-
268
- export { StoreContext, StoreProvider, type TimelineMeta, useI, useJSON, useO, useTL };
@@ -1,341 +0,0 @@
1
- import * as atom_io from 'atom.io';
2
- import { FamilyMetadata, ƒn, TransactionUpdate, MutableAtomToken, AtomToken, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, AtomIOLogger, Logger } from 'atom.io';
3
-
4
- type ClassSignature = abstract new (...args: any) => any;
5
-
6
- type RefinementStrategy = ClassSignature | Refinement$1<unknown, any>;
7
- type Supported<Refine extends RefinementStrategy> = Refine extends Refinement$1<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
8
- type RefinementSupport = Record<string, RefinementStrategy>;
9
- declare class Refinery<SupportedTypes extends RefinementSupport> {
10
- supported: SupportedTypes;
11
- constructor(supported: SupportedTypes);
12
- refine(input: unknown): {
13
- [K in keyof SupportedTypes]: {
14
- type: K;
15
- data: Supported<SupportedTypes[K]>;
16
- };
17
- }[keyof SupportedTypes] | null;
18
- }
19
-
20
- interface Refinement$1<A, B extends A> {
21
- (a: A): a is B;
22
- }
23
-
24
- type PlainObject = Record<keyof any, unknown>;
25
-
26
- declare class Subject<T> {
27
- Subscriber: (value: T) => void;
28
- subscribers: Map<string, this[`Subscriber`]>;
29
- subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
30
- private unsubscribe;
31
- next(value: T): void;
32
- }
33
- declare class StatefulSubject<T> extends Subject<T> {
34
- state: T;
35
- constructor(initialState: T);
36
- next(value: T): void;
37
- }
38
-
39
- type Selector<T> = {
40
- key: string;
41
- type: `selector`;
42
- family?: FamilyMetadata;
43
- install: (store: Store) => void;
44
- subject: Subject<{
45
- newValue: T;
46
- oldValue: T;
47
- }>;
48
- get: () => T;
49
- set: (newValue: T | ((oldValue: T) => T)) => void;
50
- };
51
- type ReadonlySelector<T> = {
52
- key: string;
53
- type: `readonly_selector`;
54
- family?: FamilyMetadata;
55
- install: (store: Store) => void;
56
- subject: Subject<{
57
- newValue: T;
58
- oldValue: T;
59
- }>;
60
- get: () => T;
61
- };
62
-
63
- type Transaction<ƒ extends ƒn> = {
64
- key: string;
65
- type: `transaction`;
66
- install: (store: Store) => void;
67
- subject: Subject<TransactionUpdate<ƒ>>;
68
- run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
69
- };
70
-
71
- type TransactionMeta<ƒ extends ƒn> = {
72
- phase: `applying` | `building`;
73
- time: number;
74
- update: TransactionUpdate<ƒ>;
75
- };
76
-
77
- type primitive = boolean | number | string | null;
78
-
79
- type Serializable = primitive | Readonly<{
80
- [key: string]: Serializable;
81
- }> | ReadonlyArray<Serializable>;
82
- type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
83
-
84
- type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
85
- type Cardinality = `1:1` | `1:n` | `n:n`;
86
-
87
- interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
88
- readonly relations: [string, string[]][];
89
- readonly contents: [string, Content][];
90
- }
91
- interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
92
- readonly between: [a: ASide, b: BSide];
93
- readonly cardinality: Cardinality;
94
- }
95
- type BaseExternalStoreConfiguration = {
96
- addRelation: (a: string, b: string) => void;
97
- deleteRelation: (a: string, b: string) => void;
98
- replaceRelationsSafely: (a: string, bs: string[]) => void;
99
- replaceRelationsUnsafely: (a: string, bs: string[]) => void;
100
- getRelatedKeys: (key: string) => Set<string> | undefined;
101
- has: (a: string, b?: string) => boolean;
102
- };
103
- type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
104
- getContent: (contentKey: string) => Content | undefined;
105
- setContent: (contentKey: string, content: Content) => void;
106
- deleteContent: (contentKey: string) => void;
107
- };
108
- type Empty<Obj extends object> = {
109
- [Key in keyof Obj]?: undefined;
110
- };
111
- type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
112
- type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
113
- externalStore?: ExternalStoreConfiguration<Content>;
114
- isContent?: Refinement<unknown, Content>;
115
- makeContentKey?: (a: string, b: string) => string;
116
- };
117
- type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
118
- declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
119
- readonly a: ASide;
120
- readonly b: BSide;
121
- readonly cardinality: Cardinality;
122
- readonly relations: Map<string, Set<string>>;
123
- readonly contents: Map<string, Content>;
124
- isContent: Refinement<unknown, Content> | null;
125
- makeContentKey: (a: string, b: string) => string;
126
- getRelatedKeys(key: string): Set<string> | undefined;
127
- protected addRelation(a: string, b: string): void;
128
- protected deleteRelation(a: string, b: string): void;
129
- protected replaceRelationsUnsafely(a: string, bs: string[]): void;
130
- protected replaceRelationsSafely(a: string, bs: string[]): void;
131
- protected getContentInternal(contentKey: string): Content | undefined;
132
- protected setContent(contentKey: string, content: Content): void;
133
- protected deleteContent(contentKey: string): void;
134
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
135
- toJSON(): JunctionJSON<ASide, BSide, Content>;
136
- set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
137
- set(relation: {
138
- [Key in ASide | BSide]: string;
139
- }, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
140
- delete(a: string, b?: string): this;
141
- delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
142
- getRelatedKey(key: string): string | undefined;
143
- replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
144
- reckless: boolean;
145
- }): this;
146
- getContent(a: string, b: string): Content | undefined;
147
- getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
148
- has(a: string, b?: string): boolean;
149
- }
150
-
151
- interface Lineage {
152
- parent: typeof this | null;
153
- child: typeof this | null;
154
- }
155
-
156
- interface Transceiver<Signal extends Serializable> {
157
- do: (update: Signal) => void;
158
- undo: (update: Signal) => void;
159
- subscribe: (key: string, fn: (update: Signal) => void) => () => void;
160
- cacheUpdateNumber: number;
161
- getUpdateNumber: (update: Signal) => number;
162
- }
163
-
164
- /**
165
- * @internal Give the tracker a transceiver state and a store, and it will
166
- * subscribe to the transceiver's inner value. When the inner value changes,
167
- * the tracker will update its own state to reflect the change.
168
- */
169
- declare class Tracker<Mutable extends Transceiver<any>> {
170
- private Update;
171
- private initializeState;
172
- private unsubscribeFromInnerValue;
173
- private observeCore;
174
- private updateCore;
175
- mutableState: MutableAtomToken<Mutable, Serializable>;
176
- latestUpdateState: AtomToken<typeof this.Update | null>;
177
- constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
178
- }
179
-
180
- interface MutableAtom<T> extends Atom<T> {
181
- mutable: true;
182
- }
183
-
184
- type OperationProgress = {
185
- open: false;
186
- } | {
187
- open: true;
188
- done: Set<string>;
189
- prev: Map<string, any>;
190
- time: number;
191
- token: StateToken<any>;
192
- };
193
-
194
- type TimelineAtomUpdate = StateUpdate<unknown> & {
195
- key: string;
196
- type: `atom_update`;
197
- timestamp: number;
198
- family?: FamilyMetadata;
199
- };
200
- type TimelineSelectorUpdate = {
201
- key: string;
202
- type: `selector_update`;
203
- timestamp: number;
204
- atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
205
- };
206
- type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
207
- key: string;
208
- type: `transaction_update`;
209
- timestamp: number;
210
- };
211
- type Timeline = {
212
- type: `timeline`;
213
- key: string;
214
- at: number;
215
- shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
216
- timeTraveling: `into_future` | `into_past` | null;
217
- history: TimelineUpdate[];
218
- selectorTime: number | null;
219
- transactionKey: string | null;
220
- install: (store: Store) => void;
221
- subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
222
- };
223
-
224
- declare class Store implements Lineage {
225
- parent: Store | null;
226
- child: Store | null;
227
- valueMap: Map<string, any>;
228
- atoms: Map<string, Atom<any> | MutableAtom<any>>;
229
- selectors: Map<string, Selector<any>>;
230
- readonlySelectors: Map<string, ReadonlySelector<any>>;
231
- trackers: Map<string, Tracker<Transceiver<any>>>;
232
- families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
233
- timelines: Map<string, Timeline>;
234
- transactions: Map<string, Transaction<ƒn>>;
235
- atomsThatAreDefault: Set<string>;
236
- timelineAtoms: Junction<"timelineKey", "atomKey", null>;
237
- selectorAtoms: Junction<"selectorKey", "atomKey", null>;
238
- selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
239
- source: string;
240
- }>;
241
- subject: {
242
- atomCreation: Subject<AtomToken<unknown>>;
243
- selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
244
- transactionCreation: Subject<TransactionToken<ƒn>>;
245
- timelineCreation: Subject<TimelineToken>;
246
- transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
247
- operationStatus: Subject<OperationProgress>;
248
- };
249
- operation: OperationProgress;
250
- transactionMeta: TransactionMeta<ƒn> | null;
251
- config: {
252
- name: string;
253
- };
254
- loggers: AtomIOLogger[];
255
- logger: Logger;
256
- constructor(name: string, store?: Store | null);
257
- }
258
-
259
- type Atom<T> = {
260
- key: string;
261
- type: `atom`;
262
- mutable?: boolean;
263
- family?: FamilyMetadata;
264
- install: (store: Store) => void;
265
- subject: Subject<{
266
- newValue: T;
267
- oldValue: T;
268
- }>;
269
- default: T | (() => T);
270
- cleanup?: () => void;
271
- };
272
-
273
- type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
274
-
275
- type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = {
276
- key: string;
277
- familyMembers: Record<string, Token>;
278
- };
279
- type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
280
-
281
- type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
282
-
283
- type Delta = {
284
- summary: string;
285
- added?: [path: string, addedStringifiedValue: string][];
286
- removed?: [path: string, removedStringifiedValue: string][];
287
- changed?: [path: string, delta: Delta][];
288
- };
289
- type Diff<T> = (a: T, b: T) => Delta;
290
- type DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta;
291
- declare class Differ<Leaf extends Record<string, any>, Tree extends Record<string, any>> {
292
- leafRefinery: Refinery<Leaf>;
293
- treeRefinery: Refinery<Tree>;
294
- leafDiffers: {
295
- [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
296
- };
297
- treeDiffers: {
298
- [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
299
- };
300
- constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
301
- [KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
302
- } & {
303
- [KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
304
- });
305
- diff(a: unknown, b: unknown): Delta;
306
- }
307
-
308
- declare const AtomIODevtools: () => JSX.Element;
309
-
310
- declare const atomIndex: atom_io.ReadonlySelectorToken<AtomTokenIndex>;
311
- declare const selectorIndex: atom_io.ReadonlySelectorToken<SelectorTokenIndex>;
312
- declare const transactionIndex: atom_io.ReadonlySelectorToken<atom_io.TransactionToken<atom_io.ƒn>[]>;
313
- declare const findTransactionLogState: atom_io.ReadonlySelectorFamily<atom_io.TransactionUpdate<atom_io.ƒn>[]>;
314
- declare const timelineIndex: atom_io.ReadonlySelectorToken<atom_io.TimelineToken[]>;
315
- declare const findTimelineState: atom_io.ReadonlySelectorFamily<Timeline>;
316
- declare const devtoolsAreOpenState: atom_io.AtomToken<boolean>;
317
- type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
318
- declare const devtoolsViewSelectionState: atom_io.AtomToken<DevtoolsView>;
319
- declare const devtoolsViewOptionsState: atom_io.AtomToken<DevtoolsView[]>;
320
- declare const findViewIsOpenState: atom_io.AtomFamily<boolean, string>;
321
- declare const primitiveRefinery: Refinery<{
322
- number: (input: unknown) => input is number;
323
- string: (input: unknown) => input is string;
324
- boolean: (input: unknown) => input is boolean;
325
- null: (input: unknown) => input is null;
326
- }>;
327
- declare const jsonTreeRefinery: Refinery<{
328
- object: (input: unknown) => input is PlainObject;
329
- array: (input: unknown) => input is unknown[];
330
- }>;
331
- declare const prettyJson: Differ<{
332
- number: (input: unknown) => input is number;
333
- string: (input: unknown) => input is string;
334
- boolean: (input: unknown) => input is boolean;
335
- null: (input: unknown) => input is null;
336
- }, {
337
- object: (input: unknown) => input is PlainObject;
338
- array: (input: unknown) => input is unknown[];
339
- }>;
340
-
341
- export { AtomIODevtools, atomIndex, devtoolsAreOpenState, devtoolsViewOptionsState, devtoolsViewSelectionState, findTimelineState, findTransactionLogState, findViewIsOpenState, jsonTreeRefinery, prettyJson, primitiveRefinery, selectorIndex, timelineIndex, transactionIndex };