atom.io 0.26.0 → 0.27.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/data/dist/index.d.ts +3 -3
- package/data/src/dict.ts +3 -3
- package/dist/chunk-AK23DRMD.js +21 -0
- package/dist/index.d.ts +32 -54
- package/ephemeral/dist/index.d.ts +7 -7
- package/ephemeral/src/find-state.ts +7 -7
- package/immortal/dist/index.d.ts +7 -7
- package/immortal/src/seek-state.ts +8 -8
- package/internal/dist/index.d.ts +56 -59
- package/internal/dist/index.js +5 -10
- package/internal/src/families/create-atom-family.ts +4 -4
- package/internal/src/families/create-readonly-selector-family.ts +2 -2
- package/internal/src/families/create-regular-atom-family.ts +2 -2
- package/internal/src/families/create-selector-family.ts +4 -4
- package/internal/src/families/create-writable-selector-family.ts +2 -2
- package/internal/src/families/dispose-from-store.ts +3 -7
- package/internal/src/families/find-in-store.ts +9 -9
- package/internal/src/families/init-family-member.ts +25 -37
- package/internal/src/families/seek-in-store.ts +11 -10
- package/internal/src/get-state/get-from-store.ts +3 -3
- package/internal/src/molecule/grow-molecule-in-store.ts +9 -9
- package/internal/src/mutable/index.ts +0 -1
- package/internal/src/mutable/tracker-family.ts +2 -2
- package/internal/src/set-state/set-into-store.ts +4 -4
- package/internal/src/store/deposit.ts +3 -3
- package/internal/src/store/withdraw.ts +10 -9
- package/json/dist/index.d.ts +10 -27
- package/json/dist/index.js +2 -2
- package/json/src/index.ts +8 -3
- package/json/src/select-json-family.ts +4 -4
- package/package.json +20 -17
- package/react/dist/index.d.ts +4 -4
- package/react/src/parse-state-overloads.ts +4 -4
- package/react/src/use-i.ts +3 -3
- package/react/src/use-json.ts +3 -3
- package/react/src/use-o.ts +3 -3
- package/react-devtools/dist/index.d.ts +1 -1
- package/react-devtools/dist/index.js +15 -4
- package/react-devtools/src/StateIndex.tsx +5 -4
- package/realtime/dist/index.d.ts +3 -3
- package/realtime/src/realtime-continuity.ts +2 -2
- package/realtime-react/dist/index.d.ts +4 -4
- package/realtime-react/src/use-pull-atom-family-member.ts +2 -2
- package/realtime-react/src/use-pull-mutable-family-member.ts +2 -2
- package/realtime-react/src/use-pull-selector-family-member.ts +2 -2
- package/realtime-server/dist/index.d.ts +9 -9
- package/realtime-server/src/ipc-sockets/custom-socket.ts +2 -2
- package/realtime-server/src/realtime-family-provider.ts +3 -2
- package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
- package/src/atom.ts +15 -42
- package/src/dispose-state.ts +2 -2
- package/src/get-state.ts +4 -4
- package/src/index.ts +5 -5
- package/src/molecule.ts +4 -3
- package/src/selector.ts +17 -39
- package/src/set-state.ts +3 -2
- package/src/silo.ts +4 -4
- package/transceivers/set-rtx/src/set-rtx.ts +5 -5
- package/dist/chunk-BF4MVQF6.js +0 -44
- package/internal/src/mutable/is-mutable.ts +0 -16
|
@@ -20,7 +20,8 @@ import type {
|
|
|
20
20
|
WritableSelectorToken,
|
|
21
21
|
WritableToken,
|
|
22
22
|
} from "atom.io"
|
|
23
|
-
import {
|
|
23
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
24
|
+
import { stringifyJson } from "atom.io/json"
|
|
24
25
|
|
|
25
26
|
import type { Molecule, ReadableState } from ".."
|
|
26
27
|
import { newest } from "../lineage"
|
|
@@ -30,7 +31,7 @@ import { deposit, type Store } from "../store"
|
|
|
30
31
|
export function seekInStore<
|
|
31
32
|
T extends Transceiver<any>,
|
|
32
33
|
J extends Json.Serializable,
|
|
33
|
-
K extends
|
|
34
|
+
K extends Canonical,
|
|
34
35
|
Key extends K,
|
|
35
36
|
>(
|
|
36
37
|
token: MutableAtomFamilyToken<T, J, K>,
|
|
@@ -38,43 +39,43 @@ export function seekInStore<
|
|
|
38
39
|
store: Store,
|
|
39
40
|
): MutableAtomToken<T, J> | undefined
|
|
40
41
|
|
|
41
|
-
export function seekInStore<T, K extends
|
|
42
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
42
43
|
token: RegularAtomFamilyToken<T, K>,
|
|
43
44
|
key: Key,
|
|
44
45
|
store: Store,
|
|
45
46
|
): RegularAtomToken<T> | undefined
|
|
46
47
|
|
|
47
|
-
export function seekInStore<T, K extends
|
|
48
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
48
49
|
token: AtomFamilyToken<T, K>,
|
|
49
50
|
key: Key,
|
|
50
51
|
store: Store,
|
|
51
52
|
): AtomToken<T> | undefined
|
|
52
53
|
|
|
53
|
-
export function seekInStore<T, K extends
|
|
54
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
54
55
|
token: WritableSelectorFamilyToken<T, K>,
|
|
55
56
|
key: Key,
|
|
56
57
|
store: Store,
|
|
57
58
|
): WritableSelectorToken<T> | undefined
|
|
58
59
|
|
|
59
|
-
export function seekInStore<T, K extends
|
|
60
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
60
61
|
token: ReadonlySelectorFamilyToken<T, K>,
|
|
61
62
|
key: Key,
|
|
62
63
|
store: Store,
|
|
63
64
|
): ReadonlySelectorToken<T> | undefined
|
|
64
65
|
|
|
65
|
-
export function seekInStore<T, K extends
|
|
66
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
66
67
|
token: SelectorFamilyToken<T, K>,
|
|
67
68
|
key: Key,
|
|
68
69
|
store: Store,
|
|
69
70
|
): SelectorToken<T> | undefined
|
|
70
71
|
|
|
71
|
-
export function seekInStore<T, K extends
|
|
72
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
72
73
|
token: WritableFamilyToken<T, K>,
|
|
73
74
|
key: Key,
|
|
74
75
|
store: Store,
|
|
75
76
|
): WritableToken<T> | undefined
|
|
76
77
|
|
|
77
|
-
export function seekInStore<T, K extends
|
|
78
|
+
export function seekInStore<T, K extends Canonical, Key extends K>(
|
|
78
79
|
token: ReadableFamilyToken<T, K>,
|
|
79
80
|
key: Key,
|
|
80
81
|
store: Store,
|
|
@@ -88,7 +89,7 @@ export function seekInStore<M extends MoleculeConstructor>(
|
|
|
88
89
|
|
|
89
90
|
export function seekInStore(
|
|
90
91
|
token: MoleculeFamilyToken<any> | ReadableFamilyToken<any, any>,
|
|
91
|
-
key:
|
|
92
|
+
key: Canonical,
|
|
92
93
|
store: Store,
|
|
93
94
|
): MoleculeToken<any> | ReadableToken<any> | undefined {
|
|
94
95
|
const subKey = stringifyJson(key)
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
ReadableFamilyToken,
|
|
7
7
|
ReadableToken,
|
|
8
8
|
} from "atom.io"
|
|
9
|
-
import type {
|
|
9
|
+
import type { Canonical } from "atom.io/json"
|
|
10
10
|
|
|
11
11
|
import { findInStore, seekInStore } from "../families"
|
|
12
12
|
import { NotFoundError } from "../not-found-error"
|
|
@@ -21,7 +21,7 @@ export function getFromStore<M extends MoleculeConstructor>(
|
|
|
21
21
|
store: Store,
|
|
22
22
|
): InstanceType<M> | undefined
|
|
23
23
|
|
|
24
|
-
export function getFromStore<T, K extends
|
|
24
|
+
export function getFromStore<T, K extends Canonical>(
|
|
25
25
|
token: ReadableFamilyToken<T, K>,
|
|
26
26
|
key: K,
|
|
27
27
|
store: Store,
|
|
@@ -37,7 +37,7 @@ export function getFromStore<T>(
|
|
|
37
37
|
...params:
|
|
38
38
|
| [token: MoleculeFamilyToken<any>, key: MoleculeKey<any>, store: Store]
|
|
39
39
|
| [token: MoleculeToken<any>, store: Store]
|
|
40
|
-
| [token: ReadableFamilyToken<T, any>, key:
|
|
40
|
+
| [token: ReadableFamilyToken<T, any>, key: Canonical, store: Store]
|
|
41
41
|
| [token: ReadableToken<T>, store: Store]
|
|
42
42
|
): any {
|
|
43
43
|
let token: MoleculeToken<any> | ReadableToken<T>
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
WritableSelectorToken,
|
|
17
17
|
WritableToken,
|
|
18
18
|
} from "atom.io"
|
|
19
|
-
import type { Json } from "atom.io/json"
|
|
19
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
20
20
|
|
|
21
21
|
import { initFamilyMemberInStore } from "../families"
|
|
22
22
|
import type { Transceiver } from "../mutable"
|
|
@@ -27,43 +27,43 @@ import type { Molecule } from "./molecule-internal"
|
|
|
27
27
|
export function growMoleculeInStore<
|
|
28
28
|
T extends Transceiver<any>,
|
|
29
29
|
J extends Json.Serializable,
|
|
30
|
-
K extends
|
|
30
|
+
K extends Canonical,
|
|
31
31
|
>(
|
|
32
32
|
molecule: Molecule<any>,
|
|
33
33
|
family: MutableAtomFamily<T, J, K>,
|
|
34
34
|
store: Store,
|
|
35
35
|
): MutableAtomToken<T, J>
|
|
36
|
-
export function growMoleculeInStore<T, K extends
|
|
36
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
37
37
|
molecule: Molecule<any>,
|
|
38
38
|
family: RegularAtomFamily<T, K>,
|
|
39
39
|
store: Store,
|
|
40
40
|
): RegularAtomToken<T>
|
|
41
|
-
export function growMoleculeInStore<T, K extends
|
|
41
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
42
42
|
molecule: Molecule<any>,
|
|
43
43
|
family: AtomFamily<T, K>,
|
|
44
44
|
store: Store,
|
|
45
45
|
): AtomToken<T>
|
|
46
|
-
export function growMoleculeInStore<T, K extends
|
|
46
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
47
47
|
molecule: Molecule<any>,
|
|
48
48
|
family: WritableSelectorFamily<T, K>,
|
|
49
49
|
store: Store,
|
|
50
50
|
): WritableSelectorToken<T>
|
|
51
|
-
export function growMoleculeInStore<T, K extends
|
|
51
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
52
52
|
molecule: Molecule<any>,
|
|
53
53
|
family: ReadonlySelectorFamily<T, K>,
|
|
54
54
|
store: Store,
|
|
55
55
|
): ReadonlySelectorToken<T>
|
|
56
|
-
export function growMoleculeInStore<T, K extends
|
|
56
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
57
57
|
molecule: Molecule<any>,
|
|
58
58
|
family: SelectorFamily<T, K>,
|
|
59
59
|
store: Store,
|
|
60
60
|
): SelectorToken<T>
|
|
61
|
-
export function growMoleculeInStore<T, K extends
|
|
61
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
62
62
|
molecule: Molecule<any>,
|
|
63
63
|
family: WritableFamily<T, K>,
|
|
64
64
|
store: Store,
|
|
65
65
|
): WritableToken<T>
|
|
66
|
-
export function growMoleculeInStore<T, K extends
|
|
66
|
+
export function growMoleculeInStore<T, K extends Canonical>(
|
|
67
67
|
molecule: Molecule<any>,
|
|
68
68
|
family: ReadableFamily<T, K>,
|
|
69
69
|
store: Store,
|
|
@@ -3,7 +3,6 @@ export * from "./create-mutable-atom-family"
|
|
|
3
3
|
export * from "./get-json-family"
|
|
4
4
|
export * from "./get-json-token"
|
|
5
5
|
export * from "./get-update-token"
|
|
6
|
-
export * from "./is-mutable"
|
|
7
6
|
export * from "./tracker"
|
|
8
7
|
export * from "./tracker-family"
|
|
9
8
|
export * from "./transceiver"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MutableAtomFamily, RegularAtomFamily } from "atom.io"
|
|
2
|
-
import type {
|
|
2
|
+
import type { Canonical } from "atom.io/json"
|
|
3
3
|
import { parseJson } from "atom.io/json"
|
|
4
4
|
|
|
5
5
|
import { createRegularAtomFamily, seekInStore } from "../families"
|
|
@@ -9,7 +9,7 @@ import type { Transceiver } from "./transceiver"
|
|
|
9
9
|
|
|
10
10
|
export class FamilyTracker<
|
|
11
11
|
Core extends Transceiver<any>,
|
|
12
|
-
FamilyMemberKey extends
|
|
12
|
+
FamilyMemberKey extends Canonical,
|
|
13
13
|
> {
|
|
14
14
|
private readonly Update: Core extends Transceiver<infer Signal>
|
|
15
15
|
? Signal
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WritableFamilyToken, WritableToken } from "atom.io"
|
|
2
|
-
import type {
|
|
2
|
+
import type { Canonical } from "atom.io/json"
|
|
3
3
|
|
|
4
4
|
import { findInStore, seekInStore } from "../families"
|
|
5
5
|
import { NotFoundError } from "../not-found-error"
|
|
@@ -14,7 +14,7 @@ export function setIntoStore<T, New extends T>(
|
|
|
14
14
|
store: Store,
|
|
15
15
|
): void
|
|
16
16
|
|
|
17
|
-
export function setIntoStore<T, K extends
|
|
17
|
+
export function setIntoStore<T, K extends Canonical, New extends T>(
|
|
18
18
|
token: WritableFamilyToken<T, K>,
|
|
19
19
|
key: K,
|
|
20
20
|
value: New | ((oldValue: T) => New),
|
|
@@ -24,8 +24,8 @@ export function setIntoStore<T, K extends Json.Serializable, New extends T>(
|
|
|
24
24
|
export function setIntoStore<T, New extends T>(
|
|
25
25
|
...params:
|
|
26
26
|
| [
|
|
27
|
-
token: WritableFamilyToken<T,
|
|
28
|
-
key:
|
|
27
|
+
token: WritableFamilyToken<T, Canonical>,
|
|
28
|
+
key: Canonical,
|
|
29
29
|
value: New | ((oldValue: T) => New),
|
|
30
30
|
store: Store,
|
|
31
31
|
]
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
WritableSelectorToken,
|
|
13
13
|
WritableToken,
|
|
14
14
|
} from "atom.io"
|
|
15
|
-
import type {
|
|
15
|
+
import type { Canonical } from "atom.io/json"
|
|
16
16
|
|
|
17
17
|
import type {
|
|
18
18
|
Atom,
|
|
@@ -39,12 +39,12 @@ export function deposit<T>(state: ReadonlySelector<T>): ReadonlySelectorToken<T>
|
|
|
39
39
|
export function deposit<T>(state: Selector<T>): SelectorToken<T>
|
|
40
40
|
export function deposit<T>(state: WritableState<T>): WritableToken<T>
|
|
41
41
|
export function deposit<
|
|
42
|
-
K extends
|
|
42
|
+
K extends Canonical,
|
|
43
43
|
S extends { [key: string]: any },
|
|
44
44
|
P extends any[],
|
|
45
45
|
>(state: Molecule<any>): MoleculeToken<any>
|
|
46
46
|
export function deposit<
|
|
47
|
-
K extends
|
|
47
|
+
K extends Canonical,
|
|
48
48
|
S extends { [key: string]: any },
|
|
49
49
|
P extends any[],
|
|
50
50
|
>(state: MoleculeFamily<any>): MoleculeFamilyToken<any>
|
|
@@ -31,7 +31,8 @@ import type {
|
|
|
31
31
|
WritableSelectorToken,
|
|
32
32
|
WritableToken,
|
|
33
33
|
} from "atom.io"
|
|
34
|
-
import {
|
|
34
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
35
|
+
import { stringifyJson } from "atom.io/json"
|
|
35
36
|
|
|
36
37
|
import type {
|
|
37
38
|
Atom,
|
|
@@ -100,39 +101,39 @@ export function withdraw<T>(
|
|
|
100
101
|
store: Store,
|
|
101
102
|
): ReadableState<T>
|
|
102
103
|
|
|
103
|
-
export function withdraw<T, K extends
|
|
104
|
+
export function withdraw<T, K extends Canonical>(
|
|
104
105
|
token: RegularAtomFamilyToken<T, K>,
|
|
105
106
|
store: Store,
|
|
106
107
|
): RegularAtomFamily<T, K>
|
|
107
108
|
export function withdraw<
|
|
108
109
|
T extends Transceiver<any>,
|
|
109
110
|
J extends Json.Serializable,
|
|
110
|
-
K extends
|
|
111
|
+
K extends Canonical,
|
|
111
112
|
>(
|
|
112
113
|
token: MutableAtomFamilyToken<T, J, K>,
|
|
113
114
|
store: Store,
|
|
114
115
|
): MutableAtomFamily<T, J, K>
|
|
115
|
-
export function withdraw<T, K extends
|
|
116
|
+
export function withdraw<T, K extends Canonical>(
|
|
116
117
|
token: AtomFamilyToken<T>,
|
|
117
118
|
store: Store,
|
|
118
119
|
): AtomFamily<T, any>
|
|
119
|
-
export function withdraw<T, K extends
|
|
120
|
+
export function withdraw<T, K extends Canonical>(
|
|
120
121
|
token: ReadonlySelectorFamilyToken<T, K>,
|
|
121
122
|
store: Store,
|
|
122
123
|
): ReadonlySelectorFamily<T, any>
|
|
123
|
-
export function withdraw<T, K extends
|
|
124
|
+
export function withdraw<T, K extends Canonical>(
|
|
124
125
|
token: WritableSelectorFamilyToken<T, K>,
|
|
125
126
|
store: Store,
|
|
126
127
|
): WritableSelectorFamily<T, any>
|
|
127
|
-
export function withdraw<T, K extends
|
|
128
|
+
export function withdraw<T, K extends Canonical>(
|
|
128
129
|
token: SelectorFamilyToken<T, K>,
|
|
129
130
|
store: Store,
|
|
130
131
|
): SelectorFamily<T, any>
|
|
131
|
-
export function withdraw<T, K extends
|
|
132
|
+
export function withdraw<T, K extends Canonical>(
|
|
132
133
|
token: ReadableFamilyToken<T, K>,
|
|
133
134
|
store: Store,
|
|
134
135
|
): ReadableFamily<T, any>
|
|
135
|
-
export function withdraw<T, K extends
|
|
136
|
+
export function withdraw<T, K extends Canonical>(
|
|
136
137
|
token: WritableFamilyToken<T, K>,
|
|
137
138
|
store: Store,
|
|
138
139
|
): WritableFamily<T, any>
|
package/json/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import * as AtomIO from 'atom.io';
|
|
2
2
|
import { Store, Transceiver } from 'atom.io/internal';
|
|
3
3
|
|
|
4
|
-
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
5
|
-
|
|
6
|
-
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
7
|
-
declare function selectJsonFamily<T, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
8
|
-
|
|
9
4
|
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
10
5
|
toJson: (t: T) => J;
|
|
11
6
|
fromJson: (json: J) => T;
|
|
12
7
|
};
|
|
13
|
-
declare const stringSetJsonInterface: JsonInterface<Set<string>, Array<string>>;
|
|
14
8
|
|
|
15
9
|
type primitive = boolean | number | string | null;
|
|
16
|
-
declare const isString: (input: unknown) => input is string;
|
|
17
|
-
declare const isNumber: (input: unknown) => input is number;
|
|
18
|
-
declare const isBoolean: (input: unknown) => input is boolean;
|
|
19
|
-
declare const isNull: (input: unknown) => input is null;
|
|
20
|
-
declare const isPrimitive: (input: unknown) => input is primitive;
|
|
21
10
|
|
|
22
11
|
type Serializable = primitive | Readonly<{
|
|
23
12
|
[key: string]: Serializable;
|
|
@@ -31,24 +20,18 @@ declare namespace json {
|
|
|
31
20
|
export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
|
|
32
21
|
}
|
|
33
22
|
|
|
34
|
-
declare const parseJson: <S extends
|
|
35
|
-
type
|
|
23
|
+
declare const parseJson: <S extends stringified<Serializable>>(str: S | string) => S extends stringified<infer J> ? J : Serializable;
|
|
24
|
+
type stringified<J extends Serializable> = string & {
|
|
36
25
|
__json: J;
|
|
37
26
|
};
|
|
38
|
-
declare const stringifyJson: <J extends Serializable>(json: J) =>
|
|
39
|
-
|
|
40
|
-
declare const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
boolean: boolean;
|
|
45
|
-
null: null;
|
|
46
|
-
number: number;
|
|
47
|
-
object: Object$1;
|
|
48
|
-
string: string;
|
|
49
|
-
}
|
|
50
|
-
declare const JSON_DEFAULTS: JsonTypes;
|
|
27
|
+
declare const stringifyJson: <J extends Serializable>(json: J) => stringified<J>;
|
|
28
|
+
|
|
29
|
+
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
30
|
+
|
|
31
|
+
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
32
|
+
declare function selectJsonFamily<T, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
51
33
|
|
|
34
|
+
type Canonical = primitive | ReadonlyArray<Canonical>;
|
|
52
35
|
type JsonIO = (...params: Serializable[]) => Serializable | void;
|
|
53
36
|
|
|
54
|
-
export { type
|
|
37
|
+
export { type Canonical, json as Json, type JsonIO, type JsonInterface, parseJson, type primitive, selectJson, selectJsonFamily, type stringified, stringifyJson };
|
package/json/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { stringifyJson, parseJson } from '../../dist/chunk-
|
|
2
|
-
export {
|
|
1
|
+
import { stringifyJson, parseJson } from '../../dist/chunk-AK23DRMD.js';
|
|
2
|
+
export { parseJson, stringifyJson } from '../../dist/chunk-AK23DRMD.js';
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
4
4
|
import { createStandaloneSelector, IMPLICIT, createSelectorFamily, growMoleculeInStore, initFamilyMemberInStore, seekInStore } from 'atom.io/internal';
|
|
5
5
|
|
package/json/src/index.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { Json, JsonInterface, stringified } from "~/packages/anvl/src/json"
|
|
2
|
+
import { parseJson, stringifyJson } from "~/packages/anvl/src/json"
|
|
3
|
+
import type { primitive } from "~/packages/anvl/src/primitive"
|
|
4
|
+
|
|
1
5
|
export * from "./select-json"
|
|
2
6
|
export * from "./select-json-family"
|
|
3
|
-
export * from "~/packages/anvl/src/json"
|
|
4
|
-
export * from "~/packages/anvl/src/primitive"
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
export type { Json, JsonInterface, primitive, stringified }
|
|
9
|
+
export { parseJson, stringifyJson }
|
|
10
|
+
|
|
11
|
+
export type Canonical = primitive | ReadonlyArray<Canonical>
|
|
7
12
|
|
|
8
13
|
export type JsonIO = (...params: Json.Serializable[]) => Json.Serializable | void
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
seekInStore,
|
|
9
9
|
} from "atom.io/internal"
|
|
10
10
|
|
|
11
|
-
import type { Json, JsonInterface } from "."
|
|
11
|
+
import type { Canonical, Json, JsonInterface } from "."
|
|
12
12
|
import { parseJson, stringifyJson } from "."
|
|
13
13
|
|
|
14
14
|
export function selectJsonFamily<
|
|
15
15
|
T extends Transceiver<any>,
|
|
16
16
|
J extends Json.Serializable,
|
|
17
|
-
K extends
|
|
17
|
+
K extends Canonical,
|
|
18
18
|
>(
|
|
19
19
|
atomFamily: AtomIO.MutableAtomFamily<T, J, K>,
|
|
20
20
|
transform: JsonInterface<T, J>,
|
|
@@ -23,7 +23,7 @@ export function selectJsonFamily<
|
|
|
23
23
|
export function selectJsonFamily<
|
|
24
24
|
T,
|
|
25
25
|
J extends Json.Serializable,
|
|
26
|
-
K extends
|
|
26
|
+
K extends Canonical,
|
|
27
27
|
>(
|
|
28
28
|
atomFamily: AtomIO.RegularAtomFamily<T, K>,
|
|
29
29
|
transform: JsonInterface<T, J>,
|
|
@@ -32,7 +32,7 @@ export function selectJsonFamily<
|
|
|
32
32
|
export function selectJsonFamily<
|
|
33
33
|
T,
|
|
34
34
|
J extends Json.Serializable,
|
|
35
|
-
K extends
|
|
35
|
+
K extends Canonical,
|
|
36
36
|
>(
|
|
37
37
|
family:
|
|
38
38
|
| AtomIO.MutableAtomFamily<T extends Transceiver<any> ? T : never, J, K>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@floating-ui/react": ">=0.25.0",
|
|
20
20
|
"@floating-ui/react-dom": ">=2.0.0",
|
|
21
21
|
"@testing-library/react": ">=14.0.0",
|
|
22
|
+
"eslint": ">=9.0.0",
|
|
22
23
|
"framer-motion": ">=10.0.0",
|
|
23
24
|
"react": ">=18.0.0",
|
|
24
25
|
"socket.io": ">=4.0.0",
|
|
@@ -37,6 +38,9 @@
|
|
|
37
38
|
"@floating-ui/react-dom": {
|
|
38
39
|
"optional": true
|
|
39
40
|
},
|
|
41
|
+
"eslint": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
40
44
|
"framer-motion": {
|
|
41
45
|
"optional": true
|
|
42
46
|
},
|
|
@@ -49,23 +53,21 @@
|
|
|
49
53
|
},
|
|
50
54
|
"devDependencies": {
|
|
51
55
|
"@testing-library/react": "16.0.0",
|
|
52
|
-
"@types/eslint": "
|
|
53
|
-
"@types/eslint-v9": "npm:@types/eslint@9.6.0",
|
|
56
|
+
"@types/eslint": "9.6.0",
|
|
54
57
|
"@types/estree": "1.0.5",
|
|
55
|
-
"@types/http-proxy": "1.17.
|
|
58
|
+
"@types/http-proxy": "1.17.15",
|
|
56
59
|
"@types/npmlog": "7.0.0",
|
|
57
60
|
"@types/react": "18.3.3",
|
|
58
61
|
"@types/tmp": "0.2.6",
|
|
59
|
-
"@typescript-eslint/parser": "8.0.
|
|
60
|
-
"@typescript-eslint/rule-tester": "8.0.
|
|
62
|
+
"@typescript-eslint/parser": "8.0.1",
|
|
63
|
+
"@typescript-eslint/rule-tester": "8.0.1",
|
|
61
64
|
"@vitest/coverage-v8": "2.0.5",
|
|
62
65
|
"@vitest/ui": "2.0.5",
|
|
63
66
|
"concurrently": "8.2.2",
|
|
64
|
-
"drizzle-kit": "0.
|
|
65
|
-
"drizzle-orm": "0.
|
|
66
|
-
"eslint": "
|
|
67
|
-
"
|
|
68
|
-
"framer-motion": "11.3.19",
|
|
67
|
+
"drizzle-kit": "0.24.0",
|
|
68
|
+
"drizzle-orm": "0.33.0",
|
|
69
|
+
"eslint": "9.9.0",
|
|
70
|
+
"framer-motion": "11.3.24",
|
|
69
71
|
"happy-dom": "14.12.3",
|
|
70
72
|
"http-proxy": "1.18.1",
|
|
71
73
|
"npmlog": "7.0.1",
|
|
@@ -73,15 +75,15 @@
|
|
|
73
75
|
"preact": "10.23.1",
|
|
74
76
|
"react": "18.3.1",
|
|
75
77
|
"react-dom": "18.3.1",
|
|
76
|
-
"react-router-dom": "6.
|
|
78
|
+
"react-router-dom": "6.26.0",
|
|
77
79
|
"socket.io": "4.7.5",
|
|
78
80
|
"socket.io-client": "4.7.5",
|
|
79
81
|
"tmp": "0.2.3",
|
|
80
|
-
"tsup": "8.2.
|
|
81
|
-
"tsx": "4.
|
|
82
|
+
"tsup": "8.2.4",
|
|
83
|
+
"tsx": "4.17.0",
|
|
82
84
|
"typescript": "5.5.4",
|
|
83
|
-
"vite": "5.
|
|
84
|
-
"vite-tsconfig-paths": "
|
|
85
|
+
"vite": "5.4.0",
|
|
86
|
+
"vite-tsconfig-paths": "5.0.1",
|
|
85
87
|
"vitest": "2.0.5"
|
|
86
88
|
},
|
|
87
89
|
"main": "dist/index.js",
|
|
@@ -239,9 +241,10 @@
|
|
|
239
241
|
"build:realtime-testing": "cd realtime-testing && tsup",
|
|
240
242
|
"build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
|
|
241
243
|
"lint:biome": "biome check -- .",
|
|
242
|
-
"lint:eslint": "eslint .",
|
|
244
|
+
"lint:eslint": "eslint --flag unstable_ts_config -- .",
|
|
243
245
|
"lint:eslint:build": "bun run build:main",
|
|
244
246
|
"lint:types": "tsc --noEmit",
|
|
247
|
+
"lint:types:watch": "tsc --watch --noEmit",
|
|
245
248
|
"lint": "bun run lint:biome && bun run lint:eslint && bun run lint:types",
|
|
246
249
|
"test": "vitest",
|
|
247
250
|
"test:coverage": "vitest run --coverage",
|
package/react/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Store } from 'atom.io/internal';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { WritableToken, WritableFamilyToken, MutableAtomToken, MutableAtomFamilyToken, ReadableToken, ReadableFamilyToken, TimelineToken } from 'atom.io';
|
|
4
|
-
import { Json } from 'atom.io/json';
|
|
4
|
+
import { Canonical, Json } from 'atom.io/json';
|
|
5
5
|
|
|
6
6
|
declare const StoreContext: React.Context<Store>;
|
|
7
7
|
declare const StoreProvider: React.FC<{
|
|
@@ -10,13 +10,13 @@ declare const StoreProvider: React.FC<{
|
|
|
10
10
|
}>;
|
|
11
11
|
|
|
12
12
|
declare function useI<T>(token: WritableToken<T>): <New extends T>(next: New | ((old: T) => New)) => void;
|
|
13
|
-
declare function useI<T, K extends
|
|
13
|
+
declare function useI<T, K extends Canonical>(token: WritableFamilyToken<T, K>, key: K): <New extends T>(next: New | ((old: T) => New)) => void;
|
|
14
14
|
|
|
15
15
|
declare function useJSON<Serializable extends Json.Serializable>(token: MutableAtomToken<any, Serializable>): Serializable;
|
|
16
|
-
declare function useJSON<Serializable extends Json.Serializable, Key extends
|
|
16
|
+
declare function useJSON<Serializable extends Json.Serializable, Key extends Canonical>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable;
|
|
17
17
|
|
|
18
18
|
declare function useO<T>(token: ReadableToken<T>): T;
|
|
19
|
-
declare function useO<T, K extends
|
|
19
|
+
declare function useO<T, K extends Canonical>(token: ReadableFamilyToken<T, K>, key: K): T;
|
|
20
20
|
|
|
21
21
|
type TimelineMeta = {
|
|
22
22
|
at: number;
|
|
@@ -6,19 +6,19 @@ import type {
|
|
|
6
6
|
} from "atom.io"
|
|
7
7
|
import type { Store } from "atom.io/internal"
|
|
8
8
|
import { findInStore, NotFoundError, seekInStore } from "atom.io/internal"
|
|
9
|
-
import type { Json } from "atom.io/json"
|
|
9
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
10
10
|
|
|
11
|
-
export function parseStateOverloads<T, K extends
|
|
11
|
+
export function parseStateOverloads<T, K extends Canonical>(
|
|
12
12
|
store: Store,
|
|
13
13
|
...rest: [WritableFamilyToken<T, K>, K] | [WritableToken<T>]
|
|
14
14
|
): WritableToken<T>
|
|
15
15
|
|
|
16
|
-
export function parseStateOverloads<T, K extends
|
|
16
|
+
export function parseStateOverloads<T, K extends Canonical>(
|
|
17
17
|
store: Store,
|
|
18
18
|
...rest: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
|
|
19
19
|
): ReadableToken<T>
|
|
20
20
|
|
|
21
|
-
export function parseStateOverloads<T, K extends
|
|
21
|
+
export function parseStateOverloads<T, K extends Canonical>(
|
|
22
22
|
store: Store,
|
|
23
23
|
...rest: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
|
|
24
24
|
): ReadableToken<T> {
|
package/react/src/use-i.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WritableFamilyToken, WritableToken } from "atom.io"
|
|
2
2
|
import { setIntoStore } from "atom.io/internal"
|
|
3
|
-
import type {
|
|
3
|
+
import type { Canonical } from "atom.io/json"
|
|
4
4
|
import * as React from "react"
|
|
5
5
|
|
|
6
6
|
import { parseStateOverloads } from "./parse-state-overloads"
|
|
@@ -10,12 +10,12 @@ export function useI<T>(
|
|
|
10
10
|
token: WritableToken<T>,
|
|
11
11
|
): <New extends T>(next: New | ((old: T) => New)) => void
|
|
12
12
|
|
|
13
|
-
export function useI<T, K extends
|
|
13
|
+
export function useI<T, K extends Canonical>(
|
|
14
14
|
token: WritableFamilyToken<T, K>,
|
|
15
15
|
key: K,
|
|
16
16
|
): <New extends T>(next: New | ((old: T) => New)) => void
|
|
17
17
|
|
|
18
|
-
export function useI<T, K extends
|
|
18
|
+
export function useI<T, K extends Canonical>(
|
|
19
19
|
...params: [WritableFamilyToken<T, K>, K] | [WritableToken<T>]
|
|
20
20
|
): <New extends T>(next: New | ((old: T) => New)) => void {
|
|
21
21
|
const store = React.useContext(StoreContext)
|
package/react/src/use-json.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ReadableToken,
|
|
5
5
|
} from "atom.io"
|
|
6
6
|
import { findInStore, getJsonToken } from "atom.io/internal"
|
|
7
|
-
import type { Json } from "atom.io/json"
|
|
7
|
+
import type { Canonical, Json } from "atom.io/json"
|
|
8
8
|
import * as React from "react"
|
|
9
9
|
|
|
10
10
|
import { StoreContext } from "./store-context"
|
|
@@ -16,12 +16,12 @@ export function useJSON<Serializable extends Json.Serializable>(
|
|
|
16
16
|
|
|
17
17
|
export function useJSON<
|
|
18
18
|
Serializable extends Json.Serializable,
|
|
19
|
-
Key extends
|
|
19
|
+
Key extends Canonical,
|
|
20
20
|
>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable
|
|
21
21
|
|
|
22
22
|
export function useJSON<
|
|
23
23
|
Serializable extends Json.Serializable,
|
|
24
|
-
Key extends
|
|
24
|
+
Key extends Canonical,
|
|
25
25
|
>(
|
|
26
26
|
token:
|
|
27
27
|
| MutableAtomFamilyToken<any, Serializable, Key>
|
package/react/src/use-o.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadableFamilyToken, ReadableToken } from "atom.io"
|
|
2
2
|
import { getFromStore, subscribeToState } from "atom.io/internal"
|
|
3
|
-
import type {
|
|
3
|
+
import type { Canonical } from "atom.io/json"
|
|
4
4
|
import * as React from "react"
|
|
5
5
|
|
|
6
6
|
import { parseStateOverloads } from "./parse-state-overloads"
|
|
@@ -8,12 +8,12 @@ import { StoreContext } from "./store-context"
|
|
|
8
8
|
|
|
9
9
|
export function useO<T>(token: ReadableToken<T>): T
|
|
10
10
|
|
|
11
|
-
export function useO<T, K extends
|
|
11
|
+
export function useO<T, K extends Canonical>(
|
|
12
12
|
token: ReadableFamilyToken<T, K>,
|
|
13
13
|
key: K,
|
|
14
14
|
): T
|
|
15
15
|
|
|
16
|
-
export function useO<T, K extends
|
|
16
|
+
export function useO<T, K extends Canonical>(
|
|
17
17
|
...params: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
|
|
18
18
|
): T {
|
|
19
19
|
const store = React.useContext(StoreContext)
|
|
@@ -69,7 +69,7 @@ declare const devtoolsAreOpenState: atom_io.RegularAtomToken<boolean>;
|
|
|
69
69
|
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
70
70
|
declare const devtoolsViewSelectionState: atom_io.RegularAtomToken<DevtoolsView>;
|
|
71
71
|
declare const devtoolsViewOptionsState: atom_io.RegularAtomToken<DevtoolsView[]>;
|
|
72
|
-
declare const findViewIsOpenState: atom_io.
|
|
72
|
+
declare const findViewIsOpenState: atom_io.RegularAtomFamilyToken<boolean, string>;
|
|
73
73
|
declare const primitiveRefinery: Refinery<{
|
|
74
74
|
number: (input: unknown) => input is number;
|
|
75
75
|
string: (input: unknown) => input is string;
|