atom.io 0.12.0 → 0.13.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 (81) hide show
  1. package/dist/index.cjs.map +1 -1
  2. package/dist/index.d.cts +6 -3
  3. package/dist/index.d.ts +6 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/metafile-cjs.json +1 -1
  6. package/dist/metafile-esm.json +1 -1
  7. package/internal/dist/index.cjs +1579 -1498
  8. package/internal/dist/index.cjs.map +1 -1
  9. package/internal/dist/index.d.cts +34 -14
  10. package/internal/dist/index.d.ts +34 -14
  11. package/internal/dist/index.js +1577 -1499
  12. package/internal/dist/index.js.map +1 -1
  13. package/internal/dist/metafile-cjs.json +1 -1
  14. package/internal/dist/metafile-esm.json +1 -1
  15. package/internal/src/atom/create-atom.ts +4 -4
  16. package/internal/src/atom/delete-atom.ts +11 -11
  17. package/internal/src/atom/is-default.ts +5 -5
  18. package/internal/src/caching.ts +12 -10
  19. package/internal/src/families/create-atom-family.ts +3 -3
  20. package/internal/src/families/create-readonly-selector-family.ts +3 -3
  21. package/internal/src/families/create-selector-family.ts +4 -4
  22. package/internal/src/index.ts +4 -2
  23. package/internal/src/keys.ts +4 -4
  24. package/internal/src/lazy-map.ts +37 -0
  25. package/internal/src/lineage.ts +18 -0
  26. package/internal/src/mutable/create-mutable-atom.ts +5 -4
  27. package/internal/src/mutable/get-json-family.ts +3 -3
  28. package/internal/src/mutable/tracker.ts +13 -10
  29. package/internal/src/operation.ts +19 -19
  30. package/internal/src/selector/create-read-write-selector.ts +5 -4
  31. package/internal/src/selector/create-readonly-selector.ts +4 -3
  32. package/internal/src/selector/create-selector.ts +6 -6
  33. package/internal/src/selector/delete-selector.ts +10 -10
  34. package/internal/src/selector/get-selector-dependency-keys.ts +2 -2
  35. package/internal/src/selector/register-selector.ts +4 -4
  36. package/internal/src/selector/update-selector-atoms.ts +2 -2
  37. package/internal/src/set-state/copy-mutable-if-needed.ts +4 -3
  38. package/internal/src/set-state/copy-mutable-in-transaction.ts +10 -16
  39. package/internal/src/set-state/copy-mutable-into-new-store.ts +1 -1
  40. package/internal/src/set-state/evict-downstream.ts +5 -5
  41. package/internal/src/set-state/set-atom.ts +6 -1
  42. package/internal/src/set-state/stow-update.ts +7 -2
  43. package/internal/src/store/store.ts +31 -24
  44. package/internal/src/store/withdraw-new-family-member.ts +3 -4
  45. package/internal/src/store/withdraw.ts +58 -59
  46. package/internal/src/subject.ts +14 -0
  47. package/internal/src/subscribe/recall-state.ts +5 -5
  48. package/internal/src/timeline/add-atom-to-timeline.ts +37 -27
  49. package/internal/src/timeline/create-timeline.ts +6 -8
  50. package/internal/src/timeline/time-travel.ts +22 -4
  51. package/internal/src/transaction/abort-transaction.ts +5 -3
  52. package/internal/src/transaction/apply-transaction.ts +80 -58
  53. package/internal/src/transaction/build-transaction.ts +34 -23
  54. package/internal/src/transaction/create-transaction.ts +6 -9
  55. package/internal/src/transaction/index.ts +2 -10
  56. package/internal/src/transaction/redo-transaction.ts +15 -10
  57. package/internal/src/transaction/undo-transaction.ts +15 -16
  58. package/introspection/dist/index.cjs +2 -2
  59. package/introspection/dist/index.cjs.map +1 -1
  60. package/introspection/dist/index.js +3 -3
  61. package/introspection/dist/index.js.map +1 -1
  62. package/introspection/src/attach-atom-index.ts +2 -2
  63. package/introspection/src/attach-selector-index.ts +2 -2
  64. package/package.json +3 -3
  65. package/react-devtools/dist/index.cjs +22 -8
  66. package/react-devtools/dist/index.cjs.map +1 -1
  67. package/react-devtools/dist/index.d.cts +17 -9
  68. package/react-devtools/dist/index.d.ts +17 -9
  69. package/react-devtools/dist/index.js +22 -8
  70. package/react-devtools/dist/index.js.map +1 -1
  71. package/react-devtools/dist/metafile-cjs.json +1 -1
  72. package/react-devtools/dist/metafile-esm.json +1 -1
  73. package/react-devtools/src/Updates.tsx +22 -10
  74. package/src/transaction.ts +7 -2
  75. package/transceivers/set-rtx/dist/index.cjs.map +1 -1
  76. package/transceivers/set-rtx/dist/index.d.cts +2 -2
  77. package/transceivers/set-rtx/dist/index.d.ts +2 -2
  78. package/transceivers/set-rtx/dist/index.js.map +1 -1
  79. package/transceivers/set-rtx/dist/metafile-cjs.json +1 -1
  80. package/transceivers/set-rtx/dist/metafile-esm.json +1 -1
  81. package/transceivers/set-rtx/src/set-rtx.ts +3 -3
@@ -1,6 +1,6 @@
1
1
  import type { AtomToken, ReadonlySelectorToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
- import { IMPLICIT, createAtom, createSelector, target } from "atom.io/internal"
3
+ import { IMPLICIT, createAtom, createSelector, newest } from "atom.io/internal"
4
4
 
5
5
  import type { StateTokenIndex } from "."
6
6
 
@@ -55,7 +55,7 @@ export const attachAtomIndex = (
55
55
  [key]: atomToken,
56
56
  }
57
57
  })
58
- if (target(store).operation.open) {
58
+ if (newest(store).operation.open) {
59
59
  const unsubscribe = store.subject.operationStatus.subscribe(
60
60
  `introspection: waiting to update atom index`,
61
61
  () => {
@@ -1,6 +1,6 @@
1
1
  import type { ReadonlySelectorToken, SelectorToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
- import { IMPLICIT, createAtom, createSelector, target } from "atom.io/internal"
3
+ import { IMPLICIT, createAtom, createSelector, newest } from "atom.io/internal"
4
4
 
5
5
  import type { StateTokenIndex } from "."
6
6
 
@@ -64,7 +64,7 @@ export const attachSelectorIndex = (
64
64
  [key]: selectorToken,
65
65
  }
66
66
  })
67
- if (target(store).operation.open) {
67
+ if (newest(store).operation.open) {
68
68
  const unsubscribe = store.subject.operationStatus.subscribe(
69
69
  `introspection: waiting to update selector index`,
70
70
  () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -59,7 +59,7 @@
59
59
  "drizzle-kit": "0.20.6",
60
60
  "drizzle-orm": "0.29.1",
61
61
  "eslint": "8.55.0",
62
- "framer-motion": "10.16.12",
62
+ "framer-motion": "10.16.14",
63
63
  "happy-dom": "12.10.3",
64
64
  "http-proxy": "1.18.1",
65
65
  "npmlog": "7.0.1",
@@ -73,7 +73,7 @@
73
73
  "tmp": "0.2.1",
74
74
  "tsup": "8.0.1",
75
75
  "typescript": "5.3.2",
76
- "vite": "5.0.5",
76
+ "vite": "5.0.6",
77
77
  "vite-tsconfig-paths": "4.2.1",
78
78
  "vitest": "1.0.1"
79
79
  },
@@ -2549,14 +2549,21 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
2549
2549
  ] }),
2550
2550
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_impact", children: [
2551
2551
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "impact: " }),
2552
- transactionUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
2553
- return /* @__PURE__ */ jsxRuntime.jsx(
2552
+ transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2553
+ return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
2554
2554
  article.AtomUpdate,
2555
2555
  {
2556
2556
  serialNumber: index,
2557
- atomUpdate
2557
+ atomUpdate: update
2558
2558
  },
2559
- `${transactionUpdate.key}:${index}:${atomUpdate.key}`
2559
+ `${transactionUpdate.key}:${index}:${update.key}`
2560
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2561
+ TransactionUpdateFC,
2562
+ {
2563
+ serialNumber: index,
2564
+ transactionUpdate: update
2565
+ },
2566
+ `${transactionUpdate.key}:${index}:${update.key}`
2560
2567
  );
2561
2568
  })
2562
2569
  ] })
@@ -2573,14 +2580,21 @@ var TimelineUpdateFC = ({ timelineUpdate }) => {
2573
2580
  timelineUpdate.key,
2574
2581
  ")"
2575
2582
  ] }) }),
2576
- /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
2577
- return /* @__PURE__ */ jsxRuntime.jsx(
2583
+ /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
2584
+ return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
2578
2585
  article.AtomUpdate,
2579
2586
  {
2580
2587
  serialNumber: index,
2581
- atomUpdate
2588
+ atomUpdate: update
2582
2589
  },
2583
- `${timelineUpdate.key}:${index}:${atomUpdate.key}`
2590
+ `${timelineUpdate.key}:${index}:${update.key}`
2591
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2592
+ TransactionUpdateFC,
2593
+ {
2594
+ serialNumber: index,
2595
+ transactionUpdate: update
2596
+ },
2597
+ `${timelineUpdate.key}:${index}:${update.key}`
2584
2598
  );
2585
2599
  }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
2586
2600
  return /* @__PURE__ */ jsxRuntime.jsx(