atom.io 0.6.6 → 0.6.7

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 (36) hide show
  1. package/dist/index.d.mts +7 -8
  2. package/dist/index.d.ts +7 -8
  3. package/dist/index.js +66 -93
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +66 -83
  6. package/dist/index.mjs.map +1 -1
  7. package/introspection/dist/index.d.mts +273 -0
  8. package/introspection/dist/index.d.ts +273 -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/package.json +12 -12
  14. package/react-devtools/dist/index.d.mts +8 -10
  15. package/react-devtools/dist/index.d.ts +8 -10
  16. package/react-devtools/dist/index.js +104 -105
  17. package/react-devtools/dist/index.js.map +1 -1
  18. package/react-devtools/dist/index.mjs +105 -106
  19. package/react-devtools/dist/index.mjs.map +1 -1
  20. package/src/internal/atom-internal.ts +5 -6
  21. package/src/internal/get.ts +7 -9
  22. package/src/internal/operation.ts +14 -21
  23. package/src/internal/selector/create-read-write-selector.ts +8 -4
  24. package/src/internal/selector/create-readonly-selector.ts +1 -7
  25. package/src/internal/selector-internal.ts +1 -3
  26. package/src/internal/set.ts +1 -4
  27. package/src/internal/store.ts +19 -22
  28. package/src/internal/subscribe-internal.ts +7 -1
  29. package/src/internal/timeline-internal.ts +1 -3
  30. package/src/internal/transaction/apply-transaction.ts +9 -6
  31. package/src/internal/transaction/build-transaction.ts +6 -6
  32. package/src/internal/transaction-internal.ts +1 -7
  33. package/src/introspection/attach-timeline-family.ts +14 -4
  34. package/src/introspection/attach-transaction-logs.ts +1 -1
  35. package/src/react-devtools/AtomIODevtools.tsx +1 -2
  36. package/src/react-explorer/AtomIOExplorer.tsx +3 -3
package/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- import { Hamt } from 'hamt_plus';
2
1
  import { Refinement } from 'fp-ts/Refinement';
3
2
 
4
3
  type ƒn = (...parameters: any[]) => any;
@@ -71,18 +70,18 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
71
70
 
72
71
  type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
73
72
  interface Store {
74
- atoms: Hamt<Atom<any>, string>;
73
+ atoms: Map<string, Atom<any>>;
75
74
  atomsThatAreDefault: Set<string>;
76
- readonlySelectors: Hamt<ReadonlySelector<any>, string>;
75
+ readonlySelectors: Map<string, ReadonlySelector<any>>;
77
76
  selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
78
77
  selectorGraph: Join<{
79
78
  source: string;
80
79
  }>;
81
- selectors: Hamt<Selector<any>, string>;
80
+ selectors: Map<string, Selector<any>>;
82
81
  timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
83
- timelines: Hamt<Timeline, string>;
84
- transactions: Hamt<Transaction<any>, string>;
85
- valueMap: Hamt<any, string>;
82
+ timelines: Map<string, Timeline>;
83
+ transactions: Map<string, Transaction<any>>;
84
+ valueMap: Map<string, any>;
86
85
  subject: {
87
86
  atomCreation: Subject<AtomToken<unknown>>;
88
87
  selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
@@ -175,7 +174,7 @@ type OperationProgress = {
175
174
  } | {
176
175
  open: true;
177
176
  done: Set<string>;
178
- prev: Hamt<any, string>;
177
+ prev: Map<string, any>;
179
178
  time: number;
180
179
  token: StateToken<any>;
181
180
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Hamt } from 'hamt_plus';
2
1
  import { Refinement } from 'fp-ts/Refinement';
3
2
 
4
3
  type ƒn = (...parameters: any[]) => any;
@@ -71,18 +70,18 @@ declare class Join<CONTENT extends JsonObj | null = null, A extends string = `fr
71
70
 
72
71
  type StoreCore = Pick<Store, `atoms` | `atomsThatAreDefault` | `operation` | `readonlySelectors` | `selectorAtoms` | `selectorGraph` | `selectors` | `timelineAtoms` | `timelines` | `transactions` | `valueMap`>;
73
72
  interface Store {
74
- atoms: Hamt<Atom<any>, string>;
73
+ atoms: Map<string, Atom<any>>;
75
74
  atomsThatAreDefault: Set<string>;
76
- readonlySelectors: Hamt<ReadonlySelector<any>, string>;
75
+ readonlySelectors: Map<string, ReadonlySelector<any>>;
77
76
  selectorAtoms: Join<null, `selectorKey`, `atomKey`>;
78
77
  selectorGraph: Join<{
79
78
  source: string;
80
79
  }>;
81
- selectors: Hamt<Selector<any>, string>;
80
+ selectors: Map<string, Selector<any>>;
82
81
  timelineAtoms: Join<null, `timelineKey`, `atomKey`>;
83
- timelines: Hamt<Timeline, string>;
84
- transactions: Hamt<Transaction<any>, string>;
85
- valueMap: Hamt<any, string>;
82
+ timelines: Map<string, Timeline>;
83
+ transactions: Map<string, Transaction<any>>;
84
+ valueMap: Map<string, any>;
86
85
  subject: {
87
86
  atomCreation: Subject<AtomToken<unknown>>;
88
87
  selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
@@ -175,7 +174,7 @@ type OperationProgress = {
175
174
  } | {
176
175
  open: true;
177
176
  done: Set<string>;
178
- prev: Hamt<any, string>;
177
+ prev: Map<string, any>;
179
178
  time: number;
180
179
  token: StateToken<any>;
181
180
  };
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);
@@ -983,11 +955,7 @@ function selectorFamily__INTERNAL(options, store = IMPLICIT.STORE) {
983
955
  );
984
956
  }
985
957
 
986
- // src/internal/selector-internal.ts
987
- var import_hamt_plus9 = __toESM(require("hamt_plus"));
988
-
989
958
  // src/internal/selector/create-read-write-selector.ts
990
- var import_hamt_plus6 = __toESM(require("hamt_plus"));
991
959
  var createReadWriteSelector = (options, family, store, core) => {
992
960
  var _a;
993
961
  const subject = new Subject();
@@ -999,8 +967,14 @@ var createReadWriteSelector = (options, family, store, core) => {
999
967
  };
1000
968
  const setSelf = (next) => {
1001
969
  var _a2;
1002
- (_a2 = store.config.logger) == null ? void 0 : _a2.info(` <- "${options.key}" became`, next);
1003
970
  const oldValue = getSelf();
971
+ (_a2 = store.config.logger) == null ? void 0 : _a2.info(
972
+ ` <- "${options.key}" went (`,
973
+ oldValue,
974
+ `->`,
975
+ next,
976
+ `)`
977
+ );
1004
978
  const newValue = become(next)(oldValue);
1005
979
  cacheValue(options.key, newValue, store);
1006
980
  markDone(options.key, store);
@@ -1016,7 +990,7 @@ var createReadWriteSelector = (options, family, store, core) => {
1016
990
  set: setSelf,
1017
991
  type: `selector`
1018
992
  }), family && { family });
1019
- core.selectors = import_hamt_plus6.default.set(options.key, mySelector, core.selectors);
993
+ core.selectors.set(options.key, mySelector);
1020
994
  const initialValue = getSelf();
1021
995
  (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1022
996
  const token = {
@@ -1028,9 +1002,6 @@ var createReadWriteSelector = (options, family, store, core) => {
1028
1002
  return token;
1029
1003
  };
1030
1004
 
1031
- // src/internal/selector/create-readonly-selector.ts
1032
- var import_hamt_plus8 = __toESM(require("hamt_plus"));
1033
-
1034
1005
  // src/internal/selector/lookup-selector-sources.ts
1035
1006
  var lookupSelectorSources = (key, store) => target(store).selectorGraph.getRelations(key).filter(({ source }) => source !== key).map(({ source }) => lookup(source, store));
1036
1007
 
@@ -1090,7 +1061,6 @@ var updateSelectorAtoms = (selectorKey, dependency, store) => {
1090
1061
  };
1091
1062
 
1092
1063
  // src/internal/set.ts
1093
- var import_hamt_plus7 = __toESM(require("hamt_plus"));
1094
1064
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1095
1065
  var _a, _b;
1096
1066
  const core = target(store);
@@ -1109,7 +1079,7 @@ var evictDownStream = (state, store = IMPLICIT.STORE) => {
1109
1079
  (_a2 = store.config.logger) == null ? void 0 : _a2.info(` || ${stateKey} already done`);
1110
1080
  return;
1111
1081
  }
1112
- const state2 = (_b2 = import_hamt_plus7.default.get(stateKey, core.selectors)) != null ? _b2 : import_hamt_plus7.default.get(stateKey, core.readonlySelectors);
1082
+ const state2 = (_b2 = core.selectors.get(stateKey)) != null ? _b2 : core.readonlySelectors.get(stateKey);
1113
1083
  if (!state2) {
1114
1084
  (_c = store.config.logger) == null ? void 0 : _c.info(
1115
1085
  ` || ${stateKey} is an atom, and can't be downstream`
@@ -1219,11 +1189,7 @@ var createReadonlySelector = (options, family, store, core) => {
1219
1189
  get: getSelf,
1220
1190
  type: `readonly_selector`
1221
1191
  }), family && { family });
1222
- core.readonlySelectors = import_hamt_plus8.default.set(
1223
- options.key,
1224
- readonlySelector,
1225
- core.readonlySelectors
1226
- );
1192
+ core.readonlySelectors.set(options.key, readonlySelector);
1227
1193
  const initialValue = getSelf();
1228
1194
  (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1229
1195
  const token = {
@@ -1239,7 +1205,7 @@ var createReadonlySelector = (options, family, store, core) => {
1239
1205
  function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
1240
1206
  var _a;
1241
1207
  const core = target(store);
1242
- if (import_hamt_plus9.default.has(options.key, core.selectors)) {
1208
+ if (core.selectors.has(options.key)) {
1243
1209
  (_a = store.config.logger) == null ? void 0 : _a.error(
1244
1210
  `Key "${options.key}" already exists in the store.`
1245
1211
  );
@@ -1323,7 +1289,13 @@ var subscribeToRootAtoms = (state, store) => {
1323
1289
  );
1324
1290
  const oldValue = recallState(state, store);
1325
1291
  const newValue = getState__INTERNAL(state, store);
1326
- (_b = store.config.logger) == null ? void 0 : _b.info(` <- ${state.key} became`, newValue);
1292
+ (_b = store.config.logger) == null ? void 0 : _b.info(
1293
+ ` <- "${state.key}" went (`,
1294
+ oldValue,
1295
+ `->`,
1296
+ newValue,
1297
+ `)`
1298
+ );
1327
1299
  state.subject.next({ newValue, oldValue });
1328
1300
  });
1329
1301
  });
@@ -1412,9 +1384,6 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1412
1384
  );
1413
1385
  };
1414
1386
 
1415
- // src/internal/timeline-internal.ts
1416
- var import_hamt_plus10 = __toESM(require("hamt_plus"));
1417
-
1418
1387
  // src/internal/timeline/add-atom-to-timeline.ts
1419
1388
  var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
1420
1389
  const atom2 = withdraw(atomToken, store);
@@ -1596,7 +1565,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
1596
1565
  timelineKey: options.key
1597
1566
  });
1598
1567
  }
1599
- store.timelines = import_hamt_plus10.default.set(options.key, tl, store.timelines);
1568
+ store.timelines.set(options.key, tl);
1600
1569
  const token = {
1601
1570
  key: options.key,
1602
1571
  type: `timeline`
@@ -1619,7 +1588,6 @@ var abortTransaction = (store) => {
1619
1588
  };
1620
1589
 
1621
1590
  // src/internal/transaction/apply-transaction.ts
1622
- var import_hamt_plus11 = __toESM(require("hamt_plus"));
1623
1591
  var applyTransaction = (output, store) => {
1624
1592
  var _a, _b, _c, _d;
1625
1593
  if (store.transactionStatus.phase !== `building`) {
@@ -1636,10 +1604,15 @@ var applyTransaction = (output, store) => {
1636
1604
  const { atomUpdates } = store.transactionStatus;
1637
1605
  for (const { key, newValue } of atomUpdates) {
1638
1606
  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);
1607
+ if (!store.valueMap.has(token.key)) {
1608
+ const newAtom = store.transactionStatus.core.atoms.get(token.key);
1609
+ if (!newAtom) {
1610
+ throw new Error(
1611
+ `Absurd Error: Atom "${token.key}" not found while copying updates from transaction "${store.transactionStatus.key}" to store "${store.config.name}"`
1612
+ );
1613
+ }
1614
+ store.atoms.set(newAtom.key, newAtom);
1615
+ store.valueMap.set(newAtom.key, newAtom.default);
1643
1616
  (_c = store.config.logger) == null ? void 0 : _c.info(`\u{1F527}`, `add atom "${newAtom.key}"`);
1644
1617
  }
1645
1618
  setState(token, newValue, store);
@@ -1671,17 +1644,17 @@ var buildTransaction = (key, params, store) => {
1671
1644
  phase: `building`,
1672
1645
  time: Date.now(),
1673
1646
  core: {
1674
- atoms: store.atoms,
1647
+ atoms: new Map(store.atoms),
1675
1648
  atomsThatAreDefault: store.atomsThatAreDefault,
1676
1649
  operation: { open: false },
1677
- readonlySelectors: store.readonlySelectors,
1678
- timelines: store.timelines,
1650
+ readonlySelectors: new Map(store.readonlySelectors),
1651
+ timelines: new Map(store.timelines),
1679
1652
  timelineAtoms: store.timelineAtoms,
1680
- transactions: store.transactions,
1653
+ transactions: new Map(store.transactions),
1681
1654
  selectorAtoms: store.selectorAtoms,
1682
1655
  selectorGraph: store.selectorGraph,
1683
- selectors: store.selectors,
1684
- valueMap: store.valueMap
1656
+ selectors: new Map(store.selectors),
1657
+ valueMap: new Map(store.valueMap)
1685
1658
  },
1686
1659
  atomUpdates: [],
1687
1660
  params,