atom.io 0.6.6 → 0.6.8

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 (76) hide show
  1. package/dist/index.d.mts +34 -25
  2. package/dist/index.d.ts +34 -25
  3. package/dist/index.js +94 -115
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +94 -105
  6. package/dist/index.mjs.map +1 -1
  7. package/introspection/dist/index.d.mts +272 -0
  8. package/introspection/dist/index.d.ts +272 -0
  9. package/introspection/dist/index.js +41 -3
  10. package/introspection/dist/index.js.map +1 -1
  11. package/introspection/dist/index.mjs +41 -3
  12. package/introspection/dist/index.mjs.map +1 -1
  13. package/json/dist/index.d.mts +5 -7
  14. package/json/dist/index.d.ts +5 -7
  15. package/json/dist/index.js.map +1 -1
  16. package/json/dist/index.mjs.map +1 -1
  17. package/package.json +22 -14
  18. package/react-devtools/dist/index.css +9 -1
  19. package/react-devtools/dist/index.css.map +1 -1
  20. package/react-devtools/dist/index.d.mts +22 -25
  21. package/react-devtools/dist/index.d.ts +22 -25
  22. package/react-devtools/dist/index.js +845 -326
  23. package/react-devtools/dist/index.js.map +1 -1
  24. package/react-devtools/dist/index.mjs +830 -306
  25. package/react-devtools/dist/index.mjs.map +1 -1
  26. package/realtime/dist/index.d.mts +6 -8
  27. package/realtime/dist/index.d.ts +6 -8
  28. package/realtime/dist/index.js +0 -1
  29. package/realtime/dist/index.js.map +1 -1
  30. package/realtime/dist/index.mjs +0 -1
  31. package/realtime/dist/index.mjs.map +1 -1
  32. package/realtime-react/dist/index.d.mts +11 -13
  33. package/realtime-react/dist/index.d.ts +11 -13
  34. package/realtime-react/dist/index.js.map +1 -1
  35. package/realtime-react/dist/index.mjs.map +1 -1
  36. package/src/atom.ts +4 -4
  37. package/src/index.ts +1 -1
  38. package/src/internal/atom-internal.ts +5 -6
  39. package/src/internal/families-internal.ts +23 -20
  40. package/src/internal/get.ts +7 -9
  41. package/src/internal/index.ts +1 -1
  42. package/src/internal/operation.ts +14 -21
  43. package/src/internal/selector/create-read-write-selector.ts +11 -5
  44. package/src/internal/selector/create-readonly-selector.ts +4 -8
  45. package/src/internal/selector-internal.ts +1 -3
  46. package/src/internal/set.ts +1 -4
  47. package/src/internal/store.ts +19 -22
  48. package/src/internal/subscribe-internal.ts +7 -1
  49. package/src/internal/time-travel-internal.ts +4 -4
  50. package/src/internal/timeline/add-atom-to-timeline.ts +2 -2
  51. package/src/internal/timeline-internal.ts +3 -5
  52. package/src/internal/transaction/apply-transaction.ts +9 -6
  53. package/src/internal/transaction/build-transaction.ts +6 -6
  54. package/src/internal/transaction-internal.ts +1 -7
  55. package/src/introspection/attach-timeline-family.ts +14 -4
  56. package/src/introspection/attach-transaction-logs.ts +1 -1
  57. package/src/json/select-json.ts +1 -1
  58. package/src/react-devtools/AtomIODevtools.tsx +1 -2
  59. package/src/react-devtools/StateEditor.tsx +5 -1
  60. package/src/react-devtools/StateIndex.tsx +4 -1
  61. package/src/react-devtools/devtools.scss +0 -1
  62. package/src/react-explorer/AtomIOExplorer.tsx +3 -3
  63. package/src/realtime/hook-composition/expose-family.ts +2 -2
  64. package/src/realtime/hook-composition/expose-single.ts +1 -1
  65. package/src/realtime/hook-composition/receive-state.ts +1 -1
  66. package/src/realtime-react/realtime-hooks.ts +4 -4
  67. package/src/realtime-react/use-pull-family-member.ts +2 -2
  68. package/src/realtime-react/use-pull-family.ts +2 -2
  69. package/src/realtime-react/use-pull.ts +3 -1
  70. package/src/realtime-react/use-push.ts +3 -1
  71. package/src/selector.ts +14 -12
  72. package/src/subscribe.ts +1 -1
  73. package/src/tracker/index.ts +3 -0
  74. package/src/tracker/tracker.ts +61 -0
  75. package/src/web-effects/storage.ts +1 -1
  76. package/src/internal/subject.ts +0 -24
@@ -1,24 +1,21 @@
1
- import { Hamt } from 'hamt_plus';
2
1
  import { Refinement } from 'fp-ts/Refinement';
3
2
  import { AtomToken as AtomToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, SelectorToken as SelectorToken$1 } from 'atom.io';
4
- import { FC } from 'react';
5
3
 
6
4
  type PlainObject = Record<keyof any, unknown>;
7
5
 
8
6
  type ƒn = (...parameters: any[]) => any;
9
7
 
10
- type JsonInterface<T, J extends Json = Json> = {
8
+ type JsonInterface<T, J extends Serializable = Serializable> = {
11
9
  toJson: (t: T) => J;
12
10
  fromJson: (json: J) => T;
13
11
  };
14
12
 
15
- type Primitive = boolean | number | string | null;
16
- type Serializable = Primitive | Readonly<{
13
+ type primitive = boolean | number | string | null;
14
+
15
+ type Serializable = primitive | Readonly<{
17
16
  [key: string]: Serializable;
18
17
  }> | ReadonlyArray<Serializable>;
19
- type JsonObj<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
20
- type JsonArr<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
21
- type Json = JsonArr | JsonObj | Primitive;
18
+ type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
22
19
 
23
20
  type Identified = {
24
21
  id: string;
@@ -26,23 +23,23 @@ type Identified = {
26
23
 
27
24
  declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
28
25
  type RelationType = typeof RELATION_TYPES[number];
29
- type RelationData<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
30
- contents: JsonObj<string, CONTENT>;
31
- relations: JsonObj<string, string[]>;
26
+ type RelationData<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
27
+ contents: Object$1<string, CONTENT>;
28
+ relations: Object$1<string, string[]>;
32
29
  relationType: RelationType;
33
30
  a: A;
34
31
  b: B;
35
32
  };
36
- type IsRelationDataOptions<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> = {
33
+ type IsRelationDataOptions<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
37
34
  from?: A;
38
35
  to?: B;
39
- isContent?: (json: Json) => json is CONTENT;
36
+ isContent?: (json: Serializable) => json is CONTENT;
40
37
  };
41
38
 
42
39
  type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
43
- type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [MaybeArg];
40
+ type NullSafeRest<MaybeArg, IfArg = MaybeArg> = MaybeArg extends null ? [] | [undefined] : [IfArg];
44
41
 
45
- declare class Join<CONTENT extends JsonObj | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
42
+ declare class Join<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
46
43
  readonly relationType: `1:1` | `1:n` | `n:n`;
47
44
  readonly a: A;
48
45
  readonly b: B;
@@ -50,7 +47,7 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
50
47
  readonly contents: Record<string, CONTENT>;
51
48
  constructor(json?: Partial<RelationData<CONTENT, A, B>>);
52
49
  toJSON(): RelationData<CONTENT, A, B>;
53
- static fromJSON<CONTENT extends JsonObj | null, A extends string, B extends string>(json: Json, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
50
+ static fromJSON<CONTENT extends Object$1 | null, A extends string, B extends string>(json: Serializable, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
54
51
  from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
55
52
  to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
56
53
  makeJsonInterface: (...params: CONTENT extends null ? [
@@ -139,18 +136,18 @@ type FamilyMetadata = {
139
136
 
140
137
  type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
141
138
  interface Store {
142
- atoms: Hamt<Atom<any>, string>;
139
+ atoms: Map<string, Atom<any>>;
143
140
  atomsThatAreDefault: Set<string>;
144
- readonlySelectors: Hamt<ReadonlySelector<any>, string>;
141
+ readonlySelectors: Map<string, ReadonlySelector<any>>;
145
142
  selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
146
143
  selectorGraph: Join<{
147
144
  source: string;
148
145
  }>;
149
- selectors: Hamt<Selector<any>, string>;
146
+ selectors: Map<string, Selector<any>>;
150
147
  timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
151
- timelines: Hamt<Timeline, string>;
152
- transactions: Hamt<Transaction<any>, string>;
153
- valueMap: Hamt<any, string>;
148
+ timelines: Map<string, Timeline>;
149
+ transactions: Map<string, Transaction<any>>;
150
+ valueMap: Map<string, any>;
154
151
  subject: {
155
152
  atomCreation: Subject<AtomToken<unknown>>;
156
153
  selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
@@ -183,7 +180,7 @@ type OperationProgress = {
183
180
  } | {
184
181
  open: true;
185
182
  done: Set<string>;
186
- prev: Hamt<any, string>;
183
+ prev: Map<string, any>;
187
184
  time: number;
188
185
  token: StateToken<any>;
189
186
  };
@@ -241,7 +238,7 @@ type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
241
238
  type Timeline = {
242
239
  key: string;
243
240
  at: number;
244
- timeTraveling: boolean;
241
+ timeTraveling: `into_future` | `into_past` | null;
245
242
  history: TimelineUpdate[];
246
243
  selectorTime: number | null;
247
244
  transactionKey: string | null;
@@ -318,7 +315,7 @@ declare class Differ<Leaf extends Record<string, any>, Tree extends Record<strin
318
315
  diff(a: unknown, b: unknown): Delta;
319
316
  }
320
317
 
321
- declare const AtomIODevtools: FC;
318
+ declare const AtomIODevtools: () => JSX.Element;
322
319
 
323
320
  declare const atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
324
321
  declare const selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;