atom.io 0.21.1 → 0.23.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 (116) hide show
  1. package/data/dist/index.cjs +152 -63
  2. package/data/dist/index.d.ts +6 -0
  3. package/data/dist/index.js +3 -3
  4. package/data/src/join.ts +164 -51
  5. package/data/src/struct-family.ts +2 -2
  6. package/dist/chunk-6MLFYN32.js +18 -0
  7. package/dist/{chunk-HITX3MO4.js → chunk-7DT3PVS3.js} +151 -62
  8. package/dist/{chunk-RT43TVKP.js → chunk-GVHKIJ3G.js} +1 -1
  9. package/dist/chunk-OAYGID5B.js +27 -0
  10. package/dist/index.cjs +4 -18
  11. package/dist/index.d.ts +71 -28
  12. package/dist/index.js +6 -19
  13. package/ephemeral/dist/index.cjs +11 -0
  14. package/ephemeral/dist/index.js +9 -0
  15. package/ephemeral/package.json +16 -0
  16. package/ephemeral/src/index.ts +1 -0
  17. package/eslint-plugin/dist/index.cjs +155 -1
  18. package/eslint-plugin/dist/index.js +155 -1
  19. package/eslint-plugin/src/rules/index.ts +1 -0
  20. package/eslint-plugin/src/rules/lifespan.ts +203 -0
  21. package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +1 -65
  22. package/eslint-plugin/src/walk.ts +73 -0
  23. package/immortal/dist/index.cjs +260 -0
  24. package/immortal/dist/index.js +212 -0
  25. package/immortal/package.json +16 -0
  26. package/immortal/src/index.ts +3 -0
  27. package/immortal/src/make-molecule.ts +222 -0
  28. package/immortal/src/molecule.ts +167 -0
  29. package/immortal/src/seek-state.ts +73 -0
  30. package/internal/dist/index.cjs +1242 -837
  31. package/internal/dist/index.d.ts +135 -22
  32. package/internal/dist/index.js +1215 -838
  33. package/internal/src/atom/create-regular-atom.ts +0 -2
  34. package/internal/src/atom/create-standalone-atom.ts +6 -2
  35. package/internal/src/atom/dispose-atom.ts +26 -3
  36. package/internal/src/families/create-readonly-selector-family.ts +15 -10
  37. package/internal/src/families/create-regular-atom-family.ts +20 -21
  38. package/internal/src/families/create-writable-selector-family.ts +13 -9
  39. package/{src/dispose.ts → internal/src/families/dispose-from-store.ts} +7 -4
  40. package/internal/src/families/find-in-store.ts +11 -6
  41. package/internal/src/families/index.ts +3 -0
  42. package/internal/src/families/init-family-member.ts +112 -0
  43. package/internal/src/families/seek-in-store.ts +123 -0
  44. package/internal/src/get-state/get-from-store.ts +2 -2
  45. package/internal/src/ingest-updates/index.ts +1 -0
  46. package/internal/src/ingest-updates/ingest-creation-disposal.ts +104 -0
  47. package/internal/src/ingest-updates/ingest-transaction-update.ts +26 -4
  48. package/internal/src/mutable/create-mutable-atom-family.ts +22 -24
  49. package/internal/src/mutable/create-mutable-atom.ts +3 -3
  50. package/internal/src/mutable/get-json-family.ts +2 -2
  51. package/internal/src/mutable/get-json-token.ts +26 -12
  52. package/internal/src/mutable/tracker-family.ts +21 -19
  53. package/internal/src/not-found-error.ts +16 -3
  54. package/internal/src/selector/create-readonly-selector.ts +2 -3
  55. package/internal/src/selector/create-standalone-selector.ts +6 -2
  56. package/internal/src/selector/create-writable-selector.ts +2 -3
  57. package/internal/src/selector/dispose-selector.ts +68 -24
  58. package/internal/src/selector/register-selector.ts +10 -5
  59. package/internal/src/set-state/set-into-store.ts +2 -2
  60. package/internal/src/set-state/stow-update.ts +5 -1
  61. package/internal/src/store/deposit.ts +41 -7
  62. package/internal/src/store/index.ts +0 -1
  63. package/internal/src/store/store.ts +29 -5
  64. package/internal/src/store/withdraw.ts +28 -1
  65. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  66. package/internal/src/timeline/add-atom-to-timeline.ts +206 -182
  67. package/internal/src/timeline/create-timeline.ts +181 -60
  68. package/internal/src/timeline/time-travel.ts +20 -0
  69. package/internal/src/transaction/apply-transaction.ts +2 -12
  70. package/internal/src/transaction/build-transaction.ts +16 -2
  71. package/introspection/dist/index.cjs +40 -53
  72. package/introspection/dist/index.js +40 -53
  73. package/introspection/src/attach-atom-index.ts +38 -48
  74. package/introspection/src/attach-selector-index.ts +45 -50
  75. package/introspection/src/attach-timeline-family.ts +1 -0
  76. package/json/dist/index.cjs +40 -6
  77. package/json/dist/index.js +44 -9
  78. package/json/src/select-json-family.ts +47 -9
  79. package/package.json +30 -10
  80. package/react/dist/index.cjs +1 -1
  81. package/react/dist/index.js +1 -1
  82. package/react/src/use-json.ts +1 -1
  83. package/react-devtools/dist/index.cjs +69 -57
  84. package/react-devtools/dist/index.js +62 -49
  85. package/react-devtools/src/StateIndex.tsx +2 -1
  86. package/react-devtools/src/TimelineIndex.tsx +17 -14
  87. package/react-devtools/src/TransactionIndex.tsx +7 -7
  88. package/react-devtools/src/Updates.tsx +41 -32
  89. package/realtime-client/dist/index.cjs +3 -3
  90. package/realtime-client/dist/index.js +3 -3
  91. package/realtime-client/src/pull-mutable-atom-family-member.ts +1 -1
  92. package/realtime-client/src/pull-mutable-atom.ts +1 -1
  93. package/realtime-client/src/sync-continuity.ts +1 -2
  94. package/realtime-react/dist/index.cjs +1 -1
  95. package/realtime-react/dist/index.js +1 -1
  96. package/realtime-server/dist/index.cjs +39 -27
  97. package/realtime-server/dist/index.d.ts +1 -1
  98. package/realtime-server/dist/index.js +27 -16
  99. package/realtime-server/src/realtime-continuity-synchronizer.ts +5 -3
  100. package/realtime-server/src/realtime-mutable-family-provider.ts +2 -1
  101. package/realtime-server/src/realtime-mutable-provider.ts +1 -1
  102. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +21 -11
  103. package/realtime-testing/dist/index.cjs +7 -2
  104. package/realtime-testing/dist/index.js +8 -5
  105. package/realtime-testing/src/setup-realtime-test.tsx +5 -2
  106. package/src/atom.ts +19 -7
  107. package/src/dispose-state.ts +10 -0
  108. package/src/index.ts +5 -2
  109. package/src/selector.ts +13 -7
  110. package/src/silo.ts +3 -3
  111. package/src/subscribe.ts +8 -4
  112. package/src/timeline.ts +18 -1
  113. package/src/transaction.ts +59 -4
  114. package/dist/chunk-BF4MVQF6.js +0 -44
  115. package/internal/src/store/withdraw-new-family-member.ts +0 -69
  116. /package/{src → ephemeral/src}/find-state.ts +0 -0
@@ -5,6 +5,7 @@ var introspection = require('atom.io/introspection');
5
5
  var react$1 = require('atom.io/react');
6
6
  var framerMotion = require('framer-motion');
7
7
  var react = require('react');
8
+ var ephemeral = require('atom.io/ephemeral');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
 
10
11
  var __defProp = Object.defineProperty;
@@ -1718,8 +1719,8 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
1718
1719
  const setIsOpen = react$1.useI(isOpenState);
1719
1720
  const isOpen = react$1.useO(isOpenState);
1720
1721
  for (const [key, childNode] of node.familyMembers) {
1721
- atom_io.findState(findViewIsOpenState, key);
1722
- atom_io.findState(findStateTypeState, childNode);
1722
+ ephemeral.findState(findViewIsOpenState, key);
1723
+ ephemeral.findState(findStateTypeState, childNode);
1723
1724
  }
1724
1725
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1725
1726
  /* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
@@ -1740,8 +1741,8 @@ var StateIndexTreeNode = ({ node, isOpenState }) => {
1740
1741
  StateIndexNode,
1741
1742
  {
1742
1743
  node: childNode,
1743
- isOpenState: atom_io.findState(findViewIsOpenState, childNode.key),
1744
- typeState: atom_io.findState(findStateTypeState, childNode)
1744
+ isOpenState: ephemeral.findState(findViewIsOpenState, childNode.key),
1745
+ typeState: ephemeral.findState(findStateTypeState, childNode)
1745
1746
  },
1746
1747
  key
1747
1748
  )) : null
@@ -1764,8 +1765,8 @@ var StateIndex = ({ tokenIndex }) => {
1764
1765
  StateIndexNode,
1765
1766
  {
1766
1767
  node,
1767
- isOpenState: atom_io.findState(findViewIsOpenState, node.key),
1768
- typeState: atom_io.findState(findStateTypeState, node)
1768
+ isOpenState: ephemeral.findState(findViewIsOpenState, node.key),
1769
+ typeState: ephemeral.findState(findStateTypeState, node)
1769
1770
  },
1770
1771
  key
1771
1772
  );
@@ -1837,25 +1838,28 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1837
1838
  ] }),
1838
1839
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "transaction_impact", children: [
1839
1840
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "detail", children: "impact: " }),
1840
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1841
- if (`newValue` in update) {
1842
- return /* @__PURE__ */ jsxRuntime.jsx(
1843
- article.AtomUpdate,
1844
- {
1845
- serialNumber: index,
1846
- atomUpdate: update
1847
- },
1848
- `${transactionUpdate.key}:${index}:${update.key}`
1849
- );
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
+ );
1850
1862
  }
1851
- return /* @__PURE__ */ jsxRuntime.jsx(
1852
- TransactionUpdateFC,
1853
- {
1854
- serialNumber: index,
1855
- transactionUpdate: update
1856
- },
1857
- `${transactionUpdate.key}:${index}:${update.key}`
1858
- );
1859
1863
  })
1860
1864
  ] })
1861
1865
  ] })
@@ -1864,7 +1868,7 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1864
1868
  );
1865
1869
  };
1866
1870
  var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1867
- return /* @__PURE__ */ jsxRuntime.jsxs(
1871
+ return `key` in timelineUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(
1868
1872
  "article",
1869
1873
  {
1870
1874
  className: "node timeline_update",
@@ -1878,22 +1882,28 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1878
1882
  timelineUpdate.key,
1879
1883
  ")"
1880
1884
  ] }) }),
1881
- /* @__PURE__ */ jsxRuntime.jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1882
- return `newValue` in update ? /* @__PURE__ */ jsxRuntime.jsx(
1883
- article.AtomUpdate,
1884
- {
1885
- serialNumber: index,
1886
- atomUpdate: update
1887
- },
1888
- `${timelineUpdate.key}:${index}:${update.key}`
1889
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1890
- TransactionUpdateFC,
1891
- {
1892
- serialNumber: index,
1893
- transactionUpdate: update
1894
- },
1895
- `${timelineUpdate.key}:${index}:${update.key}`
1896
- );
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
+ }
1897
1907
  }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1898
1908
  return /* @__PURE__ */ jsxRuntime.jsx(
1899
1909
  article.AtomUpdate,
@@ -1912,7 +1922,7 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1912
1922
  ) : null })
1913
1923
  ]
1914
1924
  }
1915
- );
1925
+ ) : null;
1916
1926
  };
1917
1927
  var article = {
1918
1928
  AtomUpdate: AtomUpdateFC,
@@ -1972,17 +1982,19 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
1972
1982
  ] })
1973
1983
  ] })
1974
1984
  ] }),
1975
- isOpen ? /* @__PURE__ */ jsxRuntime.jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
1976
- index === timeline.at ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null,
1977
- /* @__PURE__ */ jsxRuntime.jsx(
1978
- article.TimelineUpdate,
1979
- {
1980
- timelineUpdate: update,
1981
- serialNumber: index
1982
- }
1983
- ),
1984
- index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsxRuntime.jsx(YouAreHere, {}) : null
1985
- ] }, 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
1986
1998
  ] });
1987
1999
  };
1988
2000
  var TimelineIndex = () => {
@@ -1992,8 +2004,8 @@ var TimelineIndex = () => {
1992
2004
  TimelineLog,
1993
2005
  {
1994
2006
  token,
1995
- isOpenState: atom_io.findState(findViewIsOpenState, token.key),
1996
- timelineState: atom_io.findState(findTimelineState, token.key)
2007
+ isOpenState: ephemeral.findState(findViewIsOpenState, token.key),
2008
+ timelineState: ephemeral.findState(findTimelineState, token.key)
1997
2009
  },
1998
2010
  token.key
1999
2011
  );
@@ -2046,8 +2058,8 @@ var TransactionIndex = () => {
2046
2058
  TransactionLog,
2047
2059
  {
2048
2060
  token,
2049
- isOpenState: atom_io.findState(findViewIsOpenState, token.key),
2050
- logState: atom_io.findState(findTransactionLogState, token.key)
2061
+ isOpenState: ephemeral.findState(findViewIsOpenState, token.key),
2062
+ logState: ephemeral.findState(findTransactionLogState, token.key)
2051
2063
  },
2052
2064
  token.key
2053
2065
  );
@@ -1,12 +1,14 @@
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
- import { selectorFamily, atom, atomFamily, findState, undo, redo, getState } from 'atom.io';
6
+ import { selectorFamily, atom, atomFamily, undo, redo, getState } from 'atom.io';
6
7
  import { attachIntrospectionStates } from 'atom.io/introspection';
7
8
  import { useI, useO } from 'atom.io/react';
8
9
  import { motion, spring, LayoutGroup } from 'framer-motion';
9
10
  import { forwardRef, useRef, useState, useImperativeHandle, useLayoutEffect, Fragment as Fragment$1, Component, useId } from 'react';
11
+ import { findState } from 'atom.io/ephemeral';
10
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
11
13
 
12
14
  // ../anvl/src/refinement/can-exist.ts
@@ -1620,25 +1622,28 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1620
1622
  ] }),
1621
1623
  /* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
1622
1624
  /* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
1623
- transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1624
- if (`newValue` in update) {
1625
- return /* @__PURE__ */ jsx(
1626
- article.AtomUpdate,
1627
- {
1628
- serialNumber: index,
1629
- atomUpdate: update
1630
- },
1631
- `${transactionUpdate.key}:${index}:${update.key}`
1632
- );
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
+ );
1633
1646
  }
1634
- return /* @__PURE__ */ jsx(
1635
- TransactionUpdateFC,
1636
- {
1637
- serialNumber: index,
1638
- transactionUpdate: update
1639
- },
1640
- `${transactionUpdate.key}:${index}:${update.key}`
1641
- );
1642
1647
  })
1643
1648
  ] })
1644
1649
  ] })
@@ -1647,7 +1652,7 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
1647
1652
  );
1648
1653
  };
1649
1654
  var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1650
- return /* @__PURE__ */ jsxs(
1655
+ return `key` in timelineUpdate ? /* @__PURE__ */ jsxs(
1651
1656
  "article",
1652
1657
  {
1653
1658
  className: "node timeline_update",
@@ -1661,22 +1666,28 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1661
1666
  timelineUpdate.key,
1662
1667
  ")"
1663
1668
  ] }) }),
1664
- /* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
1665
- return `newValue` in update ? /* @__PURE__ */ jsx(
1666
- article.AtomUpdate,
1667
- {
1668
- serialNumber: index,
1669
- atomUpdate: update
1670
- },
1671
- `${timelineUpdate.key}:${index}:${update.key}`
1672
- ) : /* @__PURE__ */ jsx(
1673
- TransactionUpdateFC,
1674
- {
1675
- serialNumber: index,
1676
- transactionUpdate: update
1677
- },
1678
- `${timelineUpdate.key}:${index}:${update.key}`
1679
- );
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
+ }
1680
1691
  }) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
1681
1692
  return /* @__PURE__ */ jsx(
1682
1693
  article.AtomUpdate,
@@ -1695,7 +1706,7 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
1695
1706
  ) : null })
1696
1707
  ]
1697
1708
  }
1698
- );
1709
+ ) : null;
1699
1710
  };
1700
1711
  var article = {
1701
1712
  AtomUpdate: AtomUpdateFC,
@@ -1755,17 +1766,19 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
1755
1766
  ] })
1756
1767
  ] })
1757
1768
  ] }),
1758
- isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map((update, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
1759
- index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
1760
- /* @__PURE__ */ jsx(
1761
- article.TimelineUpdate,
1762
- {
1763
- timelineUpdate: update,
1764
- serialNumber: index
1765
- }
1766
- ),
1767
- index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
1768
- ] }, 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
1769
1782
  ] });
1770
1783
  };
1771
1784
  var TimelineIndex = () => {
@@ -3,7 +3,8 @@ import type {
3
3
  ReadonlySelectorToken,
4
4
  RegularAtomToken,
5
5
  } from "atom.io"
6
- import { findState, getState, selectorFamily } from "atom.io"
6
+ import { getState, selectorFamily } from "atom.io"
7
+ import { findState } from "atom.io/ephemeral"
7
8
  import type { FamilyNode, WritableTokenIndex } from "atom.io/introspection"
8
9
  import { useI, useO } from "atom.io/react"
9
10
  import type { FC } from "react"
@@ -3,7 +3,8 @@ import type {
3
3
  RegularAtomToken,
4
4
  TimelineToken,
5
5
  } from "atom.io"
6
- import { findState, redo, undo } from "atom.io"
6
+ import { redo, undo } from "atom.io"
7
+ import { findState } from "atom.io/ephemeral"
7
8
  import type { Timeline } from "atom.io/internal"
8
9
  import { useI, useO } from "atom.io/react"
9
10
  import { type FC, Fragment } from "react"
@@ -63,19 +64,21 @@ export const TimelineLog: FC<{
63
64
  </header>
64
65
  {isOpen ? (
65
66
  <main>
66
- {timeline.history.map((update, index) => (
67
- <Fragment key={update.key + index + timeline.at}>
68
- {index === timeline.at ? <YouAreHere /> : null}
69
- <article.TimelineUpdate
70
- timelineUpdate={update}
71
- serialNumber={index}
72
- />
73
- {index === timeline.history.length - 1 &&
74
- timeline.at === timeline.history.length ? (
75
- <YouAreHere />
76
- ) : null}
77
- </Fragment>
78
- ))}
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
+ )}
79
82
  </main>
80
83
  ) : null}
81
84
  </section>
@@ -1,11 +1,11 @@
1
- import {
2
- findState,
3
- type Func,
4
- type ReadonlySelectorToken,
5
- type RegularAtomToken,
6
- type TransactionToken,
7
- type TransactionUpdate,
1
+ import type {
2
+ Func,
3
+ ReadonlySelectorToken,
4
+ RegularAtomToken,
5
+ TransactionToken,
6
+ TransactionUpdate,
8
7
  } from "atom.io"
8
+ import { findState } from "atom.io/ephemeral"
9
9
  import { useI, useO } from "atom.io/react"
10
10
  import type { FC } from "react"
11
11
 
@@ -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 = {
@@ -56,7 +56,7 @@ function pullAtomFamilyMember(token, socket, store) {
56
56
  };
57
57
  }
58
58
  function pullMutableAtom(token, socket, store) {
59
- const jsonToken = Internal.getJsonToken(token);
59
+ const jsonToken = Internal.getJsonToken(token, store);
60
60
  const updateToken = Internal.getUpdateToken(token);
61
61
  socket.on(`init:${token.key}`, (data) => {
62
62
  Internal.setIntoStore(jsonToken, data, store);
@@ -83,7 +83,7 @@ function pullMutableAtomFamilyMember(token, socket, store) {
83
83
  const { key: familyKey, subKey: serializedSubKey } = token.family;
84
84
  const subKey = json.parseJson(serializedSubKey);
85
85
  socket.on(`init:${token.key}`, (data) => {
86
- const jsonToken = Internal.getJsonToken(token);
86
+ const jsonToken = Internal.getJsonToken(token, store);
87
87
  Internal.setIntoStore(jsonToken, data, store);
88
88
  });
89
89
  socket.on(
@@ -246,7 +246,7 @@ function syncContinuity(continuity, socket, store) {
246
246
  } else {
247
247
  v = x;
248
248
  if (`type` in k && k.type === `mutable_atom`) {
249
- k = Internal.getJsonToken(k);
249
+ k = Internal.getJsonToken(k, store);
250
250
  }
251
251
  Internal.setIntoStore(k, v, store);
252
252
  }
@@ -1,4 +1,4 @@
1
- export { syncContinuity } from '../../dist/chunk-RT43TVKP.js';
1
+ export { syncContinuity } from '../../dist/chunk-GVHKIJ3G.js';
2
2
  export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue } from '../../dist/chunk-O47EQUM6.js';
3
3
  import '../../dist/chunk-BWWVY5O5.js';
4
4
  import '../../dist/chunk-F2X4B4VY.js';
@@ -35,7 +35,7 @@ function pullAtomFamilyMember(token, socket, store) {
35
35
  };
36
36
  }
37
37
  function pullMutableAtom(token, socket, store) {
38
- const jsonToken = getJsonToken(token);
38
+ const jsonToken = getJsonToken(token, store);
39
39
  const updateToken = getUpdateToken(token);
40
40
  socket.on(`init:${token.key}`, (data) => {
41
41
  setIntoStore(jsonToken, data, store);
@@ -62,7 +62,7 @@ function pullMutableAtomFamilyMember(token, socket, store) {
62
62
  const { key: familyKey, subKey: serializedSubKey } = token.family;
63
63
  const subKey = parseJson(serializedSubKey);
64
64
  socket.on(`init:${token.key}`, (data) => {
65
- const jsonToken = getJsonToken(token);
65
+ const jsonToken = getJsonToken(token, store);
66
66
  setIntoStore(jsonToken, data, store);
67
67
  });
68
68
  socket.on(
@@ -20,7 +20,7 @@ export function pullMutableAtomFamilyMember<
20
20
  const { key: familyKey, subKey: serializedSubKey } = token.family
21
21
  const subKey = parseJson(serializedSubKey)
22
22
  socket.on(`init:${token.key}`, (data: J) => {
23
- const jsonToken = getJsonToken(token)
23
+ const jsonToken = getJsonToken(token, store)
24
24
  setIntoStore(jsonToken, data, store)
25
25
  })
26
26
  socket.on(
@@ -12,7 +12,7 @@ export function pullMutableAtom<
12
12
  socket: Socket,
13
13
  store: Store,
14
14
  ): () => void {
15
- const jsonToken = getJsonToken(token)
15
+ const jsonToken = getJsonToken(token, store)
16
16
  const updateToken = getUpdateToken(token)
17
17
  socket.on(`init:${token.key}`, (data: J) => {
18
18
  setIntoStore(jsonToken, data, store)
@@ -40,9 +40,8 @@ export function syncContinuity<F extends AtomIO.Func>(
40
40
  k = x
41
41
  } else {
42
42
  v = x
43
- // console.log(`❗❗❗❗❗`, k, v)
44
43
  if (`type` in k && k.type === `mutable_atom`) {
45
- k = getJsonToken(k)
44
+ k = getJsonToken(k, store)
46
45
  }
47
46
  setIntoStore(k, v, store)
48
47
  }
@@ -184,7 +184,7 @@ function syncContinuity(continuity, socket, store) {
184
184
  } else {
185
185
  v = x;
186
186
  if (`type` in k && k.type === `mutable_atom`) {
187
- k = internal.getJsonToken(k);
187
+ k = internal.getJsonToken(k, store);
188
188
  }
189
189
  internal.setIntoStore(k, v, store);
190
190
  }
@@ -1,4 +1,4 @@
1
- import { syncContinuity } from '../../dist/chunk-RT43TVKP.js';
1
+ import { syncContinuity } from '../../dist/chunk-GVHKIJ3G.js';
2
2
  import '../../dist/chunk-F2X4B4VY.js';
3
3
  import { useI, StoreContext, useO } from 'atom.io/react';
4
4
  import * as RTC from 'atom.io/realtime-client';