atom.io 0.6.7 → 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 +27 -17
- package/dist/index.d.ts +27 -17
- package/dist/index.js +28 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -22
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +14 -15
- package/introspection/dist/index.d.ts +14 -15
- package/introspection/dist/index.js +2 -2
- package/introspection/dist/index.js.map +1 -1
- package/introspection/dist/index.mjs +2 -2
- 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 +15 -7
- package/react-devtools/dist/index.css +9 -1
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +14 -15
- package/react-devtools/dist/index.d.ts +14 -15
- package/react-devtools/dist/index.js +769 -249
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +752 -227
- 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/families-internal.ts +23 -20
- package/src/internal/index.ts +1 -1
- package/src/internal/selector/create-read-write-selector.ts +3 -1
- package/src/internal/selector/create-readonly-selector.ts +3 -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 +2 -2
- package/src/introspection/attach-timeline-family.ts +1 -1
- package/src/json/select-json.ts +1 -1
- 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/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
package/dist/index.d.mts
CHANGED
|
@@ -2,18 +2,28 @@ import { Refinement } from 'fp-ts/Refinement';
|
|
|
2
2
|
|
|
3
3
|
type ƒn = (...parameters: any[]) => any;
|
|
4
4
|
|
|
5
|
-
type JsonInterface<T, J extends
|
|
5
|
+
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
6
6
|
toJson: (t: T) => J;
|
|
7
7
|
fromJson: (json: J) => T;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
type
|
|
11
|
-
|
|
10
|
+
type primitive = boolean | number | string | null;
|
|
11
|
+
|
|
12
|
+
type Serializable = primitive | Readonly<{
|
|
12
13
|
[key: string]: Serializable;
|
|
13
14
|
}> | ReadonlyArray<Serializable>;
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
|
|
15
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
16
|
+
type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
17
|
+
|
|
18
|
+
type json_Array<Element extends Serializable = Serializable> = Array<Element>;
|
|
19
|
+
type json_Serializable = Serializable;
|
|
20
|
+
declare namespace json {
|
|
21
|
+
export {
|
|
22
|
+
json_Array as Array,
|
|
23
|
+
Object$1 as Object,
|
|
24
|
+
json_Serializable as Serializable,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
17
27
|
|
|
18
28
|
type Identified = {
|
|
19
29
|
id: string;
|
|
@@ -21,23 +31,23 @@ type Identified = {
|
|
|
21
31
|
|
|
22
32
|
declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
|
|
23
33
|
type RelationType = typeof RELATION_TYPES[number];
|
|
24
|
-
type RelationData<CONTENT extends
|
|
25
|
-
contents:
|
|
26
|
-
relations:
|
|
34
|
+
type RelationData<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
35
|
+
contents: Object$1<string, CONTENT>;
|
|
36
|
+
relations: Object$1<string, string[]>;
|
|
27
37
|
relationType: RelationType;
|
|
28
38
|
a: A;
|
|
29
39
|
b: B;
|
|
30
40
|
};
|
|
31
|
-
type IsRelationDataOptions<CONTENT extends
|
|
41
|
+
type IsRelationDataOptions<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
32
42
|
from?: A;
|
|
33
43
|
to?: B;
|
|
34
|
-
isContent?: (json:
|
|
44
|
+
isContent?: (json: Serializable) => json is CONTENT;
|
|
35
45
|
};
|
|
36
46
|
|
|
37
47
|
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
38
|
-
type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [
|
|
48
|
+
type NullSafeRest<MaybeArg, IfArg = MaybeArg> = MaybeArg extends null ? [] | [undefined] : [IfArg];
|
|
39
49
|
|
|
40
|
-
declare class Join<CONTENT extends
|
|
50
|
+
declare class Join<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
41
51
|
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
42
52
|
readonly a: A;
|
|
43
53
|
readonly b: B;
|
|
@@ -45,7 +55,7 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
|
|
|
45
55
|
readonly contents: Record<string, CONTENT>;
|
|
46
56
|
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
47
57
|
toJSON(): RelationData<CONTENT, A, B>;
|
|
48
|
-
static fromJSON<CONTENT extends
|
|
58
|
+
static fromJSON<CONTENT extends Object$1 | null, A extends string, B extends string>(json: Serializable, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
|
|
49
59
|
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
50
60
|
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
51
61
|
makeJsonInterface: (...params: CONTENT extends null ? [
|
|
@@ -297,7 +307,7 @@ type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
|
297
307
|
type Timeline = {
|
|
298
308
|
key: string;
|
|
299
309
|
at: number;
|
|
300
|
-
timeTraveling:
|
|
310
|
+
timeTraveling: `into_future` | `into_past` | null;
|
|
301
311
|
history: TimelineUpdate[];
|
|
302
312
|
selectorTime: number | null;
|
|
303
313
|
transactionKey: string | null;
|
|
@@ -549,7 +559,7 @@ type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
|
549
559
|
declare const subscribe: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, store?: Store) => (() => void);
|
|
550
560
|
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
551
561
|
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, store?: Store) => (() => void);
|
|
552
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate) => void, store?: Store) => (() => void);
|
|
562
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, store?: Store) => (() => void);
|
|
553
563
|
|
|
554
564
|
type TimelineToken = {
|
|
555
565
|
key: string;
|
|
@@ -591,4 +601,4 @@ declare const getState: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, sto
|
|
|
591
601
|
declare const setState: <T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Store) => void;
|
|
592
602
|
declare const isDefault: (token: ReadonlySelectorToken<unknown> | StateToken<unknown>, store?: Store) => boolean;
|
|
593
603
|
|
|
594
|
-
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, KeyedStateUpdate, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions, ReadonlySelectorToken, ReadonlyTransactors, SelectorFamily, SelectorFamilyOptions, SelectorOptions, SelectorToken,
|
|
604
|
+
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, json as Json, KeyedStateUpdate, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions, ReadonlySelectorToken, ReadonlyTransactors, SelectorFamily, SelectorFamilyOptions, SelectorOptions, SelectorToken, Silo, StateToken, StateUpdate, Store, TimelineOptions, TimelineToken, TimelineUpdate, TransactionIO, TransactionOptions, TransactionToken, TransactionUpdate, TransactionUpdateHandler, Transactors, UpdateHandler, Write, index as __INTERNAL__, atom, atomFamily, getState, isDefault, redo, runTransaction, selector, selectorFamily, setLogLevel, setState, silo, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, useLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,18 +2,28 @@ import { Refinement } from 'fp-ts/Refinement';
|
|
|
2
2
|
|
|
3
3
|
type ƒn = (...parameters: any[]) => any;
|
|
4
4
|
|
|
5
|
-
type JsonInterface<T, J extends
|
|
5
|
+
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
6
6
|
toJson: (t: T) => J;
|
|
7
7
|
fromJson: (json: J) => T;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
type
|
|
11
|
-
|
|
10
|
+
type primitive = boolean | number | string | null;
|
|
11
|
+
|
|
12
|
+
type Serializable = primitive | Readonly<{
|
|
12
13
|
[key: string]: Serializable;
|
|
13
14
|
}> | ReadonlyArray<Serializable>;
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
|
|
15
|
+
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
16
|
+
type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
17
|
+
|
|
18
|
+
type json_Array<Element extends Serializable = Serializable> = Array<Element>;
|
|
19
|
+
type json_Serializable = Serializable;
|
|
20
|
+
declare namespace json {
|
|
21
|
+
export {
|
|
22
|
+
json_Array as Array,
|
|
23
|
+
Object$1 as Object,
|
|
24
|
+
json_Serializable as Serializable,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
17
27
|
|
|
18
28
|
type Identified = {
|
|
19
29
|
id: string;
|
|
@@ -21,23 +31,23 @@ type Identified = {
|
|
|
21
31
|
|
|
22
32
|
declare const RELATION_TYPES: readonly ["1:1", "1:n", "n:n"];
|
|
23
33
|
type RelationType = typeof RELATION_TYPES[number];
|
|
24
|
-
type RelationData<CONTENT extends
|
|
25
|
-
contents:
|
|
26
|
-
relations:
|
|
34
|
+
type RelationData<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
35
|
+
contents: Object$1<string, CONTENT>;
|
|
36
|
+
relations: Object$1<string, string[]>;
|
|
27
37
|
relationType: RelationType;
|
|
28
38
|
a: A;
|
|
29
39
|
b: B;
|
|
30
40
|
};
|
|
31
|
-
type IsRelationDataOptions<CONTENT extends
|
|
41
|
+
type IsRelationDataOptions<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> = {
|
|
32
42
|
from?: A;
|
|
33
43
|
to?: B;
|
|
34
|
-
isContent?: (json:
|
|
44
|
+
isContent?: (json: Serializable) => json is CONTENT;
|
|
35
45
|
};
|
|
36
46
|
|
|
37
47
|
type NullSafeUnion<Base, Extension> = Extension extends null ? Base : Base & Extension;
|
|
38
|
-
type NullSafeRest<MaybeArg> = MaybeArg extends null ? [] | [undefined] : [
|
|
48
|
+
type NullSafeRest<MaybeArg, IfArg = MaybeArg> = MaybeArg extends null ? [] | [undefined] : [IfArg];
|
|
39
49
|
|
|
40
|
-
declare class Join<CONTENT extends
|
|
50
|
+
declare class Join<CONTENT extends Object$1 | null = null, A extends string = `from`, B extends string = `to`> implements RelationData<CONTENT, A, B> {
|
|
41
51
|
readonly relationType: `1:1` | `1:n` | `n:n`;
|
|
42
52
|
readonly a: A;
|
|
43
53
|
readonly b: B;
|
|
@@ -45,7 +55,7 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
|
|
|
45
55
|
readonly contents: Record<string, CONTENT>;
|
|
46
56
|
constructor(json?: Partial<RelationData<CONTENT, A, B>>);
|
|
47
57
|
toJSON(): RelationData<CONTENT, A, B>;
|
|
48
|
-
static fromJSON<CONTENT extends
|
|
58
|
+
static fromJSON<CONTENT extends Object$1 | null, A extends string, B extends string>(json: Serializable, options?: IsRelationDataOptions<CONTENT, A, B>): Join<CONTENT, A, B>;
|
|
49
59
|
from<AA extends string>(newA: AA): Join<CONTENT, AA, B>;
|
|
50
60
|
to<BB extends string>(newB: BB): Join<CONTENT, A, BB>;
|
|
51
61
|
makeJsonInterface: (...params: CONTENT extends null ? [
|
|
@@ -297,7 +307,7 @@ type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
|
297
307
|
type Timeline = {
|
|
298
308
|
key: string;
|
|
299
309
|
at: number;
|
|
300
|
-
timeTraveling:
|
|
310
|
+
timeTraveling: `into_future` | `into_past` | null;
|
|
301
311
|
history: TimelineUpdate[];
|
|
302
312
|
selectorTime: number | null;
|
|
303
313
|
transactionKey: string | null;
|
|
@@ -549,7 +559,7 @@ type UpdateHandler<T> = (update: StateUpdate<T>) => void;
|
|
|
549
559
|
declare const subscribe: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, handleUpdate: UpdateHandler<T>, store?: Store) => (() => void);
|
|
550
560
|
type TransactionUpdateHandler<ƒ extends ƒn> = (data: TransactionUpdate<ƒ>) => void;
|
|
551
561
|
declare const subscribeToTransaction: <ƒ extends ƒn>(token: TransactionToken<ƒ>, handleUpdate: TransactionUpdateHandler<ƒ>, store?: Store) => (() => void);
|
|
552
|
-
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate) => void, store?: Store) => (() => void);
|
|
562
|
+
declare const subscribeToTimeline: (token: TimelineToken, handleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void, store?: Store) => (() => void);
|
|
553
563
|
|
|
554
564
|
type TimelineToken = {
|
|
555
565
|
key: string;
|
|
@@ -591,4 +601,4 @@ declare const getState: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, sto
|
|
|
591
601
|
declare const setState: <T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Store) => void;
|
|
592
602
|
declare const isDefault: (token: ReadonlySelectorToken<unknown> | StateToken<unknown>, store?: Store) => boolean;
|
|
593
603
|
|
|
594
|
-
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, KeyedStateUpdate, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions, ReadonlySelectorToken, ReadonlyTransactors, SelectorFamily, SelectorFamilyOptions, SelectorOptions, SelectorToken,
|
|
604
|
+
export { AtomEffect, AtomFamily, AtomFamilyOptions, AtomOptions, AtomToken, Effectors, FamilyMetadata, json as Json, KeyedStateUpdate, LOG_LEVELS, Logger, Read, ReadonlySelectorFamily, ReadonlySelectorFamilyOptions, ReadonlySelectorOptions, ReadonlySelectorToken, ReadonlyTransactors, SelectorFamily, SelectorFamilyOptions, SelectorOptions, SelectorToken, Silo, StateToken, StateUpdate, Store, TimelineOptions, TimelineToken, TimelineUpdate, TransactionIO, TransactionOptions, TransactionToken, TransactionUpdate, TransactionUpdateHandler, Transactors, UpdateHandler, Write, index as __INTERNAL__, atom, atomFamily, getState, isDefault, redo, runTransaction, selector, selectorFamily, setLogLevel, setState, silo, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, useLogger };
|
package/dist/index.js
CHANGED
|
@@ -860,7 +860,6 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
// ../anvl/src/json/index.ts
|
|
863
|
-
var import_function8 = require("fp-ts/function");
|
|
864
863
|
var stringifyJson = (json) => JSON.stringify(json);
|
|
865
864
|
|
|
866
865
|
// src/internal/families-internal.ts
|
|
@@ -868,20 +867,23 @@ function atomFamily__INTERNAL(options, store = IMPLICIT.STORE) {
|
|
|
868
867
|
const subject = new Subject();
|
|
869
868
|
return Object.assign(
|
|
870
869
|
(key) => {
|
|
871
|
-
var _a;
|
|
872
870
|
const subKey = stringifyJson(key);
|
|
873
871
|
const family = { key: options.key, subKey };
|
|
874
872
|
const fullKey = `${options.key}(${subKey})`;
|
|
875
873
|
const existing = withdraw({ key: fullKey, type: `atom` }, store);
|
|
876
|
-
|
|
877
|
-
|
|
874
|
+
let token;
|
|
875
|
+
if (existing) {
|
|
876
|
+
token = deposit(existing);
|
|
877
|
+
} else {
|
|
878
|
+
const individualOptions = {
|
|
878
879
|
key: fullKey,
|
|
879
|
-
default: options.default instanceof Function ? options.default(key) : options.default
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
default: options.default instanceof Function ? options.default(key) : options.default
|
|
881
|
+
};
|
|
882
|
+
if (options.effects) {
|
|
883
|
+
individualOptions.effects = options.effects(key);
|
|
884
|
+
}
|
|
885
|
+
token = atom__INTERNAL(individualOptions, family, store);
|
|
886
|
+
}
|
|
885
887
|
subject.next(token);
|
|
886
888
|
return token;
|
|
887
889
|
},
|
|
@@ -995,9 +997,11 @@ var createReadWriteSelector = (options, family, store, core) => {
|
|
|
995
997
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
996
998
|
const token = {
|
|
997
999
|
key: options.key,
|
|
998
|
-
type: `selector
|
|
999
|
-
family
|
|
1000
|
+
type: `selector`
|
|
1000
1001
|
};
|
|
1002
|
+
if (family) {
|
|
1003
|
+
token.family = family;
|
|
1004
|
+
}
|
|
1001
1005
|
store.subject.selectorCreation.next(token);
|
|
1002
1006
|
return token;
|
|
1003
1007
|
};
|
|
@@ -1194,9 +1198,11 @@ var createReadonlySelector = (options, family, store, core) => {
|
|
|
1194
1198
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
1195
1199
|
const token = {
|
|
1196
1200
|
key: options.key,
|
|
1197
|
-
type: `readonly_selector
|
|
1198
|
-
family
|
|
1201
|
+
type: `readonly_selector`
|
|
1199
1202
|
};
|
|
1203
|
+
if (family) {
|
|
1204
|
+
token.family = family;
|
|
1205
|
+
}
|
|
1200
1206
|
store.subject.selectorCreation.next(token);
|
|
1201
1207
|
return token;
|
|
1202
1208
|
};
|
|
@@ -1216,7 +1222,7 @@ function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
1216
1222
|
return createReadWriteSelector(options, family, store, core);
|
|
1217
1223
|
}
|
|
1218
1224
|
|
|
1219
|
-
//
|
|
1225
|
+
// ../anvl/reactivity/subject.ts
|
|
1220
1226
|
var Subject = class {
|
|
1221
1227
|
constructor() {
|
|
1222
1228
|
this.subscribers = [];
|
|
@@ -1319,7 +1325,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1319
1325
|
);
|
|
1320
1326
|
return;
|
|
1321
1327
|
}
|
|
1322
|
-
timelineData.timeTraveling =
|
|
1328
|
+
timelineData.timeTraveling = `into_future`;
|
|
1323
1329
|
const update = timelineData.history[timelineData.at];
|
|
1324
1330
|
switch (update.type) {
|
|
1325
1331
|
case `atom_update`: {
|
|
@@ -1338,7 +1344,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1338
1344
|
}
|
|
1339
1345
|
++timelineData.at;
|
|
1340
1346
|
timelineData.subject.next(`redo`);
|
|
1341
|
-
timelineData.timeTraveling =
|
|
1347
|
+
timelineData.timeTraveling = null;
|
|
1342
1348
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1343
1349
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
1344
1350
|
);
|
|
@@ -1359,7 +1365,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1359
1365
|
);
|
|
1360
1366
|
return;
|
|
1361
1367
|
}
|
|
1362
|
-
timelineData.timeTraveling =
|
|
1368
|
+
timelineData.timeTraveling = `into_past`;
|
|
1363
1369
|
--timelineData.at;
|
|
1364
1370
|
const update = timelineData.history[timelineData.at];
|
|
1365
1371
|
switch (update.type) {
|
|
@@ -1378,7 +1384,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1378
1384
|
}
|
|
1379
1385
|
}
|
|
1380
1386
|
timelineData.subject.next(`undo`);
|
|
1381
|
-
timelineData.timeTraveling =
|
|
1387
|
+
timelineData.timeTraveling = null;
|
|
1382
1388
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1383
1389
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
1384
1390
|
);
|
|
@@ -1405,7 +1411,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1405
1411
|
update.newValue,
|
|
1406
1412
|
currentTransactionKey ? `) in transaction "${currentTransactionKey}"` : currentSelectorKey ? `) in selector "${currentSelectorKey}"` : `)`
|
|
1407
1413
|
);
|
|
1408
|
-
if (tl.timeTraveling ===
|
|
1414
|
+
if (tl.timeTraveling === null) {
|
|
1409
1415
|
if (tl.selectorTime && tl.selectorTime !== currentSelectorTime) {
|
|
1410
1416
|
const mostRecentUpdate = tl.history.at(-1);
|
|
1411
1417
|
if (mostRecentUpdate === void 0) {
|
|
@@ -1434,7 +1440,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1434
1440
|
const subscription = currentTransaction.subject.subscribe((update2) => {
|
|
1435
1441
|
var _a2;
|
|
1436
1442
|
subscription.unsubscribe();
|
|
1437
|
-
if (tl.timeTraveling ===
|
|
1443
|
+
if (tl.timeTraveling === null && currentTransactionTime) {
|
|
1438
1444
|
if (tl.at !== tl.history.length) {
|
|
1439
1445
|
tl.history.splice(tl.at);
|
|
1440
1446
|
}
|
|
@@ -1523,7 +1529,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
1523
1529
|
const tl = __spreadProps(__spreadValues({
|
|
1524
1530
|
key: options.key,
|
|
1525
1531
|
at: 0,
|
|
1526
|
-
timeTraveling:
|
|
1532
|
+
timeTraveling: null,
|
|
1527
1533
|
selectorTime: null,
|
|
1528
1534
|
transactionKey: null
|
|
1529
1535
|
}, data), {
|