atom.io 0.22.0 → 0.23.1

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 (82) hide show
  1. package/data/dist/index.cjs +17 -1
  2. package/data/dist/index.js +1 -1
  3. package/data/src/join.ts +30 -1
  4. package/dist/chunk-6MLFYN32.js +18 -0
  5. package/dist/{chunk-JA4V7TJY.js → chunk-7DT3PVS3.js} +18 -2
  6. package/dist/chunk-OAYGID5B.js +27 -0
  7. package/dist/index.cjs +2 -11
  8. package/dist/index.d.ts +51 -23
  9. package/dist/index.js +2 -11
  10. package/ephemeral/dist/index.d.ts +12 -0
  11. package/eslint-plugin/dist/index.cjs +0 -1
  12. package/eslint-plugin/dist/index.d.ts +73 -0
  13. package/eslint-plugin/dist/index.js +0 -1
  14. package/eslint-plugin/src/rules/lifespan.ts +0 -1
  15. package/immortal/dist/index.cjs +180 -20
  16. package/immortal/dist/index.d.ts +103 -0
  17. package/immortal/dist/index.js +134 -19
  18. package/immortal/src/index.ts +1 -0
  19. package/immortal/src/make-molecule.ts +222 -0
  20. package/immortal/src/molecule.ts +49 -16
  21. package/immortal/src/seek-state.ts +15 -2
  22. package/internal/dist/index.cjs +1119 -754
  23. package/internal/dist/index.d.ts +109 -12
  24. package/internal/dist/index.js +1098 -760
  25. package/internal/src/atom/create-regular-atom.ts +0 -2
  26. package/internal/src/atom/create-standalone-atom.ts +6 -2
  27. package/internal/src/atom/dispose-atom.ts +22 -2
  28. package/internal/src/families/create-readonly-selector-family.ts +7 -2
  29. package/internal/src/families/create-regular-atom-family.ts +6 -2
  30. package/internal/src/families/create-writable-selector-family.ts +7 -2
  31. package/internal/src/families/dispose-from-store.ts +22 -0
  32. package/internal/src/families/find-in-store.ts +0 -1
  33. package/internal/src/families/index.ts +1 -0
  34. package/internal/src/families/init-family-member.ts +22 -1
  35. package/internal/src/families/seek-in-store.ts +23 -6
  36. package/internal/src/ingest-updates/index.ts +1 -0
  37. package/internal/src/ingest-updates/ingest-creation-disposal.ts +104 -0
  38. package/internal/src/ingest-updates/ingest-transaction-update.ts +26 -4
  39. package/internal/src/mutable/create-mutable-atom-family.ts +6 -2
  40. package/internal/src/mutable/create-mutable-atom.ts +0 -2
  41. package/internal/src/mutable/get-json-token.ts +0 -1
  42. package/internal/src/mutable/tracker-family.ts +7 -7
  43. package/internal/src/not-found-error.ts +5 -0
  44. package/internal/src/selector/create-readonly-selector.ts +2 -3
  45. package/internal/src/selector/create-standalone-selector.ts +6 -2
  46. package/internal/src/selector/create-writable-selector.ts +2 -3
  47. package/internal/src/selector/dispose-selector.ts +32 -5
  48. package/internal/src/selector/register-selector.ts +2 -0
  49. package/internal/src/set-state/stow-update.ts +5 -1
  50. package/internal/src/store/deposit.ts +41 -7
  51. package/internal/src/store/store.ts +11 -0
  52. package/internal/src/store/withdraw.ts +28 -1
  53. package/internal/src/timeline/add-atom-to-timeline.ts +206 -182
  54. package/internal/src/timeline/create-timeline.ts +181 -60
  55. package/internal/src/timeline/time-travel.ts +20 -0
  56. package/internal/src/transaction/apply-transaction.ts +2 -12
  57. package/internal/src/transaction/build-transaction.ts +11 -2
  58. package/introspection/dist/index.cjs +2 -1
  59. package/introspection/dist/index.js +2 -1
  60. package/introspection/src/attach-timeline-family.ts +1 -0
  61. package/json/dist/index.cjs +3 -3
  62. package/json/dist/index.js +6 -5
  63. package/json/src/select-json-family.ts +3 -4
  64. package/package.json +8 -5
  65. package/react-devtools/dist/index.cjs +58 -47
  66. package/react-devtools/dist/index.js +60 -48
  67. package/react-devtools/src/TimelineIndex.tsx +15 -13
  68. package/react-devtools/src/Updates.tsx +41 -32
  69. package/realtime-server/dist/index.cjs +21 -10
  70. package/realtime-server/dist/index.d.ts +1 -1
  71. package/realtime-server/dist/index.js +21 -11
  72. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +21 -11
  73. package/realtime-testing/dist/index.cjs +1 -0
  74. package/realtime-testing/dist/index.js +1 -1
  75. package/src/atom.ts +9 -3
  76. package/src/dispose-state.ts +3 -12
  77. package/src/index.ts +4 -0
  78. package/src/selector.ts +3 -3
  79. package/src/subscribe.ts +8 -4
  80. package/src/timeline.ts +18 -1
  81. package/src/transaction.ts +56 -4
  82. package/dist/chunk-BF4MVQF6.js +0 -44
@@ -1838,25 +1838,28 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1838
1838
  ] }),
1839
1839
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_impact", children: [
1840
1840
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "impact: " }),
1841
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1842
- if (`newValue` in update) {
1843
- return /* @__PURE__ */ jsxRuntime.jsx(
1844
- article.AtomUpdate,
1845
- {
1846
- serialNumber: index,
1847
- atomUpdate: update
1848
- },
1849
- `${transactionUpdate.key}:${index}:${update.key}`
1850
- );
1841
+ transactionUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1842
+ switch (update.type) {
1843
+ case `atom_update`:
1844
+ case `selector_update`:
1845
+ return /* @__PURE__ */ jsxRuntime.jsx(
1846
+ article.AtomUpdate,
1847
+ {
1848
+ serialNumber: index,
1849
+ atomUpdate: update
1850
+ },
1851
+ `${transactionUpdate.key}:${index}:${update.key}`
1852
+ );
1853
+ case `transaction_update`:
1854
+ return /* @__PURE__ */ jsxRuntime.jsx(
1855
+ TransactionUpdateFC,
1856
+ {
1857
+ serialNumber: index,
1858
+ transactionUpdate: update
1859
+ },
1860
+ `${transactionUpdate.key}:${index}:${update.key}`
1861
+ );
1851
1862
  }
1852
- return /* @__PURE__ */ jsxRuntime.jsx(
1853
- TransactionUpdateFC,
1854
- {
1855
- serialNumber: index,
1856
- transactionUpdate: update
1857
- },
1858
- `${transactionUpdate.key}:${index}:${update.key}`
1859
- );
1860
1863
  })
1861
1864
  ] })
1862
1865
  ] })
@@ -1865,7 +1868,7 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1865
1868
  );
1866
1869
  };
1867
1870
  var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1868
- return /* @__PURE__ */ jsxRuntime.jsxs(
1871
+ return `key` in timelineUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(
1869
1872
  "article",
1870
1873
  {
1871
1874
  className: "node timeline_update",
@@ -1879,22 +1882,28 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1879
1882
  timelineUpdate.key,
1880
1883
  ")"
1881
1884
  ] }) }),
1882
- /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1883
- return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
1884
- article.AtomUpdate,
1885
- {
1886
- serialNumber: index,
1887
- atomUpdate: update
1888
- },
1889
- `${timelineUpdate.key}:${index}:${update.key}`
1890
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1891
- TransactionUpdateFC,
1892
- {
1893
- serialNumber: index,
1894
- transactionUpdate: update
1895
- },
1896
- `${timelineUpdate.key}:${index}:${update.key}`
1897
- );
1885
+ /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1886
+ switch (update.type) {
1887
+ case `atom_update`:
1888
+ case `selector_update`:
1889
+ return /* @__PURE__ */ jsxRuntime.jsx(
1890
+ article.AtomUpdate,
1891
+ {
1892
+ serialNumber: index,
1893
+ atomUpdate: update
1894
+ },
1895
+ `${timelineUpdate.key}:${index}:${update.key}`
1896
+ );
1897
+ case `transaction_update`:
1898
+ return /* @__PURE__ */ jsxRuntime.jsx(
1899
+ TransactionUpdateFC,
1900
+ {
1901
+ serialNumber: index,
1902
+ transactionUpdate: update
1903
+ },
1904
+ `${timelineUpdate.key}:${index}:${update.key}`
1905
+ );
1906
+ }
1898
1907
  }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1899
1908
  return /* @__PURE__ */ jsxRuntime.jsx(
1900
1909
  article.AtomUpdate,
@@ -1913,7 +1922,7 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1913
1922
  ) : null })
1914
1923
  ]
1915
1924
  }
1916
- );
1925
+ ) : null;
1917
1926
  };
1918
1927
  var article = {
1919
1928
  AtomUpdate: AtomUpdateFC,
@@ -1973,17 +1982,19 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
1973
1982
  ] })
1974
1983
  ] })
1975
1984
  ] }),
1976
- isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
1977
- index === timeline.at ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null,
1978
- /* @__PURE__ */ jsxRuntime.jsx(
1979
- article.TimelineUpdate,
1980
- {
1981
- timelineUpdate: update,
1982
- serialNumber: index
1983
- }
1984
- ),
1985
- index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null
1986
- ] }, update.key + index + timeline.at)) }) : null
1985
+ isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: timeline.history.map(
1986
+ (update, index) => `key` in update ? /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
1987
+ index === timeline.at ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null,
1988
+ /* @__PURE__ */ jsxRuntime.jsx(
1989
+ article.TimelineUpdate,
1990
+ {
1991
+ timelineUpdate: update,
1992
+ serialNumber: index
1993
+ }
1994
+ ),
1995
+ index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null
1996
+ ] }, update.key + index + timeline.at) : null
1997
+ ) }) : null
1987
1998
  ] });
1988
1999
  };
1989
2000
  var TimelineIndex = () => {
@@ -1,6 +1,7 @@
1
1
  import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-3V3VWQ7X.js';
2
2
  import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
3
- import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-BF4MVQF6.js';
3
+ import { isString, isNumber, isBoolean } from '../../dist/chunk-6MLFYN32.js';
4
+ import { JSON_TYPE_NAMES, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-OAYGID5B.js';
4
5
  import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-F2X4B4VY.js';
5
6
  import { selectorFamily, atom, atomFamily, undo, redo, getState } from 'atom.io';
6
7
  import { attachIntrospectionStates } from 'atom.io/introspection';
@@ -1621,25 +1622,28 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1621
1622
  ] }),
1622
1623
  /* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
1623
1624
  /* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
1624
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1625
- if (`newValue` in update) {
1626
- return /* @__PURE__ */ jsx(
1627
- article.AtomUpdate,
1628
- {
1629
- serialNumber: index,
1630
- atomUpdate: update
1631
- },
1632
- `${transactionUpdate.key}:${index}:${update.key}`
1633
- );
1625
+ transactionUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1626
+ switch (update.type) {
1627
+ case `atom_update`:
1628
+ case `selector_update`:
1629
+ return /* @__PURE__ */ jsx(
1630
+ article.AtomUpdate,
1631
+ {
1632
+ serialNumber: index,
1633
+ atomUpdate: update
1634
+ },
1635
+ `${transactionUpdate.key}:${index}:${update.key}`
1636
+ );
1637
+ case `transaction_update`:
1638
+ return /* @__PURE__ */ jsx(
1639
+ TransactionUpdateFC,
1640
+ {
1641
+ serialNumber: index,
1642
+ transactionUpdate: update
1643
+ },
1644
+ `${transactionUpdate.key}:${index}:${update.key}`
1645
+ );
1634
1646
  }
1635
- return /* @__PURE__ */ jsx(
1636
- TransactionUpdateFC,
1637
- {
1638
- serialNumber: index,
1639
- transactionUpdate: update
1640
- },
1641
- `${transactionUpdate.key}:${index}:${update.key}`
1642
- );
1643
1647
  })
1644
1648
  ] })
1645
1649
  ] })
@@ -1648,7 +1652,7 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1648
1652
  );
1649
1653
  };
1650
1654
  var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1651
- return /* @__PURE__ */ jsxs(
1655
+ return `key` in timelineUpdate ? /* @__PURE__ */ jsxs(
1652
1656
  "article",
1653
1657
  {
1654
1658
  className: "node timeline_update",
@@ -1662,22 +1666,28 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1662
1666
  timelineUpdate.key,
1663
1667
  ")"
1664
1668
  ] }) }),
1665
- /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1666
- return `newValue` in update ? /* @__PURE__ */ jsx(
1667
- article.AtomUpdate,
1668
- {
1669
- serialNumber: index,
1670
- atomUpdate: update
1671
- },
1672
- `${timelineUpdate.key}:${index}:${update.key}`
1673
- ) : /* @__PURE__ */ jsx(
1674
- TransactionUpdateFC,
1675
- {
1676
- serialNumber: index,
1677
- transactionUpdate: update
1678
- },
1679
- `${timelineUpdate.key}:${index}:${update.key}`
1680
- );
1669
+ /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1670
+ switch (update.type) {
1671
+ case `atom_update`:
1672
+ case `selector_update`:
1673
+ return /* @__PURE__ */ jsx(
1674
+ article.AtomUpdate,
1675
+ {
1676
+ serialNumber: index,
1677
+ atomUpdate: update
1678
+ },
1679
+ `${timelineUpdate.key}:${index}:${update.key}`
1680
+ );
1681
+ case `transaction_update`:
1682
+ return /* @__PURE__ */ jsx(
1683
+ TransactionUpdateFC,
1684
+ {
1685
+ serialNumber: index,
1686
+ transactionUpdate: update
1687
+ },
1688
+ `${timelineUpdate.key}:${index}:${update.key}`
1689
+ );
1690
+ }
1681
1691
  }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1682
1692
  return /* @__PURE__ */ jsx(
1683
1693
  article.AtomUpdate,
@@ -1696,7 +1706,7 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1696
1706
  ) : null })
1697
1707
  ]
1698
1708
  }
1699
- );
1709
+ ) : null;
1700
1710
  };
1701
1711
  var article = {
1702
1712
  AtomUpdate: AtomUpdateFC,
@@ -1756,17 +1766,19 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
1756
1766
  ] })
1757
1767
  ] })
1758
1768
  ] }),
1759
- isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
1760
- index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
1761
- /* @__PURE__ */ jsx(
1762
- article.TimelineUpdate,
1763
- {
1764
- timelineUpdate: update,
1765
- serialNumber: index
1766
- }
1767
- ),
1768
- index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
1769
- ] }, update.key + index + timeline.at)) }) : null
1769
+ isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map(
1770
+ (update, index) => `key` in update ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
1771
+ index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
1772
+ /* @__PURE__ */ jsx(
1773
+ article.TimelineUpdate,
1774
+ {
1775
+ timelineUpdate: update,
1776
+ serialNumber: index
1777
+ }
1778
+ ),
1779
+ index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
1780
+ ] }, update.key + index + timeline.at) : null
1781
+ ) }) : null
1770
1782
  ] });
1771
1783
  };
1772
1784
  var TimelineIndex = () => {
@@ -64,19 +64,21 @@ export const TimelineLog: FC<{
64
64
  </header>
65
65
  {isOpen ? (
66
66
  <main>
67
- {timeline.history.map((update, index) => (
68
- <Fragment key={update.key + index + timeline.at}>
69
- {index === timeline.at ? <YouAreHere /> : null}
70
- <article.TimelineUpdate
71
- timelineUpdate={update}
72
- serialNumber={index}
73
- />
74
- {index === timeline.history.length - 1 &&
75
- timeline.at === timeline.history.length ? (
76
- <YouAreHere />
77
- ) : null}
78
- </Fragment>
79
- ))}
67
+ {timeline.history.map((update, index) =>
68
+ `key` in update ? (
69
+ <Fragment key={update.key + index + timeline.at}>
70
+ {index === timeline.at ? <YouAreHere /> : null}
71
+ <article.TimelineUpdate
72
+ timelineUpdate={update}
73
+ serialNumber={index}
74
+ />
75
+ {index === timeline.history.length - 1 &&
76
+ timeline.at === timeline.history.length ? (
77
+ <YouAreHere />
78
+ ) : null}
79
+ </Fragment>
80
+ ) : null,
81
+ )}
80
82
  </main>
81
83
  ) : null}
82
84
  </section>
@@ -91,24 +91,27 @@ const TransactionUpdateFC: React.FC<{
91
91
  <section className="transaction_impact">
92
92
  <span className="detail">impact: </span>
93
93
  {transactionUpdate.updates
94
- .filter((token) => !token.key.startsWith(`👁‍🗨`))
94
+ .filter((token) => `key` in token && !token.key.startsWith(`👁‍🗨`))
95
95
  .map((update, index) => {
96
- if (`newValue` in update) {
97
- return (
98
- <article.AtomUpdate
99
- key={`${transactionUpdate.key}:${index}:${update.key}`}
100
- serialNumber={index}
101
- atomUpdate={update}
102
- />
103
- )
96
+ switch (update.type) {
97
+ case `atom_update`:
98
+ case `selector_update`:
99
+ return (
100
+ <article.AtomUpdate
101
+ key={`${transactionUpdate.key}:${index}:${update.key}`}
102
+ serialNumber={index}
103
+ atomUpdate={update}
104
+ />
105
+ )
106
+ case `transaction_update`:
107
+ return (
108
+ <TransactionUpdateFC
109
+ key={`${transactionUpdate.key}:${index}:${update.key}`}
110
+ serialNumber={index}
111
+ transactionUpdate={update}
112
+ />
113
+ )
104
114
  }
105
- return (
106
- <TransactionUpdateFC
107
- key={`${transactionUpdate.key}:${index}:${update.key}`}
108
- serialNumber={index}
109
- transactionUpdate={update}
110
- />
111
- )
112
115
  })}
113
116
  </section>
114
117
  </main>
@@ -120,7 +123,7 @@ export const TimelineUpdateFC: React.FC<{
120
123
  timelineUpdate: TimelineUpdate<any>
121
124
  serialNumber: number
122
125
  }> = ({ timelineUpdate, serialNumber }) => {
123
- return (
126
+ return `key` in timelineUpdate ? (
124
127
  <article
125
128
  className="node timeline_update"
126
129
  data-testid={`timeline-update-${timelineUpdate.key}-${serialNumber}`}
@@ -134,21 +137,27 @@ export const TimelineUpdateFC: React.FC<{
134
137
  <main>
135
138
  {timelineUpdate.type === `transaction_update` ? (
136
139
  timelineUpdate.updates
137
- .filter((token) => !token.key.startsWith(`👁‍🗨`))
140
+ .filter((token) => `key` in token && !token.key.startsWith(`👁‍🗨`))
138
141
  .map((update, index) => {
139
- return `newValue` in update ? (
140
- <article.AtomUpdate
141
- key={`${timelineUpdate.key}:${index}:${update.key}`}
142
- serialNumber={index}
143
- atomUpdate={update}
144
- />
145
- ) : (
146
- <TransactionUpdateFC
147
- key={`${timelineUpdate.key}:${index}:${update.key}`}
148
- serialNumber={index}
149
- transactionUpdate={update}
150
- />
151
- )
142
+ switch (update.type) {
143
+ case `atom_update`:
144
+ case `selector_update`:
145
+ return (
146
+ <article.AtomUpdate
147
+ key={`${timelineUpdate.key}:${index}:${update.key}`}
148
+ serialNumber={index}
149
+ atomUpdate={update}
150
+ />
151
+ )
152
+ case `transaction_update`:
153
+ return (
154
+ <TransactionUpdateFC
155
+ key={`${timelineUpdate.key}:${index}:${update.key}`}
156
+ serialNumber={index}
157
+ transactionUpdate={update}
158
+ />
159
+ )
160
+ }
152
161
  })
153
162
  ) : timelineUpdate.type === `selector_update` ? (
154
163
  timelineUpdate.atomUpdates
@@ -170,7 +179,7 @@ export const TimelineUpdateFC: React.FC<{
170
179
  ) : null}
171
180
  </main>
172
181
  </article>
173
- )
182
+ ) : null
174
183
  }
175
184
 
176
185
  export const article = {
@@ -4,6 +4,7 @@ var json = require('atom.io/json');
4
4
  var internal = require('atom.io/internal');
5
5
  var setRtx = require('atom.io/transceivers/set-rtx');
6
6
  var AtomIO = require('atom.io');
7
+ require('atom.io/immortal');
7
8
  var realtime = require('atom.io/realtime');
8
9
  var data = require('atom.io/data');
9
10
  var child_process = require('child_process');
@@ -642,19 +643,29 @@ var destroyRoomTX = AtomIO__namespace.transaction({
642
643
  });
643
644
  function redactTransactionUpdateContent(visibleStateKeys, updates) {
644
645
  return updates.map((update) => {
645
- if (`newValue` in update) {
646
- return update;
646
+ switch (update.type) {
647
+ case `transaction_update`: {
648
+ const redacted = redactTransactionUpdateContent(
649
+ visibleStateKeys,
650
+ update.updates
651
+ );
652
+ return __spreadProps(__spreadValues({}, update), { updates: redacted });
653
+ }
654
+ default:
655
+ return update;
647
656
  }
648
- const redacted = redactTransactionUpdateContent(
649
- visibleStateKeys,
650
- update.updates
651
- );
652
- return __spreadProps(__spreadValues({}, update), { updates: redacted });
653
657
  }).filter((update) => {
654
- if (`newValue` in update) {
655
- return visibleStateKeys.includes(update.key);
658
+ switch (update.type) {
659
+ case `atom_update`:
660
+ case `selector_update`:
661
+ return visibleStateKeys.includes(update.key);
662
+ case `state_creation`:
663
+ return visibleStateKeys.includes(update.token.key);
664
+ case `molecule_creation`:
665
+ return true;
666
+ case `transaction_update`:
667
+ return true;
656
668
  }
657
- return true;
658
669
  });
659
670
  }
660
671
  var actionOcclusionAtoms = AtomIO.atomFamily({
@@ -112,7 +112,7 @@ declare function redactTransactionUpdateContent(visibleStateKeys: string[], upda
112
112
  declare const actionOcclusionAtoms: AtomIO.RegularAtomFamilyTokenWithCall<{
113
113
  occlude: (updates: TransactionUpdateContent[]) => TransactionUpdateContent[];
114
114
  }, string>;
115
- declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyTokenWithCall<Pick<TransactionUpdate<any>, "key" | "epoch" | "id" | "updates" | "output">[], string>;
115
+ declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyTokenWithCall<Pick<TransactionUpdate<any>, "key" | "id" | "epoch" | "updates" | "output">[], string>;
116
116
 
117
117
  declare const socketAtoms: AtomIO.RegularAtomFamilyTokenWithCall<Socket | null, string>;
118
118
  declare const socketIndex: AtomIO.MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
@@ -1,4 +1,4 @@
1
- import { findRelationsInStore } from '../../dist/chunk-JA4V7TJY.js';
1
+ import { findRelationsInStore } from '../../dist/chunk-7DT3PVS3.js';
2
2
  import '../../dist/chunk-FTONNX2R.js';
3
3
  import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
4
4
  import { parseJson, stringifyJson } from 'atom.io/json';
@@ -472,19 +472,29 @@ var destroyRoomTX = AtomIO.transaction({
472
472
  });
473
473
  function redactTransactionUpdateContent(visibleStateKeys, updates) {
474
474
  return updates.map((update) => {
475
- if (`newValue` in update) {
476
- return update;
475
+ switch (update.type) {
476
+ case `transaction_update`: {
477
+ const redacted = redactTransactionUpdateContent(
478
+ visibleStateKeys,
479
+ update.updates
480
+ );
481
+ return __spreadProps(__spreadValues({}, update), { updates: redacted });
482
+ }
483
+ default:
484
+ return update;
477
485
  }
478
- const redacted = redactTransactionUpdateContent(
479
- visibleStateKeys,
480
- update.updates
481
- );
482
- return __spreadProps(__spreadValues({}, update), { updates: redacted });
483
486
  }).filter((update) => {
484
- if (`newValue` in update) {
485
- return visibleStateKeys.includes(update.key);
487
+ switch (update.type) {
488
+ case `atom_update`:
489
+ case `selector_update`:
490
+ return visibleStateKeys.includes(update.key);
491
+ case `state_creation`:
492
+ return visibleStateKeys.includes(update.token.key);
493
+ case `molecule_creation`:
494
+ return true;
495
+ case `transaction_update`:
496
+ return true;
486
497
  }
487
- return true;
488
498
  });
489
499
  }
490
500
  var actionOcclusionAtoms = atomFamily({
@@ -1,5 +1,5 @@
1
1
  import type { TransactionUpdate, TransactionUpdateContent } from "atom.io"
2
- import { atomFamily, selectorFamily } from "atom.io"
2
+ import { atomFamily } from "atom.io"
3
3
 
4
4
  // export const completeUpdateAtoms = atomFamily<
5
5
  // TransactionUpdate<any> | null,
@@ -15,20 +15,30 @@ export function redactTransactionUpdateContent(
15
15
  ): TransactionUpdateContent[] {
16
16
  return updates
17
17
  .map((update): TransactionUpdateContent => {
18
- if (`newValue` in update) {
19
- return update
18
+ switch (update.type) {
19
+ case `transaction_update`: {
20
+ const redacted = redactTransactionUpdateContent(
21
+ visibleStateKeys,
22
+ update.updates,
23
+ )
24
+ return { ...update, updates: redacted }
25
+ }
26
+ default:
27
+ return update
20
28
  }
21
- const redacted = redactTransactionUpdateContent(
22
- visibleStateKeys,
23
- update.updates,
24
- )
25
- return { ...update, updates: redacted }
26
29
  })
27
30
  .filter((update) => {
28
- if (`newValue` in update) {
29
- return visibleStateKeys.includes(update.key)
31
+ switch (update.type) {
32
+ case `atom_update`:
33
+ case `selector_update`:
34
+ return visibleStateKeys.includes(update.key)
35
+ case `state_creation`:
36
+ return visibleStateKeys.includes(update.token.key)
37
+ case `molecule_creation`:
38
+ return true
39
+ case `transaction_update`:
40
+ return true
30
41
  }
31
- return true
32
42
  })
33
43
  }
34
44
 
@@ -11,6 +11,7 @@ var RTS = require('atom.io/realtime-server');
11
11
  var Happy = require('happy-dom');
12
12
  var SocketIO = require('socket.io');
13
13
  var socket_ioClient = require('socket.io-client');
14
+ require('atom.io/immortal');
14
15
  require('atom.io/json');
15
16
  require('atom.io/transceivers/set-rtx');
16
17
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,7 +1,7 @@
1
1
  import { recordToEntries } from '../../dist/chunk-3V3VWQ7X.js';
2
2
  import { myUsernameState } from '../../dist/chunk-O47EQUM6.js';
3
3
  import '../../dist/chunk-BWWVY5O5.js';
4
- import { editRelationsInStore } from '../../dist/chunk-JA4V7TJY.js';
4
+ import { editRelationsInStore } from '../../dist/chunk-7DT3PVS3.js';
5
5
  import '../../dist/chunk-FTONNX2R.js';
6
6
  import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
7
7
  import * as http from 'http';
package/src/atom.ts CHANGED
@@ -6,7 +6,13 @@ import {
6
6
  } from "atom.io/internal"
7
7
  import type { Json, JsonInterface } from "atom.io/json"
8
8
 
9
- import type { AtomToken, MutableAtomToken, RegularAtomToken } from "."
9
+ import type {
10
+ AtomToken,
11
+ MutableAtomToken,
12
+ RegularAtomToken,
13
+ StateCreation,
14
+ StateDisposal,
15
+ } from "."
10
16
 
11
17
  export type Effectors<T> = {
12
18
  setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void
@@ -67,7 +73,7 @@ export type RegularAtomFamily<T, K extends Json.Serializable> =
67
73
  & RegularAtomFamilyToken<T, K>
68
74
  & {
69
75
  (key: K): RegularAtomToken<T>
70
- subject: Subject<RegularAtomToken<T>>
76
+ subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>
71
77
  install: (store: Store) => void
72
78
  }
73
79
 
@@ -118,7 +124,7 @@ export type MutableAtomFamily<
118
124
  & MutableAtomFamilyToken<T, J, K>
119
125
  & {
120
126
  (key: K): MutableAtomToken<T, J>
121
- subject: Subject<MutableAtomToken<T, J>>
127
+ subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
122
128
  install: (store: Store) => void
123
129
  }
124
130
 
@@ -1,19 +1,10 @@
1
+ import type { MoleculeToken } from "atom.io/immortal"
1
2
  import * as Internal from "atom.io/internal"
2
3
 
3
4
  import type { ReadableToken } from "."
4
5
 
5
6
  export function disposeState(
6
- token: ReadableToken<any>,
7
- store: Internal.Store = Internal.IMPLICIT.STORE,
7
+ token: MoleculeToken<any, any, any> | ReadableToken<any>,
8
8
  ): void {
9
- switch (token.type) {
10
- case `atom`:
11
- case `mutable_atom`:
12
- Internal.disposeAtom(token, store)
13
- break
14
- case `selector`:
15
- case `readonly_selector`:
16
- Internal.disposeSelector(token, store)
17
- break
18
- }
9
+ Internal.disposeFromStore(token, Internal.IMPLICIT.STORE)
19
10
  }