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.
- package/dist/index.d.mts +34 -25
- package/dist/index.d.ts +34 -25
- package/dist/index.js +94 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -105
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +272 -0
- package/introspection/dist/index.d.ts +272 -0
- package/introspection/dist/index.js +41 -3
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +41 -3
- package/introspection/dist/index.mjs.map +1 -1
- package/json/dist/index.d.mts +5 -7
- package/json/dist/index.d.ts +5 -7
- package/json/dist/index.js.map +1 -1
- package/json/dist/index.mjs.map +1 -1
- package/package.json +22 -14
- package/react-devtools/dist/index.css +9 -1
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +22 -25
- package/react-devtools/dist/index.d.ts +22 -25
- package/react-devtools/dist/index.js +845 -326
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +830 -306
- package/react-devtools/dist/index.mjs.map +1 -1
- package/realtime/dist/index.d.mts +6 -8
- package/realtime/dist/index.d.ts +6 -8
- package/realtime/dist/index.js +0 -1
- package/realtime/dist/index.js.map +1 -1
- package/realtime/dist/index.mjs +0 -1
- package/realtime/dist/index.mjs.map +1 -1
- package/realtime-react/dist/index.d.mts +11 -13
- package/realtime-react/dist/index.d.ts +11 -13
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/dist/index.mjs.map +1 -1
- package/src/atom.ts +4 -4
- package/src/index.ts +1 -1
- package/src/internal/atom-internal.ts +5 -6
- package/src/internal/families-internal.ts +23 -20
- package/src/internal/get.ts +7 -9
- package/src/internal/index.ts +1 -1
- package/src/internal/operation.ts +14 -21
- package/src/internal/selector/create-read-write-selector.ts +11 -5
- package/src/internal/selector/create-readonly-selector.ts +4 -8
- package/src/internal/selector-internal.ts +1 -3
- package/src/internal/set.ts +1 -4
- package/src/internal/store.ts +19 -22
- package/src/internal/subscribe-internal.ts +7 -1
- package/src/internal/time-travel-internal.ts +4 -4
- package/src/internal/timeline/add-atom-to-timeline.ts +2 -2
- package/src/internal/timeline-internal.ts +3 -5
- 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-timeline-family.ts +14 -4
- package/src/introspection/attach-transaction-logs.ts +1 -1
- package/src/json/select-json.ts +1 -1
- package/src/react-devtools/AtomIODevtools.tsx +1 -2
- package/src/react-devtools/StateEditor.tsx +5 -1
- package/src/react-devtools/StateIndex.tsx +4 -1
- package/src/react-devtools/devtools.scss +0 -1
- package/src/react-explorer/AtomIOExplorer.tsx +3 -3
- package/src/realtime/hook-composition/expose-family.ts +2 -2
- package/src/realtime/hook-composition/expose-single.ts +1 -1
- package/src/realtime/hook-composition/receive-state.ts +1 -1
- package/src/realtime-react/realtime-hooks.ts +4 -4
- package/src/realtime-react/use-pull-family-member.ts +2 -2
- package/src/realtime-react/use-pull-family.ts +2 -2
- package/src/realtime-react/use-pull.ts +3 -1
- package/src/realtime-react/use-push.ts +3 -1
- package/src/selector.ts +14 -12
- package/src/subscribe.ts +1 -1
- package/src/tracker/index.ts +3 -0
- package/src/tracker/tracker.ts +61 -0
- package/src/web-effects/storage.ts +1 -1
- 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
|
|
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
|
|
16
|
-
|
|
13
|
+
type primitive = boolean | number | string | null;
|
|
14
|
+
|
|
15
|
+
type Serializable = primitive | Readonly<{
|
|
17
16
|
[key: string]: Serializable;
|
|
18
17
|
}> | ReadonlyArray<Serializable>;
|
|
19
|
-
type
|
|
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
|
|
30
|
-
contents:
|
|
31
|
-
relations:
|
|
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
|
|
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:
|
|
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] : [
|
|
40
|
+
type NullSafeRest<MaybeArg, IfArg = MaybeArg> = MaybeArg extends null ? [] | [undefined] : [IfArg];
|
|
44
41
|
|
|
45
|
-
declare class Join<CONTENT extends
|
|
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
|
|
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:
|
|
139
|
+
atoms: Map<string, Atom<any>>;
|
|
143
140
|
atomsThatAreDefault: Set<string>;
|
|
144
|
-
readonlySelectors:
|
|
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:
|
|
146
|
+
selectors: Map<string, Selector<any>>;
|
|
150
147
|
timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
|
|
151
|
-
timelines:
|
|
152
|
-
transactions:
|
|
153
|
-
valueMap:
|
|
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:
|
|
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:
|
|
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:
|
|
318
|
+
declare const AtomIODevtools: () => JSX.Element;
|
|
322
319
|
|
|
323
320
|
declare const atomIndex: ReadonlySelectorToken<AtomTokenIndex>;
|
|
324
321
|
declare const selectorIndex: ReadonlySelectorToken<SelectorTokenIndex>;
|