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
package/dist/index.js CHANGED
@@ -1,11 +1,9 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -45,14 +43,6 @@ var __copyProps = (to, from, except, desc) => {
45
43
  }
46
44
  return to;
47
45
  };
48
- var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
49
- // If the importer is in node compatibility mode or this is not an ESM
50
- // file that has been converted to a CommonJS file using a Babel-
51
- // compatible transform (i.e. "__esModule" has not been set), then set
52
- // "default" to the CommonJS "module.exports" for node compatibility.
53
- isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", { value: mod, enumerable: true }) : target2,
54
- mod
55
- ));
56
46
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
47
 
58
48
  // src/index.ts
@@ -144,21 +134,17 @@ __export(internal_exports, {
144
134
  withdraw: () => withdraw
145
135
  });
146
136
 
147
- // src/internal/atom-internal.ts
148
- var import_hamt_plus5 = __toESM(require("hamt_plus"));
149
-
150
137
  // src/internal/get.ts
151
- var import_hamt_plus = __toESM(require("hamt_plus"));
152
138
  var computeSelectorState = (selector2) => selector2.get();
153
139
  function lookup(key, store) {
154
140
  const core = target(store);
155
- const type = import_hamt_plus.default.has(key, core.atoms) ? `atom` : import_hamt_plus.default.has(key, core.selectors) ? `selector` : `readonly_selector`;
141
+ const type = core.atoms.has(key) ? `atom` : core.selectors.has(key) ? `selector` : `readonly_selector`;
156
142
  return { key, type };
157
143
  }
158
144
  function withdraw(token, store) {
159
145
  var _a, _b, _c, _d, _e;
160
146
  const core = target(store);
161
- return (_e = (_d = (_c = (_b = (_a = import_hamt_plus.default.get(token.key, core.atoms)) != null ? _a : import_hamt_plus.default.get(token.key, core.selectors)) != null ? _b : import_hamt_plus.default.get(token.key, core.readonlySelectors)) != null ? _c : import_hamt_plus.default.get(token.key, core.transactions)) != null ? _d : import_hamt_plus.default.get(token.key, core.timelines)) != null ? _e : null;
147
+ return (_e = (_d = (_c = (_b = (_a = core.atoms.get(token.key)) != null ? _a : core.selectors.get(token.key)) != null ? _b : core.readonlySelectors.get(token.key)) != null ? _c : core.transactions.get(token.key)) != null ? _d : core.timelines.get(token.key)) != null ? _e : null;
162
148
  }
163
149
  function deposit(state) {
164
150
  return __spreadValues({
@@ -201,12 +187,6 @@ var isSelectorDefault = (key, store = IMPLICIT.STORE) => {
201
187
  return roots.every((root) => isAtomDefault(root.key, store));
202
188
  };
203
189
 
204
- // src/internal/operation.ts
205
- var import_hamt_plus3 = __toESM(require("hamt_plus"));
206
-
207
- // src/internal/store.ts
208
- var import_hamt_plus2 = __toESM(require("hamt_plus"));
209
-
210
190
  // ../anvl/src/function/index.ts
211
191
  var doNothing = () => void 0;
212
192
  var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing instanceof Function ? nextVersionOfThing(
@@ -659,17 +639,17 @@ var Join = class _Join {
659
639
  // src/internal/store.ts
660
640
  var createStore = (name, store = null) => {
661
641
  var _a;
662
- const copiedStore = __spreadProps(__spreadValues({}, store != null ? store : (() => ({
642
+ const created = __spreadProps(__spreadValues({}, store != null ? store : (() => ({
663
643
  atomsThatAreDefault: /* @__PURE__ */ new Set(),
664
644
  selectorAtoms: new Join({ relationType: `n:n` }).from(`selectorKey`).to(`atomKey`),
665
- selectorGraph: new Join({ relationType: `n:n` }),
666
- valueMap: import_hamt_plus2.default.make()
645
+ selectorGraph: new Join({ relationType: `n:n` })
667
646
  }))()), {
668
- atoms: import_hamt_plus2.default.make(),
669
- readonlySelectors: import_hamt_plus2.default.make(),
670
- selectors: import_hamt_plus2.default.make(),
671
- transactions: import_hamt_plus2.default.make(),
672
- timelines: import_hamt_plus2.default.make(),
647
+ valueMap: new Map(store == null ? void 0 : store.valueMap),
648
+ atoms: /* @__PURE__ */ new Map(),
649
+ readonlySelectors: /* @__PURE__ */ new Map(),
650
+ selectors: /* @__PURE__ */ new Map(),
651
+ transactions: /* @__PURE__ */ new Map(),
652
+ timelines: /* @__PURE__ */ new Map(),
673
653
  timelineAtoms: new Join({ relationType: `1:n` }).from(`timelineKey`).to(`atomKey`),
674
654
  subject: {
675
655
  atomCreation: new Subject(),
@@ -695,21 +675,21 @@ var createStore = (name, store = null) => {
695
675
  });
696
676
  store == null ? void 0 : store.atoms.forEach((atom2) => {
697
677
  const copiedAtom = __spreadProps(__spreadValues({}, atom2), { subject: new Subject() });
698
- copiedStore.atoms = import_hamt_plus2.default.set(atom2.key, copiedAtom, copiedStore.atoms);
678
+ created.atoms.set(atom2.key, copiedAtom);
699
679
  });
700
680
  store == null ? void 0 : store.readonlySelectors.forEach((selector2) => {
701
- selector2.install(copiedStore);
681
+ selector2.install(created);
702
682
  });
703
683
  store == null ? void 0 : store.selectors.forEach((selector2) => {
704
- selector2.install(copiedStore);
684
+ selector2.install(created);
705
685
  });
706
686
  store == null ? void 0 : store.transactions.forEach((tx) => {
707
- tx.install(copiedStore);
687
+ tx.install(created);
708
688
  });
709
689
  store == null ? void 0 : store.timelines.forEach((timeline2) => {
710
- timeline2.install(copiedStore);
690
+ timeline2.install(created);
711
691
  });
712
- return copiedStore;
692
+ return created;
713
693
  };
714
694
  var IMPLICIT = {
715
695
  STORE_INTERNAL: void 0,
@@ -737,7 +717,7 @@ var openOperation = (token, store) => {
737
717
  core.operation = {
738
718
  open: true,
739
719
  done: /* @__PURE__ */ new Set(),
740
- prev: store.valueMap,
720
+ prev: new Map(store.valueMap),
741
721
  time: Date.now(),
742
722
  token
743
723
  };
@@ -781,43 +761,38 @@ var recallState = (state, store = IMPLICIT.STORE) => {
781
761
  (_a = store.config.logger) == null ? void 0 : _a.warn(
782
762
  `recall called outside of an operation. This is probably a bug.`
783
763
  );
784
- return import_hamt_plus3.default.get(state.key, core.valueMap);
764
+ return core.valueMap.get(state.key);
785
765
  }
786
- return import_hamt_plus3.default.get(state.key, core.operation.prev);
766
+ return core.operation.prev.get(state.key);
787
767
  };
788
768
  var cacheValue = (key, value, store = IMPLICIT.STORE) => {
789
769
  const core = target(store);
790
- core.valueMap = import_hamt_plus3.default.set(key, value, core.valueMap);
770
+ core.valueMap.set(key, value);
791
771
  };
792
772
  var evictCachedValue = (key, store = IMPLICIT.STORE) => {
793
773
  const core = target(store);
794
- core.valueMap = import_hamt_plus3.default.remove(key, core.valueMap);
774
+ core.valueMap.delete(key);
795
775
  };
796
- var readCachedValue = (key, store = IMPLICIT.STORE) => import_hamt_plus3.default.get(key, target(store).valueMap);
797
- var isValueCached = (key, store = IMPLICIT.STORE) => import_hamt_plus3.default.has(key, target(store).valueMap);
776
+ var readCachedValue = (key, store = IMPLICIT.STORE) => target(store).valueMap.get(key);
777
+ var isValueCached = (key, store = IMPLICIT.STORE) => target(store).valueMap.has(key);
798
778
  var storeAtom = (atom2, store = IMPLICIT.STORE) => {
799
779
  const core = target(store);
800
- core.atoms = import_hamt_plus3.default.set(atom2.key, atom2, core.atoms);
780
+ core.atoms.set(atom2.key, atom2);
801
781
  };
802
782
  var storeSelector = (selector2, store = IMPLICIT.STORE) => {
803
783
  const core = target(store);
804
- core.selectors = import_hamt_plus3.default.set(selector2.key, selector2, core.selectors);
784
+ core.selectors.set(selector2.key, selector2);
805
785
  };
806
786
  var storeReadonlySelector = (selector2, store = IMPLICIT.STORE) => {
807
787
  const core = target(store);
808
- core.readonlySelectors = import_hamt_plus3.default.set(
809
- selector2.key,
810
- selector2,
811
- core.readonlySelectors
812
- );
788
+ core.readonlySelectors.set(selector2.key, selector2);
813
789
  };
814
790
  var hasKeyBeenUsed = (key, store = IMPLICIT.STORE) => {
815
791
  const core = target(store);
816
- return import_hamt_plus3.default.has(key, core.atoms) || import_hamt_plus3.default.has(key, core.selectors) || import_hamt_plus3.default.has(key, core.readonlySelectors);
792
+ return core.atoms.has(key) || core.selectors.has(key) || core.readonlySelectors.has(key);
817
793
  };
818
794
 
819
795
  // src/internal/transaction-internal.ts
820
- var import_hamt_plus4 = __toESM(require("hamt_plus"));
821
796
  function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
822
797
  const newTransaction = {
823
798
  key: options.key,
@@ -845,11 +820,7 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
845
820
  subject: new Subject()
846
821
  };
847
822
  const core = target(store);
848
- core.transactions = import_hamt_plus4.default.set(
849
- newTransaction.key,
850
- newTransaction,
851
- core.transactions
852
- );
823
+ core.transactions.set(newTransaction.key, newTransaction);
853
824
  const token = deposit(newTransaction);
854
825
  store.subject.transactionCreation.next(token);
855
826
  return token;
@@ -860,12 +831,13 @@ var target = (store = IMPLICIT.STORE) => store.transactionStatus.phase === `buil
860
831
  function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
861
832
  var _a, _b, _c;
862
833
  const core = target(store);
863
- if (hasKeyBeenUsed(options.key, store)) {
834
+ const existing = core.atoms.get(options.key);
835
+ if (existing) {
864
836
  (_b = (_a = store.config.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(
865
837
  _a,
866
838
  `Key "${options.key}" already exists in the store.`
867
839
  );
868
- return deposit(core.atoms.get(options.key));
840
+ return deposit(existing);
869
841
  }
870
842
  const subject = new Subject();
871
843
  const newAtom = __spreadValues(__spreadProps(__spreadValues({}, options), {
@@ -873,7 +845,7 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
873
845
  type: `atom`
874
846
  }), family && { family });
875
847
  const initialValue = options.default instanceof Function ? options.default() : options.default;
876
- core.atoms = import_hamt_plus5.default.set(newAtom.key, newAtom, core.atoms);
848
+ core.atoms.set(newAtom.key, newAtom);
877
849
  markAtomAsDefault(options.key, store);
878
850
  cacheValue(options.key, initialValue, store);
879
851
  const token = deposit(newAtom);
@@ -888,7 +860,6 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
888
860
  }
889
861
 
890
862
  // ../anvl/src/json/index.ts
891
- var import_function8 = require("fp-ts/function");
892
863
  var stringifyJson = (json) => JSON.stringify(json);
893
864
 
894
865
  // src/internal/families-internal.ts
@@ -896,20 +867,23 @@ function atomFamily__INTERNAL(options, store = IMPLICIT.STORE) {
896
867
  const subject = new Subject();
897
868
  return Object.assign(
898
869
  (key) => {
899
- var _a;
900
870
  const subKey = stringifyJson(key);
901
871
  const family = { key: options.key, subKey };
902
872
  const fullKey = `${options.key}(${subKey})`;
903
873
  const existing = withdraw({ key: fullKey, type: `atom` }, store);
904
- const token = existing ? deposit(existing) : atom__INTERNAL(
905
- {
874
+ let token;
875
+ if (existing) {
876
+ token = deposit(existing);
877
+ } else {
878
+ const individualOptions = {
906
879
  key: fullKey,
907
- default: options.default instanceof Function ? options.default(key) : options.default,
908
- effects: (_a = options.effects) == null ? void 0 : _a.call(options, key)
909
- },
910
- family,
911
- store
912
- );
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
+ }
913
887
  subject.next(token);
914
888
  return token;
915
889
  },
@@ -983,11 +957,7 @@ function selectorFamily__INTERNAL(options, store = IMPLICIT.STORE) {
983
957
  );
984
958
  }
985
959
 
986
- // src/internal/selector-internal.ts
987
- var import_hamt_plus9 = __toESM(require("hamt_plus"));
988
-
989
960
  // src/internal/selector/create-read-write-selector.ts
990
- var import_hamt_plus6 = __toESM(require("hamt_plus"));
991
961
  var createReadWriteSelector = (options, family, store, core) => {
992
962
  var _a;
993
963
  const subject = new Subject();
@@ -999,8 +969,14 @@ var createReadWriteSelector = (options, family, store, core) => {
999
969
  };
1000
970
  const setSelf = (next) => {
1001
971
  var _a2;
1002
- (_a2 = store.config.logger) == null ? void 0 : _a2.info(` <- "${options.key}" became`, next);
1003
972
  const oldValue = getSelf();
973
+ (_a2 = store.config.logger) == null ? void 0 : _a2.info(
974
+ ` <- "${options.key}" went (`,
975
+ oldValue,
976
+ `->`,
977
+ next,
978
+ `)`
979
+ );
1004
980
  const newValue = become(next)(oldValue);
1005
981
  cacheValue(options.key, newValue, store);
1006
982
  markDone(options.key, store);
@@ -1016,21 +992,20 @@ var createReadWriteSelector = (options, family, store, core) => {
1016
992
  set: setSelf,
1017
993
  type: `selector`
1018
994
  }), family && { family });
1019
- core.selectors = import_hamt_plus6.default.set(options.key, mySelector, core.selectors);
995
+ core.selectors.set(options.key, mySelector);
1020
996
  const initialValue = getSelf();
1021
997
  (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1022
998
  const token = {
1023
999
  key: options.key,
1024
- type: `selector`,
1025
- family
1000
+ type: `selector`
1026
1001
  };
1002
+ if (family) {
1003
+ token.family = family;
1004
+ }
1027
1005
  store.subject.selectorCreation.next(token);
1028
1006
  return token;
1029
1007
  };
1030
1008
 
1031
- // src/internal/selector/create-readonly-selector.ts
1032
- var import_hamt_plus8 = __toESM(require("hamt_plus"));
1033
-
1034
1009
  // src/internal/selector/lookup-selector-sources.ts
1035
1010
  var lookupSelectorSources = (key, store) => target(store).selectorGraph.getRelations(key).filter(({ source }) => source !== key).map(({ source }) => lookup(source, store));
1036
1011
 
@@ -1090,7 +1065,6 @@ var updateSelectorAtoms = (selectorKey, dependency, store) => {
1090
1065
  };
1091
1066
 
1092
1067
  // src/internal/set.ts
1093
- var import_hamt_plus7 = __toESM(require("hamt_plus"));
1094
1068
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1095
1069
  var _a, _b;
1096
1070
  const core = target(store);
@@ -1109,7 +1083,7 @@ var evictDownStream = (state, store = IMPLICIT.STORE) => {
1109
1083
  (_a2 = store.config.logger) == null ? void 0 : _a2.info(` || ${stateKey} already done`);
1110
1084
  return;
1111
1085
  }
1112
- const state2 = (_b2 = import_hamt_plus7.default.get(stateKey, core.selectors)) != null ? _b2 : import_hamt_plus7.default.get(stateKey, core.readonlySelectors);
1086
+ const state2 = (_b2 = core.selectors.get(stateKey)) != null ? _b2 : core.readonlySelectors.get(stateKey);
1113
1087
  if (!state2) {
1114
1088
  (_c = store.config.logger) == null ? void 0 : _c.info(
1115
1089
  ` || ${stateKey} is an atom, and can't be downstream`
@@ -1219,18 +1193,16 @@ var createReadonlySelector = (options, family, store, core) => {
1219
1193
  get: getSelf,
1220
1194
  type: `readonly_selector`
1221
1195
  }), family && { family });
1222
- core.readonlySelectors = import_hamt_plus8.default.set(
1223
- options.key,
1224
- readonlySelector,
1225
- core.readonlySelectors
1226
- );
1196
+ core.readonlySelectors.set(options.key, readonlySelector);
1227
1197
  const initialValue = getSelf();
1228
1198
  (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1229
1199
  const token = {
1230
1200
  key: options.key,
1231
- type: `readonly_selector`,
1232
- family
1201
+ type: `readonly_selector`
1233
1202
  };
1203
+ if (family) {
1204
+ token.family = family;
1205
+ }
1234
1206
  store.subject.selectorCreation.next(token);
1235
1207
  return token;
1236
1208
  };
@@ -1239,7 +1211,7 @@ var createReadonlySelector = (options, family, store, core) => {
1239
1211
  function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
1240
1212
  var _a;
1241
1213
  const core = target(store);
1242
- if (import_hamt_plus9.default.has(options.key, core.selectors)) {
1214
+ if (core.selectors.has(options.key)) {
1243
1215
  (_a = store.config.logger) == null ? void 0 : _a.error(
1244
1216
  `Key "${options.key}" already exists in the store.`
1245
1217
  );
@@ -1250,7 +1222,7 @@ function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
1250
1222
  return createReadWriteSelector(options, family, store, core);
1251
1223
  }
1252
1224
 
1253
- // src/internal/subject.ts
1225
+ // ../anvl/reactivity/subject.ts
1254
1226
  var Subject = class {
1255
1227
  constructor() {
1256
1228
  this.subscribers = [];
@@ -1323,7 +1295,13 @@ var subscribeToRootAtoms = (state, store) => {
1323
1295
  );
1324
1296
  const oldValue = recallState(state, store);
1325
1297
  const newValue = getState__INTERNAL(state, store);
1326
- (_b = store.config.logger) == null ? void 0 : _b.info(` <- ${state.key} became`, newValue);
1298
+ (_b = store.config.logger) == null ? void 0 : _b.info(
1299
+ ` <- "${state.key}" went (`,
1300
+ oldValue,
1301
+ `->`,
1302
+ newValue,
1303
+ `)`
1304
+ );
1327
1305
  state.subject.next({ newValue, oldValue });
1328
1306
  });
1329
1307
  });
@@ -1347,7 +1325,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1347
1325
  );
1348
1326
  return;
1349
1327
  }
1350
- timelineData.timeTraveling = true;
1328
+ timelineData.timeTraveling = `into_future`;
1351
1329
  const update = timelineData.history[timelineData.at];
1352
1330
  switch (update.type) {
1353
1331
  case `atom_update`: {
@@ -1366,7 +1344,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1366
1344
  }
1367
1345
  ++timelineData.at;
1368
1346
  timelineData.subject.next(`redo`);
1369
- timelineData.timeTraveling = false;
1347
+ timelineData.timeTraveling = null;
1370
1348
  (_d = store.config.logger) == null ? void 0 : _d.info(
1371
1349
  `\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
1372
1350
  );
@@ -1387,7 +1365,7 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1387
1365
  );
1388
1366
  return;
1389
1367
  }
1390
- timelineData.timeTraveling = true;
1368
+ timelineData.timeTraveling = `into_past`;
1391
1369
  --timelineData.at;
1392
1370
  const update = timelineData.history[timelineData.at];
1393
1371
  switch (update.type) {
@@ -1406,15 +1384,12 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1406
1384
  }
1407
1385
  }
1408
1386
  timelineData.subject.next(`undo`);
1409
- timelineData.timeTraveling = false;
1387
+ timelineData.timeTraveling = null;
1410
1388
  (_d = store.config.logger) == null ? void 0 : _d.info(
1411
1389
  `\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
1412
1390
  );
1413
1391
  };
1414
1392
 
1415
- // src/internal/timeline-internal.ts
1416
- var import_hamt_plus10 = __toESM(require("hamt_plus"));
1417
-
1418
1393
  // src/internal/timeline/add-atom-to-timeline.ts
1419
1394
  var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
1420
1395
  const atom2 = withdraw(atomToken, store);
@@ -1436,7 +1411,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
1436
1411
  update.newValue,
1437
1412
  currentTransactionKey ? `) in transaction "${currentTransactionKey}"` : currentSelectorKey ? `) in selector "${currentSelectorKey}"` : `)`
1438
1413
  );
1439
- if (tl.timeTraveling === false) {
1414
+ if (tl.timeTraveling === null) {
1440
1415
  if (tl.selectorTime && tl.selectorTime !== currentSelectorTime) {
1441
1416
  const mostRecentUpdate = tl.history.at(-1);
1442
1417
  if (mostRecentUpdate === void 0) {
@@ -1465,7 +1440,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
1465
1440
  const subscription = currentTransaction.subject.subscribe((update2) => {
1466
1441
  var _a2;
1467
1442
  subscription.unsubscribe();
1468
- if (tl.timeTraveling === false && currentTransactionTime) {
1443
+ if (tl.timeTraveling === null && currentTransactionTime) {
1469
1444
  if (tl.at !== tl.history.length) {
1470
1445
  tl.history.splice(tl.at);
1471
1446
  }
@@ -1554,7 +1529,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
1554
1529
  const tl = __spreadProps(__spreadValues({
1555
1530
  key: options.key,
1556
1531
  at: 0,
1557
- timeTraveling: false,
1532
+ timeTraveling: null,
1558
1533
  selectorTime: null,
1559
1534
  transactionKey: null
1560
1535
  }, data), {
@@ -1596,7 +1571,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
1596
1571
  timelineKey: options.key
1597
1572
  });
1598
1573
  }
1599
- store.timelines = import_hamt_plus10.default.set(options.key, tl, store.timelines);
1574
+ store.timelines.set(options.key, tl);
1600
1575
  const token = {
1601
1576
  key: options.key,
1602
1577
  type: `timeline`
@@ -1619,7 +1594,6 @@ var abortTransaction = (store) => {
1619
1594
  };
1620
1595
 
1621
1596
  // src/internal/transaction/apply-transaction.ts
1622
- var import_hamt_plus11 = __toESM(require("hamt_plus"));
1623
1597
  var applyTransaction = (output, store) => {
1624
1598
  var _a, _b, _c, _d;
1625
1599
  if (store.transactionStatus.phase !== `building`) {
@@ -1636,10 +1610,15 @@ var applyTransaction = (output, store) => {
1636
1610
  const { atomUpdates } = store.transactionStatus;
1637
1611
  for (const { key, newValue } of atomUpdates) {
1638
1612
  const token = { key, type: `atom` };
1639
- if (!import_hamt_plus11.default.has(token.key, store.valueMap)) {
1640
- const newAtom = import_hamt_plus11.default.get(token.key, store.transactionStatus.core.atoms);
1641
- store.atoms = import_hamt_plus11.default.set(newAtom.key, newAtom, store.atoms);
1642
- store.valueMap = import_hamt_plus11.default.set(newAtom.key, newAtom.default, store.valueMap);
1613
+ if (!store.valueMap.has(token.key)) {
1614
+ const newAtom = store.transactionStatus.core.atoms.get(token.key);
1615
+ if (!newAtom) {
1616
+ throw new Error(
1617
+ `Absurd Error: Atom "${token.key}" not found while copying updates from transaction "${store.transactionStatus.key}" to store "${store.config.name}"`
1618
+ );
1619
+ }
1620
+ store.atoms.set(newAtom.key, newAtom);
1621
+ store.valueMap.set(newAtom.key, newAtom.default);
1643
1622
  (_c = store.config.logger) == null ? void 0 : _c.info(`\u{1F527}`, `add atom "${newAtom.key}"`);
1644
1623
  }
1645
1624
  setState(token, newValue, store);
@@ -1671,17 +1650,17 @@ var buildTransaction = (key, params, store) => {
1671
1650
  phase: `building`,
1672
1651
  time: Date.now(),
1673
1652
  core: {
1674
- atoms: store.atoms,
1653
+ atoms: new Map(store.atoms),
1675
1654
  atomsThatAreDefault: store.atomsThatAreDefault,
1676
1655
  operation: { open: false },
1677
- readonlySelectors: store.readonlySelectors,
1678
- timelines: store.timelines,
1656
+ readonlySelectors: new Map(store.readonlySelectors),
1657
+ timelines: new Map(store.timelines),
1679
1658
  timelineAtoms: store.timelineAtoms,
1680
- transactions: store.transactions,
1659
+ transactions: new Map(store.transactions),
1681
1660
  selectorAtoms: store.selectorAtoms,
1682
1661
  selectorGraph: store.selectorGraph,
1683
- selectors: store.selectors,
1684
- valueMap: store.valueMap
1662
+ selectors: new Map(store.selectors),
1663
+ valueMap: new Map(store.valueMap)
1685
1664
  },
1686
1665
  atomUpdates: [],
1687
1666
  params,