atom.io 0.11.0 → 0.12.1

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 (174) hide show
  1. package/data/dist/index.cjs +614 -0
  2. package/data/dist/index.cjs.map +1 -0
  3. package/data/dist/index.d.cts +158 -0
  4. package/data/dist/index.d.ts +118 -1
  5. package/data/dist/index.js +551 -30
  6. package/data/dist/index.js.map +1 -1
  7. package/data/dist/metafile-cjs.json +1 -0
  8. package/data/dist/metafile-esm.json +1 -0
  9. package/data/package.json +4 -3
  10. package/data/src/index.ts +1 -0
  11. package/data/src/join.ts +450 -0
  12. package/data/src/struct-family.ts +34 -24
  13. package/data/src/struct.ts +6 -8
  14. package/dist/index.cjs +257 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/{index.d.mts → index.d.cts} +10 -11
  17. package/dist/index.d.ts +10 -11
  18. package/dist/index.js +63 -104
  19. package/dist/index.js.map +1 -1
  20. package/dist/metafile-cjs.json +1 -0
  21. package/dist/metafile-esm.json +1 -0
  22. package/internal/dist/{index.mjs → index.cjs} +716 -495
  23. package/internal/dist/index.cjs.map +1 -0
  24. package/internal/dist/{index.d.mts → index.d.cts} +124 -105
  25. package/internal/dist/index.d.ts +124 -105
  26. package/internal/dist/index.js +651 -555
  27. package/internal/dist/index.js.map +1 -1
  28. package/internal/dist/metafile-cjs.json +1 -0
  29. package/internal/dist/metafile-esm.json +1 -0
  30. package/internal/package.json +4 -3
  31. package/internal/src/atom/create-atom.ts +29 -16
  32. package/internal/src/atom/delete-atom.ts +25 -6
  33. package/internal/src/atom/is-default.ts +4 -17
  34. package/internal/src/caching.ts +28 -23
  35. package/internal/src/families/create-atom-family.ts +3 -2
  36. package/internal/src/families/create-readonly-selector-family.ts +1 -1
  37. package/internal/src/families/create-selector-family.ts +4 -4
  38. package/internal/src/index.ts +4 -2
  39. package/internal/src/lazy-map.ts +33 -0
  40. package/internal/src/mutable/create-mutable-atom-family.ts +2 -2
  41. package/internal/src/mutable/create-mutable-atom.ts +1 -2
  42. package/internal/src/mutable/get-json-family.ts +22 -0
  43. package/internal/src/mutable/get-json-token.ts +1 -0
  44. package/internal/src/mutable/index.ts +1 -0
  45. package/internal/src/mutable/tracker-family.ts +1 -2
  46. package/internal/src/mutable/tracker.ts +8 -6
  47. package/internal/src/mutable/transceiver.ts +2 -0
  48. package/internal/src/not-found-error.ts +27 -0
  49. package/internal/src/operation.ts +2 -3
  50. package/internal/src/{get-state-internal.ts → read-or-compute-value.ts} +13 -6
  51. package/internal/src/selector/create-selector.ts +6 -7
  52. package/internal/src/selector/delete-selector.ts +37 -0
  53. package/internal/src/selector/index.ts +2 -1
  54. package/internal/src/selector/register-selector.ts +7 -7
  55. package/internal/src/set-state/copy-mutable-in-transaction.ts +3 -2
  56. package/internal/src/set-state/emit-update.ts +1 -3
  57. package/internal/src/set-state/evict-downstream.ts +6 -8
  58. package/internal/src/set-state/index.ts +1 -1
  59. package/internal/src/set-state/{set-state-internal.ts → set-atom-or-selector.ts} +2 -3
  60. package/internal/src/set-state/set-atom.ts +5 -6
  61. package/internal/src/store/store.ts +1 -1
  62. package/internal/src/store/withdraw-new-family-member.ts +6 -6
  63. package/internal/src/subscribe/recall-state.ts +1 -2
  64. package/internal/src/subscribe/subscribe-to-root-atoms.ts +2 -2
  65. package/internal/src/timeline/add-atom-to-timeline.ts +5 -16
  66. package/internal/src/timeline/{timeline-internal.ts → create-timeline.ts} +4 -5
  67. package/internal/src/timeline/index.ts +2 -2
  68. package/internal/src/timeline/time-travel.ts +89 -0
  69. package/internal/src/transaction/build-transaction.ts +8 -7
  70. package/internal/src/transaction/{transaction-internal.ts → create-transaction.ts} +6 -5
  71. package/internal/src/transaction/index.ts +2 -3
  72. package/introspection/dist/{index.mjs → index.cjs} +54 -29
  73. package/introspection/dist/index.cjs.map +1 -0
  74. package/introspection/dist/{index.d.mts → index.d.cts} +2 -2
  75. package/introspection/dist/index.d.ts +2 -2
  76. package/introspection/dist/index.js +32 -49
  77. package/introspection/dist/index.js.map +1 -1
  78. package/introspection/dist/metafile-cjs.json +1 -0
  79. package/introspection/dist/metafile-esm.json +1 -0
  80. package/introspection/package.json +4 -3
  81. package/introspection/src/attach-introspection-states.ts +2 -2
  82. package/introspection/src/attach-selector-index.ts +8 -4
  83. package/json/dist/{index.mjs → index.cjs} +20 -7
  84. package/json/dist/{index.mjs.map → index.cjs.map} +1 -1
  85. package/json/dist/{index.d.mts → index.d.cts} +1 -1
  86. package/json/dist/index.d.ts +1 -1
  87. package/json/dist/index.js +6 -19
  88. package/json/dist/index.js.map +1 -1
  89. package/json/dist/metafile-cjs.json +1 -0
  90. package/json/dist/metafile-esm.json +1 -0
  91. package/json/package.json +4 -3
  92. package/package.json +48 -47
  93. package/react/dist/index.cjs +59 -0
  94. package/react/dist/index.cjs.map +1 -0
  95. package/react/dist/index.js +20 -42
  96. package/react/dist/index.js.map +1 -1
  97. package/react/dist/metafile-cjs.json +1 -0
  98. package/react/dist/metafile-esm.json +1 -0
  99. package/react/package.json +4 -3
  100. package/react/src/store-hooks.ts +8 -2
  101. package/react-devtools/dist/{index.mjs → index.cjs} +286 -240
  102. package/react-devtools/dist/index.cjs.map +1 -0
  103. package/react-devtools/dist/{index.d.mts → index.d.cts} +29 -17
  104. package/react-devtools/dist/index.d.ts +29 -17
  105. package/react-devtools/dist/index.js +251 -273
  106. package/react-devtools/dist/index.js.map +1 -1
  107. package/react-devtools/dist/metafile-cjs.json +1 -0
  108. package/react-devtools/dist/metafile-esm.json +1 -0
  109. package/react-devtools/package.json +4 -3
  110. package/react-devtools/src/StateEditor.tsx +8 -8
  111. package/realtime-client/dist/{index.mjs → index.cjs} +50 -21
  112. package/realtime-client/dist/index.js +20 -49
  113. package/realtime-client/dist/metafile-cjs.json +1 -0
  114. package/realtime-client/dist/metafile-esm.json +1 -0
  115. package/realtime-client/package.json +4 -3
  116. package/realtime-react/dist/index.cjs +99 -0
  117. package/realtime-react/dist/index.js +35 -66
  118. package/realtime-react/dist/metafile-cjs.json +1 -0
  119. package/realtime-react/dist/metafile-esm.json +1 -0
  120. package/realtime-react/package.json +4 -3
  121. package/realtime-server/dist/{index.mjs → index.cjs} +67 -40
  122. package/realtime-server/dist/index.js +39 -66
  123. package/realtime-server/dist/metafile-cjs.json +1 -0
  124. package/realtime-server/dist/metafile-esm.json +1 -0
  125. package/realtime-server/package.json +4 -3
  126. package/realtime-testing/dist/{index.mjs → index.cjs} +54 -23
  127. package/realtime-testing/dist/index.js +22 -53
  128. package/realtime-testing/dist/metafile-cjs.json +1 -0
  129. package/realtime-testing/dist/metafile-esm.json +1 -0
  130. package/realtime-testing/package.json +4 -3
  131. package/src/atom.ts +6 -8
  132. package/src/dispose.ts +18 -0
  133. package/src/get-state.ts +16 -0
  134. package/src/index.ts +3 -1
  135. package/src/logger.ts +1 -1
  136. package/src/selector.ts +3 -3
  137. package/src/set-state.ts +22 -0
  138. package/src/silo.ts +7 -8
  139. package/src/timeline.ts +6 -11
  140. package/src/transaction.ts +2 -2
  141. package/transceivers/set-rtx/dist/{index.mjs → index.cjs} +40 -36
  142. package/transceivers/set-rtx/dist/index.cjs.map +1 -0
  143. package/transceivers/set-rtx/dist/{index.d.mts → index.d.cts} +2 -1
  144. package/transceivers/set-rtx/dist/index.d.ts +2 -1
  145. package/transceivers/set-rtx/dist/index.js +37 -37
  146. package/transceivers/set-rtx/dist/index.js.map +1 -1
  147. package/transceivers/set-rtx/dist/metafile-cjs.json +1 -0
  148. package/transceivers/set-rtx/dist/metafile-esm.json +1 -0
  149. package/transceivers/set-rtx/package.json +4 -3
  150. package/transceivers/set-rtx/src/set-rtx.ts +29 -26
  151. package/data/dist/index.d.mts +0 -41
  152. package/data/dist/index.mjs +0 -82
  153. package/data/dist/index.mjs.map +0 -1
  154. package/dist/index.mjs +0 -215
  155. package/dist/index.mjs.map +0 -1
  156. package/internal/dist/index.mjs.map +0 -1
  157. package/internal/src/set-state/set-selector-state.ts +0 -8
  158. package/internal/src/timeline/time-travel-internal.ts +0 -109
  159. package/introspection/dist/index.mjs.map +0 -1
  160. package/react/dist/index.mjs +0 -29
  161. package/react/dist/index.mjs.map +0 -1
  162. package/react-devtools/dist/index.mjs.map +0 -1
  163. package/realtime-react/dist/index.mjs +0 -68
  164. package/src/get-set.ts +0 -48
  165. package/transceivers/set-rtx/dist/index.mjs.map +0 -1
  166. /package/react/dist/{index.d.mts → index.d.cts} +0 -0
  167. /package/realtime-client/dist/{index.mjs.map → index.cjs.map} +0 -0
  168. /package/realtime-client/dist/{index.d.mts → index.d.cts} +0 -0
  169. /package/realtime-react/dist/{index.mjs.map → index.cjs.map} +0 -0
  170. /package/realtime-react/dist/{index.d.mts → index.d.cts} +0 -0
  171. /package/realtime-server/dist/{index.mjs.map → index.cjs.map} +0 -0
  172. /package/realtime-server/dist/{index.d.mts → index.d.cts} +0 -0
  173. /package/realtime-testing/dist/{index.mjs.map → index.cjs.map} +0 -0
  174. /package/realtime-testing/dist/{index.d.mts → index.d.cts} +0 -0
@@ -1,5 +1,9 @@
1
1
  import type * as AtomIO from "atom.io"
2
- import { createAtomFamily, createSelectorFamily } from "atom.io/internal"
2
+ import {
3
+ IMPLICIT,
4
+ createAtomFamily,
5
+ createSelectorFamily,
6
+ } from "atom.io/internal"
3
7
 
4
8
  const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)
5
9
  const nameFamily = (topKey: string, subKey: string) =>
@@ -13,36 +17,42 @@ export function structFamily<
13
17
  default: Struct
14
18
  }): [
15
19
  {
16
- [K in
17
- keyof Struct as `find${Capitalize<Key & string>}${Capitalize<
18
- K & string
19
- >}State`]: AtomIO.AtomFamily<Struct[K], string>
20
+ [K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<
21
+ K & string
22
+ >}State`]: AtomIO.AtomFamily<Struct[K], string>
20
23
  },
21
24
  AtomIO.ReadonlySelectorFamily<Struct>,
22
25
  ] {
23
26
  const atoms: {
24
- [K in
25
- keyof Struct as `find${Capitalize<Key & string>}${Capitalize<
26
- K & string
27
- >}State`]: AtomIO.AtomFamily<Struct[K], string>
27
+ [K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<
28
+ K & string
29
+ >}State`]: AtomIO.AtomFamily<Struct[K], string>
28
30
  } = Object.keys(options.default).reduce((acc, subKey) => {
29
31
  const atomFamilyName = nameFamily(options.key, subKey)
30
- acc[atomFamilyName] = createAtomFamily({
31
- key: `${options.key}.${subKey}`,
32
- default: (options.default as any)[subKey],
33
- })
32
+ acc[atomFamilyName] = createAtomFamily(
33
+ {
34
+ key: `${options.key}.${subKey}`,
35
+ default: (options.default as any)[subKey],
36
+ },
37
+ IMPLICIT.STORE,
38
+ )
34
39
  return acc
35
40
  }, {} as any)
36
- const findStructState = createSelectorFamily({
37
- key: options.key,
38
- get:
39
- (id) =>
40
- ({ get }) => {
41
- return Object.keys(options.default).reduce((acc, subKey) => {
42
- acc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))
43
- return acc
44
- }, {} as any)
45
- },
46
- })
41
+ const findStructState = createSelectorFamily(
42
+ {
43
+ key: options.key,
44
+ get:
45
+ (id) =>
46
+ ({ get }) => {
47
+ return Object.keys(options.default).reduce((acc, subKey) => {
48
+ acc[subKey] = get(
49
+ (atoms as any)[nameFamily(options.key, subKey)](id),
50
+ )
51
+ return acc
52
+ }, {} as any)
53
+ },
54
+ },
55
+ IMPLICIT.STORE,
56
+ )
47
57
  return [atoms, findStructState]
48
58
  }
@@ -17,18 +17,16 @@ export function struct<
17
17
  store: Store = IMPLICIT.STORE,
18
18
  ): [
19
19
  {
20
- [K in
21
- keyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<
22
- Struct[K]
23
- >
20
+ [K in keyof Struct as `${Key}${Capitalize<
21
+ K & string
22
+ >}State`]: AtomIO.AtomToken<Struct[K]>
24
23
  },
25
24
  AtomIO.ReadonlySelectorToken<Struct>,
26
25
  ] {
27
26
  const atoms: {
28
- [K in
29
- keyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<
30
- Struct[K]
31
- >
27
+ [K in keyof Struct as `${Key}${Capitalize<
28
+ K & string
29
+ >}State`]: AtomIO.AtomToken<Struct[K]>
32
30
  } = Object.keys(options.default).reduce((acc, key) => {
33
31
  const atomName = options.key + capitalize(key) + `State`
34
32
  acc[atomName] = createAtom(
package/dist/index.cjs ADDED
@@ -0,0 +1,257 @@
1
+ 'use strict';
2
+
3
+ var Internal3 = require('atom.io/internal');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var Internal3__namespace = /*#__PURE__*/_interopNamespace(Internal3);
24
+
25
+ // src/atom.ts
26
+ function atom(options) {
27
+ if (`mutable` in options) {
28
+ return Internal3.createMutableAtom(options, Internal3.IMPLICIT.STORE);
29
+ }
30
+ return Internal3.createAtom(options, void 0, Internal3.IMPLICIT.STORE);
31
+ }
32
+ function atomFamily(options) {
33
+ if (`mutable` in options) {
34
+ return Internal3.createMutableAtomFamily(options, Internal3.IMPLICIT.STORE);
35
+ }
36
+ return Internal3.createAtomFamily(options, Internal3.IMPLICIT.STORE);
37
+ }
38
+ function dispose(token, store = Internal3__namespace.IMPLICIT.STORE) {
39
+ switch (token.type) {
40
+ case `atom`:
41
+ Internal3__namespace.deleteAtom(token, store);
42
+ break;
43
+ case `selector`:
44
+ case `readonly_selector`:
45
+ Internal3__namespace.deleteSelector(token, store);
46
+ break;
47
+ }
48
+ }
49
+ function getState(token, store = Internal3__namespace.IMPLICIT.STORE) {
50
+ var _a;
51
+ const state = (_a = Internal3__namespace.withdraw(token, store)) != null ? _a : Internal3__namespace.withdrawNewFamilyMember(token, store);
52
+ if (state === void 0) {
53
+ throw new Internal3__namespace.NotFoundError(token, store);
54
+ }
55
+ return Internal3__namespace.readOrComputeValue(state, store);
56
+ }
57
+
58
+ // src/logger.ts
59
+ var LOG_LEVELS = [`info`, `warn`, `error`];
60
+ var simpleLog = (logLevel) => (icon, tokenType, tokenKey, message, ...rest) => {
61
+ console[logLevel](`${icon} ${tokenType} "${tokenKey}" ${message}`, ...rest);
62
+ };
63
+ var simpleLogger = {
64
+ error: simpleLog(`error`),
65
+ info: simpleLog(`info`),
66
+ warn: simpleLog(`warn`)
67
+ };
68
+ var AtomIOLogger = class {
69
+ constructor(logLevel, filter, logger = simpleLogger) {
70
+ this.logLevel = logLevel;
71
+ this.filter = filter;
72
+ this.logger = logger;
73
+ this.error = (...args) => {
74
+ var _a, _b;
75
+ if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel !== null) {
76
+ this.logger.error(...args);
77
+ }
78
+ };
79
+ this.info = (...args) => {
80
+ var _a, _b;
81
+ if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel === `info`) {
82
+ this.logger.info(...args);
83
+ }
84
+ };
85
+ this.warn = (...args) => {
86
+ var _a, _b;
87
+ if (((_b = (_a = this.filter) == null ? void 0 : _a.call(this, ...args)) != null ? _b : true) && this.logLevel !== `error` && this.logLevel !== null) {
88
+ this.logger.warn(...args);
89
+ }
90
+ };
91
+ }
92
+ };
93
+ function selector(options) {
94
+ return Internal3.createSelector(options, void 0, Internal3.IMPLICIT.STORE);
95
+ }
96
+ function selectorFamily(options) {
97
+ return Internal3.createSelectorFamily(options, Internal3.IMPLICIT.STORE);
98
+ }
99
+ function setState(token, value, store = Internal3__namespace.IMPLICIT.STORE) {
100
+ var _a;
101
+ const rejection = Internal3__namespace.openOperation(token, store);
102
+ if (rejection) {
103
+ return;
104
+ }
105
+ const state = (_a = Internal3__namespace.withdraw(token, store)) != null ? _a : Internal3__namespace.withdrawNewFamilyMember(token, store);
106
+ if (state === void 0) {
107
+ throw new Internal3__namespace.NotFoundError(token, store);
108
+ }
109
+ Internal3__namespace.setAtomOrSelector(state, value, store);
110
+ Internal3__namespace.closeOperation(store);
111
+ }
112
+ var Silo = class {
113
+ constructor(name, fromStore = null) {
114
+ const s = new Internal3.Store(name, fromStore);
115
+ this.store = s;
116
+ this.atom = (options) => {
117
+ if (`mutable` in options) {
118
+ return Internal3.createMutableAtom(options, s);
119
+ }
120
+ return Internal3.createAtom(options, void 0, s);
121
+ };
122
+ this.atomFamily = (options) => {
123
+ if (`mutable` in options) {
124
+ return Internal3.createMutableAtomFamily(options, s);
125
+ }
126
+ return Internal3.createAtomFamily(options, s);
127
+ };
128
+ this.selector = (options) => Internal3.createSelector(options, void 0, s);
129
+ this.selectorFamily = (options) => Internal3.createSelectorFamily(options, s);
130
+ this.transaction = (options) => Internal3.createTransaction(options, s);
131
+ this.timeline = (options) => Internal3.createTimeline(options, s);
132
+ this.getState = (token) => getState(token, s);
133
+ this.setState = (token, newValue) => setState(token, newValue, s);
134
+ this.subscribe = (token, handler, key) => subscribe(token, handler, key, s);
135
+ this.undo = (token) => Internal3.timeTravel(`backward`, token, s);
136
+ this.redo = (token) => Internal3.timeTravel(`forward`, token, s);
137
+ }
138
+ };
139
+ function subscribe(token, handleUpdate, key = Math.random().toString(36).slice(2), store = Internal3.IMPLICIT.STORE) {
140
+ const state = Internal3.withdraw(token, store);
141
+ if (state === void 0) {
142
+ throw new Error(
143
+ `State "${token.key}" not found in this store. Did you forget to initialize with the "atom" or "selector" function?`
144
+ );
145
+ }
146
+ const unsubFunction = state.subject.subscribe(key, handleUpdate);
147
+ store.logger.info(`\u{1F440}`, state.type, state.key, `Adding subscription "${key}"`);
148
+ const dependencyUnsubFunctions = state.type !== `atom` ? Internal3.subscribeToRootAtoms(state, store) : null;
149
+ const unsubscribe = dependencyUnsubFunctions === null ? () => {
150
+ store.logger.info(
151
+ `\u{1F648}`,
152
+ state.type,
153
+ state.key,
154
+ `Removing subscription "${key}"`
155
+ );
156
+ unsubFunction();
157
+ } : () => {
158
+ store.logger.info(
159
+ `\u{1F648}`,
160
+ state.type,
161
+ state.key,
162
+ `Removing subscription "${key}"`
163
+ );
164
+ unsubFunction();
165
+ for (const unsubFromDependency of dependencyUnsubFunctions) {
166
+ unsubFromDependency();
167
+ }
168
+ };
169
+ return unsubscribe;
170
+ }
171
+ var subscribeToTransaction = (token, handleUpdate, key = Math.random().toString(36).slice(2), store = Internal3.IMPLICIT.STORE) => {
172
+ const tx = Internal3.withdraw(token, store);
173
+ if (tx === void 0) {
174
+ throw new Error(
175
+ `Cannot subscribe to transaction "${token.key}": transaction not found in store "${store.config.name}".`
176
+ );
177
+ }
178
+ store.logger.info(
179
+ `\u{1F440}`,
180
+ `transaction`,
181
+ token.key,
182
+ `Adding subscription "${key}"`
183
+ );
184
+ const unsubscribe = tx.subject.subscribe(key, handleUpdate);
185
+ return () => {
186
+ store.logger.info(
187
+ `\u{1F648}`,
188
+ `transaction`,
189
+ token.key,
190
+ `Removing subscription "${key}"`
191
+ );
192
+ unsubscribe();
193
+ };
194
+ };
195
+ var subscribeToTimeline = (token, handleUpdate, key = Math.random().toString(36).slice(2), store = Internal3.IMPLICIT.STORE) => {
196
+ const tl = Internal3.withdraw(token, store);
197
+ if (tl === void 0) {
198
+ throw new Error(
199
+ `Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`
200
+ );
201
+ }
202
+ store.logger.info(`\u{1F440}`, `timeline`, token.key, `Adding subscription "${key}"`);
203
+ const unsubscribe = tl.subject.subscribe(key, handleUpdate);
204
+ return () => {
205
+ store.logger.info(
206
+ `\u{1F648}`,
207
+ `timeline`,
208
+ token.key,
209
+ `Removing subscription "${key}" from timeline`
210
+ );
211
+ unsubscribe();
212
+ };
213
+ };
214
+ var timeline = (options) => {
215
+ return Internal3.createTimeline(options, Internal3.IMPLICIT.STORE);
216
+ };
217
+ var redo = (timeline2) => {
218
+ Internal3.timeTravel(`forward`, timeline2, Internal3.IMPLICIT.STORE);
219
+ };
220
+ var undo = (timeline2) => {
221
+ Internal3.timeTravel(`backward`, timeline2, Internal3.IMPLICIT.STORE);
222
+ };
223
+ function transaction(options) {
224
+ return Internal3.createTransaction(options, Internal3.IMPLICIT.STORE);
225
+ }
226
+ var runTransaction = (token, store = Internal3.IMPLICIT.STORE) => (...parameters) => {
227
+ const tx = Internal3.withdraw(token, store);
228
+ if (tx) {
229
+ return tx.run(...parameters);
230
+ }
231
+ throw new Error(
232
+ `Cannot run transaction "${token.key}": transaction not found in store "${store.config.name}".`
233
+ );
234
+ };
235
+
236
+ exports.AtomIOLogger = AtomIOLogger;
237
+ exports.LOG_LEVELS = LOG_LEVELS;
238
+ exports.Silo = Silo;
239
+ exports.atom = atom;
240
+ exports.atomFamily = atomFamily;
241
+ exports.dispose = dispose;
242
+ exports.getState = getState;
243
+ exports.redo = redo;
244
+ exports.runTransaction = runTransaction;
245
+ exports.selector = selector;
246
+ exports.selectorFamily = selectorFamily;
247
+ exports.setState = setState;
248
+ exports.simpleLog = simpleLog;
249
+ exports.simpleLogger = simpleLogger;
250
+ exports.subscribe = subscribe;
251
+ exports.subscribeToTimeline = subscribeToTimeline;
252
+ exports.subscribeToTransaction = subscribeToTransaction;
253
+ exports.timeline = timeline;
254
+ exports.transaction = transaction;
255
+ exports.undo = undo;
256
+ //# sourceMappingURL=out.js.map
257
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/atom.ts","../src/dispose.ts","../src/get-state.ts","../src/logger.ts","../src/selector.ts","../src/set-state.ts","../src/silo.ts","../src/subscribe.ts","../src/timeline.ts","../src/transaction.ts"],"names":["Internal","IMPLICIT","createAtom","createAtomFamily","createMutableAtom","createMutableAtomFamily","createSelector","createSelectorFamily","withdraw","createTimeline","timeTravel","timeline","createTransaction"],"mappings":";AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;A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ICIT,\n\tcreateAtom,\n\tcreateAtomFamily,\n\tcreateMutableAtom,\n\tcreateMutableAtomFamily,\n} from \"atom.io/internal\"\nimport type { Json, JsonInterface } from \"atom.io/json\"\n\nimport type { AtomToken, MutableAtomToken } from \".\"\n\nexport type Effectors<T> = {\n\tsetSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void\n\tonSet: (callback: (options: { newValue: T; oldValue: T }) => void) => void\n}\n\nexport type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void\n\nexport type AtomOptions<T> = {\n\tkey: string\n\tdefault: T | (() => T)\n\teffects?: AtomEffect<T>[]\n}\n// biome-ignore format: complex intersection\nexport type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = \n\t& JsonInterface<T, J>\n\t& Omit<AtomOptions<T>, `default`> \n\t& { \n\t\t\tdefault: ()\t=> T\n\t\t\tmutable: true\n\t\t}\n\nexport function atom<T extends Transceiver<any>, J extends Json.Serializable>(\n\toptions: MutableAtomOptions<T, J>,\n): MutableAtomToken<T, J>\nexport function atom<T>(options: AtomOptions<T>): AtomToken<T>\nexport function atom<T>(\n\toptions: AtomOptions<any> | MutableAtomOptions<any, any>,\n): AtomToken<any> {\n\tif (`mutable` in options) {\n\t\treturn createMutableAtom(options, IMPLICIT.STORE)\n\t}\n\treturn createAtom<T>(options, undefined, IMPLICIT.STORE)\n}\n\nexport type AtomFamilyOptions<T, K extends Json.Serializable> = {\n\tkey: string\n\tdefault: T | ((key: K) => T)\n\teffects?: (key: K) => AtomEffect<T>[]\n}\n\nexport type AtomFamily<T, K extends Json.Serializable = Json.Serializable> = ((\n\tkey: K,\n) => AtomToken<T>) & {\n\tkey: string\n\ttype: `atom_family`\n\tsubject: Subject<AtomToken<T>>\n}\n// biome-ignore format: intersection\nexport type MutableAtomFamilyOptions<\n\tT extends Transceiver<any>,\n\tJ extends Json.Serializable,\n\tK extends Json.Serializable,\n> = \n\t& AtomFamilyOptions<T, K>\n\t& JsonInterface<T, J>\n\t& { mutable: true }\n\n// biome-ignore format: intersection\nexport type MutableAtomFamily<\n\tCore extends Transceiver<any>,\n\tSerializableCore extends Json.Serializable,\n\tKey extends Json.Serializable,\n> = \n\t& JsonInterface<Core, SerializableCore>\n\t& ((key: Key) => MutableAtomToken<Core, SerializableCore>) \n\t& {\n\t\t\tkey: `${string}::mutable`\n\t\t\ttype: `atom_family`\n\t\t\tsubject: Subject<MutableAtomToken<Core, SerializableCore>>\n\t\t}\n\nexport function atomFamily<\n\tT extends Transceiver<any>,\n\tJ extends Json.Serializable,\n\tK extends Json.Serializable,\n>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>\nexport function atomFamily<T, K extends Json.Serializable>(\n\toptions: AtomFamilyOptions<T, K>,\n): AtomFamily<T, K>\nexport function atomFamily<T, K extends Json.Serializable>(\n\toptions: AtomFamilyOptions<T, K> | MutableAtomFamilyOptions<any, any, any>,\n): AtomFamily<T, K> | MutableAtomFamily<any, any, any> {\n\tif (`mutable` in options) {\n\t\treturn createMutableAtomFamily(options, IMPLICIT.STORE)\n\t}\n\treturn createAtomFamily<T, K>(options, IMPLICIT.STORE)\n}\n","import * as Internal from \"atom.io/internal\"\n\nimport type { ReadonlySelectorToken, StateToken } from \".\"\n\nexport function dispose(\n\ttoken: ReadonlySelectorToken<any> | StateToken<any>,\n\tstore: Internal.Store = Internal.IMPLICIT.STORE,\n): void {\n\tswitch (token.type) {\n\t\tcase `atom`:\n\t\t\tInternal.deleteAtom(token, store)\n\t\t\tbreak\n\t\tcase `selector`:\n\t\tcase `readonly_selector`:\n\t\t\tInternal.deleteSelector(token, store)\n\t\t\tbreak\n\t}\n}\n","import * as Internal from \"atom.io/internal\"\n\nimport type { ReadonlySelectorToken, StateToken } from \".\"\n\nexport function getState<T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\tstore: Internal.Store = Internal.IMPLICIT.STORE,\n): T {\n\tconst state =\n\t\tInternal.withdraw(token, store) ??\n\t\tInternal.withdrawNewFamilyMember(token, store)\n\tif (state === undefined) {\n\t\tthrow new Internal.NotFoundError(token, store)\n\t}\n\treturn Internal.readOrComputeValue(state, store)\n}\n","const LoggerIconDictionary = {\n\t\"⌛\": `Timeline event fully captured`,\n\t\"⏩\": `Timeline redo`,\n\t\"⏪\": `Timeline undo`,\n\t\"⏭️\": `Transaction redo`,\n\t\"⏮️\": `Transaction undo`,\n\t\"⏳\": `Timeline event partially captured`,\n\t\"⏹️\": `Time-travel complete`,\n\t\"💁\": `Notice`,\n\t\"🔄\": `Realtime transaction synchronized`,\n\t\"✅\": `Realtime transaction success`,\n\t\"✨\": `Computation complete`,\n\t\"❌\": `Conflict prevents attempted action`,\n\t\"⭕\": `Operation start`,\n\t\"🐞\": `Possible bug in AtomIO`,\n\t\"👀\": `Subscription added`,\n\t\"👪\": `Family member added`,\n\t\"📁\": `Stow update`,\n\t\"📃\": `Copy mutable`,\n\t\"📖\": `Read state`,\n\t\"📝\": `Write state`,\n\t\"📢\": `Notify subscribers`,\n\t\"🔌\": `Register dependency`,\n\t\"🔍\": `Discover root`,\n\t\"🔥\": `Delete state`,\n\t\"🔧\": `Create mutable atom`,\n\t\"🔨\": `Create immutable atom`,\n\t\"🔴\": `Operation complete`,\n\t\"🗑\": `Evict cached value`,\n\t\"💥\": `Caught`,\n\t\"🙈\": `Subscription canceled`,\n\t\"🛄\": `Apply transaction`,\n\t\"🛠️\": `Install atom into store`,\n\t\"🛫\": `Begin transaction`,\n\t\"🛬\": `Complete transaction`,\n\t\"🧮\": `Computing selector`,\n\t\"🧹\": `Prepare to evict`,\n\t\"🪂\": `Abort transaction`,\n} as const\nexport type LoggerIcon = keyof typeof LoggerIconDictionary\n\nexport const LOG_LEVELS = [`info`, `warn`, `error`] as const\nexport type LogLevel = (typeof LOG_LEVELS)[number]\n\nexport type LogFn = (\n\ticon: LoggerIcon,\n\ttokenType:\n\t\t| `atom`\n\t\t| `readonly_selector`\n\t\t| `selector`\n\t\t| `state`\n\t\t| `timeline`\n\t\t| `transaction`\n\t\t| `unknown`,\n\ttokenKey: string,\n\tmessage: string,\n\t...rest: unknown[]\n) => void\nexport type LogFilter = (...params: Parameters<LogFn>) => boolean\n\nexport type Logger = Record<LogLevel, LogFn>\n\nexport const simpleLog =\n\t(logLevel: keyof Logger): LogFn =>\n\t(icon, tokenType, tokenKey, message, ...rest) => {\n\t\tconsole[logLevel](`${icon} ${tokenType} \"${tokenKey}\" ${message}`, ...rest)\n\t}\nexport const simpleLogger: Logger = {\n\terror: simpleLog(`error`),\n\tinfo: simpleLog(`info`),\n\twarn: simpleLog(`warn`),\n}\n\nexport class AtomIOLogger implements Logger {\n\tpublic constructor(\n\t\tpublic logLevel: `error` | `info` | `warn` | null,\n\t\tprivate readonly filter?: LogFilter,\n\t\tprivate readonly logger: Logger = simpleLogger,\n\t) {}\n\n\tpublic error: LogFn = (...args) => {\n\t\tif ((this.filter?.(...args) ?? true) && this.logLevel !== null) {\n\t\t\tthis.logger.error(...args)\n\t\t}\n\t}\n\tpublic info: LogFn = (...args) => {\n\t\tif ((this.filter?.(...args) ?? true) && this.logLevel === `info`) {\n\t\t\tthis.logger.info(...args)\n\t\t}\n\t}\n\tpublic warn: LogFn = (...args) => {\n\t\tif (\n\t\t\t(this.filter?.(...args) ?? true) &&\n\t\t\tthis.logLevel !== `error` &&\n\t\t\tthis.logLevel !== null\n\t\t) {\n\t\t\tthis.logger.warn(...args)\n\t\t}\n\t}\n}\n","import type { Subject } from \"atom.io/internal\"\nimport { IMPLICIT, createSelector, createSelectorFamily } from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\n\nimport type { ReadonlySelectorToken, SelectorToken } from \".\"\nimport type { Read, Write } from \"./transaction\"\n\nexport type SelectorOptions<T> = {\n\tkey: string\n\tget: Read<() => T>\n\tset: Write<(newValue: T) => void>\n}\nexport type ReadonlySelectorOptions<T> = {\n\tkey: string\n\tget: Read<() => T>\n}\n\nexport function selector<T>(options: SelectorOptions<T>): SelectorToken<T>\nexport function selector<T>(\n\toptions: ReadonlySelectorOptions<T>,\n): ReadonlySelectorToken<T>\nexport function selector<T>(\n\toptions: ReadonlySelectorOptions<T> | SelectorOptions<T>,\n): ReadonlySelectorToken<T> | SelectorToken<T> {\n\treturn createSelector(options, undefined, IMPLICIT.STORE)\n}\n\nexport type SelectorFamilyOptions<T, K extends Json.Serializable> = {\n\tkey: string\n\tget: (key: K) => Read<() => T>\n\tset: (key: K) => Write<(newValue: T) => void>\n}\nexport type ReadonlySelectorFamilyOptions<T, K extends Json.Serializable> = {\n\tkey: string\n\tget: (key: K) => Read<() => T>\n}\n\nexport type SelectorFamily<\n\tT,\n\tK extends Json.Serializable = Json.Serializable,\n> = ((key: K) => SelectorToken<T>) & {\n\tkey: string\n\ttype: `selector_family`\n\tsubject: Subject<SelectorToken<T>>\n}\n\nexport type ReadonlySelectorFamily<\n\tT,\n\tK extends Json.Serializable = Json.Serializable,\n> = ((key: K) => ReadonlySelectorToken<T>) & {\n\tkey: string\n\ttype: `readonly_selector_family`\n\tsubject: Subject<ReadonlySelectorToken<T>>\n}\n\nexport function selectorFamily<T, K extends Json.Serializable>(\n\toptions: SelectorFamilyOptions<T, K>,\n): SelectorFamily<T, K>\nexport function selectorFamily<T, K extends Json.Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K>,\n): ReadonlySelectorFamily<T, K>\nexport function selectorFamily<T, K extends Json.Serializable>(\n\toptions: ReadonlySelectorFamilyOptions<T, K> | SelectorFamilyOptions<T, K>,\n): ReadonlySelectorFamily<T, K> | SelectorFamily<T, K> {\n\treturn createSelectorFamily(options, IMPLICIT.STORE)\n}\n","import * as Internal from \"atom.io/internal\"\n\nimport type { StateToken } from \".\"\n\nexport function setState<T, New extends T>(\n\ttoken: StateToken<T>,\n\tvalue: New | ((oldValue: T) => New),\n\tstore: Internal.Store = Internal.IMPLICIT.STORE,\n): void {\n\tconst rejection = Internal.openOperation(token, store)\n\tif (rejection) {\n\t\treturn\n\t}\n\tconst state =\n\t\tInternal.withdraw(token, store) ??\n\t\tInternal.withdrawNewFamilyMember(token, store)\n\tif (state === undefined) {\n\t\tthrow new Internal.NotFoundError(token, store)\n\t}\n\tInternal.setAtomOrSelector(state, value, store)\n\tInternal.closeOperation(store)\n}\n","import {\n\tStore,\n\tcreateAtom,\n\tcreateAtomFamily,\n\tcreateMutableAtom,\n\tcreateMutableAtomFamily,\n\tcreateSelector,\n\tcreateSelectorFamily,\n\tcreateTimeline,\n\tcreateTransaction,\n\ttimeTravel,\n} from \"atom.io/internal\"\n\nimport type { redo, timeline, undo } from \".\"\nimport { getState, setState, subscribe } from \".\"\nimport type { atom, atomFamily } from \"./atom\"\nimport type { selector, selectorFamily } from \"./selector\"\nimport type { transaction } from \"./transaction\"\n\nexport class Silo {\n\tpublic store: Store\n\tpublic atom: typeof atom\n\tpublic atomFamily: typeof atomFamily\n\tpublic selector: typeof selector\n\tpublic selectorFamily: typeof selectorFamily\n\tpublic transaction: typeof transaction\n\tpublic timeline: typeof timeline\n\tpublic getState: typeof getState\n\tpublic setState: typeof setState\n\tpublic subscribe: typeof subscribe\n\tpublic undo: typeof undo\n\tpublic redo: typeof redo\n\tpublic constructor(name: string, fromStore: Store | null = null) {\n\t\tconst s = new Store(name, fromStore)\n\t\tthis.store = s\n\t\tthis.atom = (options) => {\n\t\t\tif (`mutable` in options) {\n\t\t\t\treturn createMutableAtom(options, s)\n\t\t\t}\n\t\t\treturn createAtom(options, undefined, s)\n\t\t}\n\t\tthis.atomFamily = (options) => {\n\t\t\tif (`mutable` in options) {\n\t\t\t\treturn createMutableAtomFamily(options, s) as any\n\t\t\t}\n\t\t\treturn createAtomFamily(options, s)\n\t\t}\n\t\tthis.selector = (options) => createSelector(options, undefined, s) as any\n\t\tthis.selectorFamily = (options) => createSelectorFamily(options, s) as any\n\t\tthis.transaction = (options) => createTransaction(options, s)\n\t\tthis.timeline = (options) => createTimeline(options, s)\n\t\tthis.getState = (token) => getState(token, s)\n\t\tthis.setState = (token, newValue) => setState(token, newValue, s)\n\t\tthis.subscribe = (token, handler, key) => subscribe(token, handler, key, s)\n\t\tthis.undo = (token) => timeTravel(`backward`, token, s)\n\t\tthis.redo = (token) => timeTravel(`forward`, token, s)\n\t}\n}\n","import type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, subscribeToRootAtoms, withdraw } from \"atom.io/internal\"\n\nimport type {\n\tFamilyMetadata,\n\tReadonlySelectorToken,\n\tStateToken,\n\tTimelineToken,\n\tTimelineUpdate,\n\tTransactionToken,\n\tTransactionUpdate,\n\tƒn,\n} from \".\"\n\nexport type StateUpdate<T> = { newValue: T; oldValue: T }\nexport type KeyedStateUpdate<T> = StateUpdate<T> & {\n\tkey: string\n\tfamily?: FamilyMetadata\n}\nexport type UpdateHandler<T> = (update: StateUpdate<T>) => void\n\nexport function subscribe<T>(\n\ttoken: ReadonlySelectorToken<T> | StateToken<T>,\n\thandleUpdate: UpdateHandler<T>,\n\tkey: string = Math.random().toString(36).slice(2),\n\tstore: Store = IMPLICIT.STORE,\n): () => void {\n\tconst state = withdraw<T>(token, store)\n\tif (state === undefined) {\n\t\tthrow new Error(\n\t\t\t`State \"${token.key}\" not found in this store. Did you forget to initialize with the \"atom\" or \"selector\" function?`,\n\t\t)\n\t}\n\tconst unsubFunction = state.subject.subscribe(key, handleUpdate)\n\tstore.logger.info(`👀`, state.type, state.key, `Adding subscription \"${key}\"`)\n\tconst dependencyUnsubFunctions =\n\t\tstate.type !== `atom` ? subscribeToRootAtoms(state, store) : null\n\n\tconst unsubscribe =\n\t\tdependencyUnsubFunctions === null\n\t\t\t? () => {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🙈`,\n\t\t\t\t\t\tstate.type,\n\t\t\t\t\t\tstate.key,\n\t\t\t\t\t\t`Removing subscription \"${key}\"`,\n\t\t\t\t\t)\n\t\t\t\t\tunsubFunction()\n\t\t\t }\n\t\t\t: () => {\n\t\t\t\t\tstore.logger.info(\n\t\t\t\t\t\t`🙈`,\n\t\t\t\t\t\tstate.type,\n\t\t\t\t\t\tstate.key,\n\t\t\t\t\t\t`Removing subscription \"${key}\"`,\n\t\t\t\t\t)\n\t\t\t\t\tunsubFunction()\n\t\t\t\t\tfor (const unsubFromDependency of dependencyUnsubFunctions) {\n\t\t\t\t\t\tunsubFromDependency()\n\t\t\t\t\t}\n\t\t\t }\n\n\treturn unsubscribe\n}\n\nexport type TransactionUpdateHandler<ƒ extends ƒn> = (\n\tdata: TransactionUpdate<ƒ>,\n) => void\n\nexport const subscribeToTransaction = <ƒ extends ƒn>(\n\ttoken: TransactionToken<ƒ>,\n\thandleUpdate: TransactionUpdateHandler<ƒ>,\n\tkey: string = Math.random().toString(36).slice(2),\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tx = withdraw(token, store)\n\tif (tx === undefined) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to transaction \"${token.key}\": transaction not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.logger.info(\n\t\t`👀`,\n\t\t`transaction`,\n\t\ttoken.key,\n\t\t`Adding subscription \"${key}\"`,\n\t)\n\tconst unsubscribe = tx.subject.subscribe(key, handleUpdate)\n\treturn () => {\n\t\tstore.logger.info(\n\t\t\t`🙈`,\n\t\t\t`transaction`,\n\t\t\ttoken.key,\n\t\t\t`Removing subscription \"${key}\"`,\n\t\t)\n\t\tunsubscribe()\n\t}\n}\n\nexport const subscribeToTimeline = (\n\ttoken: TimelineToken,\n\thandleUpdate: (update: TimelineUpdate | `redo` | `undo`) => void,\n\tkey: string = Math.random().toString(36).slice(2),\n\tstore = IMPLICIT.STORE,\n): (() => void) => {\n\tconst tl = withdraw(token, store)\n\tif (tl === undefined) {\n\t\tthrow new Error(\n\t\t\t`Cannot subscribe to timeline \"${token.key}\": timeline not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n\tstore.logger.info(`👀`, `timeline`, token.key, `Adding subscription \"${key}\"`)\n\tconst unsubscribe = tl.subject.subscribe(key, handleUpdate)\n\treturn () => {\n\t\tstore.logger.info(\n\t\t\t`🙈`,\n\t\t\t`timeline`,\n\t\t\ttoken.key,\n\t\t\t`Removing subscription \"${key}\" from timeline`,\n\t\t)\n\t\tunsubscribe()\n\t}\n}\n","import type {\n\tTimeline,\n\tTimelineAtomUpdate,\n\tTimelineSelectorUpdate,\n\tTimelineTransactionUpdate,\n} from \"atom.io/internal\"\nimport { IMPLICIT, createTimeline, timeTravel } from \"atom.io/internal\"\n\nimport type { AtomFamily, AtomToken } from \".\"\n\nexport type TimelineToken = {\n\tkey: string\n\ttype: `timeline`\n}\n\nexport type TimelineOptions = {\n\tkey: string\n\tatoms: (AtomFamily<any, any> | AtomToken<any>)[]\n\tshouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean\n}\n\nexport type TimelineUpdate =\n\t| TimelineAtomUpdate\n\t| TimelineSelectorUpdate\n\t| TimelineTransactionUpdate\n\nexport const timeline = (options: TimelineOptions): TimelineToken => {\n\treturn createTimeline(options, IMPLICIT.STORE)\n}\n\nexport const redo = (timeline: TimelineToken): void => {\n\ttimeTravel(`forward`, timeline, IMPLICIT.STORE)\n}\n\nexport const undo = (timeline: TimelineToken): void => {\n\ttimeTravel(`backward`, timeline, IMPLICIT.STORE)\n}\n","import type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, createTransaction, withdraw } from \"atom.io/internal\"\n\nimport type { KeyedStateUpdate, ReadonlySelectorToken, StateToken, ƒn } from \".\"\n\nexport type TransactionToken<_> = {\n\tkey: string\n\ttype: `transaction`\n\t__brand?: _\n}\n\nexport type TransactionUpdate<ƒ extends ƒn> = {\n\tkey: string\n\tatomUpdates: KeyedStateUpdate<unknown>[]\n\tparams: Parameters<ƒ>\n\toutput: ReturnType<ƒ>\n}\n\nexport type Transactors = {\n\tget: <S>(state: ReadonlySelectorToken<S> | StateToken<S>) => S\n\tset: <S>(state: StateToken<S>, newValue: S | ((oldValue: S) => S)) => void\n}\nexport type ReadonlyTransactors = Pick<Transactors, `get`>\n\nexport type Read<ƒ extends ƒn> = (\n\ttransactors: ReadonlyTransactors,\n\t...parameters: Parameters<ƒ>\n) => ReturnType<ƒ>\n\nexport type Write<ƒ extends ƒn> = (\n\ttransactors: Transactors,\n\t...parameters: Parameters<ƒ>\n) => ReturnType<ƒ>\n\nexport type TransactionOptions<ƒ extends ƒn> = {\n\tkey: string\n\tdo: Write<ƒ>\n}\n\nexport type TransactionIO<Token extends TransactionToken<any>> =\n\tToken extends TransactionToken<infer ƒ> ? ƒ : never\n\nexport function transaction<ƒ extends ƒn>(\n\toptions: TransactionOptions<ƒ>,\n): TransactionToken<ƒ> {\n\treturn createTransaction(options, IMPLICIT.STORE)\n}\n\nexport const runTransaction =\n\t<ƒ extends ƒn>(token: TransactionToken<ƒ>, store: Store = IMPLICIT.STORE) =>\n\t(...parameters: Parameters<ƒ>): ReturnType<ƒ> => {\n\t\tconst tx = withdraw(token, store)\n\t\tif (tx) {\n\t\t\treturn tx.run(...parameters)\n\t\t}\n\t\tthrow new Error(\n\t\t\t`Cannot run transaction \"${token.key}\": transaction not found in store \"${store.config.name}\".`,\n\t\t)\n\t}\n"]}
@@ -1,6 +1,5 @@
1
1
  import * as Internal from 'atom.io/internal';
2
2
  import { Transceiver, Subject, Store, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate } from 'atom.io/internal';
3
- export { deleteAtom } from 'atom.io/internal';
4
3
  import { Json, JsonInterface } from 'atom.io/json';
5
4
 
6
5
  type Effectors<T> = {
@@ -10,7 +9,7 @@ type Effectors<T> = {
10
9
  oldValue: T;
11
10
  }) => void) => void;
12
11
  };
13
- type AtomEffect<T> = (tools: Effectors<T>) => void;
12
+ type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
14
13
  type AtomOptions<T> = {
15
14
  key: string;
16
15
  default: T | (() => T);
@@ -43,11 +42,9 @@ type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends J
43
42
  declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>;
44
43
  declare function atomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>): AtomFamily<T, K>;
45
44
 
46
- declare const getState: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store) => T;
47
- declare const setState: <T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store) => void;
48
- declare class NotFoundError extends Error {
49
- constructor(token: ReadonlySelectorToken<any> | StateToken<any>, store: Internal.Store);
50
- }
45
+ declare function dispose(token: ReadonlySelectorToken<any> | StateToken<any>, store?: Internal.Store): void;
46
+
47
+ declare function getState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store): T;
51
48
 
52
49
  declare const LoggerIconDictionary: {
53
50
  readonly "\u231B": "Timeline event fully captured";
@@ -90,7 +87,7 @@ declare const LoggerIconDictionary: {
90
87
  };
91
88
  type LoggerIcon = keyof typeof LoggerIconDictionary;
92
89
  declare const LOG_LEVELS: readonly ["info", "warn", "error"];
93
- type LogLevel = typeof LOG_LEVELS[number];
90
+ type LogLevel = (typeof LOG_LEVELS)[number];
94
91
  type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
95
92
  type LogFilter = (...params: Parameters<LogFn>) => boolean;
96
93
  type Logger = Record<LogLevel, LogFn>;
@@ -165,6 +162,8 @@ type ReadonlySelectorFamily<T, K extends Json.Serializable = Json.Serializable>
165
162
  declare function selectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
166
163
  declare function selectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
167
164
 
165
+ declare function setState<T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store): void;
166
+
168
167
  declare class Silo {
169
168
  store: Store;
170
169
  atom: typeof atom;
@@ -206,8 +205,8 @@ type TimelineOptions = {
206
205
  };
207
206
  type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
208
207
  declare const timeline: (options: TimelineOptions) => TimelineToken;
209
- declare const redo: (token: TimelineToken) => void;
210
- declare const undo: (token: TimelineToken) => void;
208
+ declare const redo: (timeline: TimelineToken) => void;
209
+ declare const undo: (timeline: TimelineToken) => void;
211
210
 
212
211
  type ƒn = (...parameters: any[]) => any;
213
212
  type AtomToken<_> = {
@@ -238,4 +237,4 @@ type FamilyMetadata = {
238
237
  subKey: string;
239
238
  };
240
239
 
241
- export { type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, NotFoundError, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, type ƒn };
240
+ export { type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, dispose, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, type ƒn };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as Internal from 'atom.io/internal';
2
2
  import { Transceiver, Subject, Store, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate } from 'atom.io/internal';
3
- export { deleteAtom } from 'atom.io/internal';
4
3
  import { Json, JsonInterface } from 'atom.io/json';
5
4
 
6
5
  type Effectors<T> = {
@@ -10,7 +9,7 @@ type Effectors<T> = {
10
9
  oldValue: T;
11
10
  }) => void) => void;
12
11
  };
13
- type AtomEffect<T> = (tools: Effectors<T>) => void;
12
+ type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
14
13
  type AtomOptions<T> = {
15
14
  key: string;
16
15
  default: T | (() => T);
@@ -43,11 +42,9 @@ type MutableAtomFamily<Core extends Transceiver<any>, SerializableCore extends J
43
42
  declare function atomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamily<T, J, K>;
44
43
  declare function atomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>): AtomFamily<T, K>;
45
44
 
46
- declare const getState: <T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store) => T;
47
- declare const setState: <T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store) => void;
48
- declare class NotFoundError extends Error {
49
- constructor(token: ReadonlySelectorToken<any> | StateToken<any>, store: Internal.Store);
50
- }
45
+ declare function dispose(token: ReadonlySelectorToken<any> | StateToken<any>, store?: Internal.Store): void;
46
+
47
+ declare function getState<T>(token: ReadonlySelectorToken<T> | StateToken<T>, store?: Internal.Store): T;
51
48
 
52
49
  declare const LoggerIconDictionary: {
53
50
  readonly "\u231B": "Timeline event fully captured";
@@ -90,7 +87,7 @@ declare const LoggerIconDictionary: {
90
87
  };
91
88
  type LoggerIcon = keyof typeof LoggerIconDictionary;
92
89
  declare const LOG_LEVELS: readonly ["info", "warn", "error"];
93
- type LogLevel = typeof LOG_LEVELS[number];
90
+ type LogLevel = (typeof LOG_LEVELS)[number];
94
91
  type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
95
92
  type LogFilter = (...params: Parameters<LogFn>) => boolean;
96
93
  type Logger = Record<LogLevel, LogFn>;
@@ -165,6 +162,8 @@ type ReadonlySelectorFamily<T, K extends Json.Serializable = Json.Serializable>
165
162
  declare function selectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>): SelectorFamily<T, K>;
166
163
  declare function selectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>): ReadonlySelectorFamily<T, K>;
167
164
 
165
+ declare function setState<T, New extends T>(token: StateToken<T>, value: New | ((oldValue: T) => New), store?: Internal.Store): void;
166
+
168
167
  declare class Silo {
169
168
  store: Store;
170
169
  atom: typeof atom;
@@ -206,8 +205,8 @@ type TimelineOptions = {
206
205
  };
207
206
  type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
208
207
  declare const timeline: (options: TimelineOptions) => TimelineToken;
209
- declare const redo: (token: TimelineToken) => void;
210
- declare const undo: (token: TimelineToken) => void;
208
+ declare const redo: (timeline: TimelineToken) => void;
209
+ declare const undo: (timeline: TimelineToken) => void;
211
210
 
212
211
  type ƒn = (...parameters: any[]) => any;
213
212
  type AtomToken<_> = {
@@ -238,4 +237,4 @@ type FamilyMetadata = {
238
237
  subKey: string;
239
238
  };
240
239
 
241
- export { type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, NotFoundError, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, type ƒn };
240
+ export { type AtomEffect, type AtomFamily, type AtomFamilyOptions, AtomIOLogger, type AtomOptions, type AtomToken, type Effectors, type FamilyMetadata, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type SelectorFamily, type SelectorFamilyOptions, type SelectorOptions, type SelectorToken, Silo, type StateToken, type StateUpdate, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateHandler, type Transactors, type UpdateHandler, type Write, atom, atomFamily, dispose, getState, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, subscribeToTimeline, subscribeToTransaction, timeline, transaction, undo, type ƒn };