atom.io 0.6.5 → 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.
- package/README.md +32 -78
- package/dist/index.d.mts +11 -43
- package/dist/index.d.ts +11 -43
- package/dist/index.js +111 -291
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -278
- package/dist/index.mjs.map +1 -1
- package/introspection/dist/index.d.mts +273 -0
- package/introspection/dist/index.d.ts +273 -0
- package/introspection/dist/index.js +350 -0
- package/introspection/dist/index.js.map +1 -0
- package/introspection/dist/index.mjs +327 -0
- package/introspection/dist/index.mjs.map +1 -0
- package/introspection/package.json +15 -0
- package/package.json +22 -12
- package/react-devtools/dist/index.css +22 -5
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.mts +347 -10
- package/react-devtools/dist/index.d.ts +347 -10
- package/react-devtools/dist/index.js +2743 -696
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +2739 -701
- package/react-devtools/dist/index.mjs.map +1 -1
- package/src/internal/atom-internal.ts +5 -6
- package/src/internal/get.ts +7 -9
- package/src/internal/index.ts +0 -1
- package/src/internal/operation.ts +15 -21
- package/src/internal/selector/create-read-write-selector.ts +8 -4
- package/src/internal/selector/create-readonly-selector.ts +1 -7
- package/src/internal/selector-internal.ts +1 -3
- package/src/internal/set.ts +1 -4
- package/src/internal/store.ts +22 -24
- package/src/internal/subscribe-internal.ts +7 -1
- package/src/internal/time-travel-internal.ts +2 -0
- package/src/internal/timeline/add-atom-to-timeline.ts +11 -12
- package/src/internal/timeline-internal.ts +6 -4
- 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-atom-index.ts +73 -0
- package/src/introspection/attach-introspection-states.ts +42 -0
- package/src/introspection/attach-selector-index.ts +77 -0
- package/src/introspection/attach-timeline-family.ts +59 -0
- package/src/introspection/attach-timeline-index.ts +36 -0
- package/src/introspection/attach-transaction-index.ts +38 -0
- package/src/introspection/attach-transaction-logs.ts +40 -0
- package/src/introspection/index.ts +20 -0
- package/src/react-devtools/AtomIODevtools.tsx +97 -97
- package/src/react-devtools/Button.tsx +24 -0
- package/src/react-devtools/StateEditor.tsx +14 -16
- package/src/react-devtools/StateIndex.tsx +153 -0
- package/src/react-devtools/TimelineIndex.tsx +92 -0
- package/src/react-devtools/TransactionIndex.tsx +70 -0
- package/src/react-devtools/Updates.tsx +145 -0
- package/src/react-devtools/devtools.scss +196 -15
- package/src/react-devtools/index.ts +71 -0
- package/src/react-explorer/AtomIOExplorer.tsx +3 -4
- package/src/react-explorer/explorer-states.ts +1 -1
- package/src/react-explorer/space-states.ts +3 -1
- package/src/react-explorer/view-states.ts +0 -2
- package/realtime-testing/dist/index.d.mts +0 -49
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/index.js +0 -165
- package/realtime-testing/dist/index.js.map +0 -1
- package/realtime-testing/dist/index.mjs +0 -129
- package/realtime-testing/dist/index.mjs.map +0 -1
- package/src/internal/meta/attach-meta.ts +0 -17
- package/src/internal/meta/index.ts +0 -4
- package/src/internal/meta/meta-state.ts +0 -135
- package/src/internal/meta/meta-timelines.ts +0 -1
- package/src/internal/meta/meta-transactions.ts +0 -1
- package/src/react-devtools/TokenList.tsx +0 -61
package/dist/index.mjs
CHANGED
|
@@ -41,7 +41,6 @@ var capitalize = (str) => str[0].toUpperCase() + str.slice(1);
|
|
|
41
41
|
var internal_exports = {};
|
|
42
42
|
__export(internal_exports, {
|
|
43
43
|
IMPLICIT: () => IMPLICIT,
|
|
44
|
-
META: () => meta_exports,
|
|
45
44
|
Subject: () => Subject,
|
|
46
45
|
TRANSACTION_PHASES: () => TRANSACTION_PHASES,
|
|
47
46
|
abortTransaction: () => abortTransaction,
|
|
@@ -98,21 +97,17 @@ __export(internal_exports, {
|
|
|
98
97
|
withdraw: () => withdraw
|
|
99
98
|
});
|
|
100
99
|
|
|
101
|
-
// src/internal/atom-internal.ts
|
|
102
|
-
import HAMT5 from "hamt_plus";
|
|
103
|
-
|
|
104
100
|
// src/internal/get.ts
|
|
105
|
-
import HAMT from "hamt_plus";
|
|
106
101
|
var computeSelectorState = (selector2) => selector2.get();
|
|
107
102
|
function lookup(key, store) {
|
|
108
103
|
const core = target(store);
|
|
109
|
-
const type =
|
|
104
|
+
const type = core.atoms.has(key) ? `atom` : core.selectors.has(key) ? `selector` : `readonly_selector`;
|
|
110
105
|
return { key, type };
|
|
111
106
|
}
|
|
112
107
|
function withdraw(token, store) {
|
|
113
108
|
var _a, _b, _c, _d, _e;
|
|
114
109
|
const core = target(store);
|
|
115
|
-
return (_e = (_d = (_c = (_b = (_a =
|
|
110
|
+
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;
|
|
116
111
|
}
|
|
117
112
|
function deposit(state) {
|
|
118
113
|
return __spreadValues({
|
|
@@ -155,12 +150,6 @@ var isSelectorDefault = (key, store = IMPLICIT.STORE) => {
|
|
|
155
150
|
return roots.every((root) => isAtomDefault(root.key, store));
|
|
156
151
|
};
|
|
157
152
|
|
|
158
|
-
// src/internal/operation.ts
|
|
159
|
-
import HAMT3 from "hamt_plus";
|
|
160
|
-
|
|
161
|
-
// src/internal/store.ts
|
|
162
|
-
import HAMT2 from "hamt_plus";
|
|
163
|
-
|
|
164
153
|
// ../anvl/src/function/index.ts
|
|
165
154
|
var doNothing = () => void 0;
|
|
166
155
|
var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing instanceof Function ? nextVersionOfThing(
|
|
@@ -168,62 +157,8 @@ var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing insta
|
|
|
168
157
|
) : nextVersionOfThing;
|
|
169
158
|
var pass = (...params) => (fn) => fn(...params);
|
|
170
159
|
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
switch (arguments.length) {
|
|
174
|
-
case 1:
|
|
175
|
-
return a;
|
|
176
|
-
case 2:
|
|
177
|
-
return ab(a);
|
|
178
|
-
case 3:
|
|
179
|
-
return bc(ab(a));
|
|
180
|
-
case 4:
|
|
181
|
-
return cd(bc(ab(a)));
|
|
182
|
-
case 5:
|
|
183
|
-
return de(cd(bc(ab(a))));
|
|
184
|
-
case 6:
|
|
185
|
-
return ef(de(cd(bc(ab(a)))));
|
|
186
|
-
case 7:
|
|
187
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
188
|
-
case 8:
|
|
189
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
190
|
-
case 9:
|
|
191
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
192
|
-
default: {
|
|
193
|
-
var ret = arguments[0];
|
|
194
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
195
|
-
ret = arguments[i](ret);
|
|
196
|
-
}
|
|
197
|
-
return ret;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// ../../node_modules/.pnpm/fp-ts@2.16.0/node_modules/fp-ts/es6/string.js
|
|
203
|
-
var Eq = {
|
|
204
|
-
equals: function(first, second) {
|
|
205
|
-
return first === second;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
var Semigroup = {
|
|
209
|
-
concat: function(first, second) {
|
|
210
|
-
return first + second;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
var empty = "";
|
|
214
|
-
var Monoid = {
|
|
215
|
-
concat: Semigroup.concat,
|
|
216
|
-
empty
|
|
217
|
-
};
|
|
218
|
-
var Ord = {
|
|
219
|
-
equals: Eq.equals,
|
|
220
|
-
compare: function(first, second) {
|
|
221
|
-
return first < second ? -1 : first > second ? 1 : 0;
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
var isString = function(u) {
|
|
225
|
-
return typeof u === "string";
|
|
226
|
-
};
|
|
160
|
+
// ../anvl/src/join/core-relation-data.ts
|
|
161
|
+
import { isString } from "fp-ts/string";
|
|
227
162
|
|
|
228
163
|
// ../anvl/src/array/venn.ts
|
|
229
164
|
var includesAll = (items) => (array) => {
|
|
@@ -244,6 +179,9 @@ var addTo = (a) => (x) => a.includes(x) ? a : [...a, x];
|
|
|
244
179
|
var isEmptyArray = (input) => Array.isArray(input) && input.length === 0;
|
|
245
180
|
var isOneOf = (...args) => (input) => args.includes(input);
|
|
246
181
|
|
|
182
|
+
// ../anvl/src/object/refinement.ts
|
|
183
|
+
import { pipe as pipe2 } from "fp-ts/function";
|
|
184
|
+
|
|
247
185
|
// ../anvl/src/object/access.ts
|
|
248
186
|
var access = (k) => Object.assign((obj) => obj[k], {
|
|
249
187
|
in: (obj) => obj[k]
|
|
@@ -254,6 +192,7 @@ var recordToEntries = (obj) => Object.entries(obj);
|
|
|
254
192
|
var entriesToRecord = (entries) => Object.fromEntries(entries);
|
|
255
193
|
|
|
256
194
|
// ../anvl/src/object/mapObject.ts
|
|
195
|
+
import { pipe } from "fp-ts/function";
|
|
257
196
|
var mapObject = (obj, fn) => pipe(
|
|
258
197
|
obj,
|
|
259
198
|
recordToEntries,
|
|
@@ -276,14 +215,14 @@ var hasProperties = (isValue, options = { allowExtraProperties: false }) => {
|
|
|
276
215
|
isValue
|
|
277
216
|
).map(([k, v]) => String(k) + `:` + v.name).join(`,`)}}`;
|
|
278
217
|
const _ = {
|
|
279
|
-
[name]: (input) => isPlainObject(input) &&
|
|
218
|
+
[name]: (input) => isPlainObject(input) && pipe2(
|
|
280
219
|
isValue,
|
|
281
220
|
Object.entries,
|
|
282
221
|
every(([key, val]) => key in input || val(void 0))
|
|
283
|
-
) &&
|
|
222
|
+
) && pipe2(
|
|
284
223
|
input,
|
|
285
224
|
mob(
|
|
286
|
-
(val, key) =>
|
|
225
|
+
(val, key) => pipe2(
|
|
287
226
|
isValue,
|
|
288
227
|
access(key),
|
|
289
228
|
ifNullish(() => options.allowExtraProperties),
|
|
@@ -401,6 +340,9 @@ var makeJsonInterface = (join, ...params) => {
|
|
|
401
340
|
};
|
|
402
341
|
};
|
|
403
342
|
|
|
343
|
+
// ../anvl/src/join/relation-contents.ts
|
|
344
|
+
import { pipe as pipe5 } from "fp-ts/function";
|
|
345
|
+
|
|
404
346
|
// ../anvl/src/join/relation-record.ts
|
|
405
347
|
var getRelationEntries = (relationMap, idA) => getRelatedIds(relationMap, idA).map((idB) => [
|
|
406
348
|
idB,
|
|
@@ -408,7 +350,12 @@ var getRelationEntries = (relationMap, idA) => getRelatedIds(relationMap, idA).m
|
|
|
408
350
|
]);
|
|
409
351
|
var getRelationRecord = (relationMap, id) => Object.fromEntries(getRelationEntries(relationMap, id));
|
|
410
352
|
|
|
353
|
+
// ../anvl/src/join/remove-relation.ts
|
|
354
|
+
import { pipe as pipe4 } from "fp-ts/function";
|
|
355
|
+
import { isString as isString2 } from "fp-ts/string";
|
|
356
|
+
|
|
411
357
|
// ../anvl/src/object/index.ts
|
|
358
|
+
import { pipe as pipe3 } from "fp-ts/function";
|
|
412
359
|
var treeShake = (shouldDiscard = isUndefined) => (obj) => {
|
|
413
360
|
const newObj = {};
|
|
414
361
|
const entries = Object.entries(obj);
|
|
@@ -425,7 +372,7 @@ var split = (separator) => (str) => str.split(separator);
|
|
|
425
372
|
var removeSpecific = (current, idA, idB) => {
|
|
426
373
|
const isIdForRemoval = isOneOf(idA, idB);
|
|
427
374
|
return __spreadProps(__spreadValues({}, current), {
|
|
428
|
-
relations:
|
|
375
|
+
relations: pipe4(
|
|
429
376
|
current.relations,
|
|
430
377
|
recordToEntries,
|
|
431
378
|
map(([id, relations]) => [
|
|
@@ -435,17 +382,17 @@ var removeSpecific = (current, idA, idB) => {
|
|
|
435
382
|
entriesToRecord,
|
|
436
383
|
treeShake(isEmptyArray)
|
|
437
384
|
),
|
|
438
|
-
contents:
|
|
385
|
+
contents: pipe4(
|
|
439
386
|
current.contents,
|
|
440
387
|
treeShake(
|
|
441
|
-
(_, key) =>
|
|
388
|
+
(_, key) => isString2(key) && pipe4(key, split(`/`), comprises([idA, idB]))
|
|
442
389
|
)
|
|
443
390
|
)
|
|
444
391
|
});
|
|
445
392
|
};
|
|
446
393
|
var removeAll = (current, idToRemove) => {
|
|
447
394
|
const next = __spreadProps(__spreadValues({}, current), {
|
|
448
|
-
relations:
|
|
395
|
+
relations: pipe4(
|
|
449
396
|
current.relations,
|
|
450
397
|
recordToEntries,
|
|
451
398
|
map(([id, relations]) => [
|
|
@@ -455,10 +402,10 @@ var removeAll = (current, idToRemove) => {
|
|
|
455
402
|
entriesToRecord,
|
|
456
403
|
treeShake((val, key) => key === idToRemove || isEmptyArray(val))
|
|
457
404
|
),
|
|
458
|
-
contents:
|
|
405
|
+
contents: pipe4(
|
|
459
406
|
current.contents,
|
|
460
407
|
treeShake(
|
|
461
|
-
(_, key) =>
|
|
408
|
+
(_, key) => isString2(key) && key.split(`/`).includes(idToRemove)
|
|
462
409
|
)
|
|
463
410
|
)
|
|
464
411
|
});
|
|
@@ -540,7 +487,7 @@ var getRelations = (relationMap, id) => getRelationEntries(relationMap, id).map(
|
|
|
540
487
|
var setRelations = (current, subject, relations) => {
|
|
541
488
|
const idA = subject[current.a];
|
|
542
489
|
const idB = subject[current.b];
|
|
543
|
-
return
|
|
490
|
+
return pipe5(
|
|
544
491
|
current,
|
|
545
492
|
(relationData) => {
|
|
546
493
|
const relatedIds = getRelatedIds(current, idA);
|
|
@@ -655,24 +602,25 @@ var Join = class _Join {
|
|
|
655
602
|
// src/internal/store.ts
|
|
656
603
|
var createStore = (name, store = null) => {
|
|
657
604
|
var _a;
|
|
658
|
-
const
|
|
605
|
+
const created = __spreadProps(__spreadValues({}, store != null ? store : (() => ({
|
|
659
606
|
atomsThatAreDefault: /* @__PURE__ */ new Set(),
|
|
660
607
|
selectorAtoms: new Join({ relationType: `n:n` }).from(`selectorKey`).to(`atomKey`),
|
|
661
|
-
selectorGraph: new Join({ relationType: `n:n` })
|
|
662
|
-
valueMap: HAMT2.make()
|
|
608
|
+
selectorGraph: new Join({ relationType: `n:n` })
|
|
663
609
|
}))()), {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
610
|
+
valueMap: new Map(store == null ? void 0 : store.valueMap),
|
|
611
|
+
atoms: /* @__PURE__ */ new Map(),
|
|
612
|
+
readonlySelectors: /* @__PURE__ */ new Map(),
|
|
613
|
+
selectors: /* @__PURE__ */ new Map(),
|
|
614
|
+
transactions: /* @__PURE__ */ new Map(),
|
|
615
|
+
timelines: /* @__PURE__ */ new Map(),
|
|
669
616
|
timelineAtoms: new Join({ relationType: `1:n` }).from(`timelineKey`).to(`atomKey`),
|
|
670
|
-
subject:
|
|
617
|
+
subject: {
|
|
671
618
|
atomCreation: new Subject(),
|
|
672
619
|
selectorCreation: new Subject(),
|
|
673
620
|
transactionCreation: new Subject(),
|
|
674
|
-
timelineCreation: new Subject()
|
|
675
|
-
|
|
621
|
+
timelineCreation: new Subject(),
|
|
622
|
+
operationStatus: new Subject()
|
|
623
|
+
},
|
|
676
624
|
operation: __spreadValues({
|
|
677
625
|
open: false
|
|
678
626
|
}, store == null ? void 0 : store.operation),
|
|
@@ -690,21 +638,21 @@ var createStore = (name, store = null) => {
|
|
|
690
638
|
});
|
|
691
639
|
store == null ? void 0 : store.atoms.forEach((atom2) => {
|
|
692
640
|
const copiedAtom = __spreadProps(__spreadValues({}, atom2), { subject: new Subject() });
|
|
693
|
-
|
|
641
|
+
created.atoms.set(atom2.key, copiedAtom);
|
|
694
642
|
});
|
|
695
643
|
store == null ? void 0 : store.readonlySelectors.forEach((selector2) => {
|
|
696
|
-
selector2.install(
|
|
644
|
+
selector2.install(created);
|
|
697
645
|
});
|
|
698
646
|
store == null ? void 0 : store.selectors.forEach((selector2) => {
|
|
699
|
-
selector2.install(
|
|
647
|
+
selector2.install(created);
|
|
700
648
|
});
|
|
701
649
|
store == null ? void 0 : store.transactions.forEach((tx) => {
|
|
702
|
-
tx.install(
|
|
650
|
+
tx.install(created);
|
|
703
651
|
});
|
|
704
652
|
store == null ? void 0 : store.timelines.forEach((timeline2) => {
|
|
705
|
-
timeline2.install(
|
|
653
|
+
timeline2.install(created);
|
|
706
654
|
});
|
|
707
|
-
return
|
|
655
|
+
return created;
|
|
708
656
|
};
|
|
709
657
|
var IMPLICIT = {
|
|
710
658
|
STORE_INTERNAL: void 0,
|
|
@@ -732,7 +680,7 @@ var openOperation = (token, store) => {
|
|
|
732
680
|
core.operation = {
|
|
733
681
|
open: true,
|
|
734
682
|
done: /* @__PURE__ */ new Set(),
|
|
735
|
-
prev: store.valueMap,
|
|
683
|
+
prev: new Map(store.valueMap),
|
|
736
684
|
time: Date.now(),
|
|
737
685
|
token
|
|
738
686
|
};
|
|
@@ -745,6 +693,7 @@ var closeOperation = (store) => {
|
|
|
745
693
|
const core = target(store);
|
|
746
694
|
core.operation = { open: false };
|
|
747
695
|
(_a = store.config.logger) == null ? void 0 : _a.info(`\u{1F534} operation done`);
|
|
696
|
+
store.subject.operationStatus.next(core.operation);
|
|
748
697
|
};
|
|
749
698
|
var isDone = (key, store = IMPLICIT.STORE) => {
|
|
750
699
|
var _a;
|
|
@@ -775,43 +724,38 @@ var recallState = (state, store = IMPLICIT.STORE) => {
|
|
|
775
724
|
(_a = store.config.logger) == null ? void 0 : _a.warn(
|
|
776
725
|
`recall called outside of an operation. This is probably a bug.`
|
|
777
726
|
);
|
|
778
|
-
return
|
|
727
|
+
return core.valueMap.get(state.key);
|
|
779
728
|
}
|
|
780
|
-
return
|
|
729
|
+
return core.operation.prev.get(state.key);
|
|
781
730
|
};
|
|
782
731
|
var cacheValue = (key, value, store = IMPLICIT.STORE) => {
|
|
783
732
|
const core = target(store);
|
|
784
|
-
core.valueMap
|
|
733
|
+
core.valueMap.set(key, value);
|
|
785
734
|
};
|
|
786
735
|
var evictCachedValue = (key, store = IMPLICIT.STORE) => {
|
|
787
736
|
const core = target(store);
|
|
788
|
-
core.valueMap
|
|
737
|
+
core.valueMap.delete(key);
|
|
789
738
|
};
|
|
790
|
-
var readCachedValue = (key, store = IMPLICIT.STORE) =>
|
|
791
|
-
var isValueCached = (key, store = IMPLICIT.STORE) =>
|
|
739
|
+
var readCachedValue = (key, store = IMPLICIT.STORE) => target(store).valueMap.get(key);
|
|
740
|
+
var isValueCached = (key, store = IMPLICIT.STORE) => target(store).valueMap.has(key);
|
|
792
741
|
var storeAtom = (atom2, store = IMPLICIT.STORE) => {
|
|
793
742
|
const core = target(store);
|
|
794
|
-
core.atoms
|
|
743
|
+
core.atoms.set(atom2.key, atom2);
|
|
795
744
|
};
|
|
796
745
|
var storeSelector = (selector2, store = IMPLICIT.STORE) => {
|
|
797
746
|
const core = target(store);
|
|
798
|
-
core.selectors
|
|
747
|
+
core.selectors.set(selector2.key, selector2);
|
|
799
748
|
};
|
|
800
749
|
var storeReadonlySelector = (selector2, store = IMPLICIT.STORE) => {
|
|
801
750
|
const core = target(store);
|
|
802
|
-
core.readonlySelectors
|
|
803
|
-
selector2.key,
|
|
804
|
-
selector2,
|
|
805
|
-
core.readonlySelectors
|
|
806
|
-
);
|
|
751
|
+
core.readonlySelectors.set(selector2.key, selector2);
|
|
807
752
|
};
|
|
808
753
|
var hasKeyBeenUsed = (key, store = IMPLICIT.STORE) => {
|
|
809
754
|
const core = target(store);
|
|
810
|
-
return
|
|
755
|
+
return core.atoms.has(key) || core.selectors.has(key) || core.readonlySelectors.has(key);
|
|
811
756
|
};
|
|
812
757
|
|
|
813
758
|
// src/internal/transaction-internal.ts
|
|
814
|
-
import HAMT4 from "hamt_plus";
|
|
815
759
|
function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
|
|
816
760
|
const newTransaction = {
|
|
817
761
|
key: options.key,
|
|
@@ -839,11 +783,7 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
|
|
|
839
783
|
subject: new Subject()
|
|
840
784
|
};
|
|
841
785
|
const core = target(store);
|
|
842
|
-
core.transactions
|
|
843
|
-
newTransaction.key,
|
|
844
|
-
newTransaction,
|
|
845
|
-
core.transactions
|
|
846
|
-
);
|
|
786
|
+
core.transactions.set(newTransaction.key, newTransaction);
|
|
847
787
|
const token = deposit(newTransaction);
|
|
848
788
|
store.subject.transactionCreation.next(token);
|
|
849
789
|
return token;
|
|
@@ -854,12 +794,13 @@ var target = (store = IMPLICIT.STORE) => store.transactionStatus.phase === `buil
|
|
|
854
794
|
function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
855
795
|
var _a, _b, _c;
|
|
856
796
|
const core = target(store);
|
|
857
|
-
|
|
797
|
+
const existing = core.atoms.get(options.key);
|
|
798
|
+
if (existing) {
|
|
858
799
|
(_b = (_a = store.config.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(
|
|
859
800
|
_a,
|
|
860
801
|
`Key "${options.key}" already exists in the store.`
|
|
861
802
|
);
|
|
862
|
-
return deposit(
|
|
803
|
+
return deposit(existing);
|
|
863
804
|
}
|
|
864
805
|
const subject = new Subject();
|
|
865
806
|
const newAtom = __spreadValues(__spreadProps(__spreadValues({}, options), {
|
|
@@ -867,7 +808,7 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
867
808
|
type: `atom`
|
|
868
809
|
}), family && { family });
|
|
869
810
|
const initialValue = options.default instanceof Function ? options.default() : options.default;
|
|
870
|
-
core.atoms
|
|
811
|
+
core.atoms.set(newAtom.key, newAtom);
|
|
871
812
|
markAtomAsDefault(options.key, store);
|
|
872
813
|
cacheValue(options.key, initialValue, store);
|
|
873
814
|
const token = deposit(newAtom);
|
|
@@ -882,6 +823,7 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
|
882
823
|
}
|
|
883
824
|
|
|
884
825
|
// ../anvl/src/json/index.ts
|
|
826
|
+
import { pipe as pipe6 } from "fp-ts/function";
|
|
885
827
|
var stringifyJson = (json) => JSON.stringify(json);
|
|
886
828
|
|
|
887
829
|
// src/internal/families-internal.ts
|
|
@@ -976,125 +918,7 @@ function selectorFamily__INTERNAL(options, store = IMPLICIT.STORE) {
|
|
|
976
918
|
);
|
|
977
919
|
}
|
|
978
920
|
|
|
979
|
-
// src/internal/meta/index.ts
|
|
980
|
-
var meta_exports = {};
|
|
981
|
-
__export(meta_exports, {
|
|
982
|
-
attachMetaAtoms: () => attachMetaAtoms,
|
|
983
|
-
attachMetaSelectors: () => attachMetaSelectors,
|
|
984
|
-
attachMetaState: () => attachMetaState
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
// src/internal/meta/meta-state.ts
|
|
988
|
-
var attachMetaAtoms = (store = IMPLICIT.STORE) => {
|
|
989
|
-
const atomTokenIndexState__INTERNAL = atom({
|
|
990
|
-
key: `\u{1F441}\u200D\u{1F5E8}_atom_token_index__INTERNAL`,
|
|
991
|
-
default: () => [...store.atoms].reduce((acc, [key]) => {
|
|
992
|
-
acc[key] = { key, type: `atom` };
|
|
993
|
-
return acc;
|
|
994
|
-
}, {}),
|
|
995
|
-
effects: [
|
|
996
|
-
({ setSelf }) => {
|
|
997
|
-
store.subject.atomCreation.subscribe((atomToken) => {
|
|
998
|
-
if (store.operation.open) {
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
setSelf((state) => {
|
|
1002
|
-
const { key, family } = atomToken;
|
|
1003
|
-
if (family) {
|
|
1004
|
-
const { key: familyKey, subKey } = family;
|
|
1005
|
-
const current = state[familyKey];
|
|
1006
|
-
if (current === void 0 || `familyMembers` in current) {
|
|
1007
|
-
const familyKeyState = current || {
|
|
1008
|
-
key: familyKey,
|
|
1009
|
-
familyMembers: {}
|
|
1010
|
-
};
|
|
1011
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
1012
|
-
[familyKey]: __spreadProps(__spreadValues({}, familyKeyState), {
|
|
1013
|
-
familyMembers: __spreadProps(__spreadValues({}, familyKeyState.familyMembers), {
|
|
1014
|
-
[subKey]: atomToken
|
|
1015
|
-
})
|
|
1016
|
-
})
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
1021
|
-
[key]: atomToken
|
|
1022
|
-
});
|
|
1023
|
-
});
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
]
|
|
1027
|
-
});
|
|
1028
|
-
return selector({
|
|
1029
|
-
key: `\u{1F441}\u200D\u{1F5E8}_atom_token_index`,
|
|
1030
|
-
get: ({ get }) => get(atomTokenIndexState__INTERNAL)
|
|
1031
|
-
});
|
|
1032
|
-
};
|
|
1033
|
-
var attachMetaSelectors = (store = IMPLICIT.STORE) => {
|
|
1034
|
-
const readonlySelectorTokenIndexState__INTERNAL = atom({
|
|
1035
|
-
key: `\u{1F441}\u200D\u{1F5E8}_selector_token_index__INTERNAL`,
|
|
1036
|
-
default: () => Object.assign(
|
|
1037
|
-
[...store.readonlySelectors].reduce((acc, [key]) => {
|
|
1038
|
-
acc[key] = { key, type: `readonly_selector` };
|
|
1039
|
-
return acc;
|
|
1040
|
-
}, {}),
|
|
1041
|
-
[...store.selectors].reduce((acc, [key]) => {
|
|
1042
|
-
acc[key] = { key, type: `selector` };
|
|
1043
|
-
return acc;
|
|
1044
|
-
}, {})
|
|
1045
|
-
),
|
|
1046
|
-
effects: [
|
|
1047
|
-
({ setSelf }) => {
|
|
1048
|
-
store.subject.selectorCreation.subscribe((selectorToken) => {
|
|
1049
|
-
if (store.operation.open) {
|
|
1050
|
-
return;
|
|
1051
|
-
}
|
|
1052
|
-
setSelf((state) => {
|
|
1053
|
-
const { key, family } = selectorToken;
|
|
1054
|
-
if (family) {
|
|
1055
|
-
const { key: familyKey, subKey } = family;
|
|
1056
|
-
const current = state[familyKey];
|
|
1057
|
-
if (current === void 0 || `familyMembers` in current) {
|
|
1058
|
-
const familyKeyState = current || {
|
|
1059
|
-
key: familyKey,
|
|
1060
|
-
familyMembers: {}
|
|
1061
|
-
};
|
|
1062
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
1063
|
-
[familyKey]: __spreadProps(__spreadValues({}, familyKeyState), {
|
|
1064
|
-
familyMembers: __spreadProps(__spreadValues({}, familyKeyState.familyMembers), {
|
|
1065
|
-
[subKey]: selectorToken
|
|
1066
|
-
})
|
|
1067
|
-
})
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
1072
|
-
[key]: selectorToken
|
|
1073
|
-
});
|
|
1074
|
-
});
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
]
|
|
1078
|
-
});
|
|
1079
|
-
return selector({
|
|
1080
|
-
key: `\u{1F441}\u200D\u{1F5E8}_selector_token_index`,
|
|
1081
|
-
get: ({ get }) => get(readonlySelectorTokenIndexState__INTERNAL)
|
|
1082
|
-
});
|
|
1083
|
-
};
|
|
1084
|
-
|
|
1085
|
-
// src/internal/meta/attach-meta.ts
|
|
1086
|
-
var attachMetaState = (store = IMPLICIT.STORE) => {
|
|
1087
|
-
return {
|
|
1088
|
-
atomTokenIndexState: attachMetaAtoms(store),
|
|
1089
|
-
selectorTokenIndexState: attachMetaSelectors(store)
|
|
1090
|
-
};
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
// src/internal/selector-internal.ts
|
|
1094
|
-
import HAMT9 from "hamt_plus";
|
|
1095
|
-
|
|
1096
921
|
// src/internal/selector/create-read-write-selector.ts
|
|
1097
|
-
import HAMT6 from "hamt_plus";
|
|
1098
922
|
var createReadWriteSelector = (options, family, store, core) => {
|
|
1099
923
|
var _a;
|
|
1100
924
|
const subject = new Subject();
|
|
@@ -1106,8 +930,14 @@ var createReadWriteSelector = (options, family, store, core) => {
|
|
|
1106
930
|
};
|
|
1107
931
|
const setSelf = (next) => {
|
|
1108
932
|
var _a2;
|
|
1109
|
-
(_a2 = store.config.logger) == null ? void 0 : _a2.info(` <- "${options.key}" became`, next);
|
|
1110
933
|
const oldValue = getSelf();
|
|
934
|
+
(_a2 = store.config.logger) == null ? void 0 : _a2.info(
|
|
935
|
+
` <- "${options.key}" went (`,
|
|
936
|
+
oldValue,
|
|
937
|
+
`->`,
|
|
938
|
+
next,
|
|
939
|
+
`)`
|
|
940
|
+
);
|
|
1111
941
|
const newValue = become(next)(oldValue);
|
|
1112
942
|
cacheValue(options.key, newValue, store);
|
|
1113
943
|
markDone(options.key, store);
|
|
@@ -1123,7 +953,7 @@ var createReadWriteSelector = (options, family, store, core) => {
|
|
|
1123
953
|
set: setSelf,
|
|
1124
954
|
type: `selector`
|
|
1125
955
|
}), family && { family });
|
|
1126
|
-
core.selectors
|
|
956
|
+
core.selectors.set(options.key, mySelector);
|
|
1127
957
|
const initialValue = getSelf();
|
|
1128
958
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
1129
959
|
const token = {
|
|
@@ -1135,9 +965,6 @@ var createReadWriteSelector = (options, family, store, core) => {
|
|
|
1135
965
|
return token;
|
|
1136
966
|
};
|
|
1137
967
|
|
|
1138
|
-
// src/internal/selector/create-readonly-selector.ts
|
|
1139
|
-
import HAMT8 from "hamt_plus";
|
|
1140
|
-
|
|
1141
968
|
// src/internal/selector/lookup-selector-sources.ts
|
|
1142
969
|
var lookupSelectorSources = (key, store) => target(store).selectorGraph.getRelations(key).filter(({ source }) => source !== key).map(({ source }) => lookup(source, store));
|
|
1143
970
|
|
|
@@ -1197,7 +1024,6 @@ var updateSelectorAtoms = (selectorKey, dependency, store) => {
|
|
|
1197
1024
|
};
|
|
1198
1025
|
|
|
1199
1026
|
// src/internal/set.ts
|
|
1200
|
-
import HAMT7 from "hamt_plus";
|
|
1201
1027
|
var evictDownStream = (state, store = IMPLICIT.STORE) => {
|
|
1202
1028
|
var _a, _b;
|
|
1203
1029
|
const core = target(store);
|
|
@@ -1216,7 +1042,7 @@ var evictDownStream = (state, store = IMPLICIT.STORE) => {
|
|
|
1216
1042
|
(_a2 = store.config.logger) == null ? void 0 : _a2.info(` || ${stateKey} already done`);
|
|
1217
1043
|
return;
|
|
1218
1044
|
}
|
|
1219
|
-
const state2 = (_b2 =
|
|
1045
|
+
const state2 = (_b2 = core.selectors.get(stateKey)) != null ? _b2 : core.readonlySelectors.get(stateKey);
|
|
1220
1046
|
if (!state2) {
|
|
1221
1047
|
(_c = store.config.logger) == null ? void 0 : _c.info(
|
|
1222
1048
|
` || ${stateKey} is an atom, and can't be downstream`
|
|
@@ -1326,11 +1152,7 @@ var createReadonlySelector = (options, family, store, core) => {
|
|
|
1326
1152
|
get: getSelf,
|
|
1327
1153
|
type: `readonly_selector`
|
|
1328
1154
|
}), family && { family });
|
|
1329
|
-
core.readonlySelectors
|
|
1330
|
-
options.key,
|
|
1331
|
-
readonlySelector,
|
|
1332
|
-
core.readonlySelectors
|
|
1333
|
-
);
|
|
1155
|
+
core.readonlySelectors.set(options.key, readonlySelector);
|
|
1334
1156
|
const initialValue = getSelf();
|
|
1335
1157
|
(_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
|
|
1336
1158
|
const token = {
|
|
@@ -1346,7 +1168,7 @@ var createReadonlySelector = (options, family, store, core) => {
|
|
|
1346
1168
|
function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
|
|
1347
1169
|
var _a;
|
|
1348
1170
|
const core = target(store);
|
|
1349
|
-
if (
|
|
1171
|
+
if (core.selectors.has(options.key)) {
|
|
1350
1172
|
(_a = store.config.logger) == null ? void 0 : _a.error(
|
|
1351
1173
|
`Key "${options.key}" already exists in the store.`
|
|
1352
1174
|
);
|
|
@@ -1430,7 +1252,13 @@ var subscribeToRootAtoms = (state, store) => {
|
|
|
1430
1252
|
);
|
|
1431
1253
|
const oldValue = recallState(state, store);
|
|
1432
1254
|
const newValue = getState__INTERNAL(state, store);
|
|
1433
|
-
(_b = store.config.logger) == null ? void 0 : _b.info(
|
|
1255
|
+
(_b = store.config.logger) == null ? void 0 : _b.info(
|
|
1256
|
+
` <- "${state.key}" went (`,
|
|
1257
|
+
oldValue,
|
|
1258
|
+
`->`,
|
|
1259
|
+
newValue,
|
|
1260
|
+
`)`
|
|
1261
|
+
);
|
|
1434
1262
|
state.subject.next({ newValue, oldValue });
|
|
1435
1263
|
});
|
|
1436
1264
|
});
|
|
@@ -1472,6 +1300,7 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1472
1300
|
}
|
|
1473
1301
|
}
|
|
1474
1302
|
++timelineData.at;
|
|
1303
|
+
timelineData.subject.next(`redo`);
|
|
1475
1304
|
timelineData.timeTraveling = false;
|
|
1476
1305
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1477
1306
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
@@ -1511,15 +1340,13 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
|
|
|
1511
1340
|
break;
|
|
1512
1341
|
}
|
|
1513
1342
|
}
|
|
1343
|
+
timelineData.subject.next(`undo`);
|
|
1514
1344
|
timelineData.timeTraveling = false;
|
|
1515
1345
|
(_d = store.config.logger) == null ? void 0 : _d.info(
|
|
1516
1346
|
`\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
|
|
1517
1347
|
);
|
|
1518
1348
|
};
|
|
1519
1349
|
|
|
1520
|
-
// src/internal/timeline-internal.ts
|
|
1521
|
-
import HAMT10 from "hamt_plus";
|
|
1522
|
-
|
|
1523
1350
|
// src/internal/timeline/add-atom-to-timeline.ts
|
|
1524
1351
|
var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
1525
1352
|
const atom2 = withdraw(atomToken, store);
|
|
@@ -1549,9 +1376,6 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1549
1376
|
`Timeline "${tl.key}" has a selectorTime, but no history. This is most likely a bug in AtomIO.`
|
|
1550
1377
|
);
|
|
1551
1378
|
}
|
|
1552
|
-
if (mostRecentUpdate.type === `selector_update`) {
|
|
1553
|
-
tl.subject.next(mostRecentUpdate);
|
|
1554
|
-
}
|
|
1555
1379
|
}
|
|
1556
1380
|
if (currentTransactionKey && store.transactionStatus.phase === `applying`) {
|
|
1557
1381
|
const currentTransaction = withdraw(
|
|
@@ -1572,6 +1396,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1572
1396
|
tl.transactionKey = currentTransactionKey;
|
|
1573
1397
|
const subscription = currentTransaction.subject.subscribe((update2) => {
|
|
1574
1398
|
var _a2;
|
|
1399
|
+
subscription.unsubscribe();
|
|
1575
1400
|
if (tl.timeTraveling === false && currentTransactionTime) {
|
|
1576
1401
|
if (tl.at !== tl.history.length) {
|
|
1577
1402
|
tl.history.splice(tl.at);
|
|
@@ -1585,10 +1410,9 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1585
1410
|
)
|
|
1586
1411
|
});
|
|
1587
1412
|
tl.history.push(timelineTransactionUpdate);
|
|
1413
|
+
tl.at = tl.history.length;
|
|
1588
1414
|
tl.subject.next(timelineTransactionUpdate);
|
|
1589
1415
|
}
|
|
1590
|
-
tl.at = tl.history.length;
|
|
1591
|
-
subscription.unsubscribe();
|
|
1592
1416
|
tl.transactionKey = null;
|
|
1593
1417
|
(_a2 = store.config.logger) == null ? void 0 : _a2.info(
|
|
1594
1418
|
`\u231B timeline "${tl.key}" got a transaction_update "${update2.key}"`
|
|
@@ -1596,29 +1420,29 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1596
1420
|
});
|
|
1597
1421
|
}
|
|
1598
1422
|
} else if (currentSelectorKey && currentSelectorTime) {
|
|
1423
|
+
let latestUpdate = tl.history.at(-1);
|
|
1599
1424
|
if (currentSelectorTime !== tl.selectorTime) {
|
|
1600
|
-
|
|
1425
|
+
latestUpdate = {
|
|
1601
1426
|
type: `selector_update`,
|
|
1602
1427
|
timestamp: currentSelectorTime,
|
|
1603
1428
|
key: currentSelectorKey,
|
|
1604
1429
|
atomUpdates: []
|
|
1605
1430
|
};
|
|
1606
|
-
|
|
1431
|
+
latestUpdate.atomUpdates.push(__spreadValues({
|
|
1607
1432
|
key: atom2.key,
|
|
1608
1433
|
type: `atom_update`
|
|
1609
1434
|
}, update));
|
|
1610
1435
|
if (tl.at !== tl.history.length) {
|
|
1611
1436
|
tl.history.splice(tl.at);
|
|
1612
1437
|
}
|
|
1613
|
-
tl.history.push(
|
|
1438
|
+
tl.history.push(latestUpdate);
|
|
1614
1439
|
(_c = store.config.logger) == null ? void 0 : _c.info(
|
|
1615
1440
|
`\u231B timeline "${tl.key}" got a selector_update "${currentSelectorKey}" with`,
|
|
1616
|
-
|
|
1441
|
+
latestUpdate.atomUpdates.map((atomUpdate) => atomUpdate.key)
|
|
1617
1442
|
);
|
|
1618
1443
|
tl.at = tl.history.length;
|
|
1619
1444
|
tl.selectorTime = currentSelectorTime;
|
|
1620
1445
|
} else {
|
|
1621
|
-
const latestUpdate = tl.history.at(-1);
|
|
1622
1446
|
if ((latestUpdate == null ? void 0 : latestUpdate.type) === `selector_update`) {
|
|
1623
1447
|
latestUpdate.atomUpdates.push(__spreadValues({
|
|
1624
1448
|
key: atom2.key,
|
|
@@ -1630,6 +1454,8 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1630
1454
|
);
|
|
1631
1455
|
}
|
|
1632
1456
|
}
|
|
1457
|
+
if (latestUpdate)
|
|
1458
|
+
tl.subject.next(latestUpdate);
|
|
1633
1459
|
} else {
|
|
1634
1460
|
const timestamp = Date.now();
|
|
1635
1461
|
tl.selectorTime = null;
|
|
@@ -1646,7 +1472,7 @@ var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
|
|
|
1646
1472
|
tl.history.push(atomUpdate);
|
|
1647
1473
|
tl.subject.next(atomUpdate);
|
|
1648
1474
|
(_e = store.config.logger) == null ? void 0 : _e.info(
|
|
1649
|
-
`\u231B timeline "${tl.key}" got
|
|
1475
|
+
`\u231B timeline "${tl.key}" got an atom_update to "${atom2.key}"`
|
|
1650
1476
|
);
|
|
1651
1477
|
tl.at = tl.history.length;
|
|
1652
1478
|
}
|
|
@@ -1702,7 +1528,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
|
|
|
1702
1528
|
timelineKey: options.key
|
|
1703
1529
|
});
|
|
1704
1530
|
}
|
|
1705
|
-
store.timelines
|
|
1531
|
+
store.timelines.set(options.key, tl);
|
|
1706
1532
|
const token = {
|
|
1707
1533
|
key: options.key,
|
|
1708
1534
|
type: `timeline`
|
|
@@ -1725,7 +1551,6 @@ var abortTransaction = (store) => {
|
|
|
1725
1551
|
};
|
|
1726
1552
|
|
|
1727
1553
|
// src/internal/transaction/apply-transaction.ts
|
|
1728
|
-
import HAMT11 from "hamt_plus";
|
|
1729
1554
|
var applyTransaction = (output, store) => {
|
|
1730
1555
|
var _a, _b, _c, _d;
|
|
1731
1556
|
if (store.transactionStatus.phase !== `building`) {
|
|
@@ -1742,10 +1567,15 @@ var applyTransaction = (output, store) => {
|
|
|
1742
1567
|
const { atomUpdates } = store.transactionStatus;
|
|
1743
1568
|
for (const { key, newValue } of atomUpdates) {
|
|
1744
1569
|
const token = { key, type: `atom` };
|
|
1745
|
-
if (!
|
|
1746
|
-
const newAtom =
|
|
1747
|
-
|
|
1748
|
-
|
|
1570
|
+
if (!store.valueMap.has(token.key)) {
|
|
1571
|
+
const newAtom = store.transactionStatus.core.atoms.get(token.key);
|
|
1572
|
+
if (!newAtom) {
|
|
1573
|
+
throw new Error(
|
|
1574
|
+
`Absurd Error: Atom "${token.key}" not found while copying updates from transaction "${store.transactionStatus.key}" to store "${store.config.name}"`
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
store.atoms.set(newAtom.key, newAtom);
|
|
1578
|
+
store.valueMap.set(newAtom.key, newAtom.default);
|
|
1749
1579
|
(_c = store.config.logger) == null ? void 0 : _c.info(`\u{1F527}`, `add atom "${newAtom.key}"`);
|
|
1750
1580
|
}
|
|
1751
1581
|
setState(token, newValue, store);
|
|
@@ -1777,17 +1607,17 @@ var buildTransaction = (key, params, store) => {
|
|
|
1777
1607
|
phase: `building`,
|
|
1778
1608
|
time: Date.now(),
|
|
1779
1609
|
core: {
|
|
1780
|
-
atoms: store.atoms,
|
|
1610
|
+
atoms: new Map(store.atoms),
|
|
1781
1611
|
atomsThatAreDefault: store.atomsThatAreDefault,
|
|
1782
1612
|
operation: { open: false },
|
|
1783
|
-
readonlySelectors: store.readonlySelectors,
|
|
1784
|
-
timelines: store.timelines,
|
|
1613
|
+
readonlySelectors: new Map(store.readonlySelectors),
|
|
1614
|
+
timelines: new Map(store.timelines),
|
|
1785
1615
|
timelineAtoms: store.timelineAtoms,
|
|
1786
|
-
transactions: store.transactions,
|
|
1616
|
+
transactions: new Map(store.transactions),
|
|
1787
1617
|
selectorAtoms: store.selectorAtoms,
|
|
1788
1618
|
selectorGraph: store.selectorGraph,
|
|
1789
|
-
selectors: store.selectors,
|
|
1790
|
-
valueMap: store.valueMap
|
|
1619
|
+
selectors: new Map(store.selectors),
|
|
1620
|
+
valueMap: new Map(store.valueMap)
|
|
1791
1621
|
},
|
|
1792
1622
|
atomUpdates: [],
|
|
1793
1623
|
params,
|