atom.io 0.27.1 → 0.27.3
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 +12 -12
- package/data/dist/index.js +20 -14
- package/data/src/dict.ts +4 -4
- package/data/src/join.ts +23 -18
- package/data/src/struct-family.ts +2 -2
- package/dist/chunk-ETCFHO7J.js +3087 -0
- package/dist/index.d.ts +4 -31
- package/eslint-plugin/dist/index.js +8 -0
- package/eslint-plugin/src/walk.ts +8 -0
- package/internal/dist/index.d.ts +52 -19
- package/internal/dist/index.js +2 -3044
- package/internal/src/families/create-atom-family.ts +6 -5
- package/internal/src/families/create-readonly-selector-family.ts +38 -29
- package/internal/src/families/create-regular-atom-family.ts +40 -31
- package/internal/src/families/create-selector-family.ts +6 -5
- package/internal/src/families/create-writable-selector-family.ts +39 -30
- package/internal/src/families/throw-in-case-of-conflicting-family.ts +18 -0
- package/internal/src/index.ts +76 -2
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -1
- package/internal/src/ingest-updates/ingest-selector-update.ts +1 -1
- package/internal/src/molecule/dispose-molecule.ts +0 -1
- package/internal/src/molecule/grow-molecule-in-store.ts +27 -17
- package/internal/src/mutable/create-mutable-atom-family.ts +41 -32
- package/internal/src/mutable/get-json-family.ts +2 -1
- package/internal/src/mutable/get-update-family.ts +23 -0
- package/internal/src/mutable/index.ts +1 -0
- package/internal/src/mutable/tracker-family.ts +5 -3
- package/internal/src/not-found-error.ts +2 -35
- package/internal/src/pretty-print.ts +37 -0
- package/internal/src/store/store.ts +10 -4
- package/internal/src/store/withdraw.ts +8 -8
- package/introspection/dist/index.js +3 -3
- package/introspection/src/attach-timeline-family.ts +1 -1
- package/introspection/src/attach-transaction-logs.ts +2 -2
- package/json/dist/index.d.ts +2 -2
- package/json/dist/index.js +16 -12
- package/json/src/select-json-family.ts +21 -18
- package/package.json +4 -4
- package/realtime-server/dist/index.d.ts +1 -1
- package/src/atom.ts +2 -32
- package/src/get-state.ts +2 -2
- package/src/index.ts +1 -10
- package/src/selector.ts +1 -26
- package/src/set-state.ts +2 -2
- package/src/silo.ts +7 -5
package/src/atom.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Transceiver } from "atom.io/internal"
|
|
2
2
|
import {
|
|
3
3
|
createAtomFamily,
|
|
4
4
|
createStandaloneAtom,
|
|
@@ -6,13 +6,7 @@ import {
|
|
|
6
6
|
} from "atom.io/internal"
|
|
7
7
|
import type { Canonical, Json, JsonInterface } from "atom.io/json"
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
AtomToken,
|
|
11
|
-
MutableAtomToken,
|
|
12
|
-
RegularAtomToken,
|
|
13
|
-
StateCreation,
|
|
14
|
-
StateDisposal,
|
|
15
|
-
} from "."
|
|
9
|
+
import type { AtomToken, MutableAtomToken, RegularAtomToken } from "."
|
|
16
10
|
|
|
17
11
|
export type Effectors<T> = {
|
|
18
12
|
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void
|
|
@@ -74,14 +68,6 @@ export type RegularAtomFamilyToken<T, K extends Canonical> = {
|
|
|
74
68
|
__T?: T
|
|
75
69
|
__K?: K
|
|
76
70
|
}
|
|
77
|
-
// biome-ignore format: intersection
|
|
78
|
-
export type RegularAtomFamily<T, K extends Canonical> =
|
|
79
|
-
& RegularAtomFamilyToken<T, K>
|
|
80
|
-
& {
|
|
81
|
-
(key: K): RegularAtomToken<T>
|
|
82
|
-
subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>
|
|
83
|
-
install: (store: Store) => void
|
|
84
|
-
}
|
|
85
71
|
|
|
86
72
|
// biome-ignore format: intersection
|
|
87
73
|
export type MutableAtomFamilyOptions<
|
|
@@ -108,23 +94,7 @@ export type MutableAtomFamilyToken<
|
|
|
108
94
|
__J?: J
|
|
109
95
|
__K?: K
|
|
110
96
|
}
|
|
111
|
-
// biome-ignore format: intersection
|
|
112
|
-
export type MutableAtomFamily<
|
|
113
|
-
T extends Transceiver<any>,
|
|
114
|
-
J extends Json.Serializable,
|
|
115
|
-
K extends Canonical,
|
|
116
|
-
> =
|
|
117
|
-
& JsonInterface<T, J>
|
|
118
|
-
& MutableAtomFamilyToken<T, J, K>
|
|
119
|
-
& {
|
|
120
|
-
(key: K): MutableAtomToken<T, J>
|
|
121
|
-
subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
|
|
122
|
-
install: (store: Store) => void
|
|
123
|
-
}
|
|
124
97
|
|
|
125
|
-
export type AtomFamily<T, K extends Canonical = Canonical> =
|
|
126
|
-
| MutableAtomFamily<T extends Transceiver<any> ? T : never, any, K>
|
|
127
|
-
| RegularAtomFamily<T, K>
|
|
128
98
|
export type AtomFamilyToken<T, K extends Canonical = Canonical> =
|
|
129
99
|
| MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K>
|
|
130
100
|
| RegularAtomFamilyToken<T, K>
|
package/src/get-state.ts
CHANGED
|
@@ -15,9 +15,9 @@ export function getState<M extends MoleculeConstructor>(
|
|
|
15
15
|
token: MoleculeToken<M>,
|
|
16
16
|
): InstanceType<M>
|
|
17
17
|
|
|
18
|
-
export function getState<T, K extends Canonical>(
|
|
18
|
+
export function getState<T, K extends Canonical, Key extends K>(
|
|
19
19
|
token: ReadableFamilyToken<T, K>,
|
|
20
|
-
key:
|
|
20
|
+
key: Key,
|
|
21
21
|
): T
|
|
22
22
|
|
|
23
23
|
export function getState<M extends MoleculeConstructor>(
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { Transceiver } from "atom.io/internal"
|
|
2
2
|
import type { Canonical, Json } from "atom.io/json"
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { AtomFamilyToken } from "./atom"
|
|
5
5
|
import type {
|
|
6
|
-
SelectorFamily,
|
|
7
6
|
SelectorFamilyToken,
|
|
8
|
-
WritableSelectorFamily,
|
|
9
7
|
WritableSelectorFamilyToken,
|
|
10
8
|
} from "./selector"
|
|
11
9
|
|
|
@@ -61,13 +59,6 @@ export type SelectorToken<T> =
|
|
|
61
59
|
export type WritableToken<T> = AtomToken<T> | WritableSelectorToken<T>
|
|
62
60
|
export type ReadableToken<T> = AtomToken<T> | SelectorToken<T>
|
|
63
61
|
|
|
64
|
-
export type WritableFamily<T, K extends Canonical> =
|
|
65
|
-
| AtomFamily<T, K>
|
|
66
|
-
| WritableSelectorFamily<T, K>
|
|
67
|
-
export type ReadableFamily<T, K extends Canonical> =
|
|
68
|
-
| AtomFamily<T, K>
|
|
69
|
-
| SelectorFamily<T, K>
|
|
70
|
-
|
|
71
62
|
export type WritableFamilyToken<T, K extends Canonical> =
|
|
72
63
|
| AtomFamilyToken<T, K>
|
|
73
64
|
| WritableSelectorFamilyToken<T, K>
|
package/src/selector.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Store, Subject } from "atom.io/internal"
|
|
2
1
|
import {
|
|
3
2
|
createSelectorFamily,
|
|
4
3
|
createStandaloneSelector,
|
|
@@ -7,7 +6,7 @@ import {
|
|
|
7
6
|
import type { Canonical } from "atom.io/json"
|
|
8
7
|
|
|
9
8
|
import type { ReadonlySelectorToken, WritableSelectorToken } from "."
|
|
10
|
-
import type { Read,
|
|
9
|
+
import type { Read, Write } from "./transaction"
|
|
11
10
|
|
|
12
11
|
export type WritableSelectorOptions<T> = {
|
|
13
12
|
key: string
|
|
@@ -48,15 +47,6 @@ export type WritableSelectorFamilyToken<T, K extends Canonical> = {
|
|
|
48
47
|
__K?: K
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
// biome-ignore format: intersection
|
|
52
|
-
export type WritableSelectorFamily<T, K extends Canonical> =
|
|
53
|
-
& WritableSelectorFamilyToken<T, K>
|
|
54
|
-
& {
|
|
55
|
-
(key: K): WritableSelectorToken<T>
|
|
56
|
-
subject: Subject<StateCreation<WritableSelectorToken<T>> | StateDisposal<WritableSelectorToken<T>>>
|
|
57
|
-
install: (store: Store) => void
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
export type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
|
|
61
51
|
key: string
|
|
62
52
|
type: `readonly_selector_family`
|
|
@@ -64,21 +54,6 @@ export type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
|
|
|
64
54
|
__K?: K
|
|
65
55
|
}
|
|
66
56
|
|
|
67
|
-
// biome-ignore format: intersection
|
|
68
|
-
export type ReadonlySelectorFamily<T, K extends Canonical> =
|
|
69
|
-
& ((key: K) => ReadonlySelectorToken<T>)
|
|
70
|
-
& {
|
|
71
|
-
key: string
|
|
72
|
-
type: `readonly_selector_family`
|
|
73
|
-
subject: Subject<StateCreation<ReadonlySelectorToken<T>> | StateDisposal<ReadonlySelectorToken<T>>>
|
|
74
|
-
install: (store: Store) => void
|
|
75
|
-
__T?: T
|
|
76
|
-
__K?: K
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type SelectorFamily<T, K extends Canonical> =
|
|
80
|
-
| ReadonlySelectorFamily<T, K>
|
|
81
|
-
| WritableSelectorFamily<T, K>
|
|
82
57
|
export type SelectorFamilyToken<T, K extends Canonical> =
|
|
83
58
|
| ReadonlySelectorFamilyToken<T, K>
|
|
84
59
|
| WritableSelectorFamilyToken<T, K>
|
package/src/set-state.ts
CHANGED
|
@@ -25,9 +25,9 @@ export function setState<T, New extends T>(
|
|
|
25
25
|
* @param value - The new value of the state.
|
|
26
26
|
* @overload Streamlined
|
|
27
27
|
*/
|
|
28
|
-
export function setState<T, K extends Canonical, New extends T>(
|
|
28
|
+
export function setState<T, K extends Canonical, New extends T, Key extends K>(
|
|
29
29
|
token: WritableFamilyToken<T, K>,
|
|
30
|
-
key:
|
|
30
|
+
key: Key,
|
|
31
31
|
value: New | ((oldValue: T) => New),
|
|
32
32
|
): void
|
|
33
33
|
|
package/src/silo.ts
CHANGED
|
@@ -24,13 +24,13 @@ import type {
|
|
|
24
24
|
getState,
|
|
25
25
|
makeMolecule,
|
|
26
26
|
moleculeFamily,
|
|
27
|
-
MutableAtomFamily,
|
|
28
27
|
MutableAtomFamilyOptions,
|
|
28
|
+
MutableAtomFamilyToken,
|
|
29
29
|
MutableAtomOptions,
|
|
30
30
|
MutableAtomToken,
|
|
31
31
|
redo,
|
|
32
|
-
RegularAtomFamily,
|
|
33
32
|
RegularAtomFamilyOptions,
|
|
33
|
+
RegularAtomFamilyToken,
|
|
34
34
|
RegularAtomOptions,
|
|
35
35
|
RegularAtomToken,
|
|
36
36
|
setState,
|
|
@@ -74,15 +74,17 @@ export class Silo {
|
|
|
74
74
|
T extends Transceiver<any>,
|
|
75
75
|
J extends Json.Serializable,
|
|
76
76
|
K extends Canonical,
|
|
77
|
-
>(
|
|
77
|
+
>(
|
|
78
|
+
options: MutableAtomFamilyOptions<T, J, K>,
|
|
79
|
+
): MutableAtomFamilyToken<T, J, K>
|
|
78
80
|
function _atomFamily<T, K extends Canonical>(
|
|
79
81
|
options: RegularAtomFamilyOptions<T, K>,
|
|
80
|
-
):
|
|
82
|
+
): RegularAtomFamilyToken<T, K>
|
|
81
83
|
function _atomFamily<T, K extends Canonical>(
|
|
82
84
|
options:
|
|
83
85
|
| MutableAtomFamilyOptions<any, any, any>
|
|
84
86
|
| RegularAtomFamilyOptions<T, K>,
|
|
85
|
-
):
|
|
87
|
+
): MutableAtomFamilyToken<any, any, any> | RegularAtomFamilyToken<T, K> {
|
|
86
88
|
return createAtomFamily(options, s)
|
|
87
89
|
}
|
|
88
90
|
this.store = s
|