atom.io 0.6.5 → 0.6.6

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.
Files changed (60) hide show
  1. package/README.md +32 -78
  2. package/dist/index.d.mts +4 -35
  3. package/dist/index.d.ts +4 -35
  4. package/dist/index.js +45 -198
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +42 -195
  7. package/dist/index.mjs.map +1 -1
  8. package/introspection/dist/index.js +312 -0
  9. package/introspection/dist/index.js.map +1 -0
  10. package/introspection/dist/index.mjs +289 -0
  11. package/introspection/dist/index.mjs.map +1 -0
  12. package/introspection/package.json +15 -0
  13. package/package.json +16 -6
  14. package/react-devtools/dist/index.css +22 -5
  15. package/react-devtools/dist/index.css.map +1 -1
  16. package/react-devtools/dist/index.d.mts +347 -8
  17. package/react-devtools/dist/index.d.ts +347 -8
  18. package/react-devtools/dist/index.js +2722 -674
  19. package/react-devtools/dist/index.js.map +1 -1
  20. package/react-devtools/dist/index.mjs +2669 -630
  21. package/react-devtools/dist/index.mjs.map +1 -1
  22. package/src/internal/index.ts +0 -1
  23. package/src/internal/operation.ts +1 -0
  24. package/src/internal/store.ts +3 -2
  25. package/src/internal/time-travel-internal.ts +2 -0
  26. package/src/internal/timeline/add-atom-to-timeline.ts +11 -12
  27. package/src/internal/timeline-internal.ts +5 -1
  28. package/src/introspection/attach-atom-index.ts +73 -0
  29. package/src/introspection/attach-introspection-states.ts +42 -0
  30. package/src/introspection/attach-selector-index.ts +77 -0
  31. package/src/introspection/attach-timeline-family.ts +49 -0
  32. package/src/introspection/attach-timeline-index.ts +36 -0
  33. package/src/introspection/attach-transaction-index.ts +38 -0
  34. package/src/introspection/attach-transaction-logs.ts +40 -0
  35. package/src/introspection/index.ts +20 -0
  36. package/src/react-devtools/AtomIODevtools.tsx +97 -96
  37. package/src/react-devtools/Button.tsx +24 -0
  38. package/src/react-devtools/StateEditor.tsx +14 -16
  39. package/src/react-devtools/StateIndex.tsx +153 -0
  40. package/src/react-devtools/TimelineIndex.tsx +92 -0
  41. package/src/react-devtools/TransactionIndex.tsx +70 -0
  42. package/src/react-devtools/Updates.tsx +145 -0
  43. package/src/react-devtools/devtools.scss +196 -15
  44. package/src/react-devtools/index.ts +71 -0
  45. package/src/react-explorer/AtomIOExplorer.tsx +0 -1
  46. package/src/react-explorer/explorer-states.ts +1 -1
  47. package/src/react-explorer/space-states.ts +3 -1
  48. package/src/react-explorer/view-states.ts +0 -2
  49. package/realtime-testing/dist/index.d.mts +0 -49
  50. package/realtime-testing/dist/index.d.ts +0 -49
  51. package/realtime-testing/dist/index.js +0 -165
  52. package/realtime-testing/dist/index.js.map +0 -1
  53. package/realtime-testing/dist/index.mjs +0 -129
  54. package/realtime-testing/dist/index.mjs.map +0 -1
  55. package/src/internal/meta/attach-meta.ts +0 -17
  56. package/src/internal/meta/index.ts +0 -4
  57. package/src/internal/meta/meta-state.ts +0 -135
  58. package/src/internal/meta/meta-timelines.ts +0 -1
  59. package/src/internal/meta/meta-transactions.ts +0 -1
  60. package/src/react-devtools/TokenList.tsx +0 -61
package/README.md CHANGED
@@ -1,78 +1,32 @@
1
- ## features
2
- - [x] atoms and selectors
3
- - [x] implicit store
4
- - [x] readonly selectors
5
- - [x] settable selectors
6
- - [x] "tokens" safely expose atoms and selectors
7
- - [x] give atoms and selectors separate types with a common base
8
- - [x] utility function to pass logger to your store
9
- - [x] selector memoization
10
- - [x] atom and selector families
11
- - [x] atom effects
12
- - [x] transactions
13
- - [x] async effects
14
- - [x] atom default as function
15
- - [x] check whether an atom is "default" (never set)
16
- - [x] customizable logging
17
- - [x] subscribe to transactions
18
- - [x] timelines
19
- - [x] subscribe to families
20
-
21
- # atom.io
22
- ## upcoming features
23
- - [ ] suppressor: ({oldValue, newValue}) => boolean
24
- - [ ] resettable atoms
25
- - [ ] resettable selectors
26
-
27
- ## documentation
28
- - [ ] document atom and selector families
29
- - [ ] document atom and selector
30
- - [ ] document transactions
31
-
32
- # src/internal/meta
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,5 @@
1
1
  import { Hamt } from 'hamt_plus';
2
- import { Refinement } from 'fp-ts/lib/Refinement';
2
+ import { Refinement } from 'fp-ts/Refinement';
3
3
 
4
4
  type ƒn = (...parameters: any[]) => any;
5
5
 
@@ -86,8 +86,9 @@ interface Store {
86
86
  subject: {
87
87
  atomCreation: Subject<AtomToken<unknown>>;
88
88
  selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
89
- transactionCreation: Subject<TransactionToken<unknown>>;
89
+ transactionCreation: Subject<TransactionToken<ƒn>>;
90
90
  timelineCreation: Subject<TimelineToken>;
91
+ operationStatus: Subject<OperationProgress>;
91
92
  };
92
93
  operation: OperationProgress;
93
94
  transactionStatus: TransactionStatus<ƒn>;
@@ -169,37 +170,6 @@ declare const markAtomAsDefault: (key: string, store?: Store) => void;
169
170
  declare const markAtomAsNotDefault: (key: string, store?: Store) => void;
170
171
  declare const isSelectorDefault: (key: string, store?: Store) => boolean;
171
172
 
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
173
  type OperationProgress = {
204
174
  open: false;
205
175
  } | {
@@ -333,7 +303,7 @@ type Timeline = {
333
303
  selectorTime: number | null;
334
304
  transactionKey: string | null;
335
305
  install: (store: Store) => void;
336
- subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate>;
306
+ subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
337
307
  };
338
308
  declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
339
309
 
@@ -444,7 +414,6 @@ declare namespace index {
444
414
  export {
445
415
  index_Atom as Atom,
446
416
  index_IMPLICIT as IMPLICIT,
447
- index$1 as META,
448
417
  index_OperationProgress as OperationProgress,
449
418
  index_ReadonlySelector as ReadonlySelector,
450
419
  index_Selector as Selector,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Hamt } from 'hamt_plus';
2
- import { Refinement } from 'fp-ts/lib/Refinement';
2
+ import { Refinement } from 'fp-ts/Refinement';
3
3
 
4
4
  type ƒn = (...parameters: any[]) => any;
5
5
 
@@ -86,8 +86,9 @@ interface Store {
86
86
  subject: {
87
87
  atomCreation: Subject<AtomToken<unknown>>;
88
88
  selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
89
- transactionCreation: Subject<TransactionToken<unknown>>;
89
+ transactionCreation: Subject<TransactionToken<ƒn>>;
90
90
  timelineCreation: Subject<TimelineToken>;
91
+ operationStatus: Subject<OperationProgress>;
91
92
  };
92
93
  operation: OperationProgress;
93
94
  transactionStatus: TransactionStatus<ƒn>;
@@ -169,37 +170,6 @@ declare const markAtomAsDefault: (key: string, store?: Store) => void;
169
170
  declare const markAtomAsNotDefault: (key: string, store?: Store) => void;
170
171
  declare const isSelectorDefault: (key: string, store?: Store) => boolean;
171
172
 
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
173
  type OperationProgress = {
204
174
  open: false;
205
175
  } | {
@@ -333,7 +303,7 @@ type Timeline = {
333
303
  selectorTime: number | null;
334
304
  transactionKey: string | null;
335
305
  install: (store: Store) => void;
336
- subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate>;
306
+ subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
337
307
  };
338
308
  declare function timeline__INTERNAL(options: TimelineOptions, store?: Store, data?: Timeline | null): TimelineToken;
339
309
 
@@ -444,7 +414,6 @@ declare namespace index {
444
414
  export {
445
415
  index_Atom as Atom,
446
416
  index_IMPLICIT as IMPLICIT,
447
- index$1 as META,
448
417
  index_OperationProgress as OperationProgress,
449
418
  index_ReadonlySelector as ReadonlySelector,
450
419
  index_Selector as Selector,