atom.io 0.19.3 → 0.20.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 (104) hide show
  1. package/data/dist/index.js +1 -1
  2. package/data/src/dict.ts +1 -1
  3. package/data/src/join.ts +1 -1
  4. package/data/src/struct-family.ts +1 -1
  5. package/data/src/struct.ts +5 -3
  6. package/eslint-plugin/dist/index.cjs +53 -0
  7. package/eslint-plugin/dist/index.js +52 -0
  8. package/eslint-plugin/src/index.ts +1 -0
  9. package/eslint-plugin/src/rules/explicit-state-types.ts +55 -0
  10. package/eslint-plugin/src/rules/index.ts +1 -0
  11. package/internal/dist/index.cjs +127 -92
  12. package/internal/dist/index.d.ts +13 -9
  13. package/internal/dist/index.js +127 -92
  14. package/internal/src/atom/index.ts +1 -1
  15. package/internal/src/caching.ts +13 -9
  16. package/internal/src/families/create-atom-family.ts +1 -1
  17. package/internal/src/families/find-in-store.ts +2 -2
  18. package/internal/src/families/index.ts +1 -1
  19. package/internal/src/future.ts +52 -15
  20. package/internal/src/index.ts +2 -2
  21. package/internal/src/mutable/create-mutable-atom-family.ts +2 -3
  22. package/internal/src/mutable/create-mutable-atom.ts +3 -3
  23. package/internal/src/mutable/get-update-token.ts +1 -0
  24. package/internal/src/selector/delete-selector.ts +1 -1
  25. package/internal/src/selector/register-selector.ts +1 -1
  26. package/internal/src/store/deposit.ts +1 -1
  27. package/internal/src/store/store.ts +2 -2
  28. package/internal/src/store/withdraw-new-family-member.ts +1 -1
  29. package/internal/src/store/withdraw.ts +2 -3
  30. package/internal/src/subscribe/subscribe-to-state.ts +1 -0
  31. package/internal/src/subscribe/subscribe-to-timeline.ts +1 -0
  32. package/internal/src/subscribe/subscribe-to-transaction.ts +2 -1
  33. package/internal/src/timeline/add-atom-to-timeline.ts +2 -2
  34. package/internal/src/timeline/create-timeline.ts +1 -1
  35. package/internal/src/transaction/act-upon-store.ts +1 -1
  36. package/internal/src/transaction/apply-transaction.ts +1 -1
  37. package/internal/src/transaction/build-transaction.ts +2 -2
  38. package/internal/src/transaction/create-transaction.ts +2 -2
  39. package/internal/src/transaction/index.ts +1 -1
  40. package/internal/src/transaction/is-root-store.ts +1 -1
  41. package/introspection/src/attach-atom-index.ts +1 -1
  42. package/introspection/src/attach-introspection-states.ts +2 -2
  43. package/introspection/src/attach-selector-index.ts +1 -1
  44. package/introspection/src/attach-timeline-family.ts +2 -2
  45. package/introspection/src/attach-timeline-index.ts +1 -1
  46. package/introspection/src/attach-transaction-index.ts +2 -2
  47. package/introspection/src/attach-transaction-logs.ts +2 -2
  48. package/json/dist/index.cjs +35 -33
  49. package/json/dist/index.d.ts +5 -5
  50. package/json/dist/index.js +5 -5
  51. package/json/src/index.ts +2 -3
  52. package/json/src/select-json-family.ts +6 -6
  53. package/json/src/select-json.ts +1 -2
  54. package/package.json +18 -15
  55. package/react/src/use-tl.ts +1 -1
  56. package/react-devtools/dist/index.cjs +99 -99
  57. package/react-devtools/dist/index.css +0 -3
  58. package/react-devtools/dist/index.d.ts +2 -2
  59. package/react-devtools/dist/index.js +77 -77
  60. package/react-devtools/src/AtomIODevtools.tsx +2 -2
  61. package/react-devtools/src/TransactionIndex.tsx +2 -2
  62. package/react-devtools/src/Updates.tsx +1 -1
  63. package/react-devtools/src/devtools.scss +0 -3
  64. package/react-devtools/src/index.ts +1 -1
  65. package/realtime/src/realtime-continuity.ts +1 -1
  66. package/realtime/src/shared-room-store.ts +1 -1
  67. package/realtime-client/dist/index.js +1 -1
  68. package/realtime-client/src/pull-atom-family-member.ts +1 -1
  69. package/realtime-client/src/pull-atom.ts +1 -1
  70. package/realtime-client/src/pull-mutable-atom-family-member.ts +2 -2
  71. package/realtime-client/src/sync-continuity.ts +1 -1
  72. package/realtime-react/dist/index.js +1 -1
  73. package/realtime-react/src/use-realtime-service.ts +1 -0
  74. package/realtime-react/src/use-sync-continuity.ts +2 -1
  75. package/realtime-server/dist/index.cjs +98 -98
  76. package/realtime-server/dist/index.d.ts +17 -18
  77. package/realtime-server/dist/index.js +100 -100
  78. package/realtime-server/src/index.ts +5 -5
  79. package/realtime-server/src/ipc-sockets/parent-socket.ts +3 -3
  80. package/realtime-server/src/realtime-action-receiver.ts +1 -1
  81. package/realtime-server/src/realtime-continuity-synchronizer.ts +2 -3
  82. package/realtime-server/src/realtime-family-provider.ts +1 -1
  83. package/realtime-server/src/realtime-mutable-family-provider.ts +1 -1
  84. package/realtime-server/src/realtime-mutable-provider.ts +2 -2
  85. package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +2 -2
  86. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +1 -1
  87. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +1 -0
  88. package/realtime-server/src/realtime-server-stores/server-user-store.ts +3 -2
  89. package/realtime-server/src/realtime-state-provider.ts +1 -1
  90. package/realtime-server/src/realtime-state-synchronizer.ts +1 -1
  91. package/realtime-testing/dist/index.js +2 -2
  92. package/realtime-testing/src/setup-realtime-test.tsx +3 -2
  93. package/src/atom.ts +1 -1
  94. package/src/find-state.ts +1 -1
  95. package/src/index.ts +1 -0
  96. package/src/selector.ts +1 -1
  97. package/src/silo.ts +4 -4
  98. package/src/subscribe.ts +2 -2
  99. package/src/timeline.ts +1 -1
  100. package/src/transaction.ts +3 -3
  101. package/transceivers/set-rtx/src/set-rtx.ts +1 -1
  102. package/dist/{chunk-ATKDGVTV.js → chunk-2AIFLP2B.js} +0 -0
  103. package/dist/{chunk-CC7IF7QF.js → chunk-3V3VWQ7X.js} +6 -6
  104. /package/dist/{chunk-MSCJWACE.js → chunk-SMZRGPN6.js} +0 -0
@@ -1,13 +1,13 @@
1
1
  import type {
2
+ Func,
2
3
  TransactionOptions,
3
4
  TransactionToken,
4
5
  TransactionUpdate,
5
- Func,
6
6
  } from "atom.io"
7
7
 
8
8
  import { newest } from "../lineage"
9
- import { deposit } from "../store"
10
9
  import type { Store } from "../store"
10
+ import { deposit } from "../store"
11
11
  import { Subject } from "../subject"
12
12
  import { abortTransaction } from "./abort-transaction"
13
13
  import { applyTransaction } from "./apply-transaction"
@@ -1,4 +1,4 @@
1
- import type { TransactionUpdate, TransactorsWithRunAndEnv, Func } from "atom.io"
1
+ import type { Func, TransactionUpdate, TransactorsWithRunAndEnv } from "atom.io"
2
2
  import type { Junction } from "rel8/junction"
3
3
 
4
4
  export * from "./abort-transaction"
@@ -1,7 +1,7 @@
1
1
  import type { Func } from "atom.io"
2
2
 
3
- import type { TransactionEpoch, TransactionProgress } from "."
4
3
  import type { Store } from "../store"
4
+ import type { TransactionEpoch, TransactionProgress } from "."
5
5
 
6
6
  export interface RootStore extends Store {
7
7
  transactionMeta: TransactionEpoch
@@ -1,9 +1,9 @@
1
1
  import type { AtomToken, ReadonlySelectorToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
- IMPLICIT,
5
4
  createRegularAtom,
6
5
  createStandaloneSelector,
6
+ IMPLICIT,
7
7
  newest,
8
8
  } from "atom.io/internal"
9
9
 
@@ -1,14 +1,14 @@
1
1
  import type {
2
+ Func,
2
3
  ReadonlySelectorFamily,
3
4
  ReadonlySelectorFamilyToken,
4
5
  ReadonlySelectorToken,
5
6
  TimelineToken,
6
7
  TransactionToken,
7
8
  TransactionUpdate,
8
- Func,
9
9
  } from "atom.io"
10
- import * as Internal from "atom.io/internal"
11
10
  import type { Timeline } from "atom.io/internal"
11
+ import * as Internal from "atom.io/internal"
12
12
 
13
13
  import { type AtomTokenIndex, attachAtomIndex } from "./attach-atom-index"
14
14
  import type { SelectorTokenIndex } from "./attach-selector-index"
@@ -1,9 +1,9 @@
1
1
  import type { ReadonlySelectorToken, WritableSelectorToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
- IMPLICIT,
5
4
  createRegularAtom,
6
5
  createStandaloneSelector,
6
+ IMPLICIT,
7
7
  newest,
8
8
  } from "atom.io/internal"
9
9
 
@@ -4,10 +4,10 @@ import type {
4
4
  } from "atom.io"
5
5
  import type { Store, Timeline } from "atom.io/internal"
6
6
  import {
7
- IMPLICIT,
8
- Subject,
9
7
  createRegularAtomFamily,
10
8
  createSelectorFamily,
9
+ IMPLICIT,
10
+ Subject,
11
11
  } from "atom.io/internal"
12
12
 
13
13
  export const attachTimelineFamily = (
@@ -1,9 +1,9 @@
1
1
  import type { ReadonlySelectorToken, TimelineToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
- IMPLICIT,
5
4
  createRegularAtom,
6
5
  createStandaloneSelector,
6
+ IMPLICIT,
7
7
  } from "atom.io/internal"
8
8
 
9
9
  export const attachTimelineIndex = (
@@ -1,9 +1,9 @@
1
- import type { ReadonlySelectorToken, TransactionToken, Func } from "atom.io"
1
+ import type { Func, ReadonlySelectorToken, TransactionToken } from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
3
  import {
4
- IMPLICIT,
5
4
  createRegularAtom,
6
5
  createStandaloneSelector,
6
+ IMPLICIT,
7
7
  } from "atom.io/internal"
8
8
 
9
9
  export const attachTransactionIndex = (
@@ -1,13 +1,13 @@
1
1
  import type {
2
+ Func,
2
3
  ReadonlySelectorFamilyToken,
3
4
  TransactionUpdate,
4
- Func,
5
5
  } from "atom.io"
6
6
  import type { Store } from "atom.io/internal"
7
7
  import {
8
- IMPLICIT,
9
8
  createRegularAtomFamily,
10
9
  createSelectorFamily,
10
+ IMPLICIT,
11
11
  } from "atom.io/internal"
12
12
 
13
13
  export const attachTransactionLogs = (
@@ -2,6 +2,41 @@
2
2
 
3
3
  var internal = require('atom.io/internal');
4
4
 
5
+ // json/src/select-json.ts
6
+ var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
7
+ return internal.createStandaloneSelector(
8
+ {
9
+ key: `${atom.key}:JSON`,
10
+ get: ({ get }) => transform.toJson(get(atom)),
11
+ set: ({ set }, newValue) => {
12
+ set(atom, transform.fromJson(newValue));
13
+ }
14
+ },
15
+ store
16
+ );
17
+ };
18
+ function selectJsonFamily(family, transform, store = internal.IMPLICIT.STORE) {
19
+ const jsonFamily = internal.createSelectorFamily(
20
+ {
21
+ key: `${family.key}:JSON`,
22
+ get: (key) => ({ get }) => transform.toJson(get(family(key))),
23
+ set: (key) => ({ set }, newValue) => {
24
+ set(family(key), transform.fromJson(newValue));
25
+ }
26
+ },
27
+ store
28
+ );
29
+ family.subject.subscribe(
30
+ `store=${store.config.name}::json-selector-family`,
31
+ (token) => {
32
+ if (token.family) {
33
+ jsonFamily(parseJson(token.family.subKey));
34
+ }
35
+ }
36
+ );
37
+ return jsonFamily;
38
+ }
39
+
5
40
  // ../anvl/src/json/json-interface.ts
6
41
  var stringSetJsonInterface = {
7
42
  toJson: (stringSet) => Array.from(stringSet),
@@ -44,39 +79,6 @@ var isNull = (input) => {
44
79
  var isPrimitive = (input) => {
45
80
  return isString(input) || isNumber(input) || isBoolean(input) || isNull(input);
46
81
  };
47
- var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
48
- return internal.createStandaloneSelector(
49
- {
50
- key: `${atom.key}:JSON`,
51
- get: ({ get }) => transform.toJson(get(atom)),
52
- set: ({ set }, newValue) => {
53
- set(atom, transform.fromJson(newValue));
54
- }
55
- },
56
- store
57
- );
58
- };
59
- function selectJsonFamily(atomFamily, transform, store = internal.IMPLICIT.STORE) {
60
- const jsonFamily = internal.createSelectorFamily(
61
- {
62
- key: `${atomFamily.key}:JSON`,
63
- get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
64
- set: (key) => ({ set }, newValue) => {
65
- set(atomFamily(key), transform.fromJson(newValue));
66
- }
67
- },
68
- store
69
- );
70
- atomFamily.subject.subscribe(
71
- `store=${store.config.name}::json-selector-family`,
72
- (token) => {
73
- if (token.family) {
74
- jsonFamily(parseJson(token.family.subKey));
75
- }
76
- }
77
- );
78
- return jsonFamily;
79
- }
80
82
 
81
83
  exports.JSON_DEFAULTS = JSON_DEFAULTS;
82
84
  exports.JSON_TYPE_NAMES = JSON_TYPE_NAMES;
@@ -1,6 +1,11 @@
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
+
4
9
  type JsonInterface<T, J extends Serializable = Serializable> = {
5
10
  toJson: (t: T) => J;
6
11
  fromJson: (json: J) => T;
@@ -44,11 +49,6 @@ interface JsonTypes extends Record<JsonTypeName, Serializable> {
44
49
  }
45
50
  declare const JSON_DEFAULTS: JsonTypes;
46
51
 
47
- declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
48
-
49
- 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>;
50
- 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>;
51
-
52
52
  type JsonIO = (...params: Serializable[]) => Serializable | void;
53
53
 
54
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 };
@@ -15,18 +15,18 @@ var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
15
15
  store
16
16
  );
17
17
  };
18
- function selectJsonFamily(atomFamily, transform, store = IMPLICIT.STORE) {
18
+ function selectJsonFamily(family, transform, store = IMPLICIT.STORE) {
19
19
  const jsonFamily = createSelectorFamily(
20
20
  {
21
- key: `${atomFamily.key}:JSON`,
22
- get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
21
+ key: `${family.key}:JSON`,
22
+ get: (key) => ({ get }) => transform.toJson(get(family(key))),
23
23
  set: (key) => ({ set }, newValue) => {
24
- set(atomFamily(key), transform.fromJson(newValue));
24
+ set(family(key), transform.fromJson(newValue));
25
25
  }
26
26
  },
27
27
  store
28
28
  );
29
- atomFamily.subject.subscribe(
29
+ family.subject.subscribe(
30
30
  `store=${store.config.name}::json-selector-family`,
31
31
  (token) => {
32
32
  if (token.family) {
package/json/src/index.ts CHANGED
@@ -1,8 +1,7 @@
1
- export * from "~/packages/anvl/src/json"
2
- export * from "~/packages/anvl/src/primitive"
3
-
4
1
  export * from "./select-json"
5
2
  export * from "./select-json-family"
3
+ export * from "~/packages/anvl/src/json"
4
+ export * from "~/packages/anvl/src/primitive"
6
5
 
7
6
  import type { Json } from "~/packages/anvl/src/json"
8
7
 
@@ -1,6 +1,6 @@
1
1
  import type * as AtomIO from "atom.io"
2
2
  import type { Store, Transceiver } from "atom.io/internal"
3
- import { IMPLICIT, createSelectorFamily } from "atom.io/internal"
3
+ import { createSelectorFamily, IMPLICIT } from "atom.io/internal"
4
4
 
5
5
  import type { Json, JsonInterface } from "."
6
6
  import { parseJson } from "."
@@ -28,7 +28,7 @@ export function selectJsonFamily<
28
28
  J extends Json.Serializable,
29
29
  K extends Json.Serializable,
30
30
  >(
31
- atomFamily:
31
+ family:
32
32
  | AtomIO.MutableAtomFamily<T extends Transceiver<any> ? T : never, J, K>
33
33
  | AtomIO.RegularAtomFamily<T, K>,
34
34
  transform: JsonInterface<T, J>,
@@ -36,20 +36,20 @@ export function selectJsonFamily<
36
36
  ): AtomIO.WritableSelectorFamily<J, K> {
37
37
  const jsonFamily = createSelectorFamily<J, K>(
38
38
  {
39
- key: `${atomFamily.key}:JSON`,
39
+ key: `${family.key}:JSON`,
40
40
  get:
41
41
  (key) =>
42
42
  ({ get }) =>
43
- transform.toJson(get(atomFamily(key))),
43
+ transform.toJson(get(family(key))),
44
44
  set:
45
45
  (key) =>
46
46
  ({ set }, newValue) => {
47
- set(atomFamily(key), transform.fromJson(newValue))
47
+ set(family(key), transform.fromJson(newValue))
48
48
  },
49
49
  },
50
50
  store,
51
51
  )
52
- atomFamily.subject.subscribe(
52
+ family.subject.subscribe(
53
53
  `store=${store.config.name}::json-selector-family`,
54
54
  (token) => {
55
55
  if (token.family) {
@@ -1,8 +1,7 @@
1
1
  import type * as AtomIO from "atom.io"
2
2
  import type { Store } from "atom.io/internal"
3
- import { IMPLICIT } from "atom.io/internal"
3
+ import { createStandaloneSelector, IMPLICIT } from "atom.io/internal"
4
4
 
5
- import { createStandaloneSelector } from "atom.io/internal"
6
5
  import type { Json, JsonInterface } from "."
7
6
 
8
7
  export const selectJson = <T, J extends Json.Serializable>(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.19.3",
3
+ "version": "0.20.0",
4
4
  "description": "Composable and testable reactive data library.",
5
5
  "homepage": "https://atom.io.fyi",
6
6
  "sideEffects": false,
@@ -48,21 +48,24 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@testing-library/react": "15.0.2",
52
- "@types/eslint": "8.56.9",
51
+ "@testing-library/react": "15.0.4",
52
+ "@types/eslint": "npm:@types/eslint@8.56.10",
53
+ "@types/eslint-v9": "npm:@types/eslint@8.56.10",
53
54
  "@types/estree": "1.0.5",
54
55
  "@types/http-proxy": "1.17.14",
55
56
  "@types/npmlog": "7.0.0",
56
- "@types/react": "18.2.78",
57
+ "@types/react": "18.2.79",
57
58
  "@types/tmp": "0.2.6",
58
- "@typescript-eslint/parser": "7.7.0",
59
- "@vitest/coverage-v8": "1.5.0",
60
- "@vitest/ui": "1.5.0",
59
+ "@typescript-eslint/parser": "7.7.1",
60
+ "@typescript-eslint/rule-tester": "7.7.1",
61
+ "@vitest/coverage-v8": "1.5.1",
62
+ "@vitest/ui": "1.5.1",
61
63
  "concurrently": "8.2.2",
62
- "drizzle-kit": "0.20.14",
63
- "drizzle-orm": "0.30.8",
64
- "eslint": "9.0.0",
65
- "framer-motion": "11.0.28",
64
+ "drizzle-kit": "0.20.17",
65
+ "drizzle-orm": "0.30.9",
66
+ "eslint": "npm:eslint@8.57.0",
67
+ "eslint-v9": "npm:eslint@9.1.1",
68
+ "framer-motion": "11.1.7",
66
69
  "happy-dom": "14.7.1",
67
70
  "http-proxy": "1.18.1",
68
71
  "npmlog": "7.0.1",
@@ -70,15 +73,15 @@
70
73
  "preact": "10.20.2",
71
74
  "react": "18.2.0",
72
75
  "react-dom": "18.2.0",
73
- "react-router-dom": "6.22.3",
76
+ "react-router-dom": "6.23.0",
74
77
  "socket.io": "4.7.5",
75
78
  "socket.io-client": "4.7.5",
76
79
  "tmp": "0.2.3",
77
80
  "tsup": "8.0.2",
78
81
  "typescript": "5.4.5",
79
- "vite": "5.2.8",
82
+ "vite": "5.2.10",
80
83
  "vite-tsconfig-paths": "4.3.2",
81
- "vitest": "1.5.0"
84
+ "vitest": "1.5.1"
82
85
  },
83
86
  "main": "dist/index.js",
84
87
  "types": "dist/index.d.ts",
@@ -245,7 +248,7 @@
245
248
  "build:realtime-testing": "cd realtime-testing && tsup",
246
249
  "build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
247
250
  "lint:biome": "biome check -- .",
248
- "lint:eslint": "eslint . --ignore-pattern={**/dist/**,**/coverage/**}",
251
+ "lint:eslint": "eslint .",
249
252
  "lint:eslint:build": "bun run build:main",
250
253
  "lint:types": "tsc --noEmit",
251
254
  "lint": "bun run lint:biome && bun run lint:eslint && bun run lint:types",
@@ -1,5 +1,5 @@
1
- import { redo, undo } from "atom.io"
2
1
  import type { TimelineToken } from "atom.io"
2
+ import { redo, undo } from "atom.io"
3
3
  import { subscribeToTimeline, withdraw } from "atom.io/internal"
4
4
  import * as React from "react"
5
5
 
@@ -40,6 +40,12 @@ var __objRest = (source, exclude) => {
40
40
  return target;
41
41
  };
42
42
 
43
+ // ../anvl/src/array/index.ts
44
+ var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
45
+ var map = (f) => (a) => a.map(f);
46
+ var every = (f = Boolean) => (a) => a.every(f);
47
+ var allTrue = every((x) => x === true);
48
+
43
49
  // ../anvl/src/function/pipe.ts
44
50
  function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
45
51
  switch (arguments.length) {
@@ -88,12 +94,6 @@ var fallback = (fn, fallbackValue) => {
88
94
  }
89
95
  };
90
96
 
91
- // ../anvl/src/array/index.ts
92
- var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
93
- var map = (f) => (a) => a.map(f);
94
- var every = (f = Boolean) => (a) => a.every(f);
95
- var allTrue = every((x) => x === true);
96
-
97
97
  // ../anvl/src/nullish/index.ts
98
98
  var isUndefined = (input) => input === void 0;
99
99
  var ifDefined = (validate) => (input) => isUndefined(input) || validate(input);
@@ -181,50 +181,59 @@ var delve = (obj, path) => {
181
181
  return found === void 0 ? new Error(`Not found`) : { found };
182
182
  };
183
183
 
184
- // ../anvl/src/refinement/refinery.ts
185
- var Refinery = class {
186
- constructor(supported) {
187
- this.supported = supported;
188
- }
189
- refine(input) {
190
- for (const [key, refiner] of Object.entries(this.supported)) {
191
- try {
192
- if (
193
- // @ts-expect-error that's the point
194
- refiner(input) === true && refiner !== Boolean
195
- ) {
196
- return { type: key, data: input };
197
- }
198
- } catch (e) {
199
- try {
200
- if (input instanceof refiner) {
201
- return { type: key, data: input };
202
- }
203
- } catch (_) {
204
- }
184
+ // ../anvl/src/refinement/can-exist.ts
185
+ var canExist = (_) => true;
186
+
187
+ // ../anvl/src/refinement/cannot-exist.ts
188
+ var cannotExist = (_) => false;
189
+
190
+ // ../anvl/src/refinement/is-intersection.ts
191
+ function mustSatisfyAllOfTheFollowing(isTypeA, logging = false, refinements = [isTypeA]) {
192
+ const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` & `)})`;
193
+ const _ = {
194
+ [name]: (input) => refinements.every(
195
+ (refinement) => (logging && console.log(
196
+ refinements.map((r) => r.name || `anon`).join(` & `),
197
+ `>`,
198
+ refinement.name || `anon`,
199
+ `:`,
200
+ refinement(input)
201
+ ), refinement(input))
202
+ )
203
+ };
204
+ const checkTypes = Object.assign(_[name], {
205
+ and: (isTypeB) => mustSatisfyAllOfTheFollowing(isTypeB, logging, [
206
+ ...refinements,
207
+ isTypeB
208
+ ])
209
+ });
210
+ return checkTypes;
211
+ }
212
+ var isIntersection = mustSatisfyAllOfTheFollowing(canExist);
213
+
214
+ // ../anvl/src/refinement/is-union.ts
215
+ var mustSatisfyOneOfTheFollowing = (isTypeA, logging = false, refinements = [isTypeA]) => {
216
+ const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` | `)})`;
217
+ const _ = {
218
+ [name]: (input) => refinements.some(
219
+ (refinement) => {
220
+ var _a;
221
+ return logging && console.log(
222
+ refinements.map((r) => r.name || `anon`).join(` | `),
223
+ `>`,
224
+ (_a = refinement.name) != null ? _a : `anon`,
225
+ `:`,
226
+ refinement(input)
227
+ ), refinement(input);
205
228
  }
206
- }
207
- return null;
208
- }
209
- };
210
- var jsonRefinery = new Refinery({
211
- number: (input) => typeof input === `number`,
212
- string: (input) => typeof input === `string`,
213
- boolean: (input) => typeof input === `boolean`,
214
- object: isPlainObject,
215
- array: (input) => Array.isArray(input),
216
- null: (input) => input === null
217
- });
218
- var discoverType = (input) => {
219
- if (input === void 0) {
220
- return `undefined`;
221
- }
222
- const refined = jsonRefinery.refine(input);
223
- if (refined) {
224
- return refined.type;
225
- }
226
- return Object.getPrototypeOf(input).constructor.name;
229
+ )
230
+ };
231
+ const checkTypes = Object.assign(_[name], {
232
+ or: (isTypeB) => mustSatisfyOneOfTheFollowing(isTypeB, logging, [...refinements, isTypeB])
233
+ });
234
+ return checkTypes;
227
235
  };
236
+ var isUnion = mustSatisfyOneOfTheFollowing(cannotExist);
228
237
 
229
238
  // ../anvl/src/json/index.ts
230
239
  var stringifyJson = (json) => JSON.stringify(json);
@@ -278,59 +287,50 @@ var isJson = (input) => {
278
287
  return refine;
279
288
  };
280
289
 
281
- // ../anvl/src/refinement/can-exist.ts
282
- var canExist = (_) => true;
283
-
284
- // ../anvl/src/refinement/cannot-exist.ts
285
- var cannotExist = (_) => false;
286
-
287
- // ../anvl/src/refinement/is-union.ts
288
- var mustSatisfyOneOfTheFollowing = (isTypeA, logging = false, refinements = [isTypeA]) => {
289
- const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` | `)})`;
290
- const _ = {
291
- [name]: (input) => refinements.some(
292
- (refinement) => {
293
- var _a;
294
- return logging && console.log(
295
- refinements.map((r) => r.name || `anon`).join(` | `),
296
- `>`,
297
- (_a = refinement.name) != null ? _a : `anon`,
298
- `:`,
299
- refinement(input)
300
- ), refinement(input);
290
+ // ../anvl/src/refinement/refinery.ts
291
+ var Refinery = class {
292
+ constructor(supported) {
293
+ this.supported = supported;
294
+ }
295
+ refine(input) {
296
+ for (const [key, refiner] of Object.entries(this.supported)) {
297
+ try {
298
+ if (
299
+ // @ts-expect-error that's the point
300
+ refiner(input) === true && refiner !== Boolean
301
+ ) {
302
+ return { type: key, data: input };
303
+ }
304
+ } catch (e) {
305
+ try {
306
+ if (input instanceof refiner) {
307
+ return { type: key, data: input };
308
+ }
309
+ } catch (_) {
310
+ }
301
311
  }
302
- )
303
- };
304
- const checkTypes = Object.assign(_[name], {
305
- or: (isTypeB) => mustSatisfyOneOfTheFollowing(isTypeB, logging, [...refinements, isTypeB])
306
- });
307
- return checkTypes;
312
+ }
313
+ return null;
314
+ }
315
+ };
316
+ var jsonRefinery = new Refinery({
317
+ number: (input) => typeof input === `number`,
318
+ string: (input) => typeof input === `string`,
319
+ boolean: (input) => typeof input === `boolean`,
320
+ object: isPlainObject,
321
+ array: (input) => Array.isArray(input),
322
+ null: (input) => input === null
323
+ });
324
+ var discoverType = (input) => {
325
+ if (input === void 0) {
326
+ return `undefined`;
327
+ }
328
+ const refined = jsonRefinery.refine(input);
329
+ if (refined) {
330
+ return refined.type;
331
+ }
332
+ return Object.getPrototypeOf(input).constructor.name;
308
333
  };
309
- var isUnion = mustSatisfyOneOfTheFollowing(cannotExist);
310
-
311
- // ../anvl/src/refinement/is-intersection.ts
312
- function mustSatisfyAllOfTheFollowing(isTypeA, logging = false, refinements = [isTypeA]) {
313
- const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` & `)})`;
314
- const _ = {
315
- [name]: (input) => refinements.every(
316
- (refinement) => (logging && console.log(
317
- refinements.map((r) => r.name || `anon`).join(` & `),
318
- `>`,
319
- refinement.name || `anon`,
320
- `:`,
321
- refinement(input)
322
- ), refinement(input))
323
- )
324
- };
325
- const checkTypes = Object.assign(_[name], {
326
- and: (isTypeB) => mustSatisfyAllOfTheFollowing(isTypeB, logging, [
327
- ...refinements,
328
- isTypeB
329
- ])
330
- });
331
- return checkTypes;
332
- }
333
- var isIntersection = mustSatisfyAllOfTheFollowing(canExist);
334
334
 
335
335
  // ../anvl/src/refinement/index.ts
336
336
  var isLiteral = (value) => (input) => input === value;
@@ -131,9 +131,6 @@ main.atom_io_devtools {
131
131
  }
132
132
  section.transaction_log {
133
133
  margin-top: 0;
134
- header: {
135
- padding: 5px;
136
- }
137
134
  main {
138
135
  display: flex;
139
136
  flex-flow: row wrap;
@@ -4,6 +4,8 @@ import { AtomToken, ReadonlySelectorToken, WritableSelectorToken } from 'atom.io
4
4
 
5
5
  type ClassSignature = abstract new (...args: any) => any;
6
6
 
7
+ type Refinement<A, B extends A> = (a: A) => a is B;
8
+
7
9
  type RefinementStrategy = ClassSignature | Refinement<unknown, any>;
8
10
  type Supported<Refine extends RefinementStrategy> = Refine extends Refinement<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
9
11
  type RefinementSupport = Record<string, RefinementStrategy>;
@@ -18,8 +20,6 @@ declare class Refinery<SupportedTypes extends RefinementSupport> {
18
20
  }[keyof SupportedTypes] | null;
19
21
  }
20
22
 
21
- type Refinement<A, B extends A> = (a: A) => a is B;
22
-
23
23
  type PlainObject = Record<keyof any, unknown>;
24
24
 
25
25
  type AtomTokenIndex = WritableTokenIndex<AtomToken<unknown>>;