atom.io 0.3.1 → 0.4.1
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 +11 -3
- package/dist/index.d.ts +84 -30
- package/dist/index.js +427 -230
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +427 -230
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -5
- package/react/dist/index.d.ts +12 -17
- package/react/dist/index.js +25 -34
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +21 -34
- package/react/dist/index.mjs.map +1 -1
- package/react-devtools/dist/index.css +26 -0
- package/react-devtools/dist/index.css.map +1 -0
- package/react-devtools/dist/index.d.ts +15 -0
- package/react-devtools/dist/index.js +1582 -0
- package/react-devtools/dist/index.js.map +1 -0
- package/react-devtools/dist/index.mjs +1554 -0
- package/react-devtools/dist/index.mjs.map +1 -0
- package/react-devtools/package.json +15 -0
- package/src/index.ts +3 -3
- package/src/internal/atom-internal.ts +10 -5
- package/src/internal/families-internal.ts +4 -4
- package/src/internal/get.ts +8 -8
- package/src/internal/index.ts +2 -0
- package/src/internal/meta/attach-meta.ts +17 -0
- package/src/internal/meta/index.ts +4 -0
- package/src/internal/meta/meta-state.ts +135 -0
- package/src/internal/meta/meta-timelines.ts +1 -0
- package/src/internal/meta/meta-transactions.ts +1 -0
- package/src/internal/operation.ts +0 -1
- package/src/internal/selector-internal.ts +34 -13
- package/src/internal/store.ts +35 -5
- package/src/internal/time-travel-internal.ts +89 -0
- package/src/internal/timeline-internal.ts +23 -103
- package/src/internal/transaction-internal.ts +14 -5
- package/src/react/index.ts +28 -46
- package/src/react-devtools/AtomIODevtools.tsx +107 -0
- package/src/react-devtools/StateEditor.tsx +73 -0
- package/src/react-devtools/TokenList.tsx +57 -0
- package/src/react-devtools/devtools.scss +130 -0
- package/src/react-devtools/index.ts +1 -0
- package/src/react-explorer/AtomIOExplorer.tsx +208 -0
- package/src/react-explorer/explorer-effects.ts +20 -0
- package/src/react-explorer/explorer-states.ts +224 -0
- package/src/react-explorer/index.ts +23 -0
- package/src/react-explorer/space-states.ts +73 -0
- package/src/react-explorer/view-states.ts +43 -0
- package/src/selector.ts +6 -6
- package/src/subscribe.ts +2 -2
- package/src/timeline.ts +1 -5
- package/src/transaction.ts +4 -2
- package/src/web-effects/index.ts +1 -0
- package/src/web-effects/storage.ts +30 -0
package/README.md
CHANGED
|
@@ -20,10 +20,15 @@
|
|
|
20
20
|
|
|
21
21
|
# atom.io
|
|
22
22
|
## upcoming features
|
|
23
|
-
- [ ]
|
|
23
|
+
- [ ] store observation api
|
|
24
|
+
- [x] subscribe to creation of atom tokens
|
|
25
|
+
- [x] subscribe to creation of selector tokens
|
|
26
|
+
- [x] subscribe to creation of readonly selector tokens
|
|
27
|
+
- [ ] subscribe to creation of transaction tokens
|
|
28
|
+
- [ ] subscribe to creation of timeline tokens
|
|
29
|
+
- [ ] subscribe to changes in store configuration
|
|
24
30
|
- [ ] resettable atoms
|
|
25
31
|
- [ ] resettable selectors
|
|
26
|
-
- [ ] store observation api
|
|
27
32
|
|
|
28
33
|
## documentation
|
|
29
34
|
- [ ] document atom and selector families
|
|
@@ -32,8 +37,11 @@
|
|
|
32
37
|
|
|
33
38
|
# /react
|
|
34
39
|
## features
|
|
35
|
-
- [x] useSubject
|
|
36
40
|
- [x] useStore
|
|
41
|
+
- [x] useI, useO, useIO
|
|
42
|
+
- [ ] useTimeline
|
|
43
|
+
- [ ] useStoreIndex
|
|
44
|
+
- [ ] useTransactionIO
|
|
37
45
|
|
|
38
46
|
# /effects
|
|
39
47
|
## features
|
package/dist/index.d.ts
CHANGED
|
@@ -16,22 +16,28 @@ type Identified = {
|
|
|
16
16
|
|
|
17
17
|
declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
|
|
18
18
|
type RelationType = (typeof RELATION_TYPES)[number];
|
|
19
|
-
type RelationData<CONTENT extends JsonObj | null = null
|
|
19
|
+
type RelationData<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
20
20
|
contents: JsonObj<string, CONTENT>;
|
|
21
21
|
relations: JsonObj<string, string[]>;
|
|
22
22
|
relationType: RelationType;
|
|
23
|
+
a: A;
|
|
24
|
+
b: B;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
26
28
|
type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [MaybeArg];
|
|
27
29
|
|
|
28
|
-
declare class Join<CONTENT extends JsonObj | null = null
|
|
30
|
+
declare class Join<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
29
31
|
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
32
|
+
readonly a: A;
|
|
33
|
+
readonly b: B;
|
|
30
34
|
readonly relations: Record<string, string[]>;
|
|
31
35
|
readonly contents: Record<string, CONTENT>;
|
|
32
|
-
constructor(json?: Partial<RelationData<CONTENT>>);
|
|
33
|
-
toJSON(): RelationData<CONTENT>;
|
|
34
|
-
static fromJSON<CONTENT extends JsonObj | null
|
|
36
|
+
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
37
|
+
toJSON(): RelationData<CONTENT, A, B>;
|
|
38
|
+
static fromJSON<CONTENT extends JsonObj | null, A extends string, B extends string>(json: Json, isContent?: Refinement<unknown, CONTENT>, a?: A, b?: B): Join<CONTENT, A, B>;
|
|
39
|
+
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
40
|
+
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
35
41
|
getRelatedId(id: string): string | undefined;
|
|
36
42
|
getRelatedIds(id: string): string[];
|
|
37
43
|
getContent(idA: string, idB: string): CONTENT | undefined;
|
|
@@ -39,9 +45,15 @@ declare class Join<CONTENT extends JsonObj | null = null> implements RelationDat
|
|
|
39
45
|
getRelationRecord(id: string): Record<string, CONTENT>;
|
|
40
46
|
getRelation(id: string): NullSafeUnion<Identified, CONTENT> | undefined;
|
|
41
47
|
getRelations(id: string): NullSafeUnion<Identified, CONTENT>[];
|
|
42
|
-
setRelations(
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
setRelations(subject: {
|
|
49
|
+
[from in A]: string;
|
|
50
|
+
} | {
|
|
51
|
+
[to in B]: string;
|
|
52
|
+
}, relations: NullSafeUnion<Identified, CONTENT>[]): Join<CONTENT, A, B>;
|
|
53
|
+
set(relation: {
|
|
54
|
+
[key in A | B]: string;
|
|
55
|
+
}, ...rest: NullSafeRest<CONTENT>): Join<CONTENT, A, B>;
|
|
56
|
+
remove(relation: Partial<Record<A | B, string>>): Join<CONTENT, A, B>;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
@@ -49,16 +61,22 @@ interface Store {
|
|
|
49
61
|
atoms: Hamt<Atom<any>, string>;
|
|
50
62
|
atomsThatAreDefault: Set<string>;
|
|
51
63
|
readonlySelectors: Hamt<ReadonlySelector<any>, string>;
|
|
52
|
-
selectorAtoms: Join
|
|
64
|
+
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
53
65
|
selectorGraph: Join<{
|
|
54
66
|
source: string;
|
|
55
67
|
}>;
|
|
56
68
|
selectors: Hamt<Selector<any>, string>;
|
|
57
69
|
timelines: Hamt<Timeline, string>;
|
|
58
|
-
timelineAtoms: Join
|
|
70
|
+
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
59
71
|
timelineStore: Hamt<TimelineData, string>;
|
|
60
72
|
transactions: Hamt<Transaction<any>, string>;
|
|
61
73
|
valueMap: Hamt<any, string>;
|
|
74
|
+
subject: {
|
|
75
|
+
atomCreation: Rx.Subject<AtomToken<unknown>>;
|
|
76
|
+
selectorCreation: Rx.Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
77
|
+
transactionCreation: Rx.Subject<TransactionToken<unknown>>;
|
|
78
|
+
timelineCreation: Rx.Subject<TimelineToken>;
|
|
79
|
+
};
|
|
62
80
|
operation: OperationProgress;
|
|
63
81
|
transactionStatus: TransactionStatus<ƒn>;
|
|
64
82
|
config: {
|
|
@@ -118,19 +136,19 @@ declare function selectorFamily__INTERNAL<T, K extends Serializable>(options: Se
|
|
|
118
136
|
declare function selectorFamily__INTERNAL<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store?: Store): ReadonlySelectorFamily<T, K>;
|
|
119
137
|
|
|
120
138
|
declare const computeSelectorState: <T>(selector: ReadonlySelector<T> | Selector<T>) => T;
|
|
121
|
-
declare function lookup(key: string, store: Store): AtomToken<unknown> |
|
|
139
|
+
declare function lookup(key: string, store: Store): AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>;
|
|
122
140
|
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T>;
|
|
123
141
|
declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T>;
|
|
124
142
|
declare function withdraw<T>(token: StateToken<T>, store: Store): Atom<T> | Selector<T>;
|
|
125
|
-
declare function withdraw<T>(token:
|
|
143
|
+
declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T>;
|
|
126
144
|
declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends ƒn ? T : never>;
|
|
127
|
-
declare function withdraw<T>(token:
|
|
145
|
+
declare function withdraw<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store: Store): Atom<T> | ReadonlySelector<T> | Selector<T>;
|
|
128
146
|
declare function deposit<T>(state: Atom<T>): AtomToken<T>;
|
|
129
147
|
declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
|
|
130
148
|
declare function deposit<T>(state: Atom<T> | Selector<T>): StateToken<T>;
|
|
131
|
-
declare function deposit<T>(state: ReadonlySelector<T>):
|
|
149
|
+
declare function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>;
|
|
132
150
|
declare function deposit<T>(state: Transaction<T extends ƒn ? T : never>): TransactionToken<T>;
|
|
133
|
-
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>):
|
|
151
|
+
declare function deposit<T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>): ReadonlySelectorToken<T> | StateToken<T>;
|
|
134
152
|
declare const getState__INTERNAL: <T>(state: Atom<T> | ReadonlySelector<T> | Selector<T>, store?: Store) => T;
|
|
135
153
|
|
|
136
154
|
declare const isAtomDefault: (key: string, store?: Store) => boolean;
|
|
@@ -138,6 +156,37 @@ declare const markAtomAsDefault: (key: string, store?: Store) => void;
|
|
|
138
156
|
declare const markAtomAsNotDefault: (key: string, store?: Store) => void;
|
|
139
157
|
declare const isSelectorDefault: (key: string, store?: Store) => boolean;
|
|
140
158
|
|
|
159
|
+
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, Token | {
|
|
160
|
+
key: string;
|
|
161
|
+
familyMembers: Record<string, Token>;
|
|
162
|
+
}>;
|
|
163
|
+
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
164
|
+
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
165
|
+
declare const attachMetaAtoms: (store?: Store) => ReadonlySelectorToken<AtomTokenIndex>;
|
|
166
|
+
declare const attachMetaSelectors: (store?: Store) => ReadonlySelectorToken<SelectorTokenIndex>;
|
|
167
|
+
|
|
168
|
+
declare const attachMetaState: (store?: Store) => {
|
|
169
|
+
atomTokenIndexState: ReadonlySelectorToken<AtomTokenIndex>;
|
|
170
|
+
selectorTokenIndexState: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
type index$1_AtomTokenIndex = AtomTokenIndex;
|
|
174
|
+
type index$1_SelectorTokenIndex = SelectorTokenIndex;
|
|
175
|
+
type index$1_StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = StateTokenIndex<Token>;
|
|
176
|
+
declare const index$1_attachMetaAtoms: typeof attachMetaAtoms;
|
|
177
|
+
declare const index$1_attachMetaSelectors: typeof attachMetaSelectors;
|
|
178
|
+
declare const index$1_attachMetaState: typeof attachMetaState;
|
|
179
|
+
declare namespace index$1 {
|
|
180
|
+
export {
|
|
181
|
+
index$1_AtomTokenIndex as AtomTokenIndex,
|
|
182
|
+
index$1_SelectorTokenIndex as SelectorTokenIndex,
|
|
183
|
+
index$1_StateTokenIndex as StateTokenIndex,
|
|
184
|
+
index$1_attachMetaAtoms as attachMetaAtoms,
|
|
185
|
+
index$1_attachMetaSelectors as attachMetaSelectors,
|
|
186
|
+
index$1_attachMetaState as attachMetaState,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
141
190
|
type OperationProgress = {
|
|
142
191
|
open: false;
|
|
143
192
|
} | {
|
|
@@ -163,7 +212,7 @@ declare const hasKeyBeenUsed: (key: string, store?: Store) => boolean;
|
|
|
163
212
|
|
|
164
213
|
type ƒn = (...parameters: any[]) => any;
|
|
165
214
|
type Transactors = {
|
|
166
|
-
get: <S>(state:
|
|
215
|
+
get: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S;
|
|
167
216
|
set: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void;
|
|
168
217
|
};
|
|
169
218
|
type ReadonlyTransactors = Pick<Transactors, `get`>;
|
|
@@ -179,6 +228,7 @@ type Transaction<ƒ extends ƒn> = {
|
|
|
179
228
|
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
180
229
|
subject: Rx.Subject<TransactionUpdate<ƒ>>;
|
|
181
230
|
};
|
|
231
|
+
type TransactionIO<Token extends TransactionToken<any>> = Token extends TransactionToken<infer ƒ> ? ƒ : never;
|
|
182
232
|
declare function transaction<ƒ extends ƒn>(options: TransactionOptions<ƒ>): TransactionToken<ƒ>;
|
|
183
233
|
declare const runTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, store?: Store) => (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
184
234
|
|
|
@@ -203,13 +253,13 @@ type ReadonlySelector<T> = {
|
|
|
203
253
|
}>;
|
|
204
254
|
get: () => T;
|
|
205
255
|
};
|
|
206
|
-
declare const lookupSelectorSources: (key: string, store: Store) => (AtomToken<unknown> |
|
|
207
|
-
declare const traceSelectorAtoms: (selectorKey: string, dependency:
|
|
256
|
+
declare const lookupSelectorSources: (key: string, store: Store) => (AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>)[];
|
|
257
|
+
declare const traceSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => AtomToken<unknown>[];
|
|
208
258
|
declare const traceAllSelectorAtoms: (selectorKey: string, store: Store) => AtomToken<unknown>[];
|
|
209
|
-
declare const updateSelectorAtoms: (selectorKey: string, dependency:
|
|
259
|
+
declare const updateSelectorAtoms: (selectorKey: string, dependency: ReadonlySelectorToken<unknown> | StateToken<unknown>, store: Store) => void;
|
|
210
260
|
declare const registerSelector: (selectorKey: string, store?: Store) => Transactors;
|
|
211
261
|
declare function selector__INTERNAL<T>(options: SelectorOptions<T>, family?: FamilyMetadata, store?: Store): SelectorToken<T>;
|
|
212
|
-
declare function selector__INTERNAL<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata, store?: Store):
|
|
262
|
+
declare function selector__INTERNAL<T>(options: ReadonlySelectorOptions<T>, family?: FamilyMetadata, store?: Store): ReadonlySelectorToken<T>;
|
|
213
263
|
|
|
214
264
|
declare const evictDownStream: <T>(state: Atom<T>, store?: Store) => void;
|
|
215
265
|
declare const setAtomState: <T>(atom: Atom<T>, next: T | ((oldValue: T) => T), store?: Store) => void;
|
|
@@ -223,6 +273,9 @@ declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>
|
|
|
223
273
|
unsubscribe: () => void;
|
|
224
274
|
}[] | null;
|
|
225
275
|
|
|
276
|
+
declare const redo__INTERNAL: (token: TimelineToken, store?: Store) => void;
|
|
277
|
+
declare const undo__INTERNAL: (token: TimelineToken, store?: Store) => void;
|
|
278
|
+
|
|
226
279
|
type Timeline = {
|
|
227
280
|
key: string;
|
|
228
281
|
type: `timeline`;
|
|
@@ -244,10 +297,10 @@ type TimelineData = {
|
|
|
244
297
|
at: number;
|
|
245
298
|
timeTraveling: boolean;
|
|
246
299
|
history: (TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate)[];
|
|
300
|
+
selectorTime: number | null;
|
|
301
|
+
transactionKey: string | null;
|
|
247
302
|
};
|
|
248
303
|
declare function timeline__INTERNAL(options: TimelineOptions, store?: Store): TimelineToken;
|
|
249
|
-
declare const redo__INTERNAL: (token: TimelineToken, store?: Store) => void;
|
|
250
|
-
declare const undo__INTERNAL: (token: TimelineToken, store?: Store) => void;
|
|
251
304
|
|
|
252
305
|
declare const TRANSACTION_PHASES: readonly ["idle", "building", "applying"];
|
|
253
306
|
type TransactionPhase = (typeof TRANSACTION_PHASES)[number];
|
|
@@ -352,6 +405,7 @@ declare namespace index {
|
|
|
352
405
|
index_Atom as Atom,
|
|
353
406
|
index_IMPLICIT as IMPLICIT,
|
|
354
407
|
index_KeyedStateUpdate as KeyedStateUpdate,
|
|
408
|
+
index$1 as META,
|
|
355
409
|
index_OperationProgress as OperationProgress,
|
|
356
410
|
index_ReadonlySelector as ReadonlySelector,
|
|
357
411
|
index_Selector as Selector,
|
|
@@ -434,8 +488,8 @@ type SelectorOptions<T> = {
|
|
|
434
488
|
set: Write<(newValue: T) => void>;
|
|
435
489
|
};
|
|
436
490
|
type ReadonlySelectorOptions<T> = Omit<SelectorOptions<T>, `set`>;
|
|
491
|
+
declare function selector<T>(options: ReadonlySelectorOptions<T>): ReadonlySelectorToken<T>;
|
|
437
492
|
declare function selector<T>(options: SelectorOptions<T>): SelectorToken<T>;
|
|
438
|
-
declare function selector<T>(options: ReadonlySelectorOptions<T>): ReadonlyValueToken<T>;
|
|
439
493
|
type SelectorFamilyOptions<T, K extends Serializable> = {
|
|
440
494
|
key: string;
|
|
441
495
|
get: (key: K) => Read<() => T>;
|
|
@@ -447,10 +501,10 @@ type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => Sel
|
|
|
447
501
|
type: `selector_family`;
|
|
448
502
|
subject: Rx.Subject<SelectorToken<T>>;
|
|
449
503
|
};
|
|
450
|
-
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) =>
|
|
504
|
+
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
451
505
|
key: string;
|
|
452
506
|
type: `readonly_selector_family`;
|
|
453
|
-
subject: Rx.Subject<
|
|
507
|
+
subject: Rx.Subject<ReadonlySelectorToken<T>>;
|
|
454
508
|
};
|
|
455
509
|
declare function selectorFamily<T, K extends Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
|
|
456
510
|
declare function selectorFamily<T, K extends Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
|
|
@@ -460,7 +514,7 @@ type StateUpdate<T> = {
|
|
|
460
514
|
oldValue: T;
|
|
461
515
|
};
|
|
462
516
|
type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
463
|
-
declare const subscribe: <T>(token:
|
|
517
|
+
declare const subscribe: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, store?: Store) => (() => void);
|
|
464
518
|
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
465
519
|
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, store?: Store) => (() => void);
|
|
466
520
|
|
|
@@ -487,7 +541,7 @@ type SelectorToken<_> = {
|
|
|
487
541
|
family?: FamilyMetadata;
|
|
488
542
|
};
|
|
489
543
|
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
490
|
-
type
|
|
544
|
+
type ReadonlySelectorToken<_> = {
|
|
491
545
|
key: string;
|
|
492
546
|
type: `readonly_selector`;
|
|
493
547
|
family?: FamilyMetadata;
|
|
@@ -500,8 +554,8 @@ type TransactionToken<_> = {
|
|
|
500
554
|
key: string;
|
|
501
555
|
type: `transaction`;
|
|
502
556
|
};
|
|
503
|
-
declare const getState: <T>(token:
|
|
557
|
+
declare const getState: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Store) => T;
|
|
504
558
|
declare const setState: <T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Store) => void;
|
|
505
|
-
declare const isDefault: (token:
|
|
559
|
+
declare const isDefault: (token: ReadonlySelectorToken<unknown> | StateToken<unknown>, store?: Store) => boolean;
|
|
506
560
|
|
|
507
|
-
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions,
|
|
561
|
+
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions, ReadonlySelectorToken, ReadonlyTransactors, SelectorFamily, SelectorFamilyOptions, SelectorOptions, SelectorToken, Serializable, StateToken, StateUpdate, TimelineOptions, TimelineToken, Transaction, TransactionIO, TransactionOptions, TransactionToken, TransactionUpdateHandler, Transactors, UpdateHandler, Write, index as __INTERNAL__, atom, atomFamily, getState, isDefault, redo, runTransaction, selector, selectorFamily, setLogLevel, setState, subscribe, subscribeToTransaction, timeline, transaction, undo, useLogger, ƒn };
|