atom.io 0.25.6 → 0.27.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 (108) hide show
  1. package/data/dist/index.d.ts +3 -3
  2. package/data/dist/index.js +33 -25
  3. package/data/package.json +1 -4
  4. package/data/src/dict.ts +3 -3
  5. package/dist/chunk-AK23DRMD.js +21 -0
  6. package/dist/{chunk-HYXKCFVY.js → chunk-IBTHB2PI.js} +59 -60
  7. package/dist/{chunk-MR5NETHW.js → chunk-IW6WYRS7.js} +4 -5
  8. package/dist/chunk-XWL6SNVU.js +7 -0
  9. package/dist/index.d.ts +32 -54
  10. package/dist/index.js +33 -21
  11. package/ephemeral/dist/index.d.ts +7 -7
  12. package/ephemeral/dist/index.js +1 -1
  13. package/ephemeral/package.json +1 -4
  14. package/ephemeral/src/find-state.ts +7 -7
  15. package/eslint-plugin/dist/index.js +7 -8
  16. package/eslint-plugin/package.json +1 -4
  17. package/immortal/dist/index.d.ts +7 -7
  18. package/immortal/dist/index.js +1 -1
  19. package/immortal/package.json +1 -4
  20. package/immortal/src/seek-state.ts +8 -8
  21. package/internal/dist/index.d.ts +56 -59
  22. package/internal/dist/index.js +178 -170
  23. package/internal/package.json +1 -4
  24. package/internal/src/families/create-atom-family.ts +4 -4
  25. package/internal/src/families/create-readonly-selector-family.ts +2 -2
  26. package/internal/src/families/create-regular-atom-family.ts +2 -2
  27. package/internal/src/families/create-selector-family.ts +4 -4
  28. package/internal/src/families/create-writable-selector-family.ts +2 -2
  29. package/internal/src/families/dispose-from-store.ts +3 -7
  30. package/internal/src/families/find-in-store.ts +9 -9
  31. package/internal/src/families/init-family-member.ts +25 -37
  32. package/internal/src/families/seek-in-store.ts +11 -10
  33. package/internal/src/get-state/get-from-store.ts +3 -3
  34. package/internal/src/molecule/grow-molecule-in-store.ts +9 -9
  35. package/internal/src/mutable/index.ts +0 -1
  36. package/internal/src/mutable/tracker-family.ts +2 -2
  37. package/internal/src/set-state/set-into-store.ts +4 -4
  38. package/internal/src/store/deposit.ts +3 -3
  39. package/internal/src/store/withdraw.ts +10 -9
  40. package/introspection/dist/index.js +32 -30
  41. package/introspection/package.json +1 -4
  42. package/json/dist/index.d.ts +10 -27
  43. package/json/dist/index.js +3 -3
  44. package/json/package.json +1 -4
  45. package/json/src/index.ts +8 -3
  46. package/json/src/select-json-family.ts +4 -4
  47. package/package.json +36 -65
  48. package/react/dist/index.d.ts +4 -4
  49. package/react/dist/index.js +2 -2
  50. package/react/package.json +1 -4
  51. package/react/src/parse-state-overloads.ts +4 -4
  52. package/react/src/use-i.ts +3 -3
  53. package/react/src/use-json.ts +3 -3
  54. package/react/src/use-o.ts +3 -3
  55. package/react-devtools/dist/index.d.ts +1 -1
  56. package/react-devtools/dist/index.js +90 -72
  57. package/react-devtools/package.json +1 -4
  58. package/react-devtools/src/StateIndex.tsx +5 -4
  59. package/realtime/dist/index.d.ts +3 -3
  60. package/realtime/dist/index.js +8 -9
  61. package/realtime/package.json +1 -4
  62. package/realtime/src/realtime-continuity.ts +2 -2
  63. package/realtime-client/dist/index.js +6 -6
  64. package/realtime-client/package.json +1 -4
  65. package/realtime-react/dist/index.d.ts +4 -4
  66. package/realtime-react/dist/index.js +9 -11
  67. package/realtime-react/package.json +1 -4
  68. package/realtime-react/src/use-pull-atom-family-member.ts +2 -2
  69. package/realtime-react/src/use-pull-mutable-family-member.ts +2 -2
  70. package/realtime-react/src/use-pull-selector-family-member.ts +2 -2
  71. package/realtime-server/dist/index.d.ts +9 -9
  72. package/realtime-server/dist/index.js +59 -54
  73. package/realtime-server/package.json +1 -4
  74. package/realtime-server/src/ipc-sockets/custom-socket.ts +2 -2
  75. package/realtime-server/src/realtime-family-provider.ts +3 -2
  76. package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
  77. package/realtime-testing/dist/index.js +3 -3
  78. package/realtime-testing/package.json +1 -4
  79. package/src/atom.ts +15 -42
  80. package/src/dispose-state.ts +2 -2
  81. package/src/get-state.ts +4 -4
  82. package/src/index.ts +5 -5
  83. package/src/molecule.ts +4 -3
  84. package/src/selector.ts +17 -39
  85. package/src/set-state.ts +3 -2
  86. package/src/silo.ts +4 -4
  87. package/transceivers/set-rtx/dist/index.js +11 -11
  88. package/transceivers/set-rtx/package.json +1 -4
  89. package/transceivers/set-rtx/src/set-rtx.ts +5 -5
  90. package/data/dist/index.cjs +0 -953
  91. package/dist/chunk-BF4MVQF6.js +0 -44
  92. package/dist/chunk-S4N6XNPH.js +0 -38
  93. package/dist/index.cjs +0 -215
  94. package/ephemeral/dist/index.cjs +0 -11
  95. package/eslint-plugin/dist/index.cjs +0 -388
  96. package/immortal/dist/index.cjs +0 -14
  97. package/internal/dist/index.cjs +0 -3405
  98. package/internal/src/mutable/is-mutable.ts +0 -16
  99. package/introspection/dist/index.cjs +0 -449
  100. package/json/dist/index.cjs +0 -128
  101. package/react/dist/index.cjs +0 -118
  102. package/react-devtools/dist/index.cjs +0 -2191
  103. package/realtime/dist/index.cjs +0 -120
  104. package/realtime-client/dist/index.cjs +0 -569
  105. package/realtime-react/dist/index.cjs +0 -189
  106. package/realtime-server/dist/index.cjs +0 -965
  107. package/realtime-testing/dist/index.cjs +0 -201
  108. package/transceivers/set-rtx/dist/index.cjs +0 -215
@@ -1,4 +1,4 @@
1
- import { __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
1
+ import '../../dist/chunk-XWL6SNVU.js';
2
2
  import * as Internal from 'atom.io/internal';
3
3
  import { createRegularAtom, deposit, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
4
4
  import { getState } from 'atom.io';
@@ -177,27 +177,24 @@ var attachTimelineFamily = (store = IMPLICIT.STORE) => {
177
177
  const findTimelineLogState__INTERNAL = createRegularAtomFamily(
178
178
  {
179
179
  key: `\u{1F441}\u200D\u{1F5E8} Timeline Update Log (Internal)`,
180
- default: (key) => {
181
- var _a;
182
- return (_a = store.timelines.get(key)) != null ? _a : {
183
- type: `timeline`,
184
- key: ``,
185
- at: 0,
186
- timeTraveling: null,
187
- history: [],
188
- selectorTime: null,
189
- transactionKey: null,
190
- install: () => {
191
- },
192
- subject: new Subject(),
193
- subscriptions: /* @__PURE__ */ new Map()
194
- };
180
+ default: (key) => store.timelines.get(key) ?? {
181
+ type: `timeline`,
182
+ key: ``,
183
+ at: 0,
184
+ timeTraveling: null,
185
+ history: [],
186
+ selectorTime: null,
187
+ transactionKey: null,
188
+ install: () => {
189
+ },
190
+ subject: new Subject(),
191
+ subscriptions: /* @__PURE__ */ new Map()
195
192
  },
196
193
  effects: (key) => [
197
194
  ({ setSelf }) => {
198
195
  const tl = store.timelines.get(key);
199
- tl == null ? void 0 : tl.subject.subscribe(`introspection`, (_) => {
200
- setSelf(__spreadValues({}, tl));
196
+ tl?.subject.subscribe(`introspection`, (_) => {
197
+ setSelf({ ...tl });
201
198
  });
202
199
  }
203
200
  ]
@@ -281,7 +278,7 @@ var attachTransactionLogs = (store = IMPLICIT.STORE) => {
281
278
  effects: (key) => [
282
279
  ({ setSelf }) => {
283
280
  const tx = store.transactions.get(key);
284
- tx == null ? void 0 : tx.subject.subscribe(`introspection`, (transactionUpdate) => {
281
+ tx?.subject.subscribe(`introspection`, (transactionUpdate) => {
285
282
  if (transactionUpdate.key === key) {
286
283
  setSelf((state) => [...state, transactionUpdate]);
287
284
  }
@@ -312,15 +309,12 @@ var attachIntrospectionStates = (store = Internal.IMPLICIT.STORE) => {
312
309
  findTimelineState: attachTimelineFamily(store)
313
310
  };
314
311
  };
315
- var _Auditor = class _Auditor {
312
+ var Auditor = class _Auditor {
316
313
  /**
317
314
  * @param {Store} store - The store to audit.
318
315
  */
319
316
  constructor(store = Internal.IMPLICIT.STORE) {
320
317
  this.store = store;
321
- this.auditorCreatedAt = performance.now();
322
- this.statesCreatedAt = /* @__PURE__ */ new Map();
323
- this.disposed = false;
324
318
  this.atomIndex = attachAtomIndex(this.store);
325
319
  this.selectorIndex = attachSelectorIndex(this.store);
326
320
  this.unsubscribeFromAtomCreation = this.store.on.atomCreation.subscribe(
@@ -351,6 +345,19 @@ var _Auditor = class _Auditor {
351
345
  }
352
346
  );
353
347
  }
348
+ auditorCreatedAt = performance.now();
349
+ statesCreatedAt = /* @__PURE__ */ new Map();
350
+ atomIndex;
351
+ selectorIndex;
352
+ disposed = false;
353
+ unsubscribeFromAtomCreation;
354
+ unsubscribeFromAtomDisposal;
355
+ unsubscribeFromSelectorCreation;
356
+ unsubscribeFromSelectorDisposal;
357
+ static DEFAULT_LIST_RESOURCES_PARAM = {
358
+ atomFamilies: true,
359
+ selectorFamilies: true
360
+ };
354
361
  /**
355
362
  * Lists all resources in the store, along with their creation time.
356
363
  *
@@ -376,7 +383,7 @@ var _Auditor = class _Auditor {
376
383
  const tokens = familyNode.familyMembers.values();
377
384
  for (const token of tokens) {
378
385
  const storedTime = this.statesCreatedAt.get(token.key);
379
- const creationTime = storedTime != null ? storedTime : this.auditorCreatedAt;
386
+ const creationTime = storedTime ?? this.auditorCreatedAt;
380
387
  const age = currentTime - creationTime;
381
388
  resources.push([token, age]);
382
389
  }
@@ -387,7 +394,7 @@ var _Auditor = class _Auditor {
387
394
  const tokens = familyNode.familyMembers.values();
388
395
  for (const token of tokens) {
389
396
  const storedTime = this.statesCreatedAt.get(token.key);
390
- const creationTime = storedTime != null ? storedTime : this.auditorCreatedAt;
397
+ const creationTime = storedTime ?? this.auditorCreatedAt;
391
398
  const age = currentTime - creationTime;
392
399
  resources.push([token, age]);
393
400
  }
@@ -403,10 +410,5 @@ var _Auditor = class _Auditor {
403
410
  this.disposed = true;
404
411
  }
405
412
  };
406
- _Auditor.DEFAULT_LIST_RESOURCES_PARAM = {
407
- atomFamilies: true,
408
- selectorFamilies: true
409
- };
410
- var Auditor = _Auditor;
411
413
 
412
414
  export { Auditor, attachIntrospectionStates };
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-introspection",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }
@@ -1,23 +1,12 @@
1
1
  import * as AtomIO from 'atom.io';
2
2
  import { Store, Transceiver } from 'atom.io/internal';
3
3
 
4
- declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
5
-
6
- declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
7
- declare function selectJsonFamily<T, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
8
-
9
4
  type JsonInterface<T, J extends Serializable = Serializable> = {
10
5
  toJson: (t: T) => J;
11
6
  fromJson: (json: J) => T;
12
7
  };
13
- declare const stringSetJsonInterface: JsonInterface<Set<string>, Array<string>>;
14
8
 
15
9
  type primitive = boolean | number | string | null;
16
- declare const isString: (input: unknown) => input is string;
17
- declare const isNumber: (input: unknown) => input is number;
18
- declare const isBoolean: (input: unknown) => input is boolean;
19
- declare const isNull: (input: unknown) => input is null;
20
- declare const isPrimitive: (input: unknown) => input is primitive;
21
10
 
22
11
  type Serializable = primitive | Readonly<{
23
12
  [key: string]: Serializable;
@@ -31,24 +20,18 @@ declare namespace json {
31
20
  export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
32
21
  }
33
22
 
34
- declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J> ? J : Serializable;
35
- type Stringified<J extends Serializable> = string & {
23
+ declare const parseJson: <S extends stringified<Serializable>>(str: S | string) => S extends stringified<infer J> ? J : Serializable;
24
+ type stringified<J extends Serializable> = string & {
36
25
  __json: J;
37
26
  };
38
- declare const stringifyJson: <J extends Serializable>(json: J) => Stringified<J>;
39
- type Empty = Record<string, never>;
40
- declare const JSON_TYPE_NAMES: readonly ["array", "boolean", "null", "number", "object", "string"];
41
- type JsonTypeName = (typeof JSON_TYPE_NAMES)[number];
42
- interface JsonTypes extends Record<JsonTypeName, Serializable> {
43
- array: Array;
44
- boolean: boolean;
45
- null: null;
46
- number: number;
47
- object: Object$1;
48
- string: string;
49
- }
50
- declare const JSON_DEFAULTS: JsonTypes;
27
+ declare const stringifyJson: <J extends Serializable>(json: J) => stringified<J>;
28
+
29
+ declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
30
+
31
+ declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
32
+ declare function selectJsonFamily<T, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
51
33
 
34
+ type Canonical = primitive | ReadonlyArray<Canonical>;
52
35
  type JsonIO = (...params: Serializable[]) => Serializable | void;
53
36
 
54
- export { type Empty, JSON_DEFAULTS, JSON_TYPE_NAMES, json as Json, type JsonIO, type JsonInterface, type JsonTypeName, type JsonTypes, type Stringified, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, type primitive, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson };
37
+ export { type Canonical, json as Json, type JsonIO, type JsonInterface, parseJson, type primitive, selectJson, selectJsonFamily, type stringified, stringifyJson };
@@ -1,6 +1,6 @@
1
- import { stringifyJson, parseJson } from '../../dist/chunk-BF4MVQF6.js';
2
- export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-BF4MVQF6.js';
3
- import '../../dist/chunk-S4N6XNPH.js';
1
+ import { stringifyJson, parseJson } from '../../dist/chunk-AK23DRMD.js';
2
+ export { parseJson, stringifyJson } from '../../dist/chunk-AK23DRMD.js';
3
+ import '../../dist/chunk-XWL6SNVU.js';
4
4
  import { createStandaloneSelector, IMPLICIT, createSelectorFamily, growMoleculeInStore, initFamilyMemberInStore, seekInStore } from 'atom.io/internal';
5
5
 
6
6
  var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
package/json/package.json CHANGED
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-json",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }
package/json/src/index.ts CHANGED
@@ -1,8 +1,13 @@
1
+ import type { Json, JsonInterface, stringified } from "~/packages/anvl/src/json"
2
+ import { parseJson, stringifyJson } from "~/packages/anvl/src/json"
3
+ import type { primitive } from "~/packages/anvl/src/primitive"
4
+
1
5
  export * from "./select-json"
2
6
  export * from "./select-json-family"
3
- export * from "~/packages/anvl/src/json"
4
- export * from "~/packages/anvl/src/primitive"
5
7
 
6
- import type { Json } from "~/packages/anvl/src/json"
8
+ export type { Json, JsonInterface, primitive, stringified }
9
+ export { parseJson, stringifyJson }
10
+
11
+ export type Canonical = primitive | ReadonlyArray<Canonical>
7
12
 
8
13
  export type JsonIO = (...params: Json.Serializable[]) => Json.Serializable | void
@@ -8,13 +8,13 @@ import {
8
8
  seekInStore,
9
9
  } from "atom.io/internal"
10
10
 
11
- import type { Json, JsonInterface } from "."
11
+ import type { Canonical, Json, JsonInterface } from "."
12
12
  import { parseJson, stringifyJson } from "."
13
13
 
14
14
  export function selectJsonFamily<
15
15
  T extends Transceiver<any>,
16
16
  J extends Json.Serializable,
17
- K extends Json.Serializable,
17
+ K extends Canonical,
18
18
  >(
19
19
  atomFamily: AtomIO.MutableAtomFamily<T, J, K>,
20
20
  transform: JsonInterface<T, J>,
@@ -23,7 +23,7 @@ export function selectJsonFamily<
23
23
  export function selectJsonFamily<
24
24
  T,
25
25
  J extends Json.Serializable,
26
- K extends Json.Serializable,
26
+ K extends Canonical,
27
27
  >(
28
28
  atomFamily: AtomIO.RegularAtomFamily<T, K>,
29
29
  transform: JsonInterface<T, J>,
@@ -32,7 +32,7 @@ export function selectJsonFamily<
32
32
  export function selectJsonFamily<
33
33
  T,
34
34
  J extends Json.Serializable,
35
- K extends Json.Serializable,
35
+ K extends Canonical,
36
36
  >(
37
37
  family:
38
38
  | AtomIO.MutableAtomFamily<T extends Transceiver<any> ? T : never, J, K>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.25.6",
3
+ "version": "0.27.0",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -19,6 +19,7 @@
19
19
  "@floating-ui/react": ">=0.25.0",
20
20
  "@floating-ui/react-dom": ">=2.0.0",
21
21
  "@testing-library/react": ">=14.0.0",
22
+ "eslint": ">=9.0.0",
22
23
  "framer-motion": ">=10.0.0",
23
24
  "react": ">=18.0.0",
24
25
  "socket.io": ">=4.0.0",
@@ -37,6 +38,9 @@
37
38
  "@floating-ui/react-dom": {
38
39
  "optional": true
39
40
  },
41
+ "eslint": {
42
+ "optional": true
43
+ },
40
44
  "framer-motion": {
41
45
  "optional": true
42
46
  },
@@ -49,23 +53,21 @@
49
53
  },
50
54
  "devDependencies": {
51
55
  "@testing-library/react": "16.0.0",
52
- "@types/eslint": "npm:@types/eslint@9.6.0",
53
- "@types/eslint-v9": "npm:@types/eslint@9.6.0",
56
+ "@types/eslint": "9.6.0",
54
57
  "@types/estree": "1.0.5",
55
- "@types/http-proxy": "1.17.14",
58
+ "@types/http-proxy": "1.17.15",
56
59
  "@types/npmlog": "7.0.0",
57
60
  "@types/react": "18.3.3",
58
61
  "@types/tmp": "0.2.6",
59
- "@typescript-eslint/parser": "8.0.0",
60
- "@typescript-eslint/rule-tester": "8.0.0",
62
+ "@typescript-eslint/parser": "8.0.1",
63
+ "@typescript-eslint/rule-tester": "8.0.1",
61
64
  "@vitest/coverage-v8": "2.0.5",
62
65
  "@vitest/ui": "2.0.5",
63
66
  "concurrently": "8.2.2",
64
- "drizzle-kit": "0.23.1",
65
- "drizzle-orm": "0.32.1",
66
- "eslint": "npm:eslint@8.57.0",
67
- "eslint-v9": "npm:eslint@9.8.0",
68
- "framer-motion": "11.3.19",
67
+ "drizzle-kit": "0.24.0",
68
+ "drizzle-orm": "0.33.0",
69
+ "eslint": "9.9.0",
70
+ "framer-motion": "11.3.24",
69
71
  "happy-dom": "14.12.3",
70
72
  "http-proxy": "1.18.1",
71
73
  "npmlog": "7.0.1",
@@ -73,15 +75,15 @@
73
75
  "preact": "10.23.1",
74
76
  "react": "18.3.1",
75
77
  "react-dom": "18.3.1",
76
- "react-router-dom": "6.25.1",
78
+ "react-router-dom": "6.26.0",
77
79
  "socket.io": "4.7.5",
78
80
  "socket.io-client": "4.7.5",
79
81
  "tmp": "0.2.3",
80
- "tsup": "8.2.3",
81
- "tsx": "4.16.3",
82
+ "tsup": "8.2.4",
83
+ "tsx": "4.17.0",
82
84
  "typescript": "5.5.4",
83
- "vite": "5.3.5",
84
- "vite-tsconfig-paths": "4.3.2",
85
+ "vite": "5.4.0",
86
+ "vite-tsconfig-paths": "5.0.1",
85
87
  "vitest": "2.0.5"
86
88
  },
87
89
  "main": "dist/index.js",
@@ -138,115 +140,83 @@
138
140
  "exports": {
139
141
  "./package.json": "./package.json",
140
142
  ".": {
141
- "types": "./dist/index.d.ts",
142
- "browser": "./dist/index.js",
143
143
  "import": "./dist/index.js",
144
- "require": "./dist/index.cjs"
144
+ "types": "./dist/index.d.ts"
145
145
  },
146
146
  "./data/package.json": "./data/package.json",
147
147
  "./data": {
148
- "types": "./data/dist/index.d.ts",
149
- "browser": "./data/dist/index.js",
150
148
  "import": "./data/dist/index.js",
151
- "require": "./data/dist/index.cjs"
149
+ "types": "./data/dist/index.d.ts"
152
150
  },
153
151
  "./ephemeral/package.json": "./ephemeral/package.json",
154
152
  "./ephemeral": {
155
- "types": "./ephemeral/dist/index.d.ts",
156
- "browser": "./ephemeral/dist/index.js",
157
153
  "import": "./ephemeral/dist/index.js",
158
- "require": "./ephemeral/dist/index.cjs"
154
+ "types": "./ephemeral/dist/index.d.ts"
159
155
  },
160
156
  "./eslint-plugin/package.json": "./eslint-plugin/package.json",
161
157
  "./eslint-plugin": {
162
- "types": "./eslint-plugin/dist/index.d.ts",
163
- "browser": "./eslint-plugin/dist/index.js",
164
158
  "import": "./eslint-plugin/dist/index.js",
165
- "require": "./eslint-plugin/dist/index.cjs"
159
+ "types": "./eslint-plugin/dist/index.d.ts"
166
160
  },
167
161
  "./immortal/package.json": "./immortal/package.json",
168
162
  "./immortal": {
169
- "types": "./immortal/dist/index.d.ts",
170
- "browser": "./immortal/dist/index.js",
171
163
  "import": "./immortal/dist/index.js",
172
- "require": "./immortal/dist/index.cjs"
164
+ "types": "./immortal/dist/index.d.ts"
173
165
  },
174
166
  "./internal/package.json": "./internal/package.json",
175
167
  "./internal": {
176
- "types": "./internal/dist/index.d.ts",
177
- "browser": "./internal/dist/index.js",
178
168
  "import": "./internal/dist/index.js",
179
- "require": "./internal/dist/index.cjs"
169
+ "types": "./internal/dist/index.d.ts"
180
170
  },
181
171
  "./introspection/package.json": "./introspection/package.json",
182
172
  "./introspection": {
183
- "types": "./introspection/dist/index.d.ts",
184
- "browser": "./introspection/dist/index.js",
185
173
  "import": "./introspection/dist/index.js",
186
- "require": "./introspection/dist/index.cjs"
174
+ "types": "./introspection/dist/index.d.ts"
187
175
  },
188
176
  "./json/package.json": "./json/package.json",
189
177
  "./json": {
190
- "types": "./json/dist/index.d.ts",
191
- "browser": "./json/dist/index.js",
192
178
  "import": "./json/dist/index.js",
193
- "require": "./json/dist/index.cjs"
179
+ "types": "./json/dist/index.d.ts"
194
180
  },
195
181
  "./react/package.json": "./react/package.json",
196
182
  "./react": {
197
- "types": "./react/dist/index.d.ts",
198
- "browser": "./react/dist/index.js",
199
183
  "import": "./react/dist/index.js",
200
- "require": "./react/dist/index.cjs"
184
+ "types": "./react/dist/index.d.ts"
201
185
  },
202
186
  "./react-devtools/package.json": "./react-devtools/package.json",
203
187
  "./react-devtools": {
204
- "types": "./react-devtools/dist/index.d.ts",
205
- "browser": "./react-devtools/dist/index.js",
206
188
  "import": "./react-devtools/dist/index.js",
207
- "require": "./react-devtools/dist/index.cjs"
189
+ "types": "./react-devtools/dist/index.d.ts"
208
190
  },
209
191
  "./realtime/package.json": "./realtime/package.json",
210
192
  "./realtime": {
211
- "types": "./realtime/dist/index.d.ts",
212
- "browser": "./realtime/dist/index.js",
213
193
  "import": "./realtime/dist/index.js",
214
- "require": "./realtime/dist/index.cjs"
194
+ "types": "./realtime/dist/index.d.ts"
215
195
  },
216
196
  "./realtime-client/package.json": "./realtime-client/package.json",
217
197
  "./realtime-client": {
218
- "types": "./realtime-client/dist/index.d.ts",
219
- "browser": "./realtime-client/dist/index.js",
220
198
  "import": "./realtime-client/dist/index.js",
221
- "require": "./realtime-client/dist/index.cjs"
199
+ "types": "./realtime-client/dist/index.d.ts"
222
200
  },
223
201
  "./realtime-react/package.json": "./realtime-react/package.json",
224
202
  "./realtime-react": {
225
- "types": "./realtime-react/dist/index.d.ts",
226
- "browser": "./realtime-react/dist/index.js",
227
203
  "import": "./realtime-react/dist/index.js",
228
- "require": "./realtime-react/dist/index.cjs"
204
+ "types": "./realtime-react/dist/index.d.ts"
229
205
  },
230
206
  "./realtime-server/package.json": "./realtime-server/package.json",
231
207
  "./realtime-server": {
232
- "types": "./realtime-server/dist/index.d.ts",
233
- "browser": "./realtime-server/dist/index.js",
234
208
  "import": "./realtime-server/dist/index.js",
235
- "require": "./realtime-server/dist/index.cjs"
209
+ "types": "./realtime-server/dist/index.d.ts"
236
210
  },
237
211
  "./realtime-testing/package.json": "./realtime-testing/package.json",
238
212
  "./realtime-testing": {
239
- "types": "./realtime-testing/dist/index.d.ts",
240
- "browser": "./realtime-testing/dist/index.js",
241
213
  "import": "./realtime-testing/dist/index.js",
242
- "require": "./realtime-testing/dist/index.cjs"
214
+ "types": "./realtime-testing/dist/index.d.ts"
243
215
  },
244
216
  "./transceivers/set-rtx/package.json": "./transceivers/set-rtx/package.json",
245
217
  "./transceivers/set-rtx": {
246
- "types": "./transceivers/set-rtx/dist/index.d.ts",
247
- "browser": "./transceivers/set-rtx/dist/index.js",
248
218
  "import": "./transceivers/set-rtx/dist/index.js",
249
- "require": "./transceivers/set-rtx/dist/index.cjs"
219
+ "types": "./transceivers/set-rtx/dist/index.d.ts"
250
220
  }
251
221
  },
252
222
  "scripts": {
@@ -271,9 +241,10 @@
271
241
  "build:realtime-testing": "cd realtime-testing && tsup",
272
242
  "build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
273
243
  "lint:biome": "biome check -- .",
274
- "lint:eslint": "eslint .",
244
+ "lint:eslint": "eslint --flag unstable_ts_config -- .",
275
245
  "lint:eslint:build": "bun run build:main",
276
246
  "lint:types": "tsc --noEmit",
247
+ "lint:types:watch": "tsc --watch --noEmit",
277
248
  "lint": "bun run lint:biome && bun run lint:eslint && bun run lint:types",
278
249
  "test": "vitest",
279
250
  "test:coverage": "vitest run --coverage",
@@ -1,7 +1,7 @@
1
1
  import { Store } from 'atom.io/internal';
2
2
  import * as React from 'react';
3
3
  import { WritableToken, WritableFamilyToken, MutableAtomToken, MutableAtomFamilyToken, ReadableToken, ReadableFamilyToken, TimelineToken } from 'atom.io';
4
- import { Json } from 'atom.io/json';
4
+ import { Canonical, Json } from 'atom.io/json';
5
5
 
6
6
  declare const StoreContext: React.Context<Store>;
7
7
  declare const StoreProvider: React.FC<{
@@ -10,13 +10,13 @@ declare const StoreProvider: React.FC<{
10
10
  }>;
11
11
 
12
12
  declare function useI<T>(token: WritableToken<T>): <New extends T>(next: New | ((old: T) => New)) => void;
13
- declare function useI<T, K extends Json.Serializable>(token: WritableFamilyToken<T, K>, key: K): <New extends T>(next: New | ((old: T) => New)) => void;
13
+ declare function useI<T, K extends Canonical>(token: WritableFamilyToken<T, K>, key: K): <New extends T>(next: New | ((old: T) => New)) => void;
14
14
 
15
15
  declare function useJSON<Serializable extends Json.Serializable>(token: MutableAtomToken<any, Serializable>): Serializable;
16
- declare function useJSON<Serializable extends Json.Serializable, Key extends Json.Serializable>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable;
16
+ declare function useJSON<Serializable extends Json.Serializable, Key extends Canonical>(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable;
17
17
 
18
18
  declare function useO<T>(token: ReadableToken<T>): T;
19
- declare function useO<T, K extends Json.Serializable>(token: ReadableFamilyToken<T, K>, key: K): T;
19
+ declare function useO<T, K extends Canonical>(token: ReadableFamilyToken<T, K>, key: K): T;
20
20
 
21
21
  type TimelineMeta = {
22
22
  at: number;
@@ -1,4 +1,4 @@
1
- import '../../dist/chunk-S4N6XNPH.js';
1
+ import '../../dist/chunk-XWL6SNVU.js';
2
2
  import { IMPLICIT, setIntoStore, subscribeToState, getFromStore, findInStore, getJsonToken, withdraw, subscribeToTimeline, seekInStore, NotFoundError } from 'atom.io/internal';
3
3
  import * as React5 from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -75,7 +75,7 @@ function useTL(token) {
75
75
  };
76
76
  const meta = React5.useRef(rebuildMeta());
77
77
  const retrieve = () => {
78
- if (meta.current.at !== (timeline == null ? void 0 : timeline.at) || meta.current.length !== (timeline == null ? void 0 : timeline.history.length) || tokenRef.current !== token) {
78
+ if (meta.current.at !== timeline?.at || meta.current.length !== timeline?.history.length || tokenRef.current !== token) {
79
79
  tokenRef.current = token;
80
80
  meta.current = rebuildMeta();
81
81
  }
@@ -2,14 +2,11 @@
2
2
  "name": "atom.io-react",
3
3
  "type": "module",
4
4
  "private": true,
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "exports": {
9
8
  ".": {
10
9
  "import": "./dist/index.js",
11
- "browser": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
10
  "types": "./dist/index.d.ts"
14
11
  }
15
12
  }
@@ -6,19 +6,19 @@ import type {
6
6
  } from "atom.io"
7
7
  import type { Store } from "atom.io/internal"
8
8
  import { findInStore, NotFoundError, seekInStore } from "atom.io/internal"
9
- import type { Json } from "atom.io/json"
9
+ import type { Canonical, Json } from "atom.io/json"
10
10
 
11
- export function parseStateOverloads<T, K extends Json.Serializable>(
11
+ export function parseStateOverloads<T, K extends Canonical>(
12
12
  store: Store,
13
13
  ...rest: [WritableFamilyToken<T, K>, K] | [WritableToken<T>]
14
14
  ): WritableToken<T>
15
15
 
16
- export function parseStateOverloads<T, K extends Json.Serializable>(
16
+ export function parseStateOverloads<T, K extends Canonical>(
17
17
  store: Store,
18
18
  ...rest: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
19
19
  ): ReadableToken<T>
20
20
 
21
- export function parseStateOverloads<T, K extends Json.Serializable>(
21
+ export function parseStateOverloads<T, K extends Canonical>(
22
22
  store: Store,
23
23
  ...rest: [ReadableFamilyToken<T, K>, K] | [ReadableToken<T>]
24
24
  ): ReadableToken<T> {
@@ -1,6 +1,6 @@
1
1
  import type { WritableFamilyToken, WritableToken } from "atom.io"
2
2
  import { setIntoStore } from "atom.io/internal"
3
- import type { Json } from "atom.io/json"
3
+ import type { Canonical } from "atom.io/json"
4
4
  import * as React from "react"
5
5
 
6
6
  import { parseStateOverloads } from "./parse-state-overloads"
@@ -10,12 +10,12 @@ export function useI<T>(
10
10
  token: WritableToken<T>,
11
11
  ): <New extends T>(next: New | ((old: T) => New)) => void
12
12
 
13
- export function useI<T, K extends Json.Serializable>(
13
+ export function useI<T, K extends Canonical>(
14
14
  token: WritableFamilyToken<T, K>,
15
15
  key: K,
16
16
  ): <New extends T>(next: New | ((old: T) => New)) => void
17
17
 
18
- export function useI<T, K extends Json.Serializable>(
18
+ export function useI<T, K extends Canonical>(
19
19
  ...params: [WritableFamilyToken<T, K>, K] | [WritableToken<T>]
20
20
  ): <New extends T>(next: New | ((old: T) => New)) => void {
21
21
  const store = React.useContext(StoreContext)
@@ -4,7 +4,7 @@ import type {
4
4
  ReadableToken,
5
5
  } from "atom.io"
6
6
  import { findInStore, getJsonToken } from "atom.io/internal"
7
- import type { Json } from "atom.io/json"
7
+ import type { Canonical, Json } from "atom.io/json"
8
8
  import * as React from "react"
9
9
 
10
10
  import { StoreContext } from "./store-context"
@@ -16,12 +16,12 @@ export function useJSON<Serializable extends Json.Serializable>(
16
16
 
17
17
  export function useJSON<
18
18
  Serializable extends Json.Serializable,
19
- Key extends Json.Serializable,
19
+ Key extends Canonical,
20
20
  >(token: MutableAtomFamilyToken<any, Serializable, Key>, key: Key): Serializable
21
21
 
22
22
  export function useJSON<
23
23
  Serializable extends Json.Serializable,
24
- Key extends Serializable,
24
+ Key extends Canonical,
25
25
  >(
26
26
  token:
27
27
  | MutableAtomFamilyToken<any, Serializable, Key>