chem-rx 0.0.1 → 0.0.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/README.md +268 -30
- package/dist/Atom.d.ts +51 -16
- package/dist/Atom.d.ts.map +1 -1
- package/dist/Signal.d.ts +4 -4
- package/dist/Signal.d.ts.map +1 -1
- package/dist/index.cjs.js +199 -69
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.iife.js +199 -69
- package/dist/index.js +134 -32
- package/dist/useAtom.d.ts +2 -2
- package/dist/useAtom.d.ts.map +1 -1
- package/dist/useSelectAtom.d.ts +5 -0
- package/dist/useSelectAtom.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/Atom.ts +122 -22
- package/src/Signal.ts +4 -14
- package/src/index.ts +1 -0
- package/src/useAtom.ts +3 -3
- package/src/useSelectAtom.ts +24 -0
- package/tests/atom.test.ts +242 -19
- package/tests/sample.ts +123 -0
- package/dist/hydrateAtoms.d.ts +0 -3
- package/dist/hydrateAtoms.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# chem-rx
|
|
2
2
|
|
|
3
|
-
`chem-rx` wraps`
|
|
3
|
+
`chem-rx` wraps `rxjs` to provide a state management solution focused on
|
|
4
4
|
simplicity. Useable with or without React!
|
|
5
5
|
|
|
6
6
|
## Atom
|
|
@@ -14,10 +14,10 @@ Atoms are state containers that take any value - object, array, or primitive.
|
|
|
14
14
|
```
|
|
15
15
|
import { Atom } from 'chem-rx'
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
17
|
+
const number$: BaseAtom = Atom(0)
|
|
18
|
+
const string$: BaseAtom = Atom('hello')
|
|
19
|
+
const array$: ArrayAtom = Atom(['hello', 'world'])
|
|
20
|
+
const object$: ObjectAtom = Atom({ 'hello': 'world', 'world': 'hello' })
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Getting & setting values
|
|
@@ -26,55 +26,293 @@ const objectAtom: ObjectAtom = Atom({ 'hello': 'world', 'world': 'hello' })
|
|
|
26
26
|
`ObjectAtom` depending on the input.
|
|
27
27
|
|
|
28
28
|
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
numberAtom.set(2)
|
|
33
|
-
numberAtom.value()
|
|
29
|
+
// Base Atom
|
|
30
|
+
number$.set(2)
|
|
31
|
+
number$.value()
|
|
34
32
|
// 2
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
arrayAtom.push('!')
|
|
40
|
-
arrayAtom.value()
|
|
34
|
+
// ArrayAtom
|
|
35
|
+
array$.push('!')
|
|
36
|
+
array$.value()
|
|
41
37
|
// ['hello', 'world', '!']
|
|
42
|
-
|
|
38
|
+
array$.get(1)
|
|
43
39
|
// 'world'
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
objectAtom.set('world', 'hi')
|
|
49
|
-
objectAtom.value()
|
|
41
|
+
// ObjectAtom
|
|
42
|
+
object$.set('world', 'hi')
|
|
43
|
+
object$.value()
|
|
50
44
|
// {'hello': 'world', 'world': 'hi'}
|
|
51
45
|
|
|
52
|
-
|
|
46
|
+
object$.set('sup', 'earth')
|
|
53
47
|
// {'hello': 'world', 'world': 'hi', 'sup': 'earth'}
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
object$.get('world')
|
|
56
50
|
// 'hi'
|
|
57
51
|
```
|
|
58
52
|
|
|
59
|
-
###
|
|
53
|
+
### Selecting Atoms
|
|
54
|
+
|
|
55
|
+
You can select Object and Array atoms to return new Atoms that wrap the values
|
|
56
|
+
at that key. This can be useful for working with different parts of nested Array
|
|
57
|
+
and Object atoms.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
const nestedData = Atom({
|
|
61
|
+
stacy: {
|
|
62
|
+
nickname: "stace",
|
|
63
|
+
education: {
|
|
64
|
+
school: "Penn",
|
|
65
|
+
graduation: 2014,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const stacy = nestedData.select("stacy");
|
|
71
|
+
console.log(stacy.get('nickname'))
|
|
72
|
+
// 'stace'
|
|
73
|
+
|
|
74
|
+
const stacySchool = nestedData.select("stacy").select("education");
|
|
75
|
+
console.log(stacySchool.get('school'))
|
|
76
|
+
// 'Penn'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Derived Atoms (read-only)
|
|
80
|
+
|
|
81
|
+
You can derive new Atoms from any existing atoms. Any time the original atoms
|
|
82
|
+
change, your derived atoms will automatically update with new values!
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
const atom$ = Atom(3);
|
|
86
|
+
|
|
87
|
+
// square it
|
|
88
|
+
const squared$ = atom$.derive((x) => x * x);
|
|
89
|
+
|
|
90
|
+
// "9"
|
|
91
|
+
console.log(squared$.value())
|
|
92
|
+
|
|
93
|
+
// Update the original value
|
|
94
|
+
atom$.set(4)
|
|
95
|
+
|
|
96
|
+
// "16"
|
|
97
|
+
console.log(squared$.value())
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every derived atom is **read-only**. This prevents you from overriding the
|
|
101
|
+
derived output value, since it is automatically derived from another input!
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
// ERR: Property 'set' does not exist on type ReadOnlyAtom
|
|
105
|
+
squared$.set(2)
|
|
106
|
+
```
|
|
60
107
|
|
|
61
|
-
|
|
108
|
+
You can optionally enforce `readOnly` on an atom at creation time if needed
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
const atom$ = Atom(3, true);
|
|
112
|
+
|
|
113
|
+
// ERR: Property 'set' does not exist on type ReadOnlyAtom
|
|
114
|
+
atom$.set(2)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Combining Atoms
|
|
118
|
+
|
|
119
|
+
Multiple atoms can also be **combined** to create brand new atoms!
|
|
120
|
+
|
|
121
|
+
Here's an example of joining a set of normalized data models
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
const pets$ = Atom<{ [name: string]: { type: "dog" | "cat"; age: number } }>({
|
|
125
|
+
spot: {name: 'spot', type: "dog", age: 5 },
|
|
126
|
+
tabby: {name: 'tabby', type: "cat", age: 12 },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const people$ = Atom<{ [name: string]: { pets: string[] } }>({
|
|
130
|
+
mary: { pets: ["spot"] },
|
|
131
|
+
cam: { pets: ["tabby"] },
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const mary$ = Atom.combine(pets$, people$.select("mary")).derive(
|
|
135
|
+
([pets, mary]) => {
|
|
136
|
+
return {
|
|
137
|
+
...mary,
|
|
138
|
+
pets: mary.pets.map((petName) => pets[petName]),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
console.log(mary$.select('pets').value())
|
|
144
|
+
/*
|
|
145
|
+
* [{
|
|
146
|
+
* name: "spot",
|
|
147
|
+
* type: "dog",
|
|
148
|
+
* age: 5,
|
|
149
|
+
* }]
|
|
150
|
+
*/
|
|
151
|
+
```
|
|
62
152
|
|
|
63
153
|
### Subscribing to updates
|
|
64
154
|
|
|
155
|
+
Atoms emit values each time they're updated. You can subscribe callbacks to them
|
|
156
|
+
to act on updates
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
const atom$ = Atom(3);
|
|
160
|
+
|
|
161
|
+
const subscription = atom$.subscribe(val => {
|
|
162
|
+
console.log("Received value: ", val)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
atom$.set(4)
|
|
166
|
+
// "Received value: 4"
|
|
167
|
+
|
|
168
|
+
// Unsubscribe to clean up
|
|
169
|
+
subscription.unsubscribe();
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Signals
|
|
173
|
+
|
|
174
|
+
Sometimes, all you want is something to ping you when there's an update. Signals
|
|
175
|
+
are stateless transceivers for signaling updates.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
const signal$ = new Signal();
|
|
179
|
+
|
|
180
|
+
const subscription = signal$.subscribe(() => {
|
|
181
|
+
console.log("PONG")
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
signal$.ping()
|
|
185
|
+
// "PONG"
|
|
186
|
+
|
|
187
|
+
// Unsubscribe to clean up
|
|
188
|
+
subscription.unsubscribe();
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Signals can also send values if needed.
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
const signal$ = new Signal();
|
|
195
|
+
|
|
196
|
+
const subscription = signal$.subscribe((value) => {
|
|
197
|
+
console.log("PONGED: ", value)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
signal$.ping("hello")
|
|
201
|
+
// "PONGED: hello"
|
|
202
|
+
|
|
203
|
+
// Unsubscribe to clean up
|
|
204
|
+
subscription.unsubscribe();
|
|
205
|
+
```
|
|
206
|
+
|
|
65
207
|
## Use with React
|
|
66
208
|
|
|
67
209
|
### useAtom
|
|
68
210
|
|
|
211
|
+
`useAtom` automatically updates with new values in your react components.
|
|
212
|
+
|
|
213
|
+
If you want to update your atoms, you can simply call the same `set`
|
|
214
|
+
(Base/ObjectAtom) or `push` (ArrayAtom) methods you would typically use outside
|
|
215
|
+
of react.
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
import { Atom, useAtom } from 'chem-rx'
|
|
219
|
+
|
|
220
|
+
const count$ = Atom(0)
|
|
221
|
+
|
|
222
|
+
function Counter() {
|
|
223
|
+
const count = useAtom(count$)
|
|
224
|
+
return (
|
|
225
|
+
<h1>
|
|
226
|
+
{count}
|
|
227
|
+
<button onClick={() => count$.set(count$.value() + 1)}>one up</button> ...
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Remember that you can mix and match for any of your needs
|
|
231
|
+
|
|
232
|
+
### useSelectAtom
|
|
233
|
+
|
|
234
|
+
With `useSelect` can select a specific key from an atom, and still have it live
|
|
235
|
+
update in your react component.
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
import { Atom, useAtom } from 'chem-rx'
|
|
239
|
+
|
|
240
|
+
const count$ = Atom({ inner: 0 })
|
|
241
|
+
|
|
242
|
+
function Counter() {
|
|
243
|
+
const count = useSelectAtom(count$, 'inner')
|
|
244
|
+
return (
|
|
245
|
+
<h1>
|
|
246
|
+
{count}
|
|
247
|
+
<button onClick={() => count$.set('inner', count + 2)}>one up</button> ...
|
|
248
|
+
```
|
|
249
|
+
|
|
69
250
|
### hydrateAtoms
|
|
70
251
|
|
|
71
|
-
|
|
252
|
+
With SSR, your atoms will likely need to be properly hydrated to prevent
|
|
253
|
+
server/client mismatches. You can use `hydrateAtoms` as a simple solution for
|
|
254
|
+
seeding your client-side Atoms with the correct data.
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
import { Atom, useAtom, hydrateAtoms } from 'chem-rx'
|
|
258
|
+
|
|
259
|
+
const count$ = Atom(0)
|
|
260
|
+
const CounterPage = ({ countFromServer }) => {
|
|
261
|
+
hydrateAtoms([[count$, countFromServer]])
|
|
262
|
+
const count = useAtom(count$)
|
|
263
|
+
// count would be the value of `countFromServer`, not 0.
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Suggested Usage
|
|
268
|
+
|
|
269
|
+
There are several suggested "patterns" when using Atoms:
|
|
270
|
+
|
|
271
|
+
1. Suffix all atoms with `$` (for readability).
|
|
272
|
+
2. Keep all data management **outside** of your views (e.g, React)
|
|
273
|
+
3. Avoid using `set` and `push` directly from your client components. Instead,
|
|
274
|
+
create helper functions (actions)
|
|
275
|
+
4. Name your helper actions as `<atomName>$<actionName>`, to easily see what
|
|
276
|
+
atoms are involved.
|
|
277
|
+
5. Name your derived atoms as `<baseAtom>_<derivedValue>$` to easily see which
|
|
278
|
+
atoms it derives from.
|
|
279
|
+
|
|
280
|
+
## Common Issues
|
|
281
|
+
|
|
282
|
+
Here are some common issues you might run into when starting out.
|
|
283
|
+
|
|
284
|
+
1. Keep your atoms in separate files to prevent circular dependencies.
|
|
285
|
+
1. I typically create a new file for every action, so I can easily see the
|
|
286
|
+
API surface at a glance
|
|
287
|
+
|
|
288
|
+
## Advanced Usage with `rxjs`
|
|
289
|
+
|
|
290
|
+
Behind the scenes, `chem-rx` uses
|
|
291
|
+
[rxjs Observables](https://rxjs.dev/guide/operators) to enable reactivity.
|
|
292
|
+
`Atom` abstracts away the majority of Rx intentionally, to extract the most
|
|
293
|
+
common patterns used when managing front-end data.
|
|
294
|
+
|
|
295
|
+
If you're coming in with prior experience and are seeking more complex operators
|
|
296
|
+
enabled by Rx, you're in luck, because every Atom is simply a wrapper around a
|
|
297
|
+
`BehaviorSubject`!
|
|
298
|
+
|
|
299
|
+
You can use any rxjs operations you want with `Atom.pipe`, which wraps
|
|
300
|
+
`Observable.pipe` to return an Atom.
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
import { map } from "rxjs";
|
|
304
|
+
|
|
305
|
+
const atom$ = Atom(3);
|
|
306
|
+
|
|
307
|
+
// Replace `map` with any operators from rxjs
|
|
308
|
+
const squared$: Atom<number> = atom.pipe(map((x) => x * x));
|
|
309
|
+
|
|
310
|
+
// "9"
|
|
311
|
+
console.log(squared$.value());
|
|
312
|
+
```
|
|
72
313
|
|
|
73
314
|
## Why...?
|
|
74
315
|
|
|
75
316
|
This library spawned out of a love for the flexibility and expressiveness of
|
|
76
|
-
[
|
|
317
|
+
[rxjs](https://github.com/ReactiveX/rxjs) Observables, and the simplicity of
|
|
77
318
|
atomic libraries like [jotai](https://github.com/pmndrs/jotai).
|
|
78
|
-
|
|
79
|
-
Its primary focus is on ease of use and code cleanliness, and is my go-to
|
|
80
|
-
library for all client-side state management
|
package/dist/Atom.d.ts
CHANGED
|
@@ -1,29 +1,64 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable, OperatorFunction, Subscription } from "rxjs";
|
|
2
2
|
export type AtomTuple<T> = {
|
|
3
|
-
[K in keyof T]:
|
|
3
|
+
[K in keyof T]: ReadOnlyAtom<T[K]>;
|
|
4
4
|
};
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class ReadOnlyAtom<T> {
|
|
6
6
|
_behavior$: BehaviorSubject<T>;
|
|
7
7
|
_parent?: BehaviorSubject<T>[];
|
|
8
8
|
_bonds: BehaviorSubject<T>[];
|
|
9
9
|
_fromObservable: Observable<T> | null;
|
|
10
10
|
_fromObservableSubscription: Subscription | null;
|
|
11
|
-
static combine<A extends readonly unknown[]>(...atoms: readonly [...AtomTuple<A>]): Atom<A>;
|
|
12
11
|
constructor(_value: T | Observable<T>);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
pipe(): ReadOnlyAtom<T>;
|
|
13
|
+
pipe<A>(op1: OperatorFunction<T, A>): ReadOnlyAtom<A>;
|
|
14
|
+
pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): ReadOnlyAtom<B>;
|
|
15
|
+
pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): ReadOnlyAtom<C>;
|
|
16
|
+
pipe<A, B, C, D>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): ReadOnlyAtom<D>;
|
|
17
|
+
pipe<A, B, C, D, E>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): ReadOnlyAtom<E>;
|
|
18
|
+
pipe<A, B, C, D, E, F>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): ReadOnlyAtom<F>;
|
|
19
|
+
pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): ReadOnlyAtom<G>;
|
|
20
|
+
pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): ReadOnlyAtom<H>;
|
|
21
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): ReadOnlyAtom<I>;
|
|
22
|
+
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): ReadOnlyAtom<unknown>;
|
|
23
|
+
derive<A>(deriveFn: (value: T, index: number) => A): ReadOnlyAtom<A>;
|
|
25
24
|
subscribe(...params: Parameters<BehaviorSubject<T>["subscribe"]>): Subscription;
|
|
26
|
-
|
|
25
|
+
value(): T;
|
|
27
26
|
dispose(): void;
|
|
27
|
+
get(key: T extends (infer W)[] ? number : T extends {
|
|
28
|
+
[key in keyof T]: infer W;
|
|
29
|
+
} ? keyof T : undefined): T extends (infer W)[] ? T[number] : T extends {
|
|
30
|
+
[key in keyof T]: infer W;
|
|
31
|
+
} ? T[keyof T] : undefined;
|
|
32
|
+
select<K extends keyof T>(key: K): T[K] extends (infer W)[] ? ArrayAtom<W> : T[K] extends {
|
|
33
|
+
[key: string | symbol]: infer W;
|
|
34
|
+
} ? ObjectAtom<T[K]> : BaseAtom<T[K]>;
|
|
35
|
+
}
|
|
36
|
+
export declare class BaseAtom<T> extends ReadOnlyAtom<T> {
|
|
37
|
+
set(nextVal: T): void;
|
|
38
|
+
}
|
|
39
|
+
export declare class ArrayAtom<T> extends ReadOnlyAtom<T[]> {
|
|
40
|
+
constructor(initialValue: T[]);
|
|
41
|
+
push(nextVal: T): void;
|
|
42
|
+
}
|
|
43
|
+
export declare class ObjectAtom<T extends {
|
|
44
|
+
[key in K]: V;
|
|
45
|
+
}, K extends string | number | symbol = keyof T, V = T[K]> extends ReadOnlyAtom<T> {
|
|
46
|
+
set(nextKey: K, nextValue: V): void;
|
|
47
|
+
}
|
|
48
|
+
export declare function Atom<T>(value: T extends {
|
|
49
|
+
[key: string]: infer V;
|
|
50
|
+
} | any[] ? never : Observable<T>): BaseAtom<T>;
|
|
51
|
+
export declare function Atom<T extends any[]>(value: Observable<T>): ArrayAtom<T[number]>;
|
|
52
|
+
export declare function Atom<T>(value: T extends {
|
|
53
|
+
[key in keyof T]: infer V;
|
|
54
|
+
} ? Observable<T> : never): ObjectAtom<T>;
|
|
55
|
+
export declare function Atom<T extends any[]>(value: T): ArrayAtom<T[number]>;
|
|
56
|
+
export declare function Atom<T extends {
|
|
57
|
+
[key: string]: T[keyof T];
|
|
58
|
+
}>(value: T): ObjectAtom<T>;
|
|
59
|
+
export declare function Atom<T>(value: T): BaseAtom<T>;
|
|
60
|
+
export declare function Atom<T>(value: T, readOnly?: boolean): ReadOnlyAtom<T>;
|
|
61
|
+
export declare namespace Atom {
|
|
62
|
+
var combine: <A extends readonly unknown[]>(...atoms_0: AtomTuple<A>) => ReadOnlyAtom<A>;
|
|
28
63
|
}
|
|
29
64
|
//# sourceMappingURL=Atom.d.ts.map
|
package/dist/Atom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Atom.d.ts","sourceRoot":"","sources":["../src/Atom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"Atom.d.ts","sourceRoot":"","sources":["../src/Atom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKf,UAAU,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,MAAM,CAAC;AAGd,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF,qBAAa,YAAY,CAAC,CAAC;IACzB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE/B,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAM;IAElC,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IAC7C,2BAA2B,EAAE,YAAY,GAAG,IAAI,CAAQ;gBAE5C,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAcrC,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IACrD,IAAI,CAAC,CAAC,EAAE,CAAC,EACP,GAAG,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,GAAG,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,YAAY,CAAC,CAAC,CAAC;IAClB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACV,GAAG,E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GtE,wBAAgB,IAAI,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,EAC1D,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC,CAAC;AAGjB,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAG/C,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;yBAAvD,IAAI"}
|
package/dist/Signal.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Subject
|
|
2
|
-
export declare class
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
export declare class BaseSignal<T = any> {
|
|
3
3
|
_subject$: Subject<T>;
|
|
4
4
|
constructor();
|
|
5
5
|
ping(value: T): void;
|
|
6
|
-
subscribe(...params: Parameters<Subject<T>["subscribe"]>): Subscription;
|
|
7
|
-
dispose(): void;
|
|
6
|
+
subscribe(...params: Parameters<Subject<T>["subscribe"]>): import("rxjs").Subscription;
|
|
8
7
|
}
|
|
8
|
+
export declare function Signal<T>(): void;
|
|
9
9
|
//# sourceMappingURL=Signal.d.ts.map
|
package/dist/Signal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../src/Signal.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../src/Signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,qBAAa,UAAU,CAAC,CAAC,GAAG,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;;IAOtB,IAAI,CAAC,KAAK,EAAE,CAAC;IAIb,SAAS,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;CAGzD;AAED,wBAAgB,MAAM,CAAC,CAAC,UAAM"}
|