atom.io 0.6.5 → 0.6.7
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 +32 -78
- package/dist/index.d.mts +11 -43
- package/dist/index.d.ts +11 -43
- package/dist/index.js +111 -291
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -278
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +273 -0
- package/introspection/dist/index.d.ts +273 -0
- package/introspection/dist/index.js +350 -0
- package/introspection/dist/index.js.map +1 -0
- package/introspection/dist/index.mjs +327 -0
- package/introspection/dist/index.mjs.map +1 -0
- package/introspection/package.json +15 -0
- package/package.json +22 -12
- package/react-devtools/dist/index.css +22 -5
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +347 -10
- package/react-devtools/dist/index.d.ts +347 -10
- package/react-devtools/dist/index.js +2743 -696
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +2739 -701
- package/react-devtools/dist/index.mjs.map +1 -1
- package/src/internal/atom-internal.ts +5 -6
- package/src/internal/get.ts +7 -9
- package/src/internal/index.ts +0 -1
- package/src/internal/operation.ts +15 -21
- package/src/internal/selector/create-read-write-selector.ts +8 -4
- package/src/internal/selector/create-readonly-selector.ts +1 -7
- package/src/internal/selector-internal.ts +1 -3
- package/src/internal/set.ts +1 -4
- package/src/internal/store.ts +22 -24
- package/src/internal/subscribe-internal.ts +7 -1
- package/src/internal/time-travel-internal.ts +2 -0
- package/src/internal/timeline/add-atom-to-timeline.ts +11 -12
- package/src/internal/timeline-internal.ts +6 -4
- package/src/internal/transaction/apply-transaction.ts +9 -6
- package/src/internal/transaction/build-transaction.ts +6 -6
- package/src/internal/transaction-internal.ts +1 -7
- package/src/introspection/attach-atom-index.ts +73 -0
- package/src/introspection/attach-introspection-states.ts +42 -0
- package/src/introspection/attach-selector-index.ts +77 -0
- package/src/introspection/attach-timeline-family.ts +59 -0
- package/src/introspection/attach-timeline-index.ts +36 -0
- package/src/introspection/attach-transaction-index.ts +38 -0
- package/src/introspection/attach-transaction-logs.ts +40 -0
- package/src/introspection/index.ts +20 -0
- package/src/react-devtools/AtomIODevtools.tsx +97 -97
- package/src/react-devtools/Button.tsx +24 -0
- package/src/react-devtools/StateEditor.tsx +14 -16
- package/src/react-devtools/StateIndex.tsx +153 -0
- package/src/react-devtools/TimelineIndex.tsx +92 -0
- package/src/react-devtools/TransactionIndex.tsx +70 -0
- package/src/react-devtools/Updates.tsx +145 -0
- package/src/react-devtools/devtools.scss +196 -15
- package/src/react-devtools/index.ts +71 -0
- package/src/react-explorer/AtomIOExplorer.tsx +3 -4
- package/src/react-explorer/explorer-states.ts +1 -1
- package/src/react-explorer/space-states.ts +3 -1
- package/src/react-explorer/view-states.ts +0 -2
- package/realtime-testing/dist/index.d.mts +0 -49
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/index.js +0 -165
- package/realtime-testing/dist/index.js.map +0 -1
- package/realtime-testing/dist/index.mjs +0 -129
- package/realtime-testing/dist/index.mjs.map +0 -1
- package/src/internal/meta/attach-meta.ts +0 -17
- package/src/internal/meta/index.ts +0 -4
- package/src/internal/meta/meta-state.ts +0 -135
- package/src/internal/meta/meta-timelines.ts +0 -1
- package/src/internal/meta/meta-transactions.ts +0 -1
- package/src/react-devtools/TokenList.tsx +0 -61
package/README.md
CHANGED
|
@@ -1,78 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- [x] subscribe to creation of atom tokens
|
|
34
|
-
- [x] subscribe to creation of selector tokens
|
|
35
|
-
- [x] subscribe to creation of readonly selector tokens
|
|
36
|
-
- [ ] reimplement state indices as selectors
|
|
37
|
-
- [ ] subscribe to creation of transaction tokens
|
|
38
|
-
- [ ] subscribe to creation of timeline tokens
|
|
39
|
-
- [ ] subscribe to changes in store configuration
|
|
40
|
-
|
|
41
|
-
# /react-devtools
|
|
42
|
-
- [ ]
|
|
43
|
-
|
|
44
|
-
# /react
|
|
45
|
-
## features
|
|
46
|
-
- [x] useStore
|
|
47
|
-
- [x] useI, useO, useIO
|
|
48
|
-
- [ ] useTimeline
|
|
49
|
-
- [ ] useStoreIndex
|
|
50
|
-
- [ ] useTransactionIO
|
|
51
|
-
|
|
52
|
-
# /realtime
|
|
53
|
-
- [x] expose single atom and selector
|
|
54
|
-
- [x] expose atom family and selector family
|
|
55
|
-
- [ ] receive single atom and selector
|
|
56
|
-
- [ ] receive atom family and selector family
|
|
57
|
-
- [x] receive transaction params, run transaction
|
|
58
|
-
- [ ] assess transaction impact (active subscriptions influenced by transaction)
|
|
59
|
-
- [ ] return transaction impact as timeline event
|
|
60
|
-
- [ ] identity-based exposure and receipt
|
|
61
|
-
- [ ] expose selector as atom
|
|
62
|
-
|
|
63
|
-
# /react-realtime
|
|
64
|
-
example: what's in the box? (options: green apple, green banana, red apple, red banana)
|
|
65
|
-
- no player gets to see what's in the box
|
|
66
|
-
- player 1 can see the color of the item in the box
|
|
67
|
-
- a register must be kept allocating "subscription permissions" per player
|
|
68
|
-
- sometimes permissions may refer to "true" or "global" state; sometimes to state that is "virtual" or "local" to the player
|
|
69
|
-
- player 2 can see the type of the item in the box
|
|
70
|
-
- atom<`${string}____${string}`> boxItem
|
|
71
|
-
- selector boxItemColor
|
|
72
|
-
- selector boxItemType
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
# /web-fx
|
|
77
|
-
## features
|
|
78
|
-
- [ ] localStorage and sessionStorage effects
|
|
1
|
+
<hr>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img alt="corners logo" src="https://raw.githubusercontent.com/jeremybanka/wayforge/main/packages/atom.io/assets/logo.png"/>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://bundlephobia.com/result?p=atom.io">
|
|
11
|
+
<img alt="Bundlephobia" src="https://img.shields.io/bundlephobia/minzip/atom.io?style=for-the-badge&labelColor=333">
|
|
12
|
+
</a>
|
|
13
|
+
<a aria-label="Types" href="https://www.npmjs.com/package/atom.io">
|
|
14
|
+
<img alt="Types" src="https://img.shields.io/npm/types/atom.io?style=for-the-badge&labelColor=333">
|
|
15
|
+
</a>
|
|
16
|
+
<a aria-label="Build status" href="https://github.com/jeremybanka/wayforge/actions/workflows/integration.yml">
|
|
17
|
+
<img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/jeremybanka/wayforge/integration.yml?branch=main&style=for-the-badge&labelColor=333">
|
|
18
|
+
</a>
|
|
19
|
+
<a aria-label="NPM version" href="https://www.npmjs.com/package/atom.io">
|
|
20
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/atom.io?style=for-the-badge&labelColor=333">
|
|
21
|
+
</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
npm i atom.io
|
|
26
|
+
```
|
|
27
|
+
```shell
|
|
28
|
+
pnpm add atom.io
|
|
29
|
+
```
|
|
30
|
+
<hr>
|
|
31
|
+
|
|
32
|
+
Reactive state graph for node and the browser inspired by [Recoil](https://recoiljs.org/).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Refinement } from 'fp-ts/lib/Refinement';
|
|
1
|
+
import { Refinement } from 'fp-ts/Refinement';
|
|
3
2
|
|
|
4
3
|
type ƒn = (...parameters: any[]) => any;
|
|
5
4
|
|
|
@@ -71,23 +70,24 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
|
|
|
71
70
|
|
|
72
71
|
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
73
72
|
interface Store {
|
|
74
|
-
atoms:
|
|
73
|
+
atoms: Map<string, Atom<any>>;
|
|
75
74
|
atomsThatAreDefault: Set<string>;
|
|
76
|
-
readonlySelectors:
|
|
75
|
+
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
77
76
|
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
78
77
|
selectorGraph: Join<{
|
|
79
78
|
source: string;
|
|
80
79
|
}>;
|
|
81
|
-
selectors:
|
|
80
|
+
selectors: Map<string, Selector<any>>;
|
|
82
81
|
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
83
|
-
timelines:
|
|
84
|
-
transactions:
|
|
85
|
-
valueMap:
|
|
82
|
+
timelines: Map<string, Timeline>;
|
|
83
|
+
transactions: Map<string, Transaction<any>>;
|
|
84
|
+
valueMap: Map<string, any>;
|
|
86
85
|
subject: {
|
|
87
86
|
atomCreation: Subject<AtomToken<unknown>>;
|
|
88
87
|
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
89
|
-
transactionCreation: Subject<TransactionToken
|
|
88
|
+
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
90
89
|
timelineCreation: Subject<TimelineToken>;
|
|
90
|
+
operationStatus: Subject<OperationProgress>;
|
|
91
91
|
};
|
|
92
92
|
operation: OperationProgress;
|
|
93
93
|
transactionStatus: TransactionStatus<ƒn>;
|
|
@@ -169,43 +169,12 @@ declare const markAtomAsDefault: (key: string, store?: Store) => void;
|
|
|
169
169
|
declare const markAtomAsNotDefault: (key: string, store?: Store) => void;
|
|
170
170
|
declare const isSelectorDefault: (key: string, store?: Store) => boolean;
|
|
171
171
|
|
|
172
|
-
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, Token | {
|
|
173
|
-
key: string;
|
|
174
|
-
familyMembers: Record<string, Token>;
|
|
175
|
-
}>;
|
|
176
|
-
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
177
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
178
|
-
declare const attachMetaAtoms: (store?: Store) => ReadonlySelectorToken<AtomTokenIndex>;
|
|
179
|
-
declare const attachMetaSelectors: (store?: Store) => ReadonlySelectorToken<SelectorTokenIndex>;
|
|
180
|
-
|
|
181
|
-
declare const attachMetaState: (store?: Store) => {
|
|
182
|
-
atomTokenIndexState: ReadonlySelectorToken<AtomTokenIndex>;
|
|
183
|
-
selectorTokenIndexState: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
type index$1_AtomTokenIndex = AtomTokenIndex;
|
|
187
|
-
type index$1_SelectorTokenIndex = SelectorTokenIndex;
|
|
188
|
-
type index$1_StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = StateTokenIndex<Token>;
|
|
189
|
-
declare const index$1_attachMetaAtoms: typeof attachMetaAtoms;
|
|
190
|
-
declare const index$1_attachMetaSelectors: typeof attachMetaSelectors;
|
|
191
|
-
declare const index$1_attachMetaState: typeof attachMetaState;
|
|
192
|
-
declare namespace index$1 {
|
|
193
|
-
export {
|
|
194
|
-
index$1_AtomTokenIndex as AtomTokenIndex,
|
|
195
|
-
index$1_SelectorTokenIndex as SelectorTokenIndex,
|
|
196
|
-
index$1_StateTokenIndex as StateTokenIndex,
|
|
197
|
-
index$1_attachMetaAtoms as attachMetaAtoms,
|
|
198
|
-
index$1_attachMetaSelectors as attachMetaSelectors,
|
|
199
|
-
index$1_attachMetaState as attachMetaState,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
172
|
type OperationProgress = {
|
|
204
173
|
open: false;
|
|
205
174
|
} | {
|
|
206
175
|
open: true;
|
|
207
176
|
done: Set<string>;
|
|
208
|
-
prev:
|
|
177
|
+
prev: Map<string, any>;
|
|
209
178
|
time: number;
|
|
210
179
|
token: StateToken<any>;
|
|
211
180
|
};
|
|
@@ -333,7 +302,7 @@ type Timeline = {
|
|
|
333
302
|
selectorTime: number | null;
|
|
334
303
|
transactionKey: string | null;
|
|
335
304
|
install: (store: Store) => void;
|
|
336
|
-
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate
|
|
305
|
+
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
337
306
|
};
|
|
338
307
|
declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
|
|
339
308
|
|
|
@@ -444,7 +413,6 @@ declare namespace index {
|
|
|
444
413
|
export {
|
|
445
414
|
index_Atom as Atom,
|
|
446
415
|
index_IMPLICIT as IMPLICIT,
|
|
447
|
-
index$1 as META,
|
|
448
416
|
index_OperationProgress as OperationProgress,
|
|
449
417
|
index_ReadonlySelector as ReadonlySelector,
|
|
450
418
|
index_Selector as Selector,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Refinement } from 'fp-ts/lib/Refinement';
|
|
1
|
+
import { Refinement } from 'fp-ts/Refinement';
|
|
3
2
|
|
|
4
3
|
type ƒn = (...parameters: any[]) => any;
|
|
5
4
|
|
|
@@ -71,23 +70,24 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
|
|
|
71
70
|
|
|
72
71
|
type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
|
|
73
72
|
interface Store {
|
|
74
|
-
atoms:
|
|
73
|
+
atoms: Map<string, Atom<any>>;
|
|
75
74
|
atomsThatAreDefault: Set<string>;
|
|
76
|
-
readonlySelectors:
|
|
75
|
+
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
77
76
|
selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
|
|
78
77
|
selectorGraph: Join<{
|
|
79
78
|
source: string;
|
|
80
79
|
}>;
|
|
81
|
-
selectors:
|
|
80
|
+
selectors: Map<string, Selector<any>>;
|
|
82
81
|
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
83
|
-
timelines:
|
|
84
|
-
transactions:
|
|
85
|
-
valueMap:
|
|
82
|
+
timelines: Map<string, Timeline>;
|
|
83
|
+
transactions: Map<string, Transaction<any>>;
|
|
84
|
+
valueMap: Map<string, any>;
|
|
86
85
|
subject: {
|
|
87
86
|
atomCreation: Subject<AtomToken<unknown>>;
|
|
88
87
|
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
89
|
-
transactionCreation: Subject<TransactionToken
|
|
88
|
+
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
90
89
|
timelineCreation: Subject<TimelineToken>;
|
|
90
|
+
operationStatus: Subject<OperationProgress>;
|
|
91
91
|
};
|
|
92
92
|
operation: OperationProgress;
|
|
93
93
|
transactionStatus: TransactionStatus<ƒn>;
|
|
@@ -169,43 +169,12 @@ declare const markAtomAsDefault: (key: string, store?: Store) => void;
|
|
|
169
169
|
declare const markAtomAsNotDefault: (key: string, store?: Store) => void;
|
|
170
170
|
declare const isSelectorDefault: (key: string, store?: Store) => boolean;
|
|
171
171
|
|
|
172
|
-
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, Token | {
|
|
173
|
-
key: string;
|
|
174
|
-
familyMembers: Record<string, Token>;
|
|
175
|
-
}>;
|
|
176
|
-
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
177
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
178
|
-
declare const attachMetaAtoms: (store?: Store) => ReadonlySelectorToken<AtomTokenIndex>;
|
|
179
|
-
declare const attachMetaSelectors: (store?: Store) => ReadonlySelectorToken<SelectorTokenIndex>;
|
|
180
|
-
|
|
181
|
-
declare const attachMetaState: (store?: Store) => {
|
|
182
|
-
atomTokenIndexState: ReadonlySelectorToken<AtomTokenIndex>;
|
|
183
|
-
selectorTokenIndexState: ReadonlySelectorToken<SelectorTokenIndex>;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
type index$1_AtomTokenIndex = AtomTokenIndex;
|
|
187
|
-
type index$1_SelectorTokenIndex = SelectorTokenIndex;
|
|
188
|
-
type index$1_StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = StateTokenIndex<Token>;
|
|
189
|
-
declare const index$1_attachMetaAtoms: typeof attachMetaAtoms;
|
|
190
|
-
declare const index$1_attachMetaSelectors: typeof attachMetaSelectors;
|
|
191
|
-
declare const index$1_attachMetaState: typeof attachMetaState;
|
|
192
|
-
declare namespace index$1 {
|
|
193
|
-
export {
|
|
194
|
-
index$1_AtomTokenIndex as AtomTokenIndex,
|
|
195
|
-
index$1_SelectorTokenIndex as SelectorTokenIndex,
|
|
196
|
-
index$1_StateTokenIndex as StateTokenIndex,
|
|
197
|
-
index$1_attachMetaAtoms as attachMetaAtoms,
|
|
198
|
-
index$1_attachMetaSelectors as attachMetaSelectors,
|
|
199
|
-
index$1_attachMetaState as attachMetaState,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
172
|
type OperationProgress = {
|
|
204
173
|
open: false;
|
|
205
174
|
} | {
|
|
206
175
|
open: true;
|
|
207
176
|
done: Set<string>;
|
|
208
|
-
prev:
|
|
177
|
+
prev: Map<string, any>;
|
|
209
178
|
time: number;
|
|
210
179
|
token: StateToken<any>;
|
|
211
180
|
};
|
|
@@ -333,7 +302,7 @@ type Timeline = {
|
|
|
333
302
|
selectorTime: number | null;
|
|
334
303
|
transactionKey: string | null;
|
|
335
304
|
install: (store: Store) => void;
|
|
336
|
-
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate
|
|
305
|
+
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
337
306
|
};
|
|
338
307
|
declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
|
|
339
308
|
|
|
@@ -444,7 +413,6 @@ declare namespace index {
|
|
|
444
413
|
export {
|
|
445
414
|
index_Atom as Atom,
|
|
446
415
|
index_IMPLICIT as IMPLICIT,
|
|
447
|
-
index$1 as META,
|
|
448
416
|
index_OperationProgress as OperationProgress,
|
|
449
417
|
index_ReadonlySelector as ReadonlySelector,
|
|
450
418
|
index_Selector as Selector,
|