chem-rx 0.0.23 → 0.1.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 +36 -29
- package/dist/Atom.d.ts +39 -42
- package/dist/Atom.d.ts.map +1 -1
- package/dist/Signal.d.ts +4 -5
- package/dist/Signal.d.ts.map +1 -1
- package/dist/index.cjs.js +367 -290
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.iife.js +369 -289
- package/dist/index.mjs +366 -0
- package/dist/react.cjs.js +50 -0
- package/{src/index.ts → dist/react.d.ts} +1 -3
- package/dist/react.d.ts.map +1 -0
- package/dist/react.mjs +40 -0
- package/dist/store.d.ts +30 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/useAtom.d.ts +2 -2
- package/dist/useAtom.d.ts.map +1 -1
- package/dist/useHydrateAtoms.d.ts.map +1 -1
- package/dist/useSelectAtom.d.ts.map +1 -1
- package/package.json +33 -16
- package/.size-snapshot.json +0 -26
- package/babel.config.js +0 -24
- package/dist/index.js +0 -301
- package/dist/types.d.ts +0 -32
- package/dist/types.d.ts.map +0 -1
- package/rollup.config.js +0 -92
- package/src/Atom.ts +0 -374
- package/src/Signal.ts +0 -38
- package/src/types.ts +0 -66
- package/src/useAtom.ts +0 -20
- package/src/useHydrateAtoms.ts +0 -16
- package/src/useSelectAtom.ts +0 -25
- package/src/useSignal.ts +0 -24
- package/tests/atom.test.ts +0 -625
- package/tests/sample.ts +0 -123
- package/tsconfig.json +0 -23
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# chem-rx
|
|
2
2
|
|
|
3
|
-
`chem-rx`
|
|
4
|
-
|
|
3
|
+
`chem-rx` provides a small atomic state management layer focused on simplicity.
|
|
4
|
+
Useable with or without React!
|
|
5
5
|
|
|
6
6
|
## Atom
|
|
7
7
|
|
|
@@ -88,6 +88,7 @@ at that key. Any time the original atom changes, your selected atom will automat
|
|
|
88
88
|
This can be especially useful for working with different parts of nested Array and Object atoms.
|
|
89
89
|
|
|
90
90
|
Atoms created with `select` are **read-only** (`ReadOnlyAtom`). This prevents you from modifying original values that the atom was created from.
|
|
91
|
+
Selected atoms are lazy: calling `value()` reads the latest parent snapshot, and subscribing to a selected atom listens to the parent only while that selected atom has active subscribers.
|
|
91
92
|
|
|
92
93
|
```
|
|
93
94
|
const students = Atom({
|
|
@@ -130,6 +131,8 @@ change, your derived atoms will automatically update with new values.
|
|
|
130
131
|
|
|
131
132
|
Every derived atom is **read-only**. This prevents you from overriding the
|
|
132
133
|
derived output value, since it is automatically derived from another input.
|
|
134
|
+
Like selected atoms, derived atoms are lazy and only stay subscribed to their
|
|
135
|
+
inputs while they have active subscribers.
|
|
133
136
|
|
|
134
137
|
```
|
|
135
138
|
const atom$ = Atom(3);
|
|
@@ -138,7 +141,7 @@ const squared$ = atom$.derive((x) => x * x);
|
|
|
138
141
|
|
|
139
142
|
squared$.value() // "9"
|
|
140
143
|
|
|
141
|
-
atom$.
|
|
144
|
+
atom$.next(4)
|
|
142
145
|
|
|
143
146
|
squared$.value() // "16"
|
|
144
147
|
|
|
@@ -256,6 +259,8 @@ You can selectively subscribe to Signals, and selectively ping subscribers by ID
|
|
|
256
259
|
|
|
257
260
|
## Use with React
|
|
258
261
|
|
|
262
|
+
The root package is headless. React hooks are available from `chem-rx/react`.
|
|
263
|
+
|
|
259
264
|
### useAtom
|
|
260
265
|
|
|
261
266
|
`useAtom` automatically updates with new values in your react components.
|
|
@@ -264,7 +269,8 @@ If you want to update your atoms, you can simply call the same `next`, `set`, or
|
|
|
264
269
|
of react.
|
|
265
270
|
|
|
266
271
|
```
|
|
267
|
-
import { Atom
|
|
272
|
+
import { Atom } from 'chem-rx'
|
|
273
|
+
import { useAtom } from 'chem-rx/react'
|
|
268
274
|
|
|
269
275
|
const count$ = Atom(0)
|
|
270
276
|
|
|
@@ -273,18 +279,19 @@ function Counter() {
|
|
|
273
279
|
return (
|
|
274
280
|
<h1>
|
|
275
281
|
{count}
|
|
276
|
-
<button onClick={() => count$.
|
|
282
|
+
<button onClick={() => count$.next(count$.value() + 1)}>one up</button> ...
|
|
277
283
|
```
|
|
278
284
|
|
|
279
285
|
Remember that you can mix and match for any of your needs
|
|
280
286
|
|
|
281
287
|
### useSelectAtom
|
|
282
288
|
|
|
283
|
-
With `
|
|
289
|
+
With `useSelectAtom` you can select a specific key from an atom, and still have it live
|
|
284
290
|
update in your react component.
|
|
285
291
|
|
|
286
292
|
```
|
|
287
|
-
import { Atom
|
|
293
|
+
import { Atom } from 'chem-rx'
|
|
294
|
+
import { useSelectAtom } from 'chem-rx/react'
|
|
288
295
|
|
|
289
296
|
const count$ = Atom({ inner: 0 })
|
|
290
297
|
|
|
@@ -299,13 +306,14 @@ function Counter() {
|
|
|
299
306
|
### hydrateAtoms
|
|
300
307
|
|
|
301
308
|
With SSR, your atoms will likely need to be properly hydrated to prevent
|
|
302
|
-
server/client mismatches. You can use `
|
|
309
|
+
server/client mismatches. You can use `hydrateAtoms` as a simple solution for
|
|
303
310
|
seeding your client-side Atoms with the correct data.
|
|
304
311
|
|
|
305
312
|
NOTE: **`hydrateAtoms` caches values and only runs on the initial load by default**, to prevent re-hydration when client-side only changes are made to the component.
|
|
306
313
|
|
|
307
314
|
```
|
|
308
|
-
import { Atom,
|
|
315
|
+
import { Atom, hydrateAtoms } from 'chem-rx'
|
|
316
|
+
import { useAtom } from 'chem-rx/react'
|
|
309
317
|
|
|
310
318
|
const count$ = Atom(0)
|
|
311
319
|
const CounterPage = ({ countFromServer }) => {
|
|
@@ -372,32 +380,31 @@ There are several suggested "patterns" when using Atoms:
|
|
|
372
380
|
6. Name your derived atoms as `<baseAtom>_<derivedValue>$` to easily see which
|
|
373
381
|
atoms it derives from.
|
|
374
382
|
|
|
375
|
-
## Advanced Usage
|
|
376
|
-
|
|
377
|
-
Behind the scenes, `chem-rx` uses
|
|
378
|
-
[rxjs Observables](https://rxjs.dev/guide/operators) to enable reactivity.
|
|
379
|
-
`Atom` abstracts away the majority of Rx intentionally, to extract the most
|
|
380
|
-
common patterns used when managing front-end data.
|
|
383
|
+
## Advanced Usage
|
|
381
384
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
+
Behind the scenes, `chem-rx` uses a tiny synchronous external-store primitive to
|
|
386
|
+
enable reactivity. `derive`, `select`, and `combine` cover the common state
|
|
387
|
+
composition patterns without requiring a stream library.
|
|
385
388
|
|
|
386
|
-
|
|
387
|
-
`
|
|
389
|
+
If you already have an Observable-like source, you can still create an atom from
|
|
390
|
+
it as long as it has `subscribe` and, ideally, a synchronous `getValue` or
|
|
391
|
+
`value` method for the initial snapshot.
|
|
388
392
|
|
|
389
393
|
```
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
const source = {
|
|
395
|
+
getValue: () => 3,
|
|
396
|
+
subscribe: (next) => {
|
|
397
|
+
next(3);
|
|
398
|
+
return { unsubscribe: () => {} };
|
|
399
|
+
},
|
|
400
|
+
};
|
|
396
401
|
|
|
397
|
-
|
|
398
|
-
console.log(squared$.value());
|
|
402
|
+
const atom$ = Atom(source);
|
|
399
403
|
```
|
|
400
404
|
|
|
401
405
|
## Why...?
|
|
402
406
|
|
|
403
|
-
|
|
407
|
+
I wanted a framework-agnostic [jotai](https://github.com/pmndrs/jotai)-like
|
|
408
|
+
solution with a simpler API. The core atom model does not need a full stream
|
|
409
|
+
library, so `chem-rx` keeps the small atom surface and leaves heavier reactive
|
|
410
|
+
tooling optional.
|
package/dist/Atom.d.ts
CHANGED
|
@@ -1,60 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AtomObserver, AtomSource, AtomSubscription } from "./store";
|
|
2
2
|
export type AtomTuple<T> = {
|
|
3
3
|
[K in keyof T]: ReadOnlyAtom<T[K]>;
|
|
4
4
|
};
|
|
5
|
+
type SelectedValue<T, K extends keyof T> = T extends readonly (infer W)[] ? W : T[K];
|
|
6
|
+
type SelectKey<T> = keyof NonNullable<T>;
|
|
7
|
+
type SelectValue<T, K extends SelectKey<T>> = Extract<T, null | undefined> extends never ? SelectedValue<NonNullable<T>, K> : SelectedValue<NonNullable<T>, K> | undefined;
|
|
8
|
+
type AtomDependency<T> = {
|
|
9
|
+
getSnapshot: (force?: boolean) => T;
|
|
10
|
+
subscribe: (onDependencyChange: () => void) => AtomSubscription | (() => void) | void;
|
|
11
|
+
shouldNotify?: (previousValue: T, nextValue: T) => boolean;
|
|
12
|
+
};
|
|
5
13
|
export declare class ReadOnlyAtom<T> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
constructor(_value: T |
|
|
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>;
|
|
14
|
+
private _store;
|
|
15
|
+
private _subscriptions;
|
|
16
|
+
private _dependency;
|
|
17
|
+
private _dependencySubscription;
|
|
18
|
+
private _subscriberCount;
|
|
19
|
+
constructor(_value: T | AtomSource<T>, dependency?: AtomDependency<T>);
|
|
23
20
|
derive<A>(deriveFn: (value: T, index: number) => A): ReadOnlyAtom<A>;
|
|
24
|
-
subscribe(
|
|
21
|
+
subscribe(observer: AtomObserver<T>): AtomSubscription;
|
|
25
22
|
value(): T;
|
|
26
23
|
dispose(): void;
|
|
27
|
-
get<K extends
|
|
28
|
-
select<K extends
|
|
24
|
+
get<K extends SelectKey<T>>(key: K): SelectValue<T, K>;
|
|
25
|
+
select<K extends SelectKey<T>>(key: K): ReadOnlyAtom<SelectValue<T, K>>;
|
|
26
|
+
private _refresh;
|
|
27
|
+
private _retainDependency;
|
|
28
|
+
private _releaseDependency;
|
|
29
|
+
/** @internal */
|
|
30
|
+
_next(value: T): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
_subscribe(observer: AtomObserver<T>, options?: {
|
|
33
|
+
emitImmediately?: boolean;
|
|
34
|
+
}): AtomSubscription;
|
|
35
|
+
/** @internal */
|
|
36
|
+
_addSubscription(subscription: AtomSubscription | (() => void) | void): AtomSubscription;
|
|
29
37
|
}
|
|
30
38
|
export declare class BaseAtom<T> extends ReadOnlyAtom<T> {
|
|
31
39
|
next(nextVal: T): void;
|
|
32
|
-
set(nextKey:
|
|
40
|
+
set<K extends SelectKey<T>>(nextKey: K, nextValue: NonNullable<T>[K]): void;
|
|
33
41
|
}
|
|
34
|
-
export declare class NullableBaseAtom<T> extends BaseAtom<T> {
|
|
35
|
-
constructor(_value?: T |
|
|
36
|
-
get<K extends keyof T>(key: K): (T extends (infer W)[] ? T[number] : T[K]) | undefined;
|
|
37
|
-
select<K extends keyof T>(key: K): T extends (infer W)[] ? ArrayAtom<W> : NullableBaseAtom<T[K]>;
|
|
42
|
+
export declare class NullableBaseAtom<T> extends BaseAtom<T | null | undefined> {
|
|
43
|
+
constructor(_value?: T | null | undefined | AtomSource<T | null | undefined>);
|
|
38
44
|
next(nextVal: T | null | undefined): void;
|
|
39
45
|
reset(): void;
|
|
40
46
|
}
|
|
41
47
|
export declare class ArrayAtom<T> extends BaseAtom<T[]> {
|
|
42
|
-
constructor(initialValue?: T[]);
|
|
48
|
+
constructor(initialValue?: T[] | AtomSource<T[]>);
|
|
43
49
|
push(nextVal: T): void;
|
|
44
50
|
}
|
|
45
|
-
export declare function Atom<T
|
|
46
|
-
export declare function Atom<T>(value: T
|
|
47
|
-
|
|
48
|
-
} ? Observable<T> : never): BaseAtom<T>;
|
|
49
|
-
export declare function Atom<T>(value?: T extends {
|
|
50
|
-
[key in keyof T]: infer V;
|
|
51
|
-
} ? Observable<T> : never): NullableBaseAtom<T>;
|
|
52
|
-
export declare function Atom<T>(value?: T extends {
|
|
53
|
-
[key: string]: infer V;
|
|
54
|
-
} | any[] ? never : Observable<T>): BaseAtom<T>;
|
|
55
|
-
export declare function Atom<T>(value?: T extends {
|
|
56
|
-
[key: string]: infer V;
|
|
57
|
-
} | any[] ? never : Observable<T>): NullableBaseAtom<T>;
|
|
51
|
+
export declare function Atom<T>(value: T | AtomSource<T>, readOnly: true): ReadOnlyAtom<T>;
|
|
52
|
+
export declare function Atom<T extends any[]>(value: AtomSource<T>): ArrayAtom<T[number]>;
|
|
53
|
+
export declare function Atom<T>(value: AtomSource<T>): BaseAtom<T>;
|
|
58
54
|
export declare function Atom<T extends any[]>(value?: T): ArrayAtom<T[number]>;
|
|
59
55
|
export declare function Atom<T extends {
|
|
60
56
|
[key: string]: T[keyof T];
|
|
@@ -64,8 +60,9 @@ export declare function Atom<T extends {
|
|
|
64
60
|
}>(value?: T): NullableBaseAtom<T>;
|
|
65
61
|
export declare function Atom<T>(value: T): BaseAtom<T>;
|
|
66
62
|
export declare function Atom<T>(value?: T): NullableBaseAtom<T>;
|
|
67
|
-
export declare function Atom<T>(value: T
|
|
63
|
+
export declare function Atom<T>(value: T | AtomSource<T>, readOnly?: boolean): ReadOnlyAtom<T> | BaseAtom<T>;
|
|
68
64
|
export declare namespace Atom {
|
|
69
|
-
var combine: <A extends readonly unknown[]>(...
|
|
65
|
+
var combine: <A extends readonly unknown[]>(...atoms: AtomTuple<A>) => ReadOnlyAtom<A>;
|
|
70
66
|
}
|
|
67
|
+
export {};
|
|
71
68
|
//# 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,
|
|
1
|
+
{"version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,CAAC,GACP,QAAQ,CAAC,CAAC,CAAC,CAAC;AACf,wBAAgB,IAAI,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,EAC1D,KAAK,CAAC,EAAE,CAAC,GACR,gBAAgB,CAAC,CAAC,CAAC,CAAC;AACvB,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC/C,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;AACxD,wBAAgB,IAAI,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EACxB,QAAQ,CAAC,EAAE,OAAO,GACjB,YAAY,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;yBAHjB,IAAI;kBA8BJ,CAAC,SAAS,SAAS,OAAO,EAAE,6BAEzC,YAAY,CAAC,CAAC,CAAC"}
|
package/dist/Signal.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AtomListener, AtomSubscription } from "./store";
|
|
2
2
|
export declare class Signal<T = any> {
|
|
3
|
-
private
|
|
4
|
-
private
|
|
5
|
-
constructor();
|
|
3
|
+
private _listeners;
|
|
4
|
+
private _listenersById;
|
|
6
5
|
ping(value: T, id?: string): void;
|
|
7
|
-
subscribe(callback:
|
|
6
|
+
subscribe(callback: AtomListener<T>, id?: string): AtomSubscription;
|
|
8
7
|
}
|
|
9
8
|
//# 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,EACL,YAAY,EACZ,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAEjB,qBAAa,MAAM,CAAC,CAAC,GAAG,GAAG;IACzB,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,cAAc,CAAwC;IAE9D,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM;IAa1B,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,gBAAgB;CAqBpE"}
|