atom.io 0.6.3 → 0.6.4

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 (60) hide show
  1. package/dist/index.d.mts +25 -13
  2. package/dist/index.d.ts +25 -13
  3. package/dist/index.js +37 -22
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +37 -22
  6. package/dist/index.mjs.map +1 -1
  7. package/json/package.json +13 -13
  8. package/package.json +22 -13
  9. package/react/dist/index.d.mts +1 -1
  10. package/react/dist/index.d.ts +1 -1
  11. package/react/dist/index.js +8 -4
  12. package/react/dist/index.js.map +1 -1
  13. package/react/dist/index.mjs +8 -4
  14. package/react/dist/index.mjs.map +1 -1
  15. package/react/package.json +13 -13
  16. package/react-devtools/dist/index.js +693 -181
  17. package/react-devtools/dist/index.js.map +1 -1
  18. package/react-devtools/dist/index.mjs +689 -177
  19. package/react-devtools/dist/index.mjs.map +1 -1
  20. package/react-devtools/package.json +13 -13
  21. package/realtime/dist/index.js.map +1 -1
  22. package/realtime/dist/index.mjs.map +1 -1
  23. package/realtime/package.json +13 -13
  24. package/realtime-react/dist/index.js +14 -10
  25. package/realtime-react/dist/index.js.map +1 -1
  26. package/realtime-react/dist/index.mjs +14 -10
  27. package/realtime-react/dist/index.mjs.map +1 -1
  28. package/realtime-react/package.json +13 -13
  29. package/realtime-testing/dist/index.d.mts +1 -1
  30. package/realtime-testing/dist/index.d.ts +1 -1
  31. package/realtime-testing/dist/index.js +14 -2
  32. package/realtime-testing/dist/index.js.map +1 -1
  33. package/realtime-testing/dist/index.mjs +14 -2
  34. package/realtime-testing/dist/index.mjs.map +1 -1
  35. package/realtime-testing/package.json +13 -13
  36. package/src/atom.ts +2 -3
  37. package/src/internal/atom-internal.ts +3 -3
  38. package/src/internal/families-internal.ts +4 -5
  39. package/src/internal/index.ts +1 -0
  40. package/src/internal/selector/create-read-write-selector.ts +2 -2
  41. package/src/internal/selector/create-readonly-selector.ts +2 -2
  42. package/src/internal/selector-internal.ts +3 -4
  43. package/src/internal/store.ts +10 -10
  44. package/src/internal/subject.ts +24 -0
  45. package/src/internal/timeline-internal.ts +3 -4
  46. package/src/internal/transaction-internal.ts +3 -3
  47. package/src/react/store-context.tsx +1 -2
  48. package/src/react/store-hooks.ts +1 -2
  49. package/src/react-devtools/AtomIODevtools.tsx +2 -3
  50. package/src/react-devtools/StateEditor.tsx +1 -2
  51. package/src/react-devtools/TokenList.tsx +2 -3
  52. package/src/react-explorer/AtomIOExplorer.tsx +1 -2
  53. package/src/realtime-react/realtime-context.tsx +1 -2
  54. package/src/realtime-react/use-pull-family-member.ts +1 -2
  55. package/src/realtime-react/use-pull-family.ts +1 -2
  56. package/src/realtime-react/use-pull.ts +1 -2
  57. package/src/realtime-react/use-push.ts +1 -2
  58. package/src/realtime-react/use-server-action.ts +1 -2
  59. package/src/realtime-testing/setup-realtime-test.tsx +1 -2
  60. package/src/selector.ts +3 -4
package/dist/index.mjs CHANGED
@@ -42,6 +42,7 @@ var internal_exports = {};
42
42
  __export(internal_exports, {
43
43
  IMPLICIT: () => IMPLICIT,
44
44
  META: () => meta_exports,
45
+ Subject: () => Subject,
45
46
  TRANSACTION_PHASES: () => TRANSACTION_PHASES,
46
47
  abortTransaction: () => abortTransaction,
47
48
  applyTransaction: () => applyTransaction,
@@ -99,7 +100,6 @@ __export(internal_exports, {
99
100
 
100
101
  // src/internal/atom-internal.ts
101
102
  import HAMT5 from "hamt_plus";
102
- import * as Rx3 from "rxjs";
103
103
 
104
104
  // src/internal/get.ts
105
105
  import HAMT from "hamt_plus";
@@ -160,7 +160,6 @@ import HAMT3 from "hamt_plus";
160
160
 
161
161
  // src/internal/store.ts
162
162
  import HAMT2 from "hamt_plus";
163
- import * as Rx from "rxjs";
164
163
 
165
164
  // ../anvl/src/function/index.ts
166
165
  var doNothing = () => void 0;
@@ -627,10 +626,10 @@ var createStore = (name, store = null) => {
627
626
  timelines: HAMT2.make(),
628
627
  timelineAtoms: new Join({ relationType: `1:n` }).from(`timelineKey`).to(`atomKey`),
629
628
  subject: __spreadValues({
630
- atomCreation: new Rx.Subject(),
631
- selectorCreation: new Rx.Subject(),
632
- transactionCreation: new Rx.Subject(),
633
- timelineCreation: new Rx.Subject()
629
+ atomCreation: new Subject(),
630
+ selectorCreation: new Subject(),
631
+ transactionCreation: new Subject(),
632
+ timelineCreation: new Subject()
634
633
  }, store == null ? void 0 : store.subject),
635
634
  operation: __spreadValues({
636
635
  open: false
@@ -648,7 +647,7 @@ var createStore = (name, store = null) => {
648
647
  })
649
648
  });
650
649
  store == null ? void 0 : store.atoms.forEach((atom2) => {
651
- const copiedAtom = __spreadProps(__spreadValues({}, atom2), { subject: new Rx.Subject() });
650
+ const copiedAtom = __spreadProps(__spreadValues({}, atom2), { subject: new Subject() });
652
651
  copiedStore.atoms = HAMT2.set(atom2.key, copiedAtom, copiedStore.atoms);
653
652
  });
654
653
  store == null ? void 0 : store.readonlySelectors.forEach((selector2) => {
@@ -771,7 +770,6 @@ var hasKeyBeenUsed = (key, store = IMPLICIT.STORE) => {
771
770
 
772
771
  // src/internal/transaction-internal.ts
773
772
  import HAMT4 from "hamt_plus";
774
- import * as Rx2 from "rxjs";
775
773
  function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
776
774
  const newTransaction = {
777
775
  key: options.key,
@@ -796,7 +794,7 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
796
794
  }
797
795
  },
798
796
  install: (store2) => transaction__INTERNAL(options, store2),
799
- subject: new Rx2.Subject()
797
+ subject: new Subject()
800
798
  };
801
799
  const core = target(store);
802
800
  core.transactions = HAMT4.set(
@@ -821,7 +819,7 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
821
819
  );
822
820
  return deposit(core.atoms.get(options.key));
823
821
  }
824
- const subject = new Rx3.Subject();
822
+ const subject = new Subject();
825
823
  const newAtom = __spreadValues(__spreadProps(__spreadValues({}, options), {
826
824
  subject,
827
825
  type: `atom`
@@ -841,16 +839,13 @@ function atom__INTERNAL(options, family, store = IMPLICIT.STORE) {
841
839
  return token;
842
840
  }
843
841
 
844
- // src/internal/families-internal.ts
845
- import * as Rx4 from "rxjs";
846
-
847
842
  // ../anvl/src/json/index.ts
848
843
  import { pipe as pipe6 } from "fp-ts/function";
849
844
  var stringifyJson = (json) => JSON.stringify(json);
850
845
 
851
846
  // src/internal/families-internal.ts
852
847
  function atomFamily__INTERNAL(options, store = IMPLICIT.STORE) {
853
- const subject = new Rx4.Subject();
848
+ const subject = new Subject();
854
849
  return Object.assign(
855
850
  (key) => {
856
851
  var _a;
@@ -879,7 +874,7 @@ function atomFamily__INTERNAL(options, store = IMPLICIT.STORE) {
879
874
  }
880
875
  function readonlySelectorFamily__INTERNAL(options, store) {
881
876
  const core = target(store);
882
- const subject = new Rx4.Subject();
877
+ const subject = new Subject();
883
878
  return Object.assign(
884
879
  (key) => {
885
880
  const subKey = stringifyJson(key);
@@ -911,7 +906,7 @@ function selectorFamily__INTERNAL(options, store = IMPLICIT.STORE) {
911
906
  return readonlySelectorFamily__INTERNAL(options, store);
912
907
  }
913
908
  const core = target(store);
914
- const subject = new Rx4.Subject();
909
+ const subject = new Subject();
915
910
  return Object.assign(
916
911
  (key) => {
917
912
  const subKey = stringifyJson(key);
@@ -1059,10 +1054,9 @@ import HAMT9 from "hamt_plus";
1059
1054
 
1060
1055
  // src/internal/selector/create-read-write-selector.ts
1061
1056
  import HAMT6 from "hamt_plus";
1062
- import * as Rx5 from "rxjs";
1063
1057
  var createReadWriteSelector = (options, family, store, core) => {
1064
1058
  var _a;
1065
- const subject = new Rx5.Subject();
1059
+ const subject = new Subject();
1066
1060
  const { get, set } = registerSelector(options.key, store);
1067
1061
  const getSelf = () => {
1068
1062
  const value = options.get({ get });
@@ -1102,7 +1096,6 @@ var createReadWriteSelector = (options, family, store, core) => {
1102
1096
 
1103
1097
  // src/internal/selector/create-readonly-selector.ts
1104
1098
  import HAMT8 from "hamt_plus";
1105
- import * as Rx6 from "rxjs";
1106
1099
 
1107
1100
  // src/internal/selector/lookup-selector-sources.ts
1108
1101
  var lookupSelectorSources = (key, store) => target(store).selectorGraph.getRelations(key).filter(({ source }) => source !== key).map(({ source }) => lookup(source, store));
@@ -1279,7 +1272,7 @@ var registerSelector = (selectorKey, store = IMPLICIT.STORE) => ({
1279
1272
  // src/internal/selector/create-readonly-selector.ts
1280
1273
  var createReadonlySelector = (options, family, store, core) => {
1281
1274
  var _a;
1282
- const subject = new Rx6.Subject();
1275
+ const subject = new Subject();
1283
1276
  const { get } = registerSelector(options.key, store);
1284
1277
  const getSelf = () => {
1285
1278
  const value = options.get({ get });
@@ -1323,6 +1316,29 @@ function selector__INTERNAL(options, family, store = IMPLICIT.STORE) {
1323
1316
  return createReadWriteSelector(options, family, store, core);
1324
1317
  }
1325
1318
 
1319
+ // src/internal/subject.ts
1320
+ var Subject = class {
1321
+ constructor() {
1322
+ this.subscribers = [];
1323
+ }
1324
+ subscribe(subscriber) {
1325
+ this.subscribers.push(subscriber);
1326
+ const unsubscribe = () => this.unsubscribe(subscriber);
1327
+ return { unsubscribe };
1328
+ }
1329
+ unsubscribe(subscriber) {
1330
+ const subscriberIndex = this.subscribers.indexOf(subscriber);
1331
+ if (subscriberIndex !== -1) {
1332
+ this.subscribers.splice(subscriberIndex, 1);
1333
+ }
1334
+ }
1335
+ next(value) {
1336
+ for (const subscriber of this.subscribers) {
1337
+ subscriber(value);
1338
+ }
1339
+ }
1340
+ };
1341
+
1326
1342
  // src/internal/subscribe-internal.ts
1327
1343
  var prepareUpdate = (state, store) => {
1328
1344
  const oldValue = recallState(state, store);
@@ -1462,7 +1478,6 @@ var undo__INTERNAL = (token, store = IMPLICIT.STORE) => {
1462
1478
 
1463
1479
  // src/internal/timeline-internal.ts
1464
1480
  import HAMT10 from "hamt_plus";
1465
- import * as Rx7 from "rxjs";
1466
1481
 
1467
1482
  // src/internal/timeline/add-atom-to-timeline.ts
1468
1483
  var addAtomToTimeline = (atomToken, atoms, tl, store = IMPLICIT.STORE) => {
@@ -1610,7 +1625,7 @@ function timeline__INTERNAL(options, store = IMPLICIT.STORE, data = null) {
1610
1625
  }, data), {
1611
1626
  history: (_a = data == null ? void 0 : data.history.map((update) => __spreadValues({}, update))) != null ? _a : [],
1612
1627
  install: (store2) => timeline__INTERNAL(options, store2, tl),
1613
- subject: new Rx7.Subject()
1628
+ subject: new Subject()
1614
1629
  });
1615
1630
  const core = target(store);
1616
1631
  for (const tokenOrFamily of options.atoms) {