atom.io 0.6.8 → 0.7.0
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/README.md +21 -2
- package/dist/index.d.mts +42 -461
- package/dist/index.d.ts +42 -461
- package/dist/index.js +128 -1792
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -1742
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +342 -0
- package/internal/dist/index.d.ts +342 -0
- package/internal/dist/index.js +1873 -0
- package/internal/dist/index.js.map +1 -0
- package/internal/dist/index.mjs +1798 -0
- package/internal/dist/index.mjs.map +1 -0
- package/internal/package.json +15 -0
- package/internal/src/atom/create-atom.ts +75 -0
- package/internal/src/atom/delete-atom.ts +10 -0
- package/internal/src/atom/index.ts +3 -0
- package/{src/internal → internal/src/atom}/is-default.ts +4 -2
- package/internal/src/caching.ts +21 -0
- package/internal/src/families/create-atom-family.ts +59 -0
- package/internal/src/families/create-readonly-selector-family.ts +45 -0
- package/internal/src/families/create-selector-family.ts +67 -0
- package/internal/src/families/index.ts +3 -0
- package/internal/src/get-state-internal.ts +23 -0
- package/internal/src/index.ts +13 -0
- package/internal/src/mutable/create-mutable-atom-family.ts +25 -0
- package/internal/src/mutable/create-mutable-atom.ts +49 -0
- package/internal/src/mutable/get-json-token.ts +22 -0
- package/internal/src/mutable/get-update-token.ts +20 -0
- package/internal/src/mutable/index.ts +17 -0
- package/internal/src/mutable/is-atom-token-mutable.ts +7 -0
- package/internal/src/mutable/tracker-family.ts +61 -0
- package/internal/src/mutable/tracker.ts +164 -0
- package/internal/src/mutable/transceiver.ts +110 -0
- package/internal/src/operation.ts +68 -0
- package/{src/internal → internal/src}/selector/create-read-write-selector.ts +10 -13
- package/{src/internal → internal/src}/selector/create-readonly-selector.ts +9 -8
- package/internal/src/selector/create-selector.ts +65 -0
- package/{src/internal → internal/src}/selector/index.ts +1 -0
- package/internal/src/selector/lookup-selector-sources.ts +20 -0
- package/{src/internal → internal/src}/selector/register-selector.ts +13 -9
- package/{src/internal → internal/src}/selector/trace-selector-atoms.ts +4 -2
- package/{src/internal → internal/src}/selector/update-selector-atoms.ts +4 -3
- package/internal/src/set-state/become.ts +10 -0
- package/internal/src/set-state/copy-mutable-if-needed.ts +23 -0
- package/internal/src/set-state/copy-mutable-in-transaction.ts +59 -0
- package/internal/src/set-state/copy-mutable-into-new-store.ts +34 -0
- package/internal/src/set-state/emit-update.ts +23 -0
- package/internal/src/set-state/evict-downstream.ts +39 -0
- package/internal/src/set-state/index.ts +2 -0
- package/internal/src/set-state/set-atom-state.ts +38 -0
- package/internal/src/set-state/set-selector-state.ts +19 -0
- package/internal/src/set-state/set-state-internal.ts +18 -0
- package/internal/src/set-state/stow-update.ts +42 -0
- package/internal/src/store/deposit.ts +43 -0
- package/internal/src/store/index.ts +5 -0
- package/internal/src/store/lookup.ts +26 -0
- package/internal/src/store/store.ts +154 -0
- package/internal/src/store/withdraw-new-family-member.ts +53 -0
- package/internal/src/store/withdraw.ts +113 -0
- package/internal/src/subject.ts +21 -0
- package/internal/src/subscribe/index.ts +1 -0
- package/internal/src/subscribe/recall-state.ts +19 -0
- package/internal/src/subscribe/subscribe-to-root-atoms.ts +47 -0
- package/{src/internal → internal/src}/timeline/add-atom-to-timeline.ts +50 -29
- package/internal/src/timeline/index.ts +3 -0
- package/{src/internal → internal/src/timeline}/time-travel-internal.ts +6 -6
- package/{src/internal → internal/src/timeline}/timeline-internal.ts +20 -12
- package/{src/internal → internal/src}/transaction/abort-transaction.ts +1 -1
- package/{src/internal → internal/src}/transaction/apply-transaction.ts +25 -18
- package/{src/internal → internal/src}/transaction/build-transaction.ts +12 -6
- package/{src/internal → internal/src}/transaction/index.ts +3 -2
- package/{src/internal → internal/src}/transaction/redo-transaction.ts +4 -5
- package/{src/internal → internal/src/transaction}/transaction-internal.ts +16 -13
- package/{src/internal → internal/src}/transaction/undo-transaction.ts +4 -5
- package/introspection/dist/index.d.mts +12 -260
- package/introspection/dist/index.d.ts +12 -260
- package/introspection/dist/index.js +125 -140
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +103 -116
- package/introspection/dist/index.mjs.map +1 -1
- package/{src/introspection → introspection/src}/attach-atom-index.ts +41 -30
- package/{src/introspection → introspection/src}/attach-introspection-states.ts +6 -10
- package/introspection/src/attach-selector-index.ts +90 -0
- package/{src/introspection → introspection/src}/attach-timeline-family.ts +16 -16
- package/introspection/src/attach-timeline-index.ts +38 -0
- package/introspection/src/attach-transaction-index.ts +40 -0
- package/{src/introspection → introspection/src}/attach-transaction-logs.ts +11 -8
- package/json/dist/index.d.mts +41 -2
- package/json/dist/index.d.ts +41 -2
- package/json/dist/index.js +88 -48
- package/json/dist/index.js.map +1 -1
- package/json/dist/index.mjs +76 -13
- package/json/dist/index.mjs.map +1 -1
- package/json/src/index.ts +5 -0
- package/json/src/select-json-family.ts +35 -0
- package/json/src/select-json.ts +22 -0
- package/package.json +105 -57
- package/react/dist/index.d.mts +9 -17
- package/react/dist/index.d.ts +9 -17
- package/react/dist/index.js +45 -77
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +18 -34
- package/react/dist/index.mjs.map +1 -1
- package/react/src/store-context.tsx +12 -0
- package/react/src/store-hooks.ts +36 -0
- package/react-devtools/dist/index.css +1 -1
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +199 -230
- package/react-devtools/dist/index.d.ts +199 -230
- package/react-devtools/dist/index.js +610 -2466
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +543 -2401
- package/react-devtools/dist/index.mjs.map +1 -1
- package/{src/react-devtools → react-devtools/src}/AtomIODevtools.tsx +5 -3
- package/{src/react-devtools → react-devtools/src}/Button.tsx +2 -3
- package/{src/react-devtools → react-devtools/src}/StateEditor.tsx +3 -2
- package/{src/react-devtools → react-devtools/src}/StateIndex.tsx +7 -4
- package/{src/react-devtools → react-devtools/src}/TimelineIndex.tsx +7 -11
- package/{src/react-devtools → react-devtools/src}/TransactionIndex.tsx +4 -4
- package/{src/react-devtools → react-devtools/src}/Updates.tsx +9 -4
- package/{src/react-devtools → react-devtools/src}/index.ts +5 -5
- package/realtime-react/dist/index.d.mts +9 -25
- package/realtime-react/dist/index.d.ts +9 -25
- package/realtime-react/dist/index.js +75 -193
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/dist/index.mjs +44 -148
- package/realtime-react/dist/index.mjs.map +1 -1
- package/realtime-react/src/index.ts +7 -0
- package/{src/realtime-react → realtime-react/src}/realtime-context.tsx +3 -4
- package/realtime-react/src/use-pull-family-member.ts +15 -0
- package/realtime-react/src/use-pull-mutable-family-member.ts +20 -0
- package/realtime-react/src/use-pull-mutable.ts +17 -0
- package/realtime-react/src/use-pull.ts +15 -0
- package/realtime-react/src/use-push.ts +19 -0
- package/realtime-react/src/use-server-action.ts +18 -0
- package/realtime-testing/dist/index.d.mts +49 -0
- package/realtime-testing/dist/index.d.ts +49 -0
- package/realtime-testing/dist/index.js +147 -0
- package/realtime-testing/dist/index.js.map +1 -0
- package/realtime-testing/dist/index.mjs +116 -0
- package/realtime-testing/dist/index.mjs.map +1 -0
- package/{src/realtime-testing → realtime-testing/src}/setup-realtime-test.tsx +10 -8
- package/src/atom.ts +64 -8
- package/src/index.ts +36 -29
- package/src/logger.ts +7 -7
- package/src/selector.ts +5 -5
- package/src/silo.ts +49 -43
- package/src/subscribe.ts +27 -22
- package/src/timeline.ts +9 -4
- package/src/transaction.ts +3 -4
- package/transceivers/set-rtx/dist/index.d.mts +39 -0
- package/transceivers/set-rtx/dist/index.d.ts +39 -0
- package/transceivers/set-rtx/dist/index.js +213 -0
- package/transceivers/set-rtx/dist/index.js.map +1 -0
- package/transceivers/set-rtx/dist/index.mjs +211 -0
- package/transceivers/set-rtx/dist/index.mjs.map +1 -0
- package/{realtime → transceivers/set-rtx}/package.json +1 -1
- package/transceivers/set-rtx/src/index.ts +1 -0
- package/transceivers/set-rtx/src/set-rtx.ts +242 -0
- package/realtime/dist/index.d.mts +0 -25
- package/realtime/dist/index.d.ts +0 -25
- package/realtime/dist/index.js +0 -190
- package/realtime/dist/index.js.map +0 -1
- package/realtime/dist/index.mjs +0 -151
- package/realtime/dist/index.mjs.map +0 -1
- package/src/internal/atom-internal.ts +0 -54
- package/src/internal/families-internal.ts +0 -144
- package/src/internal/get.ts +0 -129
- package/src/internal/index.ts +0 -15
- package/src/internal/operation.ts +0 -139
- package/src/internal/selector/lookup-selector-sources.ts +0 -16
- 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/subscribe-internal.ts +0 -88
- package/src/internal/timeline/index.ts +0 -1
- package/src/introspection/attach-selector-index.ts +0 -77
- package/src/introspection/attach-timeline-index.ts +0 -36
- package/src/introspection/attach-transaction-index.ts +0 -38
- package/src/json/index.ts +0 -1
- package/src/json/select-json.ts +0 -18
- package/src/react/store-context.tsx +0 -13
- package/src/react/store-hooks.ts +0 -47
- 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-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 -24
- package/src/realtime-react/use-push.ts +0 -27
- package/src/realtime-react/use-server-action.ts +0 -33
- package/src/tracker/index.ts +0 -3
- package/src/tracker/tracker.ts +0 -61
- package/src/web-effects/index.ts +0 -1
- package/src/web-effects/storage.ts +0 -30
- /package/{src/introspection → introspection/src}/index.ts +0 -0
- /package/{src/react → react/src}/index.ts +0 -0
- /package/{src/react-devtools → react-devtools/src}/devtools.scss +0 -0
- /package/{src/realtime-testing → realtime-testing/src}/index.ts +0 -0
|
@@ -1,272 +1,24 @@
|
|
|
1
|
-
import { AtomToken
|
|
2
|
-
import
|
|
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';
|
|
3
4
|
|
|
4
|
-
type
|
|
5
|
+
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
5
6
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken$1<unknown> | SelectorToken$1<unknown>>;
|
|
9
|
-
|
|
10
|
-
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
11
|
-
toJson: (t: T) => J;
|
|
12
|
-
fromJson: (json: J) => T;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type primitive = boolean | number | string | null;
|
|
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
|
-
|
|
22
|
-
type Identified = {
|
|
23
|
-
id: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
|
|
27
|
-
type RelationType = typeof RELATION_TYPES[number];
|
|
28
|
-
type RelationData<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
29
|
-
contents: Object$1<string, CONTENT>;
|
|
30
|
-
relations: Object$1<string, string[]>;
|
|
31
|
-
relationType: RelationType;
|
|
32
|
-
a: A;
|
|
33
|
-
b: B;
|
|
34
|
-
};
|
|
35
|
-
type IsRelationDataOptions<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
36
|
-
from?: A;
|
|
37
|
-
to?: B;
|
|
38
|
-
isContent?: (json: Serializable) => json is CONTENT;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
42
|
-
type NullSafeRest<MaybeArg, IfArg = MaybeArg> = MaybeArg extends null ? [] | [undefined] : [IfArg];
|
|
43
|
-
|
|
44
|
-
declare class Join<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
45
|
-
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
46
|
-
readonly a: A;
|
|
47
|
-
readonly b: B;
|
|
48
|
-
readonly relations: Record<string, string[]>;
|
|
49
|
-
readonly contents: Record<string, CONTENT>;
|
|
50
|
-
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
51
|
-
toJSON(): RelationData<CONTENT, A, B>;
|
|
52
|
-
static fromJSON<CONTENT extends Object$1 | null, A extends string, B extends string>(json: Serializable, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
|
|
53
|
-
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
54
|
-
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
55
|
-
makeJsonInterface: (...params: CONTENT extends null ? [
|
|
56
|
-
] : [Refinement<unknown, CONTENT>]) => JsonInterface<Join<CONTENT, A, B>, RelationData<CONTENT, A, B>>;
|
|
57
|
-
getRelatedId(id: string): string | undefined;
|
|
58
|
-
getRelatedIds(id: string): string[];
|
|
59
|
-
getContent(idA: string, idB: string): CONTENT | undefined;
|
|
60
|
-
getRelationEntries(id: string): [string, CONTENT][];
|
|
61
|
-
getRelationRecord(id: string): Record<string, CONTENT>;
|
|
62
|
-
getRelation(id: string): NullSafeUnion<Identified, CONTENT> | undefined;
|
|
63
|
-
getRelations(id: string): NullSafeUnion<Identified, CONTENT>[];
|
|
64
|
-
setRelations(subject: {
|
|
65
|
-
[from in A]: string;
|
|
66
|
-
} | {
|
|
67
|
-
[to in B]: string;
|
|
68
|
-
}, relations: NullSafeUnion<Identified, CONTENT>[]): Join<CONTENT, A, B>;
|
|
69
|
-
set(relation: {
|
|
70
|
-
[key in A | B]: string;
|
|
71
|
-
}, ...rest: NullSafeRest<CONTENT>): Join<CONTENT, A, B>;
|
|
72
|
-
remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B>;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
type Logger = Pick<Console, `error` | `info` | `warn`>;
|
|
76
|
-
|
|
77
|
-
type TransactionToken<_> = {
|
|
78
|
-
key: string;
|
|
79
|
-
type: `transaction`;
|
|
80
|
-
__brand?: _;
|
|
81
|
-
};
|
|
82
|
-
type TransactionUpdate<ƒ extends ƒn> = {
|
|
83
|
-
key: string;
|
|
84
|
-
atomUpdates: KeyedStateUpdate<unknown>[];
|
|
85
|
-
params: Parameters<ƒ>;
|
|
86
|
-
output: ReturnType<ƒ>;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
type StateUpdate<T> = {
|
|
90
|
-
newValue: T;
|
|
91
|
-
oldValue: T;
|
|
92
|
-
};
|
|
93
|
-
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
94
|
-
key: string;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
type TimelineToken = {
|
|
98
|
-
key: string;
|
|
99
|
-
type: `timeline`;
|
|
100
|
-
};
|
|
101
|
-
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
102
|
-
|
|
103
|
-
type AtomToken<_> = {
|
|
104
|
-
key: string;
|
|
105
|
-
type: `atom`;
|
|
106
|
-
family?: FamilyMetadata;
|
|
107
|
-
__brand?: _;
|
|
108
|
-
};
|
|
109
|
-
type SelectorToken<_> = {
|
|
110
|
-
key: string;
|
|
111
|
-
type: `selector`;
|
|
112
|
-
family?: FamilyMetadata;
|
|
113
|
-
__brand?: _;
|
|
114
|
-
};
|
|
115
|
-
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
116
|
-
type ReadonlySelectorToken<_> = {
|
|
117
|
-
key: string;
|
|
118
|
-
type: `readonly_selector`;
|
|
119
|
-
family?: FamilyMetadata;
|
|
120
|
-
__brand?: _;
|
|
121
|
-
};
|
|
122
|
-
type FamilyMetadata = {
|
|
123
|
-
key: string;
|
|
124
|
-
subKey: string;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
128
|
-
interface Store {
|
|
129
|
-
atoms: Map<string, Atom<any>>;
|
|
130
|
-
atomsThatAreDefault: Set<string>;
|
|
131
|
-
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
132
|
-
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
133
|
-
selectorGraph: Join<{
|
|
134
|
-
source: string;
|
|
135
|
-
}>;
|
|
136
|
-
selectors: Map<string, Selector<any>>;
|
|
137
|
-
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
138
|
-
timelines: Map<string, Timeline>;
|
|
139
|
-
transactions: Map<string, Transaction<any>>;
|
|
140
|
-
valueMap: Map<string, any>;
|
|
141
|
-
subject: {
|
|
142
|
-
atomCreation: Subject<AtomToken<unknown>>;
|
|
143
|
-
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
144
|
-
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
145
|
-
timelineCreation: Subject<TimelineToken>;
|
|
146
|
-
operationStatus: Subject<OperationProgress>;
|
|
147
|
-
};
|
|
148
|
-
operation: OperationProgress;
|
|
149
|
-
transactionStatus: TransactionStatus<ƒn>;
|
|
150
|
-
config: {
|
|
151
|
-
name: string;
|
|
152
|
-
logger: Logger | null;
|
|
153
|
-
logger__INTERNAL: Logger;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
type Atom<T> = {
|
|
158
|
-
key: string;
|
|
159
|
-
type: `atom`;
|
|
160
|
-
family?: FamilyMetadata;
|
|
161
|
-
subject: Subject<{
|
|
162
|
-
newValue: T;
|
|
163
|
-
oldValue: T;
|
|
164
|
-
}>;
|
|
165
|
-
default: T;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
type OperationProgress = {
|
|
169
|
-
open: false;
|
|
170
|
-
} | {
|
|
171
|
-
open: true;
|
|
172
|
-
done: Set<string>;
|
|
173
|
-
prev: Map<string, any>;
|
|
174
|
-
time: number;
|
|
175
|
-
token: StateToken<any>;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
type Selector<T> = {
|
|
179
|
-
key: string;
|
|
180
|
-
type: `selector`;
|
|
181
|
-
family?: FamilyMetadata;
|
|
182
|
-
install: (store: Store) => void;
|
|
183
|
-
subject: Subject<{
|
|
184
|
-
newValue: T;
|
|
185
|
-
oldValue: T;
|
|
186
|
-
}>;
|
|
187
|
-
get: () => T;
|
|
188
|
-
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
189
|
-
};
|
|
190
|
-
type ReadonlySelector<T> = {
|
|
191
|
-
key: string;
|
|
192
|
-
type: `readonly_selector`;
|
|
193
|
-
family?: FamilyMetadata;
|
|
194
|
-
install: (store: Store) => void;
|
|
195
|
-
subject: Subject<{
|
|
196
|
-
newValue: T;
|
|
197
|
-
oldValue: T;
|
|
198
|
-
}>;
|
|
199
|
-
get: () => T;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
type Subscriber<T> = (value: T) => void;
|
|
203
|
-
declare class Subject<T> {
|
|
204
|
-
subscribers: Subscriber<T>[];
|
|
205
|
-
subscribe(subscriber: Subscriber<T>): {
|
|
206
|
-
unsubscribe: () => void;
|
|
207
|
-
};
|
|
208
|
-
private unsubscribe;
|
|
209
|
-
next(value: T): void;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
213
|
-
key: string;
|
|
214
|
-
type: `atom_update`;
|
|
215
|
-
timestamp: number;
|
|
216
|
-
};
|
|
217
|
-
type TimelineSelectorUpdate = {
|
|
218
|
-
key: string;
|
|
219
|
-
type: `selector_update`;
|
|
220
|
-
timestamp: number;
|
|
221
|
-
atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
|
|
222
|
-
};
|
|
223
|
-
type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
224
|
-
key: string;
|
|
225
|
-
type: `transaction_update`;
|
|
226
|
-
timestamp: number;
|
|
227
|
-
};
|
|
228
|
-
type Timeline = {
|
|
229
|
-
key: string;
|
|
230
|
-
at: number;
|
|
231
|
-
timeTraveling: `into_future` | `into_past` | null;
|
|
232
|
-
history: TimelineUpdate[];
|
|
233
|
-
selectorTime: number | null;
|
|
234
|
-
transactionKey: string | null;
|
|
235
|
-
install: (store: Store) => void;
|
|
236
|
-
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
type Transaction<ƒ extends ƒn> = {
|
|
240
|
-
key: string;
|
|
241
|
-
type: `transaction`;
|
|
242
|
-
install: (store: Store) => void;
|
|
243
|
-
subject: Subject<TransactionUpdate<ƒ>>;
|
|
244
|
-
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
type TransactionUpdateInProgress<ƒ extends ƒn> = TransactionUpdate<ƒ> & {
|
|
248
|
-
phase: `applying` | `building`;
|
|
249
|
-
time: number;
|
|
250
|
-
core: StoreCore;
|
|
251
|
-
};
|
|
252
|
-
type TransactionIdle = {
|
|
253
|
-
phase: `idle`;
|
|
254
|
-
};
|
|
255
|
-
type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
|
|
7
|
+
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
256
8
|
|
|
257
9
|
declare const attachIntrospectionStates: (store?: __INTERNAL__.Store) => {
|
|
258
|
-
atomIndex: ReadonlySelectorToken
|
|
259
|
-
selectorIndex: ReadonlySelectorToken
|
|
260
|
-
transactionIndex: ReadonlySelectorToken
|
|
261
|
-
findTransactionLogState: ReadonlySelectorFamily<TransactionUpdate
|
|
262
|
-
timelineIndex: ReadonlySelectorToken
|
|
10
|
+
atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
11
|
+
selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
12
|
+
transactionIndex: ReadonlySelectorToken<TransactionToken<ƒn>[]>;
|
|
13
|
+
findTransactionLogState: ReadonlySelectorFamily<TransactionUpdate<ƒn>[]>;
|
|
14
|
+
timelineIndex: ReadonlySelectorToken<TimelineToken[]>;
|
|
263
15
|
findTimelineState: ReadonlySelectorFamily<Timeline>;
|
|
264
16
|
};
|
|
265
17
|
|
|
266
|
-
type FamilyNode<Token extends AtomToken
|
|
18
|
+
type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = {
|
|
267
19
|
key: string;
|
|
268
20
|
familyMembers: Record<string, Token>;
|
|
269
21
|
};
|
|
270
|
-
type StateTokenIndex<Token extends AtomToken
|
|
22
|
+
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
|
|
271
23
|
|
|
272
24
|
export { FamilyNode, StateTokenIndex, attachIntrospectionStates };
|