atom.io 0.9.6 → 0.9.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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +1 -0
- package/internal/dist/index.d.ts +1 -0
- package/internal/dist/index.js +36 -17
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +36 -17
- package/internal/dist/index.mjs.map +1 -1
- package/internal/src/timeline/add-atom-to-timeline.ts +24 -7
- package/internal/src/timeline/timeline-internal.ts +12 -3
- package/package.json +4 -4
- package/react-devtools/dist/index.d.mts +1 -0
- package/react-devtools/dist/index.d.ts +1 -0
- package/src/timeline.ts +2 -0
package/internal/dist/index.mjs
CHANGED
|
@@ -551,7 +551,7 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
|
|
|
551
551
|
);
|
|
552
552
|
}
|
|
553
553
|
atom.subject.subscribe(`timeline`, (update) => {
|
|
554
|
-
var _a, _b, _c, _d, _e;
|
|
554
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
555
555
|
const currentSelectorKey = store.operation.open && store.operation.token.type === `selector` ? store.operation.token.key : null;
|
|
556
556
|
const currentSelectorTime = store.operation.open && store.operation.token.type === `selector` ? store.operation.time : null;
|
|
557
557
|
const currentTransactionKey = store.transactionStatus.phase === `applying` ? store.transactionStatus.key : null;
|
|
@@ -592,7 +592,7 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
|
|
|
592
592
|
const unsubscribe = currentTransaction.subject.subscribe(
|
|
593
593
|
`timeline:${tl.key}`,
|
|
594
594
|
(update2) => {
|
|
595
|
-
var _a2;
|
|
595
|
+
var _a2, _b2, _c2;
|
|
596
596
|
unsubscribe();
|
|
597
597
|
if (tl.timeTraveling === null && currentTransactionTime) {
|
|
598
598
|
if (tl.at !== tl.history.length) {
|
|
@@ -616,12 +616,15 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
|
|
|
616
616
|
}, update2), {
|
|
617
617
|
atomUpdates
|
|
618
618
|
});
|
|
619
|
-
tl.
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
const willCapture = (_b2 = (_a2 = tl.shouldCapture) == null ? void 0 : _a2.call(tl, timelineTransactionUpdate, tl)) != null ? _b2 : true;
|
|
620
|
+
if (willCapture) {
|
|
621
|
+
tl.history.push(timelineTransactionUpdate);
|
|
622
|
+
tl.at = tl.history.length;
|
|
623
|
+
tl.subject.next(timelineTransactionUpdate);
|
|
624
|
+
}
|
|
622
625
|
}
|
|
623
626
|
tl.transactionKey = null;
|
|
624
|
-
(
|
|
627
|
+
(_c2 = store.config.logger) == null ? void 0 : _c2.info(
|
|
625
628
|
`\u231B timeline "${tl.key}" got a transaction_update "${update2.key}"`
|
|
626
629
|
);
|
|
627
630
|
}
|
|
@@ -662,8 +665,15 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
|
|
|
662
665
|
);
|
|
663
666
|
}
|
|
664
667
|
}
|
|
665
|
-
if (latestUpdate)
|
|
666
|
-
tl.
|
|
668
|
+
if (latestUpdate) {
|
|
669
|
+
const willCaptureSelectorUpdate = (_f = (_e = tl.shouldCapture) == null ? void 0 : _e.call(tl, latestUpdate, tl)) != null ? _f : true;
|
|
670
|
+
if (willCaptureSelectorUpdate) {
|
|
671
|
+
tl.subject.next(latestUpdate);
|
|
672
|
+
} else {
|
|
673
|
+
tl.history.pop();
|
|
674
|
+
tl.at = tl.history.length;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
667
677
|
} else {
|
|
668
678
|
const timestamp = Date.now();
|
|
669
679
|
tl.selectorTime = null;
|
|
@@ -680,12 +690,15 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
|
|
|
680
690
|
if (atom.family) {
|
|
681
691
|
atomUpdate.family = atom.family;
|
|
682
692
|
}
|
|
683
|
-
tl.
|
|
684
|
-
|
|
685
|
-
(_e = store.config.logger) == null ? void 0 : _e.info(
|
|
693
|
+
const willCapture = (_h = (_g = tl.shouldCapture) == null ? void 0 : _g.call(tl, atomUpdate, tl)) != null ? _h : true;
|
|
694
|
+
(_i = store.config.logger) == null ? void 0 : _i.info(
|
|
686
695
|
`\u231B timeline "${tl.key}" got an atom_update to "${atom.key}"`
|
|
687
696
|
);
|
|
688
|
-
|
|
697
|
+
if (willCapture) {
|
|
698
|
+
tl.history.push(atomUpdate);
|
|
699
|
+
tl.at = tl.history.length;
|
|
700
|
+
tl.subject.next(atomUpdate);
|
|
701
|
+
}
|
|
689
702
|
}
|
|
690
703
|
}
|
|
691
704
|
});
|
|
@@ -773,7 +786,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
773
786
|
|
|
774
787
|
// src/timeline/timeline-internal.ts
|
|
775
788
|
function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
776
|
-
var _a, _b, _c;
|
|
789
|
+
var _a, _b, _c, _d;
|
|
777
790
|
const tl = __spreadProps(__spreadValues({
|
|
778
791
|
type: `timeline`,
|
|
779
792
|
key: options.key,
|
|
@@ -786,6 +799,9 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
786
799
|
install: (store2) => timeline__INTERNAL(options, store2, tl),
|
|
787
800
|
subject: new Subject()
|
|
788
801
|
});
|
|
802
|
+
if (options.shouldCapture) {
|
|
803
|
+
tl.shouldCapture = options.shouldCapture;
|
|
804
|
+
}
|
|
789
805
|
const core = target(store);
|
|
790
806
|
for (const tokenOrFamily of options.atoms) {
|
|
791
807
|
const timelineKey = core.timelineAtoms.getRelatedKey(tokenOrFamily.key);
|
|
@@ -798,10 +814,13 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
798
814
|
if (tokenOrFamily.type === `atom_family`) {
|
|
799
815
|
const family = tokenOrFamily;
|
|
800
816
|
family.subject.subscribe(`timeline:${options.key}`, (token2) => {
|
|
801
|
-
|
|
802
|
-
addAtomToTimeline(token2, tl, store);
|
|
803
|
-
}
|
|
817
|
+
addAtomToTimeline(token2, tl, store);
|
|
804
818
|
});
|
|
819
|
+
for (const atom of core.atoms.values()) {
|
|
820
|
+
if (((_c = atom.family) == null ? void 0 : _c.key) === family.key) {
|
|
821
|
+
addAtomToTimeline(atom, tl, store);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
805
824
|
} else {
|
|
806
825
|
const token2 = tokenOrFamily;
|
|
807
826
|
if (`family` in token2 && token2.family) {
|
|
@@ -809,7 +828,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
809
828
|
token2.family.key
|
|
810
829
|
);
|
|
811
830
|
if (familyTimelineKey) {
|
|
812
|
-
(
|
|
831
|
+
(_d = store.config.logger) == null ? void 0 : _d.error(
|
|
813
832
|
`\u274C Failed to add atom "${token2.key}" to timeline "${options.key}" because its family "${token2.family.key}" belongs to timeline "${familyTimelineKey}"`
|
|
814
833
|
);
|
|
815
834
|
continue;
|