atom.io 0.6.7 → 0.6.9
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/dist/index.d.mts +241 -263
- package/dist/index.d.ts +241 -263
- package/dist/index.js +28 -1911
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1871
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +121 -176
- package/introspection/dist/index.d.ts +121 -176
- package/introspection/dist/index.js +6 -346
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +5 -324
- package/introspection/dist/index.mjs.map +1 -1
- package/json/dist/index.d.mts +37 -8
- package/json/dist/index.d.ts +37 -8
- package/json/dist/index.js +31 -48
- package/json/dist/index.js.map +1 -1
- package/json/dist/index.mjs +6 -14
- package/json/dist/index.mjs.map +1 -1
- package/package.json +30 -14
- package/react/dist/index.js +34 -83
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +7 -43
- package/react/dist/index.mjs.map +1 -1
- package/react-devtools/dist/index.css +1 -42
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +128 -193
- package/react-devtools/dist/index.d.ts +128 -193
- package/react-devtools/dist/index.js +56 -4154
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +19 -4117
- package/react-devtools/dist/index.mjs.map +1 -1
- package/realtime/dist/index.d.mts +7 -11
- package/realtime/dist/index.d.ts +7 -11
- package/realtime/dist/index.js +26 -185
- package/realtime/dist/index.js.map +1 -1
- package/realtime/dist/index.mjs +4 -149
- package/realtime/dist/index.mjs.map +1 -1
- package/realtime-react/dist/index.d.mts +12 -16
- package/realtime-react/dist/index.d.ts +12 -16
- package/realtime-react/dist/index.js +41 -214
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/dist/index.mjs +9 -169
- package/realtime-react/dist/index.mjs.map +1 -1
- package/src/atom.ts +7 -6
- package/src/index.ts +12 -9
- package/src/logger.ts +5 -5
- package/src/selector.ts +16 -14
- package/src/silo.ts +36 -39
- package/src/subscribe.ts +25 -20
- package/src/timeline.ts +9 -4
- package/src/transaction.ts +3 -4
- package/src/internal/atom-internal.ts +0 -54
- package/src/internal/families-internal.ts +0 -141
- package/src/internal/get.ts +0 -129
- package/src/internal/index.ts +0 -15
- package/src/internal/is-default.ts +0 -35
- package/src/internal/operation.ts +0 -139
- package/src/internal/selector/create-read-write-selector.ts +0 -66
- package/src/internal/selector/create-readonly-selector.ts +0 -46
- package/src/internal/selector/index.ts +0 -4
- package/src/internal/selector/lookup-selector-sources.ts +0 -16
- package/src/internal/selector/register-selector.ts +0 -57
- package/src/internal/selector/trace-selector-atoms.ts +0 -43
- package/src/internal/selector/update-selector-atoms.ts +0 -33
- package/src/internal/selector-internal.ts +0 -58
- package/src/internal/set.ts +0 -99
- package/src/internal/store.ts +0 -151
- package/src/internal/subject.ts +0 -24
- package/src/internal/subscribe-internal.ts +0 -88
- package/src/internal/time-travel-internal.ts +0 -91
- package/src/internal/timeline/add-atom-to-timeline.ts +0 -168
- package/src/internal/timeline/index.ts +0 -1
- package/src/internal/timeline-internal.ts +0 -107
- package/src/internal/transaction/abort-transaction.ts +0 -12
- package/src/internal/transaction/apply-transaction.ts +0 -57
- package/src/internal/transaction/build-transaction.ts +0 -33
- package/src/internal/transaction/index.ts +0 -25
- package/src/internal/transaction/redo-transaction.ts +0 -23
- package/src/internal/transaction/undo-transaction.ts +0 -23
- package/src/internal/transaction-internal.ts +0 -61
- package/src/introspection/attach-atom-index.ts +0 -73
- package/src/introspection/attach-introspection-states.ts +0 -42
- package/src/introspection/attach-selector-index.ts +0 -77
- package/src/introspection/attach-timeline-family.ts +0 -59
- package/src/introspection/attach-timeline-index.ts +0 -36
- package/src/introspection/attach-transaction-index.ts +0 -38
- package/src/introspection/attach-transaction-logs.ts +0 -40
- package/src/introspection/index.ts +0 -20
- package/src/json/index.ts +0 -1
- package/src/json/select-json.ts +0 -18
- package/src/react/index.ts +0 -2
- package/src/react/store-context.tsx +0 -13
- package/src/react/store-hooks.ts +0 -47
- package/src/react-devtools/AtomIODevtools.tsx +0 -107
- package/src/react-devtools/Button.tsx +0 -24
- package/src/react-devtools/StateEditor.tsx +0 -70
- package/src/react-devtools/StateIndex.tsx +0 -153
- package/src/react-devtools/TimelineIndex.tsx +0 -92
- package/src/react-devtools/TransactionIndex.tsx +0 -70
- package/src/react-devtools/Updates.tsx +0 -145
- package/src/react-devtools/devtools.scss +0 -311
- package/src/react-devtools/index.ts +0 -72
- package/src/react-explorer/AtomIOExplorer.tsx +0 -218
- package/src/react-explorer/explorer-effects.ts +0 -20
- package/src/react-explorer/explorer-states.ts +0 -217
- package/src/react-explorer/index.ts +0 -23
- package/src/react-explorer/space-states.ts +0 -72
- package/src/react-explorer/view-states.ts +0 -41
- package/src/realtime/README.md +0 -33
- package/src/realtime/hook-composition/expose-family.ts +0 -101
- package/src/realtime/hook-composition/expose-single.ts +0 -38
- package/src/realtime/hook-composition/expose-timeline.ts +0 -60
- package/src/realtime/hook-composition/index.ts +0 -12
- package/src/realtime/hook-composition/receive-state.ts +0 -29
- package/src/realtime/hook-composition/receive-transaction.ts +0 -18
- package/src/realtime/index.ts +0 -1
- package/src/realtime-react/index.ts +0 -3
- package/src/realtime-react/realtime-context.tsx +0 -30
- package/src/realtime-react/realtime-hooks.ts +0 -39
- package/src/realtime-react/realtime-state.ts +0 -10
- package/src/realtime-react/use-pull-family-member.ts +0 -26
- package/src/realtime-react/use-pull-family.ts +0 -24
- package/src/realtime-react/use-pull.ts +0 -22
- package/src/realtime-react/use-push.ts +0 -25
- package/src/realtime-react/use-server-action.ts +0 -33
- package/src/realtime-testing/index.ts +0 -1
- package/src/realtime-testing/setup-realtime-test.tsx +0 -159
- package/src/web-effects/index.ts +0 -1
- package/src/web-effects/storage.ts +0 -30
|
@@ -1,180 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as atom_io from 'atom.io';
|
|
2
|
+
import { StateToken, FamilyMetadata, TimelineUpdate, StateUpdate, TransactionUpdate, ƒn, AtomToken, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, Logger } from 'atom.io';
|
|
3
|
+
import { Refinement as Refinement$1 } from 'fp-ts/Refinement';
|
|
3
4
|
|
|
4
5
|
type PlainObject = Record<keyof any, unknown>;
|
|
5
6
|
|
|
6
|
-
type
|
|
7
|
+
type primitive = boolean | number | string | null;
|
|
7
8
|
|
|
8
|
-
type
|
|
9
|
-
toJson: (t: T) => J;
|
|
10
|
-
fromJson: (json: J) => T;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type Primitive = boolean | number | string | null;
|
|
14
|
-
type Serializable = Primitive | Readonly<{
|
|
9
|
+
type Serializable = primitive | Readonly<{
|
|
15
10
|
[key: string]: Serializable;
|
|
16
11
|
}> | ReadonlyArray<Serializable>;
|
|
17
|
-
type
|
|
18
|
-
type JsonArr<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
19
|
-
type Json = JsonArr | JsonObj | Primitive;
|
|
12
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
20
13
|
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
};
|
|
14
|
+
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
15
|
+
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
contents: JsonObj<string, CONTENT>;
|
|
29
|
-
relations: JsonObj<string, string[]>;
|
|
30
|
-
relationType: RelationType;
|
|
31
|
-
a: A;
|
|
32
|
-
b: B;
|
|
33
|
-
};
|
|
34
|
-
type IsRelationDataOptions<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
35
|
-
from?: A;
|
|
36
|
-
to?: B;
|
|
37
|
-
isContent?: (json: Json) => json is CONTENT;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
41
|
-
type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [MaybeArg];
|
|
42
|
-
|
|
43
|
-
declare class Join<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
44
|
-
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
45
|
-
readonly a: A;
|
|
46
|
-
readonly b: B;
|
|
47
|
-
readonly relations: Record<string, string[]>;
|
|
48
|
-
readonly contents: Record<string, CONTENT>;
|
|
49
|
-
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
50
|
-
toJSON(): RelationData<CONTENT, A, B>;
|
|
51
|
-
static fromJSON<CONTENT extends JsonObj | null, A extends string, B extends string>(json: Json, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
|
|
52
|
-
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
53
|
-
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
54
|
-
makeJsonInterface: (...params: CONTENT extends null ? [
|
|
55
|
-
] : [Refinement<unknown, CONTENT>]) => JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>>;
|
|
56
|
-
getRelatedId(id: string): string | undefined;
|
|
57
|
-
getRelatedIds(id: string): string[];
|
|
58
|
-
getContent(idA: string, idB: string): CONTENT | undefined;
|
|
59
|
-
getRelationEntries(id: string): [string, CONTENT][];
|
|
60
|
-
getRelationRecord(id: string): Record<string, CONTENT>;
|
|
61
|
-
getRelation(id: string): NullSafeUnion<Identified, CONTENT> | undefined;
|
|
62
|
-
getRelations(id: string): NullSafeUnion<Identified, CONTENT>[];
|
|
63
|
-
setRelations(subject: {
|
|
64
|
-
[from in A]: string;
|
|
65
|
-
} | {
|
|
66
|
-
[to in B]: string;
|
|
67
|
-
}, relations: NullSafeUnion<Identified, CONTENT>[]): Join<CONTENT, A, B>;
|
|
68
|
-
set(relation: {
|
|
69
|
-
[key in A | B]: string;
|
|
70
|
-
}, ...rest: NullSafeRest<CONTENT>): Join<CONTENT, A, B>;
|
|
71
|
-
remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B>;
|
|
17
|
+
interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
|
|
18
|
+
readonly relations: [string, string[]][];
|
|
19
|
+
readonly contents: [string, Content][];
|
|
72
20
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
type: `atom_family`;
|
|
77
|
-
subject: Subject<AtomToken<T>>;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
type Logger = Pick<Console, `error` | `info` | `warn`>;
|
|
81
|
-
|
|
82
|
-
type TransactionToken<_> = {
|
|
83
|
-
key: string;
|
|
84
|
-
type: `transaction`;
|
|
85
|
-
__brand?: _;
|
|
86
|
-
};
|
|
87
|
-
type TransactionUpdate<ƒ extends ƒn> = {
|
|
88
|
-
key: string;
|
|
89
|
-
atomUpdates: KeyedStateUpdate<unknown>[];
|
|
90
|
-
params: Parameters<ƒ>;
|
|
91
|
-
output: ReturnType<ƒ>;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
95
|
-
key: string;
|
|
96
|
-
type: `readonly_selector_family`;
|
|
97
|
-
subject: Subject<ReadonlySelectorToken<T>>;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
type StateUpdate<T> = {
|
|
101
|
-
newValue: T;
|
|
102
|
-
oldValue: T;
|
|
103
|
-
};
|
|
104
|
-
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
105
|
-
key: string;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type TimelineToken = {
|
|
109
|
-
key: string;
|
|
110
|
-
type: `timeline`;
|
|
111
|
-
};
|
|
112
|
-
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
113
|
-
|
|
114
|
-
type AtomToken<_> = {
|
|
115
|
-
key: string;
|
|
116
|
-
type: `atom`;
|
|
117
|
-
family?: FamilyMetadata;
|
|
118
|
-
__brand?: _;
|
|
119
|
-
};
|
|
120
|
-
type SelectorToken<_> = {
|
|
121
|
-
key: string;
|
|
122
|
-
type: `selector`;
|
|
123
|
-
family?: FamilyMetadata;
|
|
124
|
-
__brand?: _;
|
|
125
|
-
};
|
|
126
|
-
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
127
|
-
type ReadonlySelectorToken<_> = {
|
|
128
|
-
key: string;
|
|
129
|
-
type: `readonly_selector`;
|
|
130
|
-
family?: FamilyMetadata;
|
|
131
|
-
__brand?: _;
|
|
132
|
-
};
|
|
133
|
-
type FamilyMetadata = {
|
|
134
|
-
key: string;
|
|
135
|
-
subKey: string;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
139
|
-
interface Store {
|
|
140
|
-
atoms: Map<string, Atom<any>>;
|
|
141
|
-
atomsThatAreDefault: Set<string>;
|
|
142
|
-
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
143
|
-
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
144
|
-
selectorGraph: Join<{
|
|
145
|
-
source: string;
|
|
146
|
-
}>;
|
|
147
|
-
selectors: Map<string, Selector<any>>;
|
|
148
|
-
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
149
|
-
timelines: Map<string, Timeline>;
|
|
150
|
-
transactions: Map<string, Transaction<any>>;
|
|
151
|
-
valueMap: Map<string, any>;
|
|
152
|
-
subject: {
|
|
153
|
-
atomCreation: Subject<AtomToken<unknown>>;
|
|
154
|
-
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
155
|
-
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
156
|
-
timelineCreation: Subject<TimelineToken>;
|
|
157
|
-
operationStatus: Subject<OperationProgress>;
|
|
158
|
-
};
|
|
159
|
-
operation: OperationProgress;
|
|
160
|
-
transactionStatus: TransactionStatus<ƒn>;
|
|
161
|
-
config: {
|
|
162
|
-
name: string;
|
|
163
|
-
logger: Logger | null;
|
|
164
|
-
logger__INTERNAL: Logger;
|
|
165
|
-
};
|
|
21
|
+
interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
|
|
22
|
+
readonly between: [a: ASide, b: BSide];
|
|
23
|
+
readonly cardinality: Cardinality;
|
|
166
24
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
25
|
+
type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
|
|
26
|
+
externalStore?: (Content extends null ? {
|
|
27
|
+
getContent?: undefined;
|
|
28
|
+
setContent?: undefined;
|
|
29
|
+
deleteContent?: undefined;
|
|
30
|
+
} : {
|
|
31
|
+
getContent: (contentKey: string) => Content | undefined;
|
|
32
|
+
setContent: (contentKey: string, content: Content) => void;
|
|
33
|
+
deleteContent: (g: any) => void;
|
|
34
|
+
}) & {
|
|
35
|
+
addRelation: (a: string, b: string) => void;
|
|
36
|
+
deleteRelation: (a: string, b: string) => void;
|
|
37
|
+
getRelatedKeys: (key: string) => Set<string> | undefined;
|
|
38
|
+
has: (a: string, b?: string) => boolean;
|
|
39
|
+
};
|
|
40
|
+
isContent?: Refinement<unknown, Content>;
|
|
41
|
+
makeContentKey?: (a: string, b: string) => string;
|
|
177
42
|
};
|
|
43
|
+
type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
|
|
44
|
+
declare class Junction<ASide extends string, BSide extends string, Content extends Object$1 | null = null> {
|
|
45
|
+
readonly a: ASide;
|
|
46
|
+
readonly b: BSide;
|
|
47
|
+
readonly cardinality: Cardinality;
|
|
48
|
+
readonly relations: Map<string, Set<string>>;
|
|
49
|
+
readonly contents: Map<string, Content>;
|
|
50
|
+
isContent: Refinement<unknown, Content> | null;
|
|
51
|
+
makeContentKey: (a: string, b: string) => string;
|
|
52
|
+
getRelatedKeys(key: string): Set<string> | undefined;
|
|
53
|
+
protected addRelation(a: string, b: string): void;
|
|
54
|
+
protected deleteRelation(a: string, b: string): void;
|
|
55
|
+
protected getContentInternal(contentKey: string): Content | undefined;
|
|
56
|
+
protected setContent(contentKey: string, content: Content): void;
|
|
57
|
+
protected deleteContent(contentKey: string): void;
|
|
58
|
+
constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
|
|
59
|
+
toJSON(): JunctionJSON<ASide, BSide, Content>;
|
|
60
|
+
set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
|
|
61
|
+
set(relation: {
|
|
62
|
+
[Key in ASide | BSide]: string;
|
|
63
|
+
}, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
|
|
64
|
+
delete(a: string, b?: string): this;
|
|
65
|
+
delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
|
|
66
|
+
getRelatedKey(key: string): string | undefined;
|
|
67
|
+
getContent(a: string, b: string): Content | undefined;
|
|
68
|
+
getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
|
|
69
|
+
has(a: string, b?: string): boolean;
|
|
70
|
+
}
|
|
178
71
|
|
|
179
72
|
type OperationProgress = {
|
|
180
73
|
open: false;
|
|
@@ -186,6 +79,14 @@ type OperationProgress = {
|
|
|
186
79
|
token: StateToken<any>;
|
|
187
80
|
};
|
|
188
81
|
|
|
82
|
+
type Subscriber<T> = (value: T) => void;
|
|
83
|
+
declare class Subject<T> {
|
|
84
|
+
subscribers: Map<string, Subscriber<T>>;
|
|
85
|
+
subscribe(key: string, subscriber: Subscriber<T>): () => void;
|
|
86
|
+
private unsubscribe;
|
|
87
|
+
next(value: T): void;
|
|
88
|
+
}
|
|
89
|
+
|
|
189
90
|
type Selector<T> = {
|
|
190
91
|
key: string;
|
|
191
92
|
type: `selector`;
|
|
@@ -210,20 +111,11 @@ type ReadonlySelector<T> = {
|
|
|
210
111
|
get: () => T;
|
|
211
112
|
};
|
|
212
113
|
|
|
213
|
-
type Subscriber<T> = (value: T) => void;
|
|
214
|
-
declare class Subject<T> {
|
|
215
|
-
subscribers: Subscriber<T>[];
|
|
216
|
-
subscribe(subscriber: Subscriber<T>): {
|
|
217
|
-
unsubscribe: () => void;
|
|
218
|
-
};
|
|
219
|
-
private unsubscribe;
|
|
220
|
-
next(value: T): void;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
114
|
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
224
115
|
key: string;
|
|
225
116
|
type: `atom_update`;
|
|
226
117
|
timestamp: number;
|
|
118
|
+
family?: FamilyMetadata;
|
|
227
119
|
};
|
|
228
120
|
type TimelineSelectorUpdate = {
|
|
229
121
|
key: string;
|
|
@@ -237,9 +129,10 @@ type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
|
237
129
|
timestamp: number;
|
|
238
130
|
};
|
|
239
131
|
type Timeline = {
|
|
132
|
+
type: `timeline`;
|
|
240
133
|
key: string;
|
|
241
134
|
at: number;
|
|
242
|
-
timeTraveling:
|
|
135
|
+
timeTraveling: `into_future` | `into_past` | null;
|
|
243
136
|
history: TimelineUpdate[];
|
|
244
137
|
selectorTime: number | null;
|
|
245
138
|
transactionKey: string | null;
|
|
@@ -265,20 +158,62 @@ type TransactionIdle = {
|
|
|
265
158
|
};
|
|
266
159
|
type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
|
|
267
160
|
|
|
268
|
-
type
|
|
161
|
+
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
162
|
+
declare class Store {
|
|
163
|
+
valueMap: Map<string, any>;
|
|
164
|
+
atoms: Map<string, Atom<any>>;
|
|
165
|
+
selectors: Map<string, Selector<any>>;
|
|
166
|
+
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
167
|
+
timelines: Map<string, Timeline>;
|
|
168
|
+
transactions: Map<string, Transaction<ƒn>>;
|
|
169
|
+
atomsThatAreDefault: Set<string>;
|
|
170
|
+
timelineAtoms: Junction<"timelineKey", "atomKey", null>;
|
|
171
|
+
selectorAtoms: Junction<"selectorKey", "atomKey", null>;
|
|
172
|
+
selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
|
|
173
|
+
source: string;
|
|
174
|
+
}>;
|
|
175
|
+
subject: {
|
|
176
|
+
atomCreation: Subject<AtomToken<unknown>>;
|
|
177
|
+
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
178
|
+
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
179
|
+
timelineCreation: Subject<TimelineToken>;
|
|
180
|
+
operationStatus: Subject<OperationProgress>;
|
|
181
|
+
};
|
|
182
|
+
operation: OperationProgress;
|
|
183
|
+
transactionStatus: TransactionStatus<ƒn>;
|
|
184
|
+
config: {
|
|
185
|
+
name: string;
|
|
186
|
+
logger: Logger | null;
|
|
187
|
+
logger__INTERNAL: Logger;
|
|
188
|
+
};
|
|
189
|
+
constructor(name: string, store?: Store | null);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
type Atom<T> = {
|
|
193
|
+
key: string;
|
|
194
|
+
type: `atom`;
|
|
195
|
+
family?: FamilyMetadata;
|
|
196
|
+
subject: Subject<{
|
|
197
|
+
newValue: T;
|
|
198
|
+
oldValue: T;
|
|
199
|
+
}>;
|
|
200
|
+
default: T;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
269
204
|
|
|
270
|
-
type FamilyNode<Token extends AtomToken
|
|
205
|
+
type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = {
|
|
271
206
|
key: string;
|
|
272
207
|
familyMembers: Record<string, Token>;
|
|
273
208
|
};
|
|
274
|
-
type StateTokenIndex<Token extends AtomToken
|
|
209
|
+
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
|
|
275
210
|
|
|
276
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken
|
|
211
|
+
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
277
212
|
|
|
278
213
|
type ClassSignature = abstract new (...args: any) => any;
|
|
279
214
|
|
|
280
|
-
type RefinementStrategy = ClassSignature | Refinement<unknown, any>;
|
|
281
|
-
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
215
|
+
type RefinementStrategy = ClassSignature | Refinement$1<unknown, any>;
|
|
216
|
+
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement$1<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
282
217
|
type RefinementSupport = Record<string, RefinementStrategy>;
|
|
283
218
|
declare class Refinery<SupportedTypes extends RefinementSupport> {
|
|
284
219
|
supported: SupportedTypes;
|
|
@@ -318,17 +253,17 @@ declare class Differ<Leaf extends Record<string, any>, Tree extends Record<strin
|
|
|
318
253
|
|
|
319
254
|
declare const AtomIODevtools: () => JSX.Element;
|
|
320
255
|
|
|
321
|
-
declare const atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
322
|
-
declare const selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
323
|
-
declare const transactionIndex: ReadonlySelectorToken<TransactionToken
|
|
324
|
-
declare const findTransactionLogState: ReadonlySelectorFamily<TransactionUpdate
|
|
325
|
-
declare const timelineIndex: ReadonlySelectorToken<TimelineToken[]>;
|
|
326
|
-
declare const findTimelineState: ReadonlySelectorFamily<Timeline>;
|
|
327
|
-
declare const devtoolsAreOpenState: AtomToken<boolean>;
|
|
256
|
+
declare const atomIndex: atom_io.ReadonlySelectorToken<AtomTokenIndex>;
|
|
257
|
+
declare const selectorIndex: atom_io.ReadonlySelectorToken<SelectorTokenIndex>;
|
|
258
|
+
declare const transactionIndex: atom_io.ReadonlySelectorToken<atom_io.TransactionToken<atom_io.ƒn>[]>;
|
|
259
|
+
declare const findTransactionLogState: atom_io.ReadonlySelectorFamily<atom_io.TransactionUpdate<atom_io.ƒn>[]>;
|
|
260
|
+
declare const timelineIndex: atom_io.ReadonlySelectorToken<atom_io.TimelineToken[]>;
|
|
261
|
+
declare const findTimelineState: atom_io.ReadonlySelectorFamily<Timeline>;
|
|
262
|
+
declare const devtoolsAreOpenState: atom_io.AtomToken<boolean>;
|
|
328
263
|
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
329
|
-
declare const devtoolsViewSelectionState: AtomToken<DevtoolsView>;
|
|
330
|
-
declare const devtoolsViewOptionsState: AtomToken<DevtoolsView[]>;
|
|
331
|
-
declare const findViewIsOpenState: AtomFamily<boolean, string>;
|
|
264
|
+
declare const devtoolsViewSelectionState: atom_io.AtomToken<DevtoolsView>;
|
|
265
|
+
declare const devtoolsViewOptionsState: atom_io.AtomToken<DevtoolsView[]>;
|
|
266
|
+
declare const findViewIsOpenState: atom_io.AtomFamily<boolean, string>;
|
|
332
267
|
declare const primitiveRefinery: Refinery<{
|
|
333
268
|
number: (input: unknown) => input is number;
|
|
334
269
|
string: (input: unknown) => input is string;
|