atom.io 0.9.10 → 0.10.0

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 (55) hide show
  1. package/dist/index.d.mts +11 -4
  2. package/dist/index.d.ts +11 -4
  3. package/dist/index.js +36 -56
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +34 -55
  6. package/dist/index.mjs.map +1 -1
  7. package/internal/dist/index.d.mts +30 -19
  8. package/internal/dist/index.d.ts +30 -19
  9. package/internal/dist/index.js +156 -184
  10. package/internal/dist/index.js.map +1 -1
  11. package/internal/dist/index.mjs +157 -185
  12. package/internal/dist/index.mjs.map +1 -1
  13. package/internal/src/atom/create-atom.ts +5 -5
  14. package/internal/src/atom/delete-atom.ts +9 -2
  15. package/internal/src/caching.ts +5 -5
  16. package/internal/src/get-state-internal.ts +4 -4
  17. package/internal/src/mutable/create-mutable-atom.ts +2 -2
  18. package/internal/src/mutable/tracker.ts +1 -1
  19. package/internal/src/operation.ts +7 -7
  20. package/internal/src/selector/create-read-write-selector.ts +2 -8
  21. package/internal/src/selector/create-readonly-selector.ts +1 -1
  22. package/internal/src/selector/create-selector.ts +5 -3
  23. package/internal/src/selector/register-selector.ts +4 -11
  24. package/internal/src/selector/update-selector-atoms.ts +14 -14
  25. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  26. package/internal/src/set-state/copy-mutable-in-transaction.ts +1 -1
  27. package/internal/src/set-state/emit-update.ts +1 -1
  28. package/internal/src/set-state/evict-downstream.ts +5 -6
  29. package/internal/src/set-state/set-atom.ts +1 -4
  30. package/internal/src/set-state/stow-update.ts +10 -4
  31. package/internal/src/store/store.ts +27 -10
  32. package/internal/src/store/withdraw-new-family-member.ts +1 -1
  33. package/internal/src/store/withdraw.ts +1 -1
  34. package/internal/src/subscribe/recall-state.ts +2 -2
  35. package/internal/src/subscribe/subscribe-to-root-atoms.ts +3 -3
  36. package/internal/src/timeline/add-atom-to-timeline.ts +8 -8
  37. package/internal/src/timeline/time-travel-internal.ts +12 -12
  38. package/internal/src/timeline/timeline-internal.ts +2 -2
  39. package/internal/src/transaction/abort-transaction.ts +3 -3
  40. package/internal/src/transaction/apply-transaction.ts +6 -6
  41. package/internal/src/transaction/build-transaction.ts +2 -3
  42. package/internal/src/transaction/redo-transaction.ts +1 -1
  43. package/internal/src/transaction/transaction-internal.ts +2 -2
  44. package/internal/src/transaction/undo-transaction.ts +1 -1
  45. package/package.json +2 -2
  46. package/react-devtools/dist/index.d.mts +3 -3
  47. package/react-devtools/dist/index.d.ts +3 -3
  48. package/realtime-client/dist/index.js +6 -9
  49. package/realtime-client/dist/index.js.map +1 -1
  50. package/realtime-client/dist/index.mjs +6 -9
  51. package/realtime-client/dist/index.mjs.map +1 -1
  52. package/realtime-client/src/use-server-action.ts +6 -8
  53. package/src/atom.ts +3 -0
  54. package/src/logger.ts +25 -36
  55. package/src/subscribe.ts +7 -7
@@ -1,4 +1,4 @@
1
- import { setState, getState, subscribe, subscribeToTimeline } from 'atom.io';
1
+ import { AtomIOLogger, setState, getState, subscribe, subscribeToTimeline } from 'atom.io';
2
2
  import { selectJson, stringifyJson, parseJson, selectJsonFamily } from 'atom.io/json';
3
3
 
4
4
  var __defProp = Object.defineProperty;
@@ -309,20 +309,37 @@ var Store = class {
309
309
  this.operation = { open: false };
310
310
  this.transactionStatus = { phase: `idle` };
311
311
  this.config = {
312
- name: `IMPLICIT_STORE`,
313
- logger: __spreadProps(__spreadValues({}, console), { info: () => void 0 }),
314
- logger__INTERNAL: console
312
+ name: `IMPLICIT_STORE`
313
+ };
314
+ this.loggers = [
315
+ new AtomIOLogger(
316
+ __spreadValues({}, console),
317
+ `warn`,
318
+ (message) => !message.includes(`\u{1F441}\u200D\u{1F5E8}`)
319
+ )
320
+ ];
321
+ this.logger = {
322
+ error: (message) => {
323
+ for (const logger of this.loggers) {
324
+ logger.error(message);
325
+ }
326
+ },
327
+ info: (message) => {
328
+ for (const logger of this.loggers) {
329
+ logger.info(message);
330
+ }
331
+ },
332
+ warn: (message) => {
333
+ for (const logger of this.loggers) {
334
+ logger.warn(message);
335
+ }
336
+ }
315
337
  };
316
- var _a;
317
338
  if (store !== null) {
318
339
  this.valueMap = new Map(store == null ? void 0 : store.valueMap);
319
340
  this.operation = __spreadValues({}, store == null ? void 0 : store.operation);
320
341
  this.transactionStatus = __spreadValues({}, store == null ? void 0 : store.transactionStatus);
321
342
  this.config = __spreadProps(__spreadValues({}, store == null ? void 0 : store.config), {
322
- logger__INTERNAL: console,
323
- logger: __spreadValues(__spreadProps(__spreadValues({}, console), {
324
- info: () => void 0
325
- }), (_a = store == null ? void 0 : store.config) == null ? void 0 : _a.logger),
326
343
  name
327
344
  });
328
345
  for (const [, atom] of store.atoms) {
@@ -358,31 +375,29 @@ var clearStore = (store = IMPLICIT.STORE) => {
358
375
 
359
376
  // src/transaction/abort-transaction.ts
360
377
  var abortTransaction = (store) => {
361
- var _a, _b;
362
378
  if (store.transactionStatus.phase === `idle`) {
363
- (_a = store.config.logger) == null ? void 0 : _a.warn(
364
- `abortTransaction called outside of a transaction. This is probably a bug.`
379
+ store.logger.warn(
380
+ `\u{1F41E} abortTransaction called outside of a transaction. This is probably a bug.`
365
381
  );
366
382
  return;
367
383
  }
368
384
  store.transactionStatus = { phase: `idle` };
369
- (_b = store.config.logger) == null ? void 0 : _b.info(`\u{1FA82}`, `transaction fail`);
385
+ store.logger.info(`\u{1FA82}`, `transaction fail`);
370
386
  };
371
387
  var applyTransaction = (output, store) => {
372
- var _a, _b, _c, _d, _e;
373
388
  if (store.transactionStatus.phase !== `building`) {
374
- (_a = store.config.logger) == null ? void 0 : _a.warn(
375
- `abortTransaction called outside of a transaction. This is probably a bug.`
389
+ store.logger.warn(
390
+ `\u{1F41E} applyTransaction called outside of a transaction. This is probably a bug.`
376
391
  );
377
392
  return;
378
393
  }
379
394
  store.transactionStatus.phase = `applying`;
380
395
  store.transactionStatus.output = output;
381
396
  const { atomUpdates } = store.transactionStatus;
382
- (_b = store.config.logger) == null ? void 0 : _b.info(
397
+ store.logger.info(
383
398
  `\u{1F6C3} applying transaction "${store.transactionStatus.key}" with ${atomUpdates.length} updates.`
384
399
  );
385
- (_c = store.config.logger) == null ? void 0 : _c.info(`\u{1F6C3} the updates are:`, atomUpdates);
400
+ store.logger.info(`\u{1F6C3} the updates are:`, atomUpdates);
386
401
  for (const { key, newValue } of atomUpdates) {
387
402
  const token = { key, type: `atom` };
388
403
  if (!store.valueMap.has(token.key)) {
@@ -400,7 +415,7 @@ var applyTransaction = (output, store) => {
400
415
  }
401
416
  store.atoms.set(newAtom.key, newAtom);
402
417
  store.valueMap.set(newAtom.key, newAtom.default);
403
- (_d = store.config.logger) == null ? void 0 : _d.info(`\u{1F527}`, `add atom "${newAtom.key}"`);
418
+ store.logger.info(`\u{1F527} add atom "${newAtom.key}"`);
404
419
  }
405
420
  }
406
421
  setState(token, newValue, store);
@@ -421,12 +436,11 @@ var applyTransaction = (output, store) => {
421
436
  params: store.transactionStatus.params
422
437
  });
423
438
  store.transactionStatus = { phase: `idle` };
424
- (_e = store.config.logger) == null ? void 0 : _e.info(`\u{1F6EC}`, `transaction "${myTransaction.key}" applied`);
439
+ store.logger.info(`\u{1F6EC} transaction "${myTransaction.key}" applied`);
425
440
  };
426
441
 
427
442
  // src/transaction/build-transaction.ts
428
443
  var buildTransaction = (key, params, store) => {
429
- var _a;
430
444
  store.transactionStatus = {
431
445
  key,
432
446
  phase: `building`,
@@ -452,9 +466,8 @@ var buildTransaction = (key, params, store) => {
452
466
  params,
453
467
  output: void 0
454
468
  };
455
- (_a = store.config.logger) == null ? void 0 : _a.info(
456
- `\u{1F6EB}`,
457
- `transaction "${key}" building in store "${store.config.name}"`
469
+ store.logger.info(
470
+ `\u{1F6EB} transaction "${key}" building in store "${store.config.name}"`
458
471
  );
459
472
  };
460
473
 
@@ -464,7 +477,6 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
464
477
  key: options.key,
465
478
  type: `transaction`,
466
479
  run: (...params) => {
467
- var _a;
468
480
  buildTransaction(options.key, params, store);
469
481
  try {
470
482
  const output = options.do(
@@ -478,8 +490,8 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
478
490
  return output;
479
491
  } catch (thrown) {
480
492
  abortTransaction(store);
481
- (_a = store.config.logger) == null ? void 0 : _a.error(
482
- `Transaction "${options.key}" failed in store "${store.config.name}":`,
493
+ store.logger.error(
494
+ `\u2757 Transaction "${options.key}" failed in store "${store.config.name}":`,
483
495
  thrown
484
496
  );
485
497
  throw thrown;
@@ -496,8 +508,7 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
496
508
  }
497
509
  var target = (store = IMPLICIT.STORE) => store.transactionStatus.phase === `building` ? store.transactionStatus.core : store;
498
510
  var redoTransactionUpdate = (update, store) => {
499
- var _a;
500
- (_a = store.config.logger) == null ? void 0 : _a.info(` \u23ED redo transaction "${update.key}" (redo)`);
511
+ store.logger.info(` \u23ED redo transaction "${update.key}" (redo)`);
501
512
  for (const { key, newValue } of update.atomUpdates) {
502
513
  const token = { key, type: `atom` };
503
514
  const state = withdraw(token, store);
@@ -510,8 +521,7 @@ var redoTransactionUpdate = (update, store) => {
510
521
  }
511
522
  };
512
523
  var undoTransactionUpdate = (update, store) => {
513
- var _a;
514
- (_a = store.config.logger) == null ? void 0 : _a.info(` \u23EE undo transaction "${update.key}" (undo)`);
524
+ store.logger.info(` \u23EE undo transaction "${update.key}" (undo)`);
515
525
  for (const { key, oldValue } of update.atomUpdates) {
516
526
  const token = { key, type: `atom` };
517
527
  const state = withdraw(token, store);
@@ -536,12 +546,12 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
536
546
  );
537
547
  }
538
548
  atom.subject.subscribe(`timeline`, (update) => {
539
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
549
+ var _a, _b, _c, _d;
540
550
  const currentSelectorKey = store.operation.open && store.operation.token.type === `selector` ? store.operation.token.key : null;
541
551
  const currentSelectorTime = store.operation.open && store.operation.token.type === `selector` ? store.operation.time : null;
542
552
  const currentTransactionKey = store.transactionStatus.phase === `applying` ? store.transactionStatus.key : null;
543
553
  const currentTransactionTime = store.transactionStatus.phase === `applying` ? store.transactionStatus.time : null;
544
- (_a = store.config.logger) == null ? void 0 : _a.info(
554
+ store.logger.info(
545
555
  `\u23F3 timeline "${tl.key}" saw atom "${atomToken.key}" go (`,
546
556
  update.oldValue,
547
557
  `->`,
@@ -569,15 +579,15 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
569
579
  }
570
580
  if (tl.transactionKey !== currentTransactionKey) {
571
581
  if (tl.transactionKey) {
572
- (_b = store.config.logger) == null ? void 0 : _b.error(
573
- `Timeline "${tl.key}" was unable to resolve transaction "${tl.transactionKey}. This is probably a bug.`
582
+ store.logger.error(
583
+ `\u{1F41E} Timeline "${tl.key}" was unable to resolve transaction "${tl.transactionKey}. This is probably a bug.`
574
584
  );
575
585
  }
576
586
  tl.transactionKey = currentTransactionKey;
577
587
  const unsubscribe = currentTransaction.subject.subscribe(
578
588
  `timeline:${tl.key}`,
579
589
  (update2) => {
580
- var _a2, _b2, _c2;
590
+ var _a2, _b2;
581
591
  unsubscribe();
582
592
  if (tl.timeTraveling === null && currentTransactionTime) {
583
593
  if (tl.at !== tl.history.length) {
@@ -609,7 +619,7 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
609
619
  }
610
620
  }
611
621
  tl.transactionKey = null;
612
- (_c2 = store.config.logger) == null ? void 0 : _c2.info(
622
+ store.logger.info(
613
623
  `\u231B timeline "${tl.key}" got a transaction_update "${update2.key}"`
614
624
  );
615
625
  }
@@ -632,7 +642,7 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
632
642
  tl.history.splice(tl.at);
633
643
  }
634
644
  tl.history.push(latestUpdate);
635
- (_c = store.config.logger) == null ? void 0 : _c.info(
645
+ store.logger.info(
636
646
  `\u231B timeline "${tl.key}" got a selector_update "${currentSelectorKey}" with`,
637
647
  latestUpdate.atomUpdates.map((atomUpdate) => atomUpdate.key)
638
648
  );
@@ -644,14 +654,14 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
644
654
  key: atom.key,
645
655
  type: `atom_update`
646
656
  }, update));
647
- (_d = store.config.logger) == null ? void 0 : _d.info(
648
- ` \u231B timeline "${tl.key}" set selector_update "${currentSelectorKey}" to`,
657
+ store.logger.info(
658
+ `\u231B timeline "${tl.key}" set selector_update "${currentSelectorKey}" to`,
649
659
  latestUpdate == null ? void 0 : latestUpdate.atomUpdates.map((atomUpdate) => atomUpdate.key)
650
660
  );
651
661
  }
652
662
  }
653
663
  if (latestUpdate) {
654
- const willCaptureSelectorUpdate = (_f = (_e = tl.shouldCapture) == null ? void 0 : _e.call(tl, latestUpdate, tl)) != null ? _f : true;
664
+ const willCaptureSelectorUpdate = (_b = (_a = tl.shouldCapture) == null ? void 0 : _a.call(tl, latestUpdate, tl)) != null ? _b : true;
655
665
  if (willCaptureSelectorUpdate) {
656
666
  tl.subject.next(latestUpdate);
657
667
  } else {
@@ -675,8 +685,8 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
675
685
  if (atom.family) {
676
686
  atomUpdate.family = atom.family;
677
687
  }
678
- const willCapture = (_h = (_g = tl.shouldCapture) == null ? void 0 : _g.call(tl, atomUpdate, tl)) != null ? _h : true;
679
- (_i = store.config.logger) == null ? void 0 : _i.info(
688
+ const willCapture = (_d = (_c = tl.shouldCapture) == null ? void 0 : _c.call(tl, atomUpdate, tl)) != null ? _d : true;
689
+ store.logger.info(
680
690
  `\u231B timeline "${tl.key}" got an atom_update to "${atom.key}"`
681
691
  );
682
692
  if (willCapture) {
@@ -689,18 +699,17 @@ var addAtomToTimeline = (atomToken, tl, store = IMPLICIT.STORE) => {
689
699
  });
690
700
  };
691
701
  var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
692
- var _a, _b, _c, _d;
693
- (_a = store.config.logger) == null ? void 0 : _a.info(`\u23E9 redo "${token.key}"`);
702
+ store.logger.info(`\u23E9 redo "${token.key}"`);
694
703
  const timelineData = store.timelines.get(token.key);
695
704
  if (!timelineData) {
696
- (_b = store.config.logger) == null ? void 0 : _b.error(
697
- `Failed to redo on timeline "${token.key}". This timeline has not been initialized.`
705
+ store.logger.error(
706
+ `\u{1F41E} Failed to redo on timeline "${token.key}". This timeline has not been initialized.`
698
707
  );
699
708
  return;
700
709
  }
701
710
  if (timelineData.at === timelineData.history.length) {
702
- (_c = store.config.logger) == null ? void 0 : _c.warn(
703
- `Failed to redo at the end of timeline "${token.key}". There is nothing to redo.`
711
+ store.logger.warn(
712
+ `\u261D\uFE0F Failed to redo at the end of timeline "${token.key}". There is nothing to redo.`
704
713
  );
705
714
  return;
706
715
  }
@@ -724,23 +733,22 @@ var redo__INTERNAL = (token, store = IMPLICIT.STORE) => {
724
733
  ++timelineData.at;
725
734
  timelineData.subject.next(`redo`);
726
735
  timelineData.timeTraveling = null;
727
- (_d = store.config.logger) == null ? void 0 : _d.info(
736
+ store.logger.info(
728
737
  `\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
729
738
  );
730
739
  };
731
740
  var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
732
- var _a, _b, _c, _d;
733
- (_a = store.config.logger) == null ? void 0 : _a.info(`\u23EA undo "${token.key}"`);
741
+ store.logger.info(`\u23EA undo "${token.key}"`);
734
742
  const timelineData = store.timelines.get(token.key);
735
743
  if (!timelineData) {
736
- (_b = store.config.logger) == null ? void 0 : _b.error(
737
- `Failed to undo on timeline "${token.key}". This timeline has not been initialized.`
744
+ store.logger.error(
745
+ `\u{1F41E} Failed to undo on timeline "${token.key}". This timeline has not been initialized.`
738
746
  );
739
747
  return;
740
748
  }
741
749
  if (timelineData.at === 0) {
742
- (_c = store.config.logger) == null ? void 0 : _c.warn(
743
- `Failed to undo at the beginning of timeline "${token.key}". There is nothing to undo.`
750
+ store.logger.warn(
751
+ `\u261D\uFE0F Failed to undo at the beginning of timeline "${token.key}". There is nothing to undo.`
744
752
  );
745
753
  return;
746
754
  }
@@ -764,14 +772,14 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
764
772
  }
765
773
  timelineData.subject.next(`undo`);
766
774
  timelineData.timeTraveling = null;
767
- (_d = store.config.logger) == null ? void 0 : _d.info(
775
+ store.logger.info(
768
776
  `\u23F9\uFE0F "${token.key}" is now at ${timelineData.at} / ${timelineData.history.length}`
769
777
  );
770
778
  };
771
779
 
772
780
  // src/timeline/timeline-internal.ts
773
781
  function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
774
- var _a, _b, _c, _d;
782
+ var _a, _b;
775
783
  const tl = __spreadProps(__spreadValues({
776
784
  type: `timeline`,
777
785
  key: options.key,
@@ -791,7 +799,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
791
799
  for (const tokenOrFamily of options.atoms) {
792
800
  const timelineKey = core.timelineAtoms.getRelatedKey(tokenOrFamily.key);
793
801
  if (timelineKey) {
794
- (_b = store.config.logger) == null ? void 0 : _b.error(
802
+ store.logger.error(
795
803
  `\u274C Failed to add atom "${tokenOrFamily.key}" to timeline "${options.key}" because it belongs to timeline "${timelineKey}"`
796
804
  );
797
805
  continue;
@@ -802,7 +810,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
802
810
  addAtomToTimeline(token2, tl, store);
803
811
  });
804
812
  for (const atom of core.atoms.values()) {
805
- if (((_c = atom.family) == null ? void 0 : _c.key) === family.key) {
813
+ if (((_b = atom.family) == null ? void 0 : _b.key) === family.key) {
806
814
  addAtomToTimeline(atom, tl, store);
807
815
  }
808
816
  }
@@ -813,7 +821,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
813
821
  token2.family.key
814
822
  );
815
823
  if (familyTimelineKey) {
816
- (_d = store.config.logger) == null ? void 0 : _d.error(
824
+ store.logger.error(
817
825
  `\u274C Failed to add atom "${token2.key}" to timeline "${options.key}" because its family "${token2.family.key}" belongs to timeline "${familyTimelineKey}"`
818
826
  );
819
827
  continue;
@@ -837,7 +845,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
837
845
 
838
846
  // src/store/withdraw.ts
839
847
  function withdraw(token, store) {
840
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
848
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
841
849
  let core = target(store);
842
850
  let state = (_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);
843
851
  if (state) {
@@ -847,13 +855,13 @@ function withdraw(token, store) {
847
855
  core = store.transactionStatus.core;
848
856
  state = (_h = (_g = (_f = (_e = core.atoms.get(token.key)) != null ? _e : core.selectors.get(token.key)) != null ? _f : core.readonlySelectors.get(token.key)) != null ? _g : core.transactions.get(token.key)) != null ? _h : core.timelines.get(token.key);
849
857
  if (state) {
850
- (_i = store.config.logger) == null ? void 0 : _i.info(`\u{1F6E0}\uFE0F add ${token.type} "${token.key}"`);
858
+ store.logger.info(`\u{1F6E0}\uFE0F add ${token.type} "${token.key}"`);
851
859
  switch (state.type) {
852
860
  case `atom`: {
853
861
  store.atoms.set(token.key, state);
854
862
  store.valueMap.set(token.key, state.default);
855
863
  const stateKey = state.key;
856
- const familyKey = (_j = state.family) == null ? void 0 : _j.key;
864
+ const familyKey = (_i = state.family) == null ? void 0 : _i.key;
857
865
  let timelineKey = core.timelineAtoms.getRelatedKey(stateKey);
858
866
  if (timelineKey === void 0 && typeof familyKey === `string`) {
859
867
  timelineKey = core.timelineAtoms.getRelatedKey(familyKey);
@@ -885,8 +893,7 @@ function withdraw(token, store) {
885
893
 
886
894
  // src/store/withdraw-new-family-member.ts
887
895
  function withdrawNewFamilyMember(token, store) {
888
- var _a;
889
- (_a = store.config.logger) == null ? void 0 : _a.info(
896
+ store.logger.info(
890
897
  `\u{1F46A} creating new family member "${token.key}" in store "${store.config.name}"`
891
898
  );
892
899
  if (token.family) {
@@ -918,12 +925,8 @@ var cacheValue = (key, value, subject, store = IMPLICIT.STORE) => {
918
925
  cacheValue(key, value2, subject, store);
919
926
  subject.next({ newValue: value2, oldValue: value2 });
920
927
  }).catch((error) => {
921
- var _a;
922
928
  if (error !== `canceled`) {
923
- (_a = store.config.logger) == null ? void 0 : _a.error(
924
- `Promised value for "${key}" rejected:`,
925
- error
926
- );
929
+ store.logger.error(`\u{1F645}\u200D\u2642\uFE0F Promised value for "${key}" rejected:`, error);
927
930
  }
928
931
  });
929
932
  } else {
@@ -933,14 +936,16 @@ var cacheValue = (key, value, subject, store = IMPLICIT.STORE) => {
933
936
  var readCachedValue = (key, store = IMPLICIT.STORE) => target(store).valueMap.get(key);
934
937
  var isValueCached = (key, store = IMPLICIT.STORE) => target(store).valueMap.has(key);
935
938
  var evictCachedValue = (key, store = IMPLICIT.STORE) => {
936
- var _a;
937
939
  const core = target(store);
938
940
  const currentValue = core.valueMap.get(key);
939
941
  if (currentValue instanceof Future) {
940
942
  currentValue.cancel();
941
943
  }
944
+ if (core.operation.open) {
945
+ core.operation.prev.set(key, currentValue);
946
+ }
942
947
  core.valueMap.delete(key);
943
- (_a = store.config.logger) == null ? void 0 : _a.info(` xx evicted "${key}"`);
948
+ store.logger.info(`\u{1F5D1} evicted "${key}"`);
944
949
  };
945
950
  var Tracker = class {
946
951
  constructor(mutableState, store = IMPLICIT.STORE) {
@@ -954,7 +959,7 @@ var Tracker = class {
954
959
  }
955
960
  initializeState(mutableState, store = IMPLICIT.STORE) {
956
961
  const latestUpdateStateKey = `*${mutableState.key}`;
957
- deleteAtom(latestUpdateStateKey, target(store));
962
+ deleteAtom({ type: `atom`, key: latestUpdateStateKey }, store);
958
963
  const familyMetaData = mutableState.family ? {
959
964
  key: `*${mutableState.family.key}`,
960
965
  subKey: mutableState.family.subKey
@@ -1060,8 +1065,7 @@ var Tracker = class {
1060
1065
 
1061
1066
  // src/mutable/create-mutable-atom.ts
1062
1067
  function createMutableAtom(options, store = IMPLICIT.STORE) {
1063
- var _a;
1064
- (_a = store.config.logger) == null ? void 0 : _a.info(
1068
+ store.logger.info(
1065
1069
  `\u{1F527} creating mutable atom "${options.key}" in store "${store.config.name}"`
1066
1070
  );
1067
1071
  const coreState = createAtom(options, void 0, store);
@@ -1070,8 +1074,7 @@ function createMutableAtom(options, store = IMPLICIT.STORE) {
1070
1074
  subscribe(
1071
1075
  jsonState,
1072
1076
  () => {
1073
- var _a2;
1074
- (_a2 = store.config.logger) == null ? void 0 : _a2.info(
1077
+ store.logger.info(
1075
1078
  `\u{1F50D} tracker-initializer:${store == null ? void 0 : store.config.name}:${store.transactionStatus.phase === `idle` ? `main` : store.transactionStatus.key}`,
1076
1079
  `Initializing tracker for ${coreState.key}`
1077
1080
  );
@@ -1133,17 +1136,16 @@ var getSelectorDependencyKeys = (key, store) => {
1133
1136
 
1134
1137
  // src/get-state-internal.ts
1135
1138
  var getState__INTERNAL = (state, store = IMPLICIT.STORE) => {
1136
- var _a, _b, _c;
1137
1139
  if (isValueCached(state.key, store)) {
1138
- (_a = store.config.logger) == null ? void 0 : _a.info(`>> read "${state.key}"`);
1140
+ store.logger.info(`\u{1F4D6} reading "${state.key}"`);
1139
1141
  return readCachedValue(state.key, store);
1140
1142
  }
1141
1143
  if (state.type !== `atom`) {
1142
- (_b = store.config.logger) == null ? void 0 : _b.info(`-> calc "${state.key}"`);
1144
+ store.logger.info(`\u{1F9EE} calculating "${state.key}"`);
1143
1145
  return state.get();
1144
1146
  }
1145
- (_c = store.config.logger) == null ? void 0 : _c.error(
1146
- `Attempted to get atom "${state.key}", which was never initialized in store "${store.config.name}".`
1147
+ store.logger.error(
1148
+ `\u{1F41E} Attempted to get atom "${state.key}", which was never initialized in store "${store.config.name}".`
1147
1149
  );
1148
1150
  return state.default;
1149
1151
  };
@@ -1155,10 +1157,9 @@ var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing insta
1155
1157
 
1156
1158
  // src/operation.ts
1157
1159
  var openOperation = (token, store) => {
1158
- var _a, _b;
1159
1160
  const core = target(store);
1160
1161
  if (core.operation.open) {
1161
- (_a = store.config.logger) == null ? void 0 : _a.error(
1162
+ store.logger.error(
1162
1163
  `\u274C failed to setState to "${token.key}" during a setState for "${core.operation.token.key}"`
1163
1164
  );
1164
1165
  return `rejection`;
@@ -1166,26 +1167,24 @@ var openOperation = (token, store) => {
1166
1167
  core.operation = {
1167
1168
  open: true,
1168
1169
  done: /* @__PURE__ */ new Set(),
1169
- prev: new Map(store.valueMap),
1170
+ prev: /* @__PURE__ */ new Map(),
1170
1171
  time: Date.now(),
1171
1172
  token
1172
1173
  };
1173
- (_b = store.config.logger) == null ? void 0 : _b.info(
1174
+ store.logger.info(
1174
1175
  `\u2B55 operation start from "${token.key}" in store "${store.config.name}"${store.transactionStatus.phase === `idle` ? `` : ` ${store.transactionStatus.phase} "${store.transactionStatus.key}"`}`
1175
1176
  );
1176
1177
  };
1177
1178
  var closeOperation = (store) => {
1178
- var _a;
1179
1179
  const core = target(store);
1180
1180
  core.operation = { open: false };
1181
- (_a = store.config.logger) == null ? void 0 : _a.info(`\u{1F534} operation done`);
1181
+ store.logger.info(`\u{1F534} operation done`);
1182
1182
  store.subject.operationStatus.next(core.operation);
1183
1183
  };
1184
1184
  var isDone = (key, store = IMPLICIT.STORE) => {
1185
- var _a;
1186
1185
  const core = target(store);
1187
1186
  if (!core.operation.open) {
1188
- (_a = store.config.logger) == null ? void 0 : _a.warn(
1187
+ store.logger.warn(
1189
1188
  `isDone called outside of an operation. This is probably a bug.`
1190
1189
  );
1191
1190
  return true;
@@ -1193,11 +1192,10 @@ var isDone = (key, store = IMPLICIT.STORE) => {
1193
1192
  return core.operation.done.has(key);
1194
1193
  };
1195
1194
  var markDone = (key, store = IMPLICIT.STORE) => {
1196
- var _a;
1197
1195
  const core = target(store);
1198
1196
  if (!core.operation.open) {
1199
- (_a = store.config.logger) == null ? void 0 : _a.warn(
1200
- `markDone called outside of an operation. This is probably a bug.`
1197
+ store.logger.warn(
1198
+ `\u{1F41E} markDone called outside of an operation. This is probably a bug.`
1201
1199
  );
1202
1200
  return;
1203
1201
  }
@@ -1205,14 +1203,13 @@ var markDone = (key, store = IMPLICIT.STORE) => {
1205
1203
  };
1206
1204
 
1207
1205
  // src/set-state/copy-mutable-if-needed.ts
1208
- function copyMutableIfNeeded(atom, transform, origin, target3) {
1209
- var _a;
1206
+ function copyMutableIfNeeded(atom, transform, origin, target2) {
1210
1207
  const originValue = origin.valueMap.get(atom.key);
1211
- const targetValue = target3.valueMap.get(atom.key);
1208
+ const targetValue = target2.valueMap.get(atom.key);
1212
1209
  if (originValue === targetValue) {
1213
- (_a = origin.config.logger) == null ? void 0 : _a.info(`\u{1F4C3} copying`, `${atom.key}`);
1210
+ origin.logger.info(`\u{1F4C3} copying`, `${atom.key}`);
1214
1211
  const copiedValue = transform.fromJson(transform.toJson(originValue));
1215
- target3.valueMap.set(atom.key, copiedValue);
1212
+ target2.valueMap.set(atom.key, copiedValue);
1216
1213
  new Tracker(atom, origin);
1217
1214
  return copiedValue;
1218
1215
  }
@@ -1221,10 +1218,9 @@ function copyMutableIfNeeded(atom, transform, origin, target3) {
1221
1218
 
1222
1219
  // src/set-state/copy-mutable-in-transaction.ts
1223
1220
  function copyMutableIfWithinTransaction(atom, store) {
1224
- var _a;
1225
1221
  if (store.transactionStatus.phase === `building` || store.transactionStatus.phase === `applying`) {
1226
1222
  if (`toJson` in atom && `fromJson` in atom) {
1227
- (_a = store.config.logger) == null ? void 0 : _a.info(
1223
+ store.logger.info(
1228
1224
  `\u{1F4C4} copyMutableIfWithinTransaction: ${atom.key} is mutable`
1229
1225
  );
1230
1226
  const copiedValue = copyMutableIfNeeded(
@@ -1252,9 +1248,9 @@ function copyMutableIfWithinTransaction(atom, store) {
1252
1248
  }
1253
1249
  return getState__INTERNAL(atom, store);
1254
1250
  }
1255
- function copyMutableFamilyMemberWithinTransaction(atom, family, origin, target3) {
1251
+ function copyMutableFamilyMemberWithinTransaction(atom, family, origin, target2) {
1256
1252
  if (`toJson` in family && `fromJson` in family) {
1257
- const copyCreated = copyMutableIfNeeded(atom, family, origin, target3);
1253
+ const copyCreated = copyMutableIfNeeded(atom, family, origin, target2);
1258
1254
  return copyCreated;
1259
1255
  }
1260
1256
  return null;
@@ -1263,7 +1259,7 @@ function copyMutableFamilyMemberWithinTransaction(atom, family, origin, target3)
1263
1259
  // src/set-state/emit-update.ts
1264
1260
  var emitUpdate = (state, update, store) => {
1265
1261
  const { key } = state;
1266
- const { logger } = store.config;
1262
+ const { logger } = store;
1267
1263
  logger == null ? void 0 : logger.info(
1268
1264
  `\u{1F4E2} ${state.type} "${key}" went (`,
1269
1265
  update.oldValue,
@@ -1277,26 +1273,25 @@ var emitUpdate = (state, update, store) => {
1277
1273
 
1278
1274
  // src/set-state/evict-downstream.ts
1279
1275
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1280
- var _a, _b, _c, _d, _e, _f;
1276
+ var _a;
1281
1277
  const core = target(store);
1282
1278
  const downstreamKeys = core.selectorAtoms.getRelatedKeys(state.key);
1283
- (_b = store.config.logger) == null ? void 0 : _b.info(
1284
- ` || ${(_a = downstreamKeys == null ? void 0 : downstreamKeys.size) != null ? _a : `none`} downstream:`,
1279
+ store.logger.info(
1280
+ `\u{1F9F9} evicting ${downstreamKeys == null ? void 0 : downstreamKeys.size} states downstream from ${state.type} "${state.key}":`,
1285
1281
  downstreamKeys
1286
1282
  );
1287
1283
  if (core.operation.open) {
1288
- (_c = store.config.logger) == null ? void 0 : _c.info(` ||`, [...core.operation.done], `already done`);
1284
+ store.logger.info(`\u{1F9F9}`, [...core.operation.done], `already done`);
1289
1285
  }
1290
1286
  if (downstreamKeys) {
1291
1287
  for (const key of downstreamKeys) {
1292
1288
  if (isDone(key, store)) {
1293
- (_d = store.config.logger) == null ? void 0 : _d.info(` || ${key} already done`);
1294
1289
  continue;
1295
1290
  }
1296
- const state2 = (_e = core.selectors.get(key)) != null ? _e : core.readonlySelectors.get(key);
1291
+ const state2 = (_a = core.selectors.get(key)) != null ? _a : core.readonlySelectors.get(key);
1297
1292
  if (!state2) {
1298
- (_f = store.config.logger) == null ? void 0 : _f.info(
1299
- ` || ${key} was not found in selectors or readonlySelectors`
1293
+ store.logger.error(
1294
+ `\u{1F41E} "${key}" was not found in selectors or readonlySelectors`
1300
1295
  );
1301
1296
  return;
1302
1297
  }
@@ -1317,12 +1312,10 @@ function shouldUpdateBeStowed(key, update) {
1317
1312
  return true;
1318
1313
  }
1319
1314
  var stowUpdate = (state, update, store) => {
1320
- var _a;
1321
1315
  const { key } = state;
1322
- const { logger } = store.config;
1323
1316
  if (store.transactionStatus.phase !== `building`) {
1324
- (_a = store.config.logger) == null ? void 0 : _a.warn(
1325
- `stowUpdate called outside of a transaction. This is probably a bug.`
1317
+ store.logger.warn(
1318
+ `\u{1F41E} stowUpdate called outside of a transaction. This is probably a bug.`
1326
1319
  );
1327
1320
  return;
1328
1321
  }
@@ -1335,24 +1328,26 @@ var stowUpdate = (state, update, store) => {
1335
1328
  atomUpdate.family = state.family;
1336
1329
  }
1337
1330
  store.transactionStatus.atomUpdates.push(atomUpdate);
1338
- logger == null ? void 0 : logger.info(`\u{1F4DD} ${key} stowed (`, update.oldValue, `->`, update.newValue, `)`);
1331
+ store.logger.info(
1332
+ `\u{1F4C1} ${key} stowed (`,
1333
+ update.oldValue,
1334
+ `->`,
1335
+ update.newValue,
1336
+ `)`
1337
+ );
1339
1338
  };
1340
1339
 
1341
1340
  // src/set-state/set-atom.ts
1342
1341
  var setAtom = (atom, next, store = IMPLICIT.STORE) => {
1343
- var _a, _b;
1344
1342
  const oldValue = getState__INTERNAL(atom, store);
1345
1343
  let newValue = copyMutableIfWithinTransaction(atom, store);
1346
1344
  newValue = become(next)(newValue);
1347
- (_a = store.config.logger) == null ? void 0 : _a.info(`<< setting atom "${atom.key}" to`, newValue);
1345
+ store.logger.info(`\u{1F4DD} setting atom "${atom.key}" to`, newValue);
1348
1346
  cacheValue(atom.key, newValue, atom.subject, store);
1349
1347
  if (isAtomDefault(atom.key, store)) {
1350
1348
  markAtomAsNotDefault(atom.key, store);
1351
1349
  }
1352
1350
  markDone(atom.key, store);
1353
- (_b = store.config.logger) == null ? void 0 : _b.info(
1354
- ` || evicting caches downstream from "${atom.key}"`
1355
- );
1356
1351
  evictDownStream(atom, store);
1357
1352
  const update = { oldValue, newValue };
1358
1353
  if (store.transactionStatus.phase !== `building`) {
@@ -1406,35 +1401,33 @@ var traceAllSelectorAtoms = (selectorKey, store) => {
1406
1401
 
1407
1402
  // src/selector/update-selector-atoms.ts
1408
1403
  var updateSelectorAtoms = (selectorKey, dependency, store) => {
1409
- var _a, _b;
1410
1404
  const core = target(store);
1411
1405
  if (dependency.type === `atom`) {
1412
1406
  core.selectorAtoms = core.selectorAtoms.set({
1413
1407
  selectorKey,
1414
1408
  atomKey: dependency.key
1415
1409
  });
1416
- (_a = store.config.logger) == null ? void 0 : _a.info(
1417
- ` || adding root for "${selectorKey}": ${dependency.key}`
1410
+ store.logger.info(
1411
+ `\u{1F50D} selector "${selectorKey}" discovers root atom "${dependency.key}"`
1418
1412
  );
1419
- return;
1420
- }
1421
- const rootKeys = traceSelectorAtoms(selectorKey, dependency.key, store);
1422
- (_b = store.config.logger) == null ? void 0 : _b.info(
1423
- ` || adding roots for "${selectorKey}":`,
1424
- rootKeys.map((r) => r)
1425
- );
1426
- for (const atomKey of rootKeys) {
1427
- core.selectorAtoms = core.selectorAtoms.set({
1428
- selectorKey,
1429
- atomKey
1430
- });
1413
+ } else {
1414
+ const rootKeys = traceSelectorAtoms(selectorKey, dependency.key, store);
1415
+ store.logger.info(
1416
+ `\u{1F50D} selector "${selectorKey}" discovers root atoms:`,
1417
+ rootKeys.map((r) => r)
1418
+ );
1419
+ for (const atomKey of rootKeys) {
1420
+ core.selectorAtoms = core.selectorAtoms.set({
1421
+ selectorKey,
1422
+ atomKey
1423
+ });
1424
+ }
1431
1425
  }
1432
1426
  };
1433
1427
 
1434
1428
  // src/selector/register-selector.ts
1435
1429
  var registerSelector = (selectorKey, store = IMPLICIT.STORE) => ({
1436
1430
  get: (dependency) => {
1437
- var _a, _b;
1438
1431
  const core = target(store);
1439
1432
  const alreadyRegistered = core.selectorGraph.getRelationEntries({ downstreamSelectorKey: selectorKey }).some(([_, { source }]) => source === dependency.key);
1440
1433
  const dependencyState = withdraw(dependency, store);
@@ -1444,17 +1437,10 @@ var registerSelector = (selectorKey, store = IMPLICIT.STORE) => ({
1444
1437
  );
1445
1438
  }
1446
1439
  const dependencyValue = getState__INTERNAL(dependencyState, store);
1447
- if (alreadyRegistered) {
1448
- (_a = store.config.logger) == null ? void 0 : _a.info(
1449
- ` || ${selectorKey} <- ${dependency.key} =`,
1450
- dependencyValue
1451
- );
1452
- } else {
1453
- (_b = store.config.logger) == null ? void 0 : _b.info(
1454
- `\u{1F50C} registerSelector "${selectorKey}" <- ( "${dependency.key}" =`,
1455
- dependencyValue,
1456
- `)`
1457
- );
1440
+ store.logger.info(
1441
+ `\u{1F50C} selector "${selectorKey}" registers dependency ( "${dependency.key}" = ${dependencyValue} )`
1442
+ );
1443
+ if (!alreadyRegistered) {
1458
1444
  core.selectorGraph = core.selectorGraph.set(
1459
1445
  {
1460
1446
  upstreamSelectorKey: dependency.key,
@@ -1481,7 +1467,6 @@ var registerSelector = (selectorKey, store = IMPLICIT.STORE) => ({
1481
1467
 
1482
1468
  // src/selector/create-read-write-selector.ts
1483
1469
  var createReadWriteSelector = (options, family, store, core) => {
1484
- var _a;
1485
1470
  const subject = new Subject();
1486
1471
  const { get, set } = registerSelector(options.key, store);
1487
1472
  const getSelf = () => {
@@ -1490,16 +1475,9 @@ var createReadWriteSelector = (options, family, store, core) => {
1490
1475
  return value;
1491
1476
  };
1492
1477
  const setSelf = (next) => {
1493
- var _a2;
1494
1478
  const oldValue = getSelf();
1495
1479
  const newValue = become(next)(oldValue);
1496
- (_a2 = store.config.logger) == null ? void 0 : _a2.info(
1497
- ` <- "${options.key}" went (`,
1498
- oldValue,
1499
- `->`,
1500
- newValue,
1501
- `)`
1502
- );
1480
+ store.logger.info(`\u{1F4DD} set "${options.key}" (`, oldValue, `->`, newValue, `)`);
1503
1481
  cacheValue(options.key, newValue, subject, store);
1504
1482
  markDone(options.key, store);
1505
1483
  if (store.transactionStatus.phase === `idle`) {
@@ -1516,7 +1494,7 @@ var createReadWriteSelector = (options, family, store, core) => {
1516
1494
  }), family && { family });
1517
1495
  core.selectors.set(options.key, mySelector);
1518
1496
  const initialValue = getSelf();
1519
- (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1497
+ store.logger.info(`\u2728 "${options.key}" =`, initialValue);
1520
1498
  const token = {
1521
1499
  key: options.key,
1522
1500
  type: `selector`
@@ -1530,7 +1508,6 @@ var createReadWriteSelector = (options, family, store, core) => {
1530
1508
 
1531
1509
  // src/selector/create-readonly-selector.ts
1532
1510
  var createReadonlySelector = (options, family, store, core) => {
1533
- var _a;
1534
1511
  const subject = new Subject();
1535
1512
  const { get } = registerSelector(options.key, store);
1536
1513
  const getSelf = () => {
@@ -1546,7 +1523,7 @@ var createReadonlySelector = (options, family, store, core) => {
1546
1523
  }), family && { family });
1547
1524
  core.readonlySelectors.set(options.key, readonlySelector);
1548
1525
  const initialValue = getSelf();
1549
- (_a = store.config.logger) == null ? void 0 : _a.info(` \u2728 "${options.key}" =`, initialValue);
1526
+ store.logger.info(`\u2728 "${options.key}" =`, initialValue);
1550
1527
  const token = {
1551
1528
  key: options.key,
1552
1529
  type: `readonly_selector`
@@ -1560,16 +1537,14 @@ var createReadonlySelector = (options, family, store, core) => {
1560
1537
 
1561
1538
  // src/selector/create-selector.ts
1562
1539
  function createSelector(options, family, store = IMPLICIT.STORE) {
1563
- var _a, _b;
1564
1540
  const core = target(store);
1565
1541
  const existingWritable = core.selectors.get(options.key);
1566
1542
  const existingReadonly = core.readonlySelectors.get(options.key);
1567
1543
  if (existingWritable || existingReadonly) {
1568
- (_b = (_a = store.config.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(
1569
- _a,
1570
- `Tried to create ${existingReadonly ? `readonly selector` : `selector`}`,
1544
+ store.logger.error(
1545
+ `\u2753 Tried to create ${existingReadonly ? `readonly selector` : `selector`}`,
1571
1546
  `"${options.key}", but it already exists in the store.`,
1572
- `(Ignore if you are using hot module replacement.)`
1547
+ `(Ignore if you are in development using hot module replacement.)`
1573
1548
  );
1574
1549
  }
1575
1550
  if (`set` in options) {
@@ -1749,19 +1724,17 @@ var isSelectorDefault = (key, store = IMPLICIT.STORE) => {
1749
1724
 
1750
1725
  // src/atom/create-atom.ts
1751
1726
  function createAtom(options, family, store = IMPLICIT.STORE) {
1752
- var _a, _b, _c, _d, _e;
1753
- (_b = (_a = store.config.logger) == null ? void 0 : _a.info) == null ? void 0 : _b.call(
1754
- _a,
1727
+ var _a;
1728
+ store.logger.info(
1755
1729
  `\u{1F528} creating atom "${options.key}" in store "${store.config.name}"`
1756
1730
  );
1757
1731
  const core = target(store);
1758
1732
  const existing = core.atoms.get(options.key);
1759
1733
  if (existing) {
1760
- (_d = (_c = store.config.logger) == null ? void 0 : _c.error) == null ? void 0 : _d.call(
1761
- _c,
1762
- `Tried to create atom "${options.key}",`,
1734
+ store.logger.error(
1735
+ `\u2753 Tried to create atom "${options.key}",`,
1763
1736
  `but it already exists in the store.`,
1764
- `(Ignore if you are using hot module replacement.)`
1737
+ `(Ignore if you are in development using hot module replacement.)`
1765
1738
  );
1766
1739
  return deposit(existing);
1767
1740
  }
@@ -1769,9 +1742,7 @@ function createAtom(options, family, store = IMPLICIT.STORE) {
1769
1742
  const newAtom = __spreadValues(__spreadProps(__spreadValues({}, options), {
1770
1743
  type: `atom`,
1771
1744
  install: (store2) => {
1772
- var _a2, _b2;
1773
- (_b2 = (_a2 = store2.config.logger) == null ? void 0 : _a2.info) == null ? void 0 : _b2.call(
1774
- _a2,
1745
+ store2.logger.info(
1775
1746
  `\u{1F6E0}\uFE0F installing atom "${options.key}" in store "${store2.config.name}"`
1776
1747
  );
1777
1748
  return `mutable` in options ? createMutableAtom(options, store2) : createAtom(options, void 0, store2);
@@ -1783,7 +1754,7 @@ function createAtom(options, family, store = IMPLICIT.STORE) {
1783
1754
  markAtomAsDefault(options.key, store);
1784
1755
  cacheValue(options.key, initialValue, subject, store);
1785
1756
  const token = deposit(newAtom);
1786
- for (const effect of (_e = options.effects) != null ? _e : []) {
1757
+ for (const effect of (_a = options.effects) != null ? _a : []) {
1787
1758
  effect({
1788
1759
  setSelf: (next) => setState(token, next, store),
1789
1760
  onSet: (handle) => subscribe(token, handle, `effect[${subject.subscribers.size}]`, store)
@@ -1794,21 +1765,23 @@ function createAtom(options, family, store = IMPLICIT.STORE) {
1794
1765
  }
1795
1766
 
1796
1767
  // src/atom/delete-atom.ts
1797
- function deleteAtom(key, core = IMPLICIT.STORE) {
1768
+ function deleteAtom(atomToken, store = IMPLICIT.STORE) {
1769
+ const core = target(store);
1770
+ const { key } = atomToken;
1798
1771
  core.atoms.delete(key);
1799
1772
  core.valueMap.delete(key);
1800
1773
  core.selectorAtoms.delete(key);
1801
1774
  core.atomsThatAreDefault.delete(key);
1802
1775
  core.timelineAtoms.delete(key);
1776
+ store.logger.info(`\u{1F525} Atom "${key}" deleted`);
1803
1777
  }
1804
1778
 
1805
1779
  // src/subscribe/recall-state.ts
1806
1780
  var recallState = (state, store = IMPLICIT.STORE) => {
1807
- var _a;
1808
1781
  const core = target(store);
1809
1782
  if (!core.operation.open) {
1810
- (_a = store.config.logger) == null ? void 0 : _a.warn(
1811
- `recall called outside of an operation. This is probably a bug.`
1783
+ store.logger.warn(
1784
+ `\u{1F41E}recall called outside of an operation. This is probably a bug.`
1812
1785
  );
1813
1786
  return core.valueMap.get(state.key);
1814
1787
  }
@@ -1827,8 +1800,7 @@ var subscribeToRootAtoms = (state, store) => {
1827
1800
  return atom.subject.subscribe(
1828
1801
  `${state.type}:${state.key}`,
1829
1802
  (atomChange) => {
1830
- var _a, _b;
1831
- (_a = store.config.logger) == null ? void 0 : _a.info(
1803
+ store.logger.info(
1832
1804
  `\u{1F4E2} selector "${state.key}" saw root "${atomKey}" go (`,
1833
1805
  atomChange.oldValue,
1834
1806
  `->`,
@@ -1837,8 +1809,8 @@ var subscribeToRootAtoms = (state, store) => {
1837
1809
  );
1838
1810
  const oldValue = recallState(state, store);
1839
1811
  const newValue = getState__INTERNAL(state, store);
1840
- (_b = store.config.logger) == null ? void 0 : _b.info(
1841
- ` <- "${state.key}" went (`,
1812
+ store.logger.info(
1813
+ `\u2728 "${state.key}" went (`,
1842
1814
  oldValue,
1843
1815
  `->`,
1844
1816
  newValue,