atom.io 0.19.0 → 0.19.2

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 (110) hide show
  1. package/data/dist/index.cjs +99 -79
  2. package/data/dist/index.js +2 -2
  3. package/data/src/join.ts +91 -74
  4. package/dist/{chunk-YDOGCZ53.js → chunk-ATKDGVTV.js} +29 -29
  5. package/dist/{chunk-CVBEVTM5.js → chunk-CC7IF7QF.js} +5 -42
  6. package/dist/{chunk-WX2NCOZR.js → chunk-FTONNX2R.js} +8 -8
  7. package/dist/{chunk-7ZR244C2.js → chunk-MSCJWACE.js} +92 -72
  8. package/dist/index.cjs +15 -7
  9. package/dist/index.d.ts +24 -35
  10. package/dist/index.js +15 -7
  11. package/internal/dist/index.cjs +56 -44
  12. package/internal/dist/index.d.ts +21 -21
  13. package/internal/dist/index.js +49 -37
  14. package/internal/src/atom/create-regular-atom.ts +7 -5
  15. package/internal/src/atom/delete-atom.ts +2 -2
  16. package/internal/src/families/create-readonly-selector-family.ts +2 -2
  17. package/internal/src/families/create-regular-atom-family.ts +1 -1
  18. package/internal/src/families/create-writable-selector-family.ts +1 -1
  19. package/internal/src/future.ts +4 -2
  20. package/internal/src/lineage.ts +1 -0
  21. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  22. package/internal/src/mutable/create-mutable-atom.ts +7 -5
  23. package/internal/src/mutable/tracker.ts +4 -4
  24. package/internal/src/mutable/transceiver.ts +2 -2
  25. package/internal/src/selector/delete-selector.ts +1 -1
  26. package/internal/src/set-state/become.ts +1 -1
  27. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  28. package/internal/src/store/deposit.ts +5 -5
  29. package/internal/src/store/store.ts +5 -5
  30. package/internal/src/store/withdraw.ts +4 -5
  31. package/internal/src/subject.ts +3 -1
  32. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  33. package/internal/src/subscribe/subscribe-to-transaction.ts +4 -4
  34. package/internal/src/timeline/add-atom-to-timeline.ts +16 -11
  35. package/internal/src/timeline/create-timeline.ts +3 -4
  36. package/internal/src/transaction/act-upon-store.ts +5 -5
  37. package/internal/src/transaction/apply-transaction.ts +4 -4
  38. package/internal/src/transaction/build-transaction.ts +10 -7
  39. package/internal/src/transaction/create-transaction.ts +10 -10
  40. package/internal/src/transaction/index.ts +3 -3
  41. package/internal/src/transaction/is-root-store.ts +2 -2
  42. package/introspection/dist/index.cjs +3 -2
  43. package/introspection/dist/index.d.ts +6 -6
  44. package/introspection/dist/index.js +3 -2
  45. package/introspection/src/attach-atom-index.ts +5 -4
  46. package/introspection/src/attach-introspection-states.ts +3 -3
  47. package/introspection/src/attach-transaction-index.ts +4 -4
  48. package/introspection/src/attach-transaction-logs.ts +8 -4
  49. package/introspection/src/index.ts +3 -3
  50. package/json/dist/index.cjs +6 -2
  51. package/json/dist/index.d.ts +1 -1
  52. package/json/dist/index.js +8 -4
  53. package/json/src/select-json-family.ts +3 -2
  54. package/json/src/select-json.ts +3 -1
  55. package/package.json +243 -242
  56. package/react/dist/index.cjs +9 -3
  57. package/react/dist/index.js +9 -3
  58. package/react/src/use-i.ts +3 -1
  59. package/react/src/use-tl.ts +6 -2
  60. package/react-devtools/dist/index.cjs +332 -978
  61. package/react-devtools/dist/index.css +0 -18
  62. package/react-devtools/dist/index.d.ts +7 -9
  63. package/react-devtools/dist/index.js +291 -881
  64. package/react-devtools/src/AtomIODevtools.tsx +5 -2
  65. package/react-devtools/src/Button.tsx +6 -2
  66. package/react-devtools/src/StateEditor.tsx +13 -16
  67. package/react-devtools/src/StateIndex.tsx +28 -21
  68. package/react-devtools/src/TimelineIndex.tsx +17 -6
  69. package/react-devtools/src/TransactionIndex.tsx +13 -6
  70. package/react-devtools/src/Updates.tsx +24 -9
  71. package/realtime/dist/index.cjs +1 -0
  72. package/realtime/dist/index.d.ts +2 -2
  73. package/realtime/dist/index.js +1 -0
  74. package/realtime/src/realtime-continuity.ts +4 -3
  75. package/realtime-client/dist/index.cjs +29 -29
  76. package/realtime-client/dist/index.d.ts +2 -2
  77. package/realtime-client/dist/index.js +1 -1
  78. package/realtime-client/src/server-action.ts +2 -2
  79. package/realtime-client/src/sync-continuity.ts +23 -23
  80. package/realtime-react/dist/index.cjs +30 -30
  81. package/realtime-react/dist/index.d.ts +2 -2
  82. package/realtime-react/dist/index.js +2 -2
  83. package/realtime-react/src/use-server-action.ts +3 -3
  84. package/realtime-react/src/use-single-effect.ts +1 -1
  85. package/realtime-server/dist/index.cjs +54 -44
  86. package/realtime-server/dist/index.d.ts +6 -6
  87. package/realtime-server/dist/index.js +34 -24
  88. package/realtime-server/src/ipc-sockets/child-socket.ts +7 -7
  89. package/realtime-server/src/ipc-sockets/custom-socket.ts +4 -8
  90. package/realtime-server/src/ipc-sockets/parent-socket.ts +13 -7
  91. package/realtime-server/src/realtime-action-receiver.ts +7 -5
  92. package/realtime-server/src/realtime-continuity-synchronizer.ts +3 -3
  93. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +2 -2
  94. package/realtime-server/src/realtime-state-receiver.ts +3 -1
  95. package/realtime-testing/dist/index.cjs +15 -13
  96. package/realtime-testing/dist/index.js +9 -7
  97. package/realtime-testing/src/setup-realtime-test.tsx +7 -5
  98. package/src/atom.ts +4 -8
  99. package/src/dispose.ts +1 -0
  100. package/src/index.ts +2 -9
  101. package/src/selector.ts +4 -8
  102. package/src/silo.ts +13 -3
  103. package/src/subscribe.ts +6 -6
  104. package/src/timeline.ts +4 -4
  105. package/src/transaction.ts +24 -24
  106. package/src/validators.ts +2 -2
  107. package/transceivers/set-rtx/dist/index.cjs +11 -12
  108. package/transceivers/set-rtx/dist/index.js +11 -12
  109. package/transceivers/set-rtx/src/set-rtx.ts +10 -10
  110. /package/dist/{chunk-VAE5OCKN.js → chunk-BF4MVQF6.js} +0 -0
@@ -34,18 +34,6 @@ var doNothing = () => void 0;
34
34
  var become = (nextVersionOfThing) => (originalThing) => nextVersionOfThing instanceof Function ? nextVersionOfThing(
35
35
  originalThing instanceof Function ? originalThing() : originalThing
36
36
  ) : nextVersionOfThing;
37
- var isModifier = (validate) => (sample) => {
38
- const sampleIsValid = validate(sample);
39
- if (!sampleIsValid) {
40
- throw new Error(`Invalid test case: JSON.stringify(${sample})`);
41
- }
42
- return (input) => {
43
- if (typeof input !== `function`)
44
- return false;
45
- const testResult = input(sample);
46
- return validate(testResult);
47
- };
48
- };
49
37
  var pass = (...params) => (fn) => fn(...params);
50
38
  var raiseError = (message) => {
51
39
  throw new Error(message);
@@ -58,24 +46,11 @@ var fallback = (fn, fallbackValue) => {
58
46
  }
59
47
  };
60
48
 
61
- // ../anvl/src/array/venn.ts
62
- var includesAll = (items) => (array) => {
63
- for (const item of items) {
64
- if (!array.includes(item))
65
- return false;
66
- }
67
- return true;
68
- };
69
- var comprises = (items) => (array) => includesAll(items)(array) && includesAll(array)(items);
70
-
71
49
  // ../anvl/src/array/index.ts
72
50
  var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
73
51
  var map = (f) => (a) => a.map(f);
74
52
  var every = (f = Boolean) => (a) => a.every(f);
75
53
  var allTrue = every((x) => x === true);
76
- var addTo = (a) => (x) => a.includes(x) ? a : [...a, x];
77
- var isEmptyArray = (input) => Array.isArray(input) && input.length === 0;
78
- var isOneOf = (...args) => (input) => args.includes(input);
79
54
 
80
55
  // ../anvl/src/nullish/index.ts
81
56
  var isUndefined = (input) => input === void 0;
@@ -103,7 +78,6 @@ var mob = (fn) => (obj) => mapObject(obj, fn);
103
78
  // ../anvl/src/object/refinement.ts
104
79
  var isNonNullObject = (input) => typeof input === `object` && input !== null;
105
80
  var isPlainObject = (input) => isNonNullObject(input) && Object.getPrototypeOf(input) === Object.prototype;
106
- var isEmptyObject = (input) => isPlainObject(input) && Object.keys(input).length === 0;
107
81
  var isRecord = (isKey, isValue) => (input) => isPlainObject(input) && Object.entries(input).every(([k, v]) => isKey(k) && isValue(v));
108
82
  var hasProperties = (isValue, options = { allowExtraProperties: false }) => {
109
83
  const name = `{${recordToEntries(
@@ -132,20 +106,19 @@ var hasProperties = (isValue, options = { allowExtraProperties: false }) => {
132
106
  };
133
107
  var ALLOW_EXTENSION = { allowExtraProperties: true };
134
108
  var doesExtend = (isValue) => hasProperties(isValue, ALLOW_EXTENSION);
135
- var DO_NOT_ALLOW_EXTENSION = { allowExtraProperties: false };
136
- var hasExactProperties = (isValue) => hasProperties(isValue, DO_NOT_ALLOW_EXTENSION);
137
109
 
138
110
  // ../anvl/src/object/sprawl.ts
139
111
  var sprawl = (tree, inspector) => {
140
112
  const walk = (path, node) => {
141
- const inspect = (path2, node2) => {
142
- const result2 = inspector(path2, node2);
113
+ var _a;
114
+ const inspect = (p, n) => {
115
+ const result2 = inspector(p, n);
143
116
  if (result2)
144
117
  return result2;
145
118
  return null;
146
119
  };
147
120
  const result = inspect(path, node);
148
- if ((result == null ? void 0 : result.jobComplete) || (result == null ? void 0 : result.pathComplete)) {
121
+ if ((_a = result == null ? void 0 : result.jobComplete) != null ? _a : result == null ? void 0 : result.pathComplete) {
149
122
  return result;
150
123
  }
151
124
  const childEntries = Array.isArray(node) ? node.map((v, i) => [i, v]) : isPlainObject(node) ? Object.entries(node) : [];
@@ -161,19 +134,9 @@ var sprawl = (tree, inspector) => {
161
134
  };
162
135
 
163
136
  // ../anvl/src/object/index.ts
164
- var treeShake = (shouldDiscard = isUndefined) => (obj) => {
165
- const newObj = {};
166
- const entries = Object.entries(obj);
167
- for (const [key, val] of entries) {
168
- if (!shouldDiscard(val, key)) {
169
- newObj[key] = val;
170
- }
171
- }
172
- return newObj;
173
- };
174
137
  var delve = (obj, path) => {
175
138
  const found = path.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
176
139
  return found === void 0 ? new Error(`Not found`) : { found };
177
140
  };
178
141
 
179
- export { addTo, become, comprises, delve, doNothing, doesExtend, entriesToRecord, fallback, hasExactProperties, ifDefined, isArray, isEmptyArray, isEmptyObject, isModifier, isOneOf, isPlainObject, isRecord, map, mapObject, pipe, raiseError, recordToEntries, sprawl, treeShake };
142
+ export { become, delve, doNothing, doesExtend, fallback, ifDefined, isArray, isPlainObject, isRecord, mapObject, pipe, raiseError, recordToEntries, sprawl };
@@ -167,16 +167,16 @@ var Junction = class {
167
167
  if (a === void 0 && typeof b === `string`) {
168
168
  const bRelations = this.getRelatedKeys(b);
169
169
  if (bRelations) {
170
- for (const a2 of bRelations) {
171
- this.delete(a2, b);
170
+ for (const bRelation of bRelations) {
171
+ this.delete(bRelation, b);
172
172
  }
173
173
  }
174
174
  }
175
175
  if (typeof a === `string` && b === void 0) {
176
176
  const aRelations = this.getRelatedKeys(a);
177
177
  if (aRelations) {
178
- for (const b2 of aRelations) {
179
- this.delete(a, b2);
178
+ for (const aRelation of aRelations) {
179
+ this.delete(a, aRelation);
180
180
  }
181
181
  }
182
182
  }
@@ -229,18 +229,18 @@ var Junction = class {
229
229
  if (a !== void 0 && b === void 0) {
230
230
  const aRelations = this.getRelatedKeys(a);
231
231
  if (aRelations) {
232
- return [...aRelations].map((b2) => {
232
+ return [...aRelations].map((aRelation) => {
233
233
  var _a;
234
- return [b2, (_a = this.getContent(a, b2)) != null ? _a : null];
234
+ return [aRelation, (_a = this.getContent(a, aRelation)) != null ? _a : null];
235
235
  });
236
236
  }
237
237
  }
238
238
  if (a === void 0 && b !== void 0) {
239
239
  const bRelations = this.getRelatedKeys(b);
240
240
  if (bRelations) {
241
- return [...bRelations].map((a2) => {
241
+ return [...bRelations].map((bRelation) => {
242
242
  var _a;
243
- return [a2, (_a = this.getContent(a2, b)) != null ? _a : null];
243
+ return [bRelation, (_a = this.getContent(bRelation, b)) != null ? _a : null];
244
244
  });
245
245
  }
246
246
  }
@@ -1,4 +1,4 @@
1
- import { Junction } from './chunk-WX2NCOZR.js';
1
+ import { Junction } from './chunk-FTONNX2R.js';
2
2
  import { dispose } from 'atom.io';
3
3
  import { getFromStore, setIntoStore, findInStore, createMutableAtomFamily, createRegularAtomFamily, IMPLICIT, newest, isChildStore, createSelectorFamily, getJsonFamily } from 'atom.io/internal';
4
4
  import { SetRTX } from 'atom.io/transceivers/set-rtx';
@@ -31,11 +31,13 @@ var Join = class _Join {
31
31
  this.alternates.set(store.config.name, this);
32
32
  this.transactors = {
33
33
  get: (token) => getFromStore(token, store),
34
- set: (token, value) => setIntoStore(token, value, store),
34
+ set: (token, value) => {
35
+ setIntoStore(token, value, store);
36
+ },
35
37
  find: (token, key) => findInStore(token, key, store)
36
38
  };
37
- const a = options.between[0];
38
- const b = options.between[1];
39
+ const aSide = options.between[0];
40
+ const bSide = options.between[1];
39
41
  const relatedKeysAtoms = createMutableAtomFamily(
40
42
  {
41
43
  key: `${options.key}/relatedKeys`,
@@ -48,23 +50,23 @@ var Join = class _Join {
48
50
  );
49
51
  this.core = { findRelatedKeysState: relatedKeysAtoms };
50
52
  const getRelatedKeys = ({ find, get }, key) => get(find(relatedKeysAtoms, key));
51
- const addRelation = (transactors, a2, b2) => {
53
+ const addRelation = (transactors, a, b) => {
52
54
  const { set, find } = transactors;
53
- const aKeysState = find(relatedKeysAtoms, a2);
54
- const bKeysState = find(relatedKeysAtoms, b2);
55
- set(aKeysState, (aKeys) => aKeys.add(b2));
56
- set(bKeysState, (bKeys) => bKeys.add(a2));
55
+ const aKeysState = find(relatedKeysAtoms, a);
56
+ const bKeysState = find(relatedKeysAtoms, b);
57
+ set(aKeysState, (aKeys) => aKeys.add(b));
58
+ set(bKeysState, (bKeys) => bKeys.add(a));
57
59
  };
58
- const deleteRelation = (transactors, a2, b2) => {
60
+ const deleteRelation = (transactors, a, b) => {
59
61
  const { find, set } = transactors;
60
- const aKeysState = find(relatedKeysAtoms, a2);
61
- const bKeysState = find(relatedKeysAtoms, b2);
62
- set(aKeysState, (aKeys) => (aKeys.delete(b2), aKeys));
63
- set(bKeysState, (bKeys) => (bKeys.delete(a2), bKeys));
62
+ const aKeysState = find(relatedKeysAtoms, a);
63
+ const bKeysState = find(relatedKeysAtoms, b);
64
+ set(aKeysState, (aKeys) => (aKeys.delete(b), aKeys));
65
+ set(bKeysState, (bKeys) => (bKeys.delete(a), bKeys));
64
66
  };
65
- const replaceRelationsSafely = (transactors, a2, newRelationsOfA) => {
67
+ const replaceRelationsSafely = (transactors, a, newRelationsOfA) => {
66
68
  const { find, get, set } = transactors;
67
- const relationsOfAState = find(relatedKeysAtoms, a2);
69
+ const relationsOfAState = find(relatedKeysAtoms, a);
68
70
  const currentRelationsOfA = get(relationsOfAState);
69
71
  for (const currentRelationB of currentRelationsOfA) {
70
72
  const remainsRelated = newRelationsOfA.includes(currentRelationB);
@@ -73,7 +75,7 @@ var Join = class _Join {
73
75
  }
74
76
  const relationsOfBState = find(relatedKeysAtoms, currentRelationB);
75
77
  set(relationsOfBState, (relationsOfB) => {
76
- relationsOfB.delete(a2);
78
+ relationsOfB.delete(a);
77
79
  return relationsOfB;
78
80
  });
79
81
  }
@@ -82,10 +84,10 @@ var Join = class _Join {
82
84
  nextRelationsOfA.clear();
83
85
  for (const newRelationB of newRelationsOfA) {
84
86
  const relationsOfB = getRelatedKeys(transactors, newRelationB);
85
- const newRelationBIsAlreadyRelated = relationsOfB.has(a2);
87
+ const newRelationBIsAlreadyRelated = relationsOfB.has(a);
86
88
  if (this.relations.cardinality === `1:n`) {
87
89
  for (const previousOwner of relationsOfB) {
88
- if (previousOwner === a2) {
90
+ if (previousOwner === a) {
89
91
  continue;
90
92
  }
91
93
  const previousOwnerRelations = getRelatedKeys(
@@ -99,7 +101,7 @@ var Join = class _Join {
99
101
  }
100
102
  }
101
103
  if (!newRelationBIsAlreadyRelated) {
102
- relationsOfB.add(a2);
104
+ relationsOfB.add(a);
103
105
  }
104
106
  nextRelationsOfA.add(newRelationB);
105
107
  }
@@ -108,9 +110,9 @@ var Join = class _Join {
108
110
  return relationsOfA;
109
111
  });
110
112
  };
111
- const replaceRelationsUnsafely = (transactors, a2, newRelationsOfA) => {
113
+ const replaceRelationsUnsafely = (transactors, a, newRelationsOfA) => {
112
114
  const { find, set } = transactors;
113
- const relationsOfAState = find(relatedKeysAtoms, a2);
115
+ const relationsOfAState = find(relatedKeysAtoms, a);
114
116
  set(relationsOfAState, (relationsOfA) => {
115
117
  relationsOfA.transaction((nextRelationsOfA) => {
116
118
  for (const newRelationB of newRelationsOfA) {
@@ -123,23 +125,31 @@ var Join = class _Join {
123
125
  for (const newRelationB of newRelationsOfA) {
124
126
  const newRelationsBState = find(relatedKeysAtoms, newRelationB);
125
127
  set(newRelationsBState, (newRelationsB) => {
126
- newRelationsB.add(a2);
128
+ newRelationsB.add(a);
127
129
  return newRelationsB;
128
130
  });
129
131
  }
130
132
  return true;
131
133
  };
132
- const has = (transactors, a2, b2) => {
133
- const aKeys = getRelatedKeys(transactors, a2);
134
- return b2 ? aKeys.has(b2) : aKeys.size > 0;
134
+ const has = (transactors, a, b) => {
135
+ const aKeys = getRelatedKeys(transactors, a);
136
+ return b ? aKeys.has(b) : aKeys.size > 0;
135
137
  };
136
138
  const baseExternalStoreConfiguration = {
137
139
  getRelatedKeys: (key) => getRelatedKeys(this.transactors, key),
138
- addRelation: (a2, b2) => addRelation(this.transactors, a2, b2),
139
- deleteRelation: (a2, b2) => deleteRelation(this.transactors, a2, b2),
140
- replaceRelationsSafely: (a2, bs) => replaceRelationsSafely(this.transactors, a2, bs),
141
- replaceRelationsUnsafely: (a2, bs) => replaceRelationsUnsafely(this.transactors, a2, bs),
142
- has: (a2, b2) => has(this.transactors, a2, b2)
140
+ addRelation: (a, b) => {
141
+ addRelation(this.transactors, a, b);
142
+ },
143
+ deleteRelation: (a, b) => {
144
+ deleteRelation(this.transactors, a, b);
145
+ },
146
+ replaceRelationsSafely: (a, bs) => {
147
+ replaceRelationsSafely(this.transactors, a, bs);
148
+ },
149
+ replaceRelationsUnsafely: (a, bs) => {
150
+ replaceRelationsUnsafely(this.transactors, a, bs);
151
+ },
152
+ has: (a, b) => has(this.transactors, a, b)
143
153
  };
144
154
  let externalStore;
145
155
  let contentAtoms;
@@ -152,8 +162,12 @@ var Join = class _Join {
152
162
  store
153
163
  );
154
164
  const getContent = ({ find, get }, key) => get(find(contentAtoms, key));
155
- const setContent = ({ find, set }, key, content) => set(find(contentAtoms, key), content);
156
- const deleteContent = ({ find }, key) => dispose(find(contentAtoms, key));
165
+ const setContent = ({ find, set }, key, content) => {
166
+ set(find(contentAtoms, key), content);
167
+ };
168
+ const deleteContent = ({ find }, key) => {
169
+ dispose(find(contentAtoms, key));
170
+ };
157
171
  const externalStoreWithContentConfiguration = {
158
172
  getContent: (contentKey) => {
159
173
  const content = getContent(this.transactors, contentKey);
@@ -241,8 +255,8 @@ var Join = class _Join {
241
255
  switch (options.cardinality) {
242
256
  case `1:1`: {
243
257
  const findSingleRelatedKeyState = createSingleKeyStateFamily();
244
- const stateKeyA = `${a}KeyOf${capitalize(b)}`;
245
- const stateKeyB = `${b}KeyOf${capitalize(a)}`;
258
+ const stateKeyA = `${aSide}KeyOf${capitalize(bSide)}`;
259
+ const stateKeyB = `${bSide}KeyOf${capitalize(aSide)}`;
246
260
  const baseStates = {
247
261
  [stateKeyA]: findSingleRelatedKeyState,
248
262
  [stateKeyB]: findSingleRelatedKeyState
@@ -250,8 +264,8 @@ var Join = class _Join {
250
264
  let states;
251
265
  if (defaultContent) {
252
266
  const findSingleRelatedEntryState = createSingleEntryStateFamily();
253
- const entriesStateKeyA = `${a}EntryOf${capitalize(b)}`;
254
- const entriesStateKeyB = `${b}EntryOf${capitalize(a)}`;
267
+ const entriesStateKeyA = `${aSide}EntryOf${capitalize(bSide)}`;
268
+ const entriesStateKeyB = `${bSide}EntryOf${capitalize(aSide)}`;
255
269
  const contentStates = {
256
270
  [entriesStateKeyA]: findSingleRelatedEntryState,
257
271
  [entriesStateKeyB]: findSingleRelatedEntryState
@@ -267,8 +281,8 @@ var Join = class _Join {
267
281
  case `1:n`: {
268
282
  const findSingleRelatedKeyState = createSingleKeyStateFamily();
269
283
  const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
270
- const stateKeyA = `${a}KeyOf${capitalize(b)}`;
271
- const stateKeyB = `${b}KeysOf${capitalize(a)}`;
284
+ const stateKeyA = `${aSide}KeyOf${capitalize(bSide)}`;
285
+ const stateKeyB = `${bSide}KeysOf${capitalize(aSide)}`;
272
286
  const baseStates = {
273
287
  [stateKeyA]: findSingleRelatedKeyState,
274
288
  [stateKeyB]: findMultipleRelatedKeysState
@@ -277,8 +291,10 @@ var Join = class _Join {
277
291
  if (defaultContent) {
278
292
  const findSingleRelatedEntryState = createSingleEntryStateFamily();
279
293
  const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
280
- const entriesStateKeyA = `${a}EntryOf${capitalize(b)}`;
281
- const entriesStateKeyB = `${b}EntriesOf${capitalize(a)}`;
294
+ const entriesStateKeyA = `${aSide}EntryOf${capitalize(bSide)}`;
295
+ const entriesStateKeyB = `${bSide}EntriesOf${capitalize(
296
+ aSide
297
+ )}`;
282
298
  const contentStates = {
283
299
  [entriesStateKeyA]: findSingleRelatedEntryState,
284
300
  [entriesStateKeyB]: findMultipleRelatedEntriesState
@@ -293,8 +309,8 @@ var Join = class _Join {
293
309
  }
294
310
  default: {
295
311
  const findMultipleRelatedKeysState = getMultipleKeyStateFamily();
296
- const stateKeyA = `${a}KeysOf${capitalize(b)}`;
297
- const stateKeyB = `${b}KeysOf${capitalize(a)}`;
312
+ const stateKeyA = `${aSide}KeysOf${capitalize(bSide)}`;
313
+ const stateKeyB = `${bSide}KeysOf${capitalize(aSide)}`;
298
314
  const baseStates = {
299
315
  [stateKeyA]: findMultipleRelatedKeysState,
300
316
  [stateKeyB]: findMultipleRelatedKeysState
@@ -302,8 +318,12 @@ var Join = class _Join {
302
318
  let states;
303
319
  if (defaultContent) {
304
320
  const findMultipleRelatedEntriesState = getMultipleEntryStateFamily();
305
- const entriesStateKeyA = `${a}EntriesOf${capitalize(b)}`;
306
- const entriesStateKeyB = `${b}EntriesOf${capitalize(a)}`;
321
+ const entriesStateKeyA = `${aSide}EntriesOf${capitalize(
322
+ bSide
323
+ )}`;
324
+ const entriesStateKeyB = `${bSide}EntriesOf${capitalize(
325
+ aSide
326
+ )}`;
307
327
  const contentStates = {
308
328
  [entriesStateKeyA]: findMultipleRelatedEntriesState,
309
329
  [entriesStateKeyB]: findMultipleRelatedEntriesState
@@ -341,21 +361,21 @@ function getJoinMap(store) {
341
361
  function getJoin(token, store) {
342
362
  var _a;
343
363
  const joinMap = getJoinMap(store);
344
- let join2 = joinMap.get(token.key);
345
- if (join2 === void 0) {
364
+ let myJoin = joinMap.get(token.key);
365
+ if (myJoin === void 0) {
346
366
  const rootJoinMap = getJoinMap(IMPLICIT.STORE);
347
- join2 = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
348
- if (join2 === void 0) {
367
+ myJoin = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
368
+ if (myJoin === void 0) {
349
369
  throw new Error(
350
370
  `Join "${token.key}" not found in store "${store.config.name}"`
351
371
  );
352
372
  }
353
- joinMap.set(token.key, join2);
373
+ joinMap.set(token.key, myJoin);
354
374
  }
355
- return join2;
375
+ return myJoin;
356
376
  }
357
377
  function findRelationsInStore(token, key, store) {
358
- const join2 = getJoin(token, store);
378
+ const myJoin = getJoin(token, store);
359
379
  let relations;
360
380
  switch (token.cardinality) {
361
381
  case `1:1`: {
@@ -363,27 +383,27 @@ function findRelationsInStore(token, key, store) {
363
383
  const keyBA = `${token.b}KeyOf${capitalize(token.a)}`;
364
384
  relations = {
365
385
  get [keyAB]() {
366
- const familyAB = join2.states[keyAB];
386
+ const familyAB = myJoin.states[keyAB];
367
387
  const state = findInStore(familyAB, key, store);
368
388
  return state;
369
389
  },
370
390
  get [keyBA]() {
371
- const familyBA = join2.states[keyBA];
391
+ const familyBA = myJoin.states[keyBA];
372
392
  const state = findInStore(familyBA, key, store);
373
393
  return state;
374
394
  }
375
395
  };
376
396
  const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
377
- if (entryAB in join2.states) {
397
+ if (entryAB in myJoin.states) {
378
398
  const entryBA = `${token.b}EntryOf${capitalize(token.a)}`;
379
399
  Object.assign(relations, {
380
400
  get [entryAB]() {
381
- const familyAB = join2.states[entryAB];
401
+ const familyAB = myJoin.states[entryAB];
382
402
  const state = findInStore(familyAB, key, store);
383
403
  return state;
384
404
  },
385
405
  get [entryBA]() {
386
- const familyBA = join2.states[entryBA];
406
+ const familyBA = myJoin.states[entryBA];
387
407
  const state = findInStore(familyBA, key, store);
388
408
  return state;
389
409
  }
@@ -396,27 +416,27 @@ function findRelationsInStore(token, key, store) {
396
416
  const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
397
417
  relations = {
398
418
  get [keyAB]() {
399
- const familyAB = join2.states[keyAB];
419
+ const familyAB = myJoin.states[keyAB];
400
420
  const state = findInStore(familyAB, key, store);
401
421
  return state;
402
422
  },
403
423
  get [keysBA]() {
404
- const familyBA = join2.states[keysBA];
424
+ const familyBA = myJoin.states[keysBA];
405
425
  const state = findInStore(familyBA, key, store);
406
426
  return state;
407
427
  }
408
428
  };
409
429
  const entryAB = `${token.a}EntryOf${capitalize(token.b)}`;
410
- if (entryAB in join2.states) {
430
+ if (entryAB in myJoin.states) {
411
431
  const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
412
432
  Object.assign(relations, {
413
433
  get [entryAB]() {
414
- const familyAB = join2.states[entryAB];
434
+ const familyAB = myJoin.states[entryAB];
415
435
  const state = findInStore(familyAB, key, store);
416
436
  return state;
417
437
  },
418
438
  get [entriesBA]() {
419
- const familyBA = join2.states[entriesBA];
439
+ const familyBA = myJoin.states[entriesBA];
420
440
  const state = findInStore(familyBA, key, store);
421
441
  return state;
422
442
  }
@@ -429,27 +449,27 @@ function findRelationsInStore(token, key, store) {
429
449
  const keysBA = `${token.b}KeysOf${capitalize(token.a)}`;
430
450
  relations = {
431
451
  get [keysAB]() {
432
- const familyAB = join2.states[keysAB];
452
+ const familyAB = myJoin.states[keysAB];
433
453
  const state = findInStore(familyAB, key, store);
434
454
  return state;
435
455
  },
436
456
  get [keysBA]() {
437
- const familyBA = join2.states[keysBA];
457
+ const familyBA = myJoin.states[keysBA];
438
458
  const state = findInStore(familyBA, key, store);
439
459
  return state;
440
460
  }
441
461
  };
442
462
  const entriesAB = `${token.a}EntriesOf${capitalize(token.b)}`;
443
- if (entriesAB in join2.states) {
463
+ if (entriesAB in myJoin.states) {
444
464
  const entriesBA = `${token.b}EntriesOf${capitalize(token.a)}`;
445
465
  Object.assign(relations, {
446
466
  get [entriesAB]() {
447
- const familyAB = join2.states[entriesAB];
467
+ const familyAB = myJoin.states[entriesAB];
448
468
  const state = findInStore(familyAB, key, store);
449
469
  return state;
450
470
  },
451
471
  get [entriesBA]() {
452
- const familyBA = join2.states[entriesBA];
472
+ const familyBA = myJoin.states[entriesBA];
453
473
  const state = findInStore(familyBA, key, store);
454
474
  return state;
455
475
  }
@@ -463,23 +483,23 @@ function findRelations(token, key) {
463
483
  return findRelationsInStore(token, key, IMPLICIT.STORE);
464
484
  }
465
485
  function editRelationsInStore(token, change, store) {
466
- const join2 = getJoin(token, store);
486
+ const myJoin = getJoin(token, store);
467
487
  const target = newest(store);
468
488
  if (isChildStore(target)) {
469
489
  const { transactors } = target.transactionMeta;
470
- join2.transact(transactors, ({ relations }) => {
490
+ myJoin.transact(transactors, ({ relations }) => {
471
491
  change(relations);
472
492
  });
473
493
  } else {
474
- change(join2.relations);
494
+ change(myJoin.relations);
475
495
  }
476
496
  }
477
497
  function editRelations(token, change) {
478
498
  editRelationsInStore(token, change, IMPLICIT.STORE);
479
499
  }
480
500
  function getInternalRelationsFromStore(token, store) {
481
- const join2 = getJoin(token, store);
482
- const family = join2.core.findRelatedKeysState;
501
+ const myJoin = getJoin(token, store);
502
+ const family = myJoin.core.findRelatedKeysState;
483
503
  return family;
484
504
  }
485
505
  function getInternalRelations(token) {
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ function atomFamily(options) {
32
32
  function dispose(token, store = Internal__namespace.IMPLICIT.STORE) {
33
33
  switch (token.type) {
34
34
  case `atom`:
35
+ case `mutable_atom`:
35
36
  Internal__namespace.deleteAtom(token, store);
36
37
  break;
37
38
  case `selector`:
@@ -111,11 +112,18 @@ var Silo = class {
111
112
  this.selectorFamily = (options) => Internal.createSelectorFamily(options, s);
112
113
  this.transaction = (options) => Internal.createTransaction(options, s);
113
114
  this.timeline = (options) => Internal.createTimeline(options, s);
115
+ this.findState = (token, key) => Internal.findInStore(token, key, s);
114
116
  this.getState = (token) => Internal.getFromStore(token, s);
115
- this.setState = (token, newValue) => Internal.setIntoStore(token, newValue, s);
117
+ this.setState = (token, newValue) => {
118
+ Internal.setIntoStore(token, newValue, s);
119
+ };
116
120
  this.subscribe = (token, handler, key) => subscribe(token, handler, key, s);
117
- this.undo = (token) => Internal.timeTravel(`undo`, token, s);
118
- this.redo = (token) => Internal.timeTravel(`redo`, token, s);
121
+ this.undo = (token) => {
122
+ Internal.timeTravel(`undo`, token, s);
123
+ };
124
+ this.redo = (token) => {
125
+ Internal.timeTravel(`redo`, token, s);
126
+ };
119
127
  }
120
128
  };
121
129
  function subscribe(token, handleUpdate, key = Internal.arbitrary(), store = Internal.IMPLICIT.STORE) {
@@ -134,11 +142,11 @@ function subscribe(token, handleUpdate, key = Internal.arbitrary(), store = Inte
134
142
  var timeline = (options) => {
135
143
  return Internal.createTimeline(options, Internal.IMPLICIT.STORE);
136
144
  };
137
- var redo = (timeline2) => {
138
- Internal.timeTravel(`redo`, timeline2, Internal.IMPLICIT.STORE);
145
+ var redo = (tl) => {
146
+ Internal.timeTravel(`redo`, tl, Internal.IMPLICIT.STORE);
139
147
  };
140
- var undo = (timeline2) => {
141
- Internal.timeTravel(`undo`, timeline2, Internal.IMPLICIT.STORE);
148
+ var undo = (tl) => {
149
+ Internal.timeTravel(`undo`, tl, Internal.IMPLICIT.STORE);
142
150
  };
143
151
  function transaction(options) {
144
152
  return Internal.createTransaction(options, Internal.IMPLICIT.STORE);