atom.io 0.24.2 → 0.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/dist/index.cjs +3 -6
- package/data/dist/index.js +2 -2
- package/dist/{chunk-BWWVY5O5.js → chunk-H6EDLPKH.js} +1 -2
- package/dist/{chunk-FTONNX2R.js → chunk-HYXKCFVY.js} +3 -6
- package/dist/{chunk-3V3VWQ7X.js → chunk-MR5NETHW.js} +1 -2
- package/dist/index.cjs +0 -9
- package/dist/index.d.ts +6 -7
- package/dist/index.js +2 -9
- package/ephemeral/dist/index.js +1 -1
- package/eslint-plugin/dist/index.js +1 -1
- package/immortal/dist/index.js +1 -1
- package/internal/dist/index.cjs +16 -14
- package/internal/dist/index.d.ts +3 -1
- package/internal/dist/index.js +15 -10
- package/internal/src/get-state/get-from-store.ts +31 -2
- package/internal/src/molecule/make-molecule-in-store.ts +2 -1
- package/introspection/dist/index.js +1 -1
- package/json/dist/index.d.ts +1 -1
- package/json/dist/index.js +1 -1
- package/package.json +12 -12
- package/react/dist/index.js +1 -1
- package/react-devtools/dist/index.cjs +44 -60
- package/react-devtools/dist/index.js +43 -57
- package/realtime/dist/index.js +1 -1
- package/realtime-client/dist/index.cjs +2 -4
- package/realtime-client/dist/index.js +3 -4
- package/realtime-react/dist/index.js +1 -1
- package/realtime-server/dist/index.cjs +2 -4
- package/realtime-server/dist/index.js +3 -5
- package/realtime-testing/dist/index.cjs +1 -2
- package/realtime-testing/dist/index.js +3 -4
- package/src/get-state.ts +6 -2
- package/src/molecule.ts +1 -14
- package/src/transaction.ts +3 -2
- package/transceivers/set-rtx/dist/index.cjs +1 -2
- package/transceivers/set-rtx/dist/index.js +2 -3
- /package/dist/{chunk-F2X4B4VY.js → chunk-S4N6XNPH.js} +0 -0
package/data/dist/index.cjs
CHANGED
|
@@ -67,8 +67,7 @@ var Junction = class {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
|
|
70
|
-
for (const y of ys)
|
|
71
|
-
this.addRelation(x, y);
|
|
70
|
+
for (const y of ys) this.addRelation(x, y);
|
|
72
71
|
}
|
|
73
72
|
for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
|
|
74
73
|
this.setContent(contentKey, content);
|
|
@@ -168,13 +167,11 @@ var Junction = class {
|
|
|
168
167
|
switch (this.cardinality) {
|
|
169
168
|
case `1:1`: {
|
|
170
169
|
const bPrev = this.getRelatedKey(a);
|
|
171
|
-
if (bPrev && bPrev !== b)
|
|
172
|
-
this.delete(bPrev, a);
|
|
170
|
+
if (bPrev && bPrev !== b) this.delete(bPrev, a);
|
|
173
171
|
}
|
|
174
172
|
case `1:n`: {
|
|
175
173
|
const aPrev = this.getRelatedKey(b);
|
|
176
|
-
if (aPrev && aPrev !== a)
|
|
177
|
-
this.delete(aPrev, b);
|
|
174
|
+
if (aPrev && aPrev !== a) this.delete(aPrev, b);
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
177
|
if (content) {
|
package/data/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Junction } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
1
|
+
import { Junction } from '../../dist/chunk-HYXKCFVY.js';
|
|
2
|
+
import '../../dist/chunk-S4N6XNPH.js';
|
|
3
3
|
import { createStandaloneSelector, findInStore, IMPLICIT, getFromStore, setIntoStore, seekInStore, getJsonToken, disposeFromStore, withdraw, growMoleculeInStore, initFamilyMemberInStore, createMutableAtomFamily, createRegularAtomFamily, createMoleculeFamily, newest, makeMoleculeInStore, isChildStore, createRegularAtom, createSelectorFamily, getJsonFamily } from 'atom.io/internal';
|
|
4
4
|
import { stringifyJson } from 'atom.io/json';
|
|
5
5
|
import { SetRTX } from 'atom.io/transceivers/set-rtx';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// __unstable__/web-effects/src/storage.ts
|
|
2
2
|
var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, onSet }) => {
|
|
3
3
|
const savedValue = storage.getItem(key);
|
|
4
|
-
if (savedValue != null)
|
|
5
|
-
setSelf(parse(savedValue));
|
|
4
|
+
if (savedValue != null) setSelf(parse(savedValue));
|
|
6
5
|
onSet(({ newValue }) => {
|
|
7
6
|
if (newValue == null) {
|
|
8
7
|
storage.removeItem(key);
|
|
@@ -44,8 +44,7 @@ var Junction = class {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
|
|
47
|
-
for (const y of ys)
|
|
48
|
-
this.addRelation(x, y);
|
|
47
|
+
for (const y of ys) this.addRelation(x, y);
|
|
49
48
|
}
|
|
50
49
|
for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
|
|
51
50
|
this.setContent(contentKey, content);
|
|
@@ -145,13 +144,11 @@ var Junction = class {
|
|
|
145
144
|
switch (this.cardinality) {
|
|
146
145
|
case `1:1`: {
|
|
147
146
|
const bPrev = this.getRelatedKey(a);
|
|
148
|
-
if (bPrev && bPrev !== b)
|
|
149
|
-
this.delete(bPrev, a);
|
|
147
|
+
if (bPrev && bPrev !== b) this.delete(bPrev, a);
|
|
150
148
|
}
|
|
151
149
|
case `1:n`: {
|
|
152
150
|
const aPrev = this.getRelatedKey(b);
|
|
153
|
-
if (aPrev && aPrev !== a)
|
|
154
|
-
this.delete(aPrev, b);
|
|
151
|
+
if (aPrev && aPrev !== a) this.delete(aPrev, b);
|
|
155
152
|
}
|
|
156
153
|
}
|
|
157
154
|
if (content) {
|
|
@@ -113,8 +113,7 @@ var sprawl = (tree, inspector) => {
|
|
|
113
113
|
var _a;
|
|
114
114
|
const inspect = (p, n) => {
|
|
115
115
|
const result2 = inspector(p, n);
|
|
116
|
-
if (result2)
|
|
117
|
-
return result2;
|
|
116
|
+
if (result2) return result2;
|
|
118
117
|
return null;
|
|
119
118
|
};
|
|
120
119
|
const result = inspect(path, node);
|
package/dist/index.cjs
CHANGED
|
@@ -81,13 +81,6 @@ function moleculeFamily(options) {
|
|
|
81
81
|
function makeMolecule(context, family, key, ...params) {
|
|
82
82
|
return Internal.makeMoleculeInStore(Internal.IMPLICIT.STORE, context, family, key, ...params);
|
|
83
83
|
}
|
|
84
|
-
function useMoleculeFromStore(token, store) {
|
|
85
|
-
const molecule = store.molecules.get(json.stringifyJson(token.key));
|
|
86
|
-
return molecule == null ? void 0 : molecule.instance;
|
|
87
|
-
}
|
|
88
|
-
function useMolecule(token) {
|
|
89
|
-
return useMoleculeFromStore(token, Internal.IMPLICIT.STORE);
|
|
90
|
-
}
|
|
91
84
|
function makeRootMolecule(key, store = Internal.IMPLICIT.STORE) {
|
|
92
85
|
const molecule = new Internal.Molecule(void 0, key);
|
|
93
86
|
store.molecules.set(json.stringifyJson(key), molecule);
|
|
@@ -196,5 +189,3 @@ exports.subscribe = subscribe;
|
|
|
196
189
|
exports.timeline = timeline;
|
|
197
190
|
exports.transaction = transaction;
|
|
198
191
|
exports.undo = undo;
|
|
199
|
-
exports.useMolecule = useMolecule;
|
|
200
|
-
exports.useMoleculeFromStore = useMoleculeFromStore;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transceiver, Subject, Store, EnvironmentData, Timeline, TimelineAtomUpdate, TimelineMoleculeCreation, TimelineMoleculeDisposal, TimelineSelectorUpdate, TimelineStateCreation, TimelineStateDisposal, TimelineTransactionUpdate } from 'atom.io/internal';
|
|
2
2
|
import { Json, JsonInterface } from 'atom.io/json';
|
|
3
|
-
import { MoleculeConstructor as MoleculeConstructor$1, MoleculeToken as MoleculeToken$1, MoleculeFamilyToken as MoleculeFamilyToken$1, MoleculeParams as MoleculeParams$1, makeMolecule as makeMolecule$1, Flat as Flat$1, TransactorsWithRunAndEnv as TransactorsWithRunAndEnv$1, MutableAtomFamilyToken as MutableAtomFamilyToken$1, MutableAtomToken as MutableAtomToken$1, RegularAtomFamilyToken as RegularAtomFamilyToken$1, RegularAtomToken as RegularAtomToken$1, WritableSelectorFamilyToken as WritableSelectorFamilyToken$1, WritableSelectorToken as WritableSelectorToken$1, ReadonlySelectorFamilyToken as ReadonlySelectorFamilyToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, WritableFamilyToken as WritableFamilyToken$1, WritableToken as WritableToken$1, ReadableFamilyToken as ReadableFamilyToken$1, ReadableToken as ReadableToken$1, MoleculeCreation as MoleculeCreation$1, MoleculeDisposal as MoleculeDisposal$1 } from 'atom.io';
|
|
3
|
+
import { MoleculeConstructor as MoleculeConstructor$1, MoleculeToken as MoleculeToken$1, MoleculeFamilyToken as MoleculeFamilyToken$1, MoleculeParams as MoleculeParams$1, getState as getState$1, makeMolecule as makeMolecule$1, Flat as Flat$1, TransactorsWithRunAndEnv as TransactorsWithRunAndEnv$1, MutableAtomFamilyToken as MutableAtomFamilyToken$1, MutableAtomToken as MutableAtomToken$1, RegularAtomFamilyToken as RegularAtomFamilyToken$1, RegularAtomToken as RegularAtomToken$1, WritableSelectorFamilyToken as WritableSelectorFamilyToken$1, WritableSelectorToken as WritableSelectorToken$1, ReadonlySelectorFamilyToken as ReadonlySelectorFamilyToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, WritableFamilyToken as WritableFamilyToken$1, WritableToken as WritableToken$1, ReadableFamilyToken as ReadableFamilyToken$1, ReadableToken as ReadableToken$1, MoleculeCreation as MoleculeCreation$1, MoleculeDisposal as MoleculeDisposal$1 } from 'atom.io';
|
|
4
4
|
import { findState } from 'atom.io/ephemeral';
|
|
5
5
|
import { seekState } from 'atom.io/immortal';
|
|
6
6
|
import { JoinToken } from 'atom.io/data';
|
|
@@ -110,14 +110,14 @@ type TransactionUpdate<F extends Func> = {
|
|
|
110
110
|
output: ReturnType<F>;
|
|
111
111
|
};
|
|
112
112
|
type Transactors = Readonly<{
|
|
113
|
-
get:
|
|
113
|
+
get: typeof getState$1;
|
|
114
114
|
set: <S, New extends S>(state: WritableToken<S>, newValue: New | ((oldValue: S) => New)) => void;
|
|
115
115
|
find: typeof findState;
|
|
116
116
|
seek: typeof seekState;
|
|
117
117
|
json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
|
|
118
118
|
}>;
|
|
119
119
|
type TransactorsWithRunAndEnv = Readonly<{
|
|
120
|
-
get:
|
|
120
|
+
get: typeof getState$1;
|
|
121
121
|
set: <S, New extends S>(state: WritableToken<S>, newValue: New | ((oldValue: S) => New)) => void;
|
|
122
122
|
find: typeof findState;
|
|
123
123
|
seek: typeof seekState;
|
|
@@ -207,7 +207,7 @@ type MoleculeTransactors<K extends Json.Serializable> = Flat$1<Omit<TransactorsW
|
|
|
207
207
|
claim(below: MoleculeToken<any>, options: {
|
|
208
208
|
exclusive: boolean;
|
|
209
209
|
}): any;
|
|
210
|
-
join
|
|
210
|
+
join<J extends JoinToken<any, any, any, any>>(joinToken: J): J;
|
|
211
211
|
spawn<Key extends Json.Serializable, Ctor extends MoleculeConstructor>(family: MoleculeFamilyToken<Ctor>, key: Key, ...params: MoleculeParams<Ctor>): MoleculeToken<Ctor>;
|
|
212
212
|
}>;
|
|
213
213
|
type MoleculeConstructor = new (transactors: MoleculeTransactors<any>, key: any, ...params: any) => any;
|
|
@@ -237,8 +237,6 @@ type MoleculeToken<M extends MoleculeConstructor> = {
|
|
|
237
237
|
};
|
|
238
238
|
declare function moleculeFamily<M extends MoleculeConstructor>(options: MoleculeFamilyOptions<M>): MoleculeFamilyToken<M>;
|
|
239
239
|
declare function makeMolecule<M extends MoleculeConstructor>(context: MoleculeToken<any> | MoleculeToken<any>[], family: MoleculeFamilyToken<M>, key: MoleculeKey<M>, ...params: MoleculeParams<M>): MoleculeToken<M>;
|
|
240
|
-
declare function useMoleculeFromStore<M extends MoleculeConstructor>(token: MoleculeToken<M>, store: Store): InstanceType<M> | undefined;
|
|
241
|
-
declare function useMolecule<M extends MoleculeConstructor>(token: MoleculeToken<M>): InstanceType<M> | undefined;
|
|
242
240
|
type MoleculeType<T extends MoleculeFamilyToken<any>> = T extends MoleculeFamilyToken<infer M> ? M : T extends MoleculeToken<infer M> ? M : never;
|
|
243
241
|
type MoleculeKey<M extends MoleculeConstructor> = InstanceType<M>[`key`];
|
|
244
242
|
type MK<M extends MoleculeConstructor> = MoleculeKey<M>;
|
|
@@ -247,6 +245,7 @@ declare function makeRootMolecule(key: string, store?: Store): MoleculeToken<Obj
|
|
|
247
245
|
declare function disposeState(token: MoleculeToken<any> | ReadableToken<any>): void;
|
|
248
246
|
|
|
249
247
|
declare function getState<T>(token: ReadableToken<T>): T;
|
|
248
|
+
declare function getState<M extends MoleculeConstructor>(token: MoleculeToken<M>): InstanceType<M> | undefined;
|
|
250
249
|
|
|
251
250
|
declare const LoggerIconDictionary: {
|
|
252
251
|
readonly "\u231B": "Timeline event fully captured";
|
|
@@ -427,4 +426,4 @@ type FamilyMetadata = {
|
|
|
427
426
|
subKey: string;
|
|
428
427
|
};
|
|
429
428
|
|
|
430
|
-
export { type AtomEffect, type AtomFamily, type AtomFamilyToken, AtomIOLogger, type AtomOnly, type AtomToken, type Effectors, type FamilyMetadata, type Flat, type Func, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MK, type MoleculeConstructor, type MoleculeCreation, type MoleculeDisposal, type MoleculeFamily, type MoleculeFamilyOptions, type MoleculeFamilyToken, type MoleculeKey, type MoleculeParams, type MoleculeToken, type MoleculeTransactors, type MoleculeType, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomFamilyToken, type MutableAtomFamilyTokenWithCall, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadableFamily, type ReadableFamilyToken, type ReadableToken, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorFamilyToken, type ReadonlySelectorFamilyTokenWithCall, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type RegularAtomFamily, type RegularAtomFamilyOptions, type RegularAtomFamilyToken, type RegularAtomFamilyTokenWithCall, type RegularAtomOptions, type RegularAtomToken, type SelectorFamily, type SelectorFamilyToken, type SelectorToken, Silo, type StateCreation, type StateDisposal, type StateUpdate, type TimelineManageable, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TokenDenomination, type TokenType, type Transact, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateContent, type TransactionUpdateHandler, type Transactors, type TransactorsWithRunAndEnv, type UpdateHandler, type WritableFamily, type WritableFamilyToken, type WritableSelectorFamily, type WritableSelectorFamilyOptions, type WritableSelectorFamilyToken, type WritableSelectorFamilyTokenWithCall, type WritableSelectorOptions, type WritableSelectorToken, type WritableToken, type Write, atom, atomFamily, belongsTo, disposeState, getState, isToken, makeMolecule, makeRootMolecule, moleculeFamily, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo
|
|
429
|
+
export { type AtomEffect, type AtomFamily, type AtomFamilyToken, AtomIOLogger, type AtomOnly, type AtomToken, type Effectors, type FamilyMetadata, type Flat, type Func, type KeyedStateUpdate, LOG_LEVELS, type LogFilter, type LogFn, type LogLevel, type Logger, type LoggerIcon, type MK, type MoleculeConstructor, type MoleculeCreation, type MoleculeDisposal, type MoleculeFamily, type MoleculeFamilyOptions, type MoleculeFamilyToken, type MoleculeKey, type MoleculeParams, type MoleculeToken, type MoleculeTransactors, type MoleculeType, type MutableAtomFamily, type MutableAtomFamilyOptions, type MutableAtomFamilyToken, type MutableAtomFamilyTokenWithCall, type MutableAtomOptions, type MutableAtomToken, type Read, type ReadableFamily, type ReadableFamilyToken, type ReadableToken, type ReadonlySelectorFamily, type ReadonlySelectorFamilyOptions, type ReadonlySelectorFamilyToken, type ReadonlySelectorFamilyTokenWithCall, type ReadonlySelectorOptions, type ReadonlySelectorToken, type ReadonlyTransactors, type RegularAtomFamily, type RegularAtomFamilyOptions, type RegularAtomFamilyToken, type RegularAtomFamilyTokenWithCall, type RegularAtomOptions, type RegularAtomToken, type SelectorFamily, type SelectorFamilyToken, type SelectorToken, Silo, type StateCreation, type StateDisposal, type StateUpdate, type TimelineManageable, type TimelineOptions, type TimelineToken, type TimelineUpdate, type TokenDenomination, type TokenType, type Transact, type TransactionIO, type TransactionOptions, type TransactionToken, type TransactionUpdate, type TransactionUpdateContent, type TransactionUpdateHandler, type Transactors, type TransactorsWithRunAndEnv, type UpdateHandler, type WritableFamily, type WritableFamilyToken, type WritableSelectorFamily, type WritableSelectorFamilyOptions, type WritableSelectorFamilyToken, type WritableSelectorFamilyTokenWithCall, type WritableSelectorOptions, type WritableSelectorToken, type WritableToken, type Write, atom, atomFamily, belongsTo, disposeState, getState, isToken, makeMolecule, makeRootMolecule, moleculeFamily, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './chunk-
|
|
1
|
+
import './chunk-S4N6XNPH.js';
|
|
2
2
|
import * as Internal from 'atom.io/internal';
|
|
3
3
|
import { createStandaloneAtom, IMPLICIT, createAtomFamily, createMoleculeFamily, makeMoleculeInStore, Molecule, createStandaloneSelector, createSelectorFamily, Store, createTransaction, createTimeline, findInStore, getFromStore, setIntoStore, timeTravel, subscribeToTimeline, subscribeToTransaction, subscribeToState, arbitrary, actUponStore } from 'atom.io/internal';
|
|
4
4
|
import { stringifyJson } from 'atom.io/json';
|
|
@@ -60,13 +60,6 @@ function moleculeFamily(options) {
|
|
|
60
60
|
function makeMolecule(context, family, key, ...params) {
|
|
61
61
|
return makeMoleculeInStore(IMPLICIT.STORE, context, family, key, ...params);
|
|
62
62
|
}
|
|
63
|
-
function useMoleculeFromStore(token, store) {
|
|
64
|
-
const molecule = store.molecules.get(stringifyJson(token.key));
|
|
65
|
-
return molecule == null ? void 0 : molecule.instance;
|
|
66
|
-
}
|
|
67
|
-
function useMolecule(token) {
|
|
68
|
-
return useMoleculeFromStore(token, IMPLICIT.STORE);
|
|
69
|
-
}
|
|
70
63
|
function makeRootMolecule(key, store = IMPLICIT.STORE) {
|
|
71
64
|
const molecule = new Molecule(void 0, key);
|
|
72
65
|
store.molecules.set(stringifyJson(key), molecule);
|
|
@@ -152,4 +145,4 @@ function belongsTo(family, unknownToken) {
|
|
|
152
145
|
return family.key === ((_a = unknownToken.family) == null ? void 0 : _a.key);
|
|
153
146
|
}
|
|
154
147
|
|
|
155
|
-
export { AtomIOLogger, LOG_LEVELS, Silo, atom, atomFamily, belongsTo, disposeState, getState, isToken, makeMolecule, makeRootMolecule, moleculeFamily, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo
|
|
148
|
+
export { AtomIOLogger, LOG_LEVELS, Silo, atom, atomFamily, belongsTo, disposeState, getState, isToken, makeMolecule, makeRootMolecule, moleculeFamily, redo, runTransaction, selector, selectorFamily, setState, simpleLog, simpleLogger, subscribe, timeline, transaction, undo };
|
package/ephemeral/dist/index.js
CHANGED
package/immortal/dist/index.js
CHANGED
package/internal/dist/index.cjs
CHANGED
|
@@ -137,8 +137,7 @@ var Junction = class {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
for (const [x, ys] of (_c = data.relations) != null ? _c : []) {
|
|
140
|
-
for (const y of ys)
|
|
141
|
-
this.addRelation(x, y);
|
|
140
|
+
for (const y of ys) this.addRelation(x, y);
|
|
142
141
|
}
|
|
143
142
|
for (const [contentKey, content] of (_d = data.contents) != null ? _d : []) {
|
|
144
143
|
this.setContent(contentKey, content);
|
|
@@ -238,13 +237,11 @@ var Junction = class {
|
|
|
238
237
|
switch (this.cardinality) {
|
|
239
238
|
case `1:1`: {
|
|
240
239
|
const bPrev = this.getRelatedKey(a);
|
|
241
|
-
if (bPrev && bPrev !== b)
|
|
242
|
-
this.delete(bPrev, a);
|
|
240
|
+
if (bPrev && bPrev !== b) this.delete(bPrev, a);
|
|
243
241
|
}
|
|
244
242
|
case `1:n`: {
|
|
245
243
|
const aPrev = this.getRelatedKey(b);
|
|
246
|
-
if (aPrev && aPrev !== a)
|
|
247
|
-
this.delete(aPrev, b);
|
|
244
|
+
if (aPrev && aPrev !== a) this.delete(aPrev, b);
|
|
248
245
|
}
|
|
249
246
|
}
|
|
250
247
|
if (content) {
|
|
@@ -456,16 +453,13 @@ var Store = class {
|
|
|
456
453
|
];
|
|
457
454
|
this.logger = {
|
|
458
455
|
error: (...messages) => {
|
|
459
|
-
for (const logger of this.loggers)
|
|
460
|
-
logger.error(...messages);
|
|
456
|
+
for (const logger of this.loggers) logger.error(...messages);
|
|
461
457
|
},
|
|
462
458
|
info: (...messages) => {
|
|
463
|
-
for (const logger of this.loggers)
|
|
464
|
-
logger.info(...messages);
|
|
459
|
+
for (const logger of this.loggers) logger.info(...messages);
|
|
465
460
|
},
|
|
466
461
|
warn: (...messages) => {
|
|
467
|
-
for (const logger of this.loggers)
|
|
468
|
-
logger.warn(...messages);
|
|
462
|
+
for (const logger of this.loggers) logger.warn(...messages);
|
|
469
463
|
}
|
|
470
464
|
};
|
|
471
465
|
if (store !== null) {
|
|
@@ -966,8 +960,7 @@ var setAtom = (atom, next, target) => {
|
|
|
966
960
|
transceiver = copiedValue;
|
|
967
961
|
}
|
|
968
962
|
const accepted = transceiver.do(update.newValue) === null;
|
|
969
|
-
if (accepted)
|
|
970
|
-
evictDownStream(mutableAtom, target);
|
|
963
|
+
if (accepted) evictDownStream(mutableAtom, target);
|
|
971
964
|
}
|
|
972
965
|
}
|
|
973
966
|
};
|
|
@@ -1062,6 +1055,14 @@ function getEnvironmentData(store) {
|
|
|
1062
1055
|
|
|
1063
1056
|
// internal/src/get-state/get-from-store.ts
|
|
1064
1057
|
function getFromStore(token, store) {
|
|
1058
|
+
if (token.type === `molecule`) {
|
|
1059
|
+
try {
|
|
1060
|
+
const molecule = withdraw(token, store);
|
|
1061
|
+
return molecule.instance;
|
|
1062
|
+
} catch (_) {
|
|
1063
|
+
return void 0;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1065
1066
|
const state = withdraw(token, store);
|
|
1066
1067
|
return readOrComputeValue(state, store);
|
|
1067
1068
|
}
|
|
@@ -1157,6 +1158,7 @@ function makeMoleculeInStore(store, context, familyToken, key, ...params) {
|
|
|
1157
1158
|
const join = data.getJoin(joinToken, store);
|
|
1158
1159
|
join.molecules.set(json.stringifyJson(key), molecule);
|
|
1159
1160
|
molecule.joins.set(joinToken.key, join);
|
|
1161
|
+
return joinToken;
|
|
1160
1162
|
},
|
|
1161
1163
|
spawn: (f, k, ...p) => makeMoleculeInStore(
|
|
1162
1164
|
newest(store),
|
package/internal/dist/index.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ declare class Store implements Lineage {
|
|
|
245
245
|
molecules: Map<string, Molecule<any>>;
|
|
246
246
|
moleculeFamilies: Map<string, atom_io.Flat<atom_io.MoleculeFamilyToken<any> & {
|
|
247
247
|
subject: Subject<atom_io.MoleculeDisposal | atom_io.MoleculeCreation<any>>;
|
|
248
|
-
dependsOn:
|
|
248
|
+
dependsOn: `all` | `any`;
|
|
249
249
|
new: any;
|
|
250
250
|
}>>;
|
|
251
251
|
miscResources: Map<string, Disposable>;
|
|
@@ -432,6 +432,8 @@ type EnvironmentData = {
|
|
|
432
432
|
declare function getEnvironmentData(store: Store): EnvironmentData;
|
|
433
433
|
|
|
434
434
|
declare function getFromStore<T>(token: ReadableToken<T>, store: Store): T;
|
|
435
|
+
declare function getFromStore<M extends MoleculeConstructor>(token: MoleculeToken<M>, store: Store): InstanceType<M> | undefined;
|
|
436
|
+
declare function getFromStore<T, M extends MoleculeConstructor, Token extends MoleculeToken<M> | ReadableToken<T>>(token: Token, store: Store): InstanceType<M> | T | undefined;
|
|
435
437
|
|
|
436
438
|
declare const readOrComputeValue: <T>(state: ReadableState<T>, target: Store) => T;
|
|
437
439
|
|
package/internal/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Junction } from '../../dist/chunk-
|
|
2
|
-
import { __spreadValues, __spreadProps } from '../../dist/chunk-
|
|
1
|
+
import { Junction } from '../../dist/chunk-HYXKCFVY.js';
|
|
2
|
+
import { __spreadValues, __spreadProps } from '../../dist/chunk-S4N6XNPH.js';
|
|
3
3
|
import { stringifyJson, parseJson, selectJson, selectJsonFamily } from 'atom.io/json';
|
|
4
4
|
import { AtomIOLogger } from 'atom.io';
|
|
5
5
|
import { getJoin } from 'atom.io/data';
|
|
@@ -178,16 +178,13 @@ var Store = class {
|
|
|
178
178
|
];
|
|
179
179
|
this.logger = {
|
|
180
180
|
error: (...messages) => {
|
|
181
|
-
for (const logger of this.loggers)
|
|
182
|
-
logger.error(...messages);
|
|
181
|
+
for (const logger of this.loggers) logger.error(...messages);
|
|
183
182
|
},
|
|
184
183
|
info: (...messages) => {
|
|
185
|
-
for (const logger of this.loggers)
|
|
186
|
-
logger.info(...messages);
|
|
184
|
+
for (const logger of this.loggers) logger.info(...messages);
|
|
187
185
|
},
|
|
188
186
|
warn: (...messages) => {
|
|
189
|
-
for (const logger of this.loggers)
|
|
190
|
-
logger.warn(...messages);
|
|
187
|
+
for (const logger of this.loggers) logger.warn(...messages);
|
|
191
188
|
}
|
|
192
189
|
};
|
|
193
190
|
if (store !== null) {
|
|
@@ -688,8 +685,7 @@ var setAtom = (atom, next, target) => {
|
|
|
688
685
|
transceiver = copiedValue;
|
|
689
686
|
}
|
|
690
687
|
const accepted = transceiver.do(update.newValue) === null;
|
|
691
|
-
if (accepted)
|
|
692
|
-
evictDownStream(mutableAtom, target);
|
|
688
|
+
if (accepted) evictDownStream(mutableAtom, target);
|
|
693
689
|
}
|
|
694
690
|
}
|
|
695
691
|
};
|
|
@@ -784,6 +780,14 @@ function getEnvironmentData(store) {
|
|
|
784
780
|
|
|
785
781
|
// internal/src/get-state/get-from-store.ts
|
|
786
782
|
function getFromStore(token, store) {
|
|
783
|
+
if (token.type === `molecule`) {
|
|
784
|
+
try {
|
|
785
|
+
const molecule = withdraw(token, store);
|
|
786
|
+
return molecule.instance;
|
|
787
|
+
} catch (_) {
|
|
788
|
+
return void 0;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
787
791
|
const state = withdraw(token, store);
|
|
788
792
|
return readOrComputeValue(state, store);
|
|
789
793
|
}
|
|
@@ -879,6 +883,7 @@ function makeMoleculeInStore(store, context, familyToken, key, ...params) {
|
|
|
879
883
|
const join = getJoin(joinToken, store);
|
|
880
884
|
join.molecules.set(stringifyJson(key), molecule);
|
|
881
885
|
molecule.joins.set(joinToken.key, join);
|
|
886
|
+
return joinToken;
|
|
882
887
|
},
|
|
883
888
|
spawn: (f, k, ...p) => makeMoleculeInStore(
|
|
884
889
|
newest(store),
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import type { ReadableToken } from "atom.io"
|
|
1
|
+
import type { MoleculeConstructor, MoleculeToken, ReadableToken } from "atom.io"
|
|
2
2
|
|
|
3
3
|
import type { Store } from "../store"
|
|
4
4
|
import { withdraw } from "../store"
|
|
5
5
|
import { readOrComputeValue } from "./read-or-compute-value"
|
|
6
6
|
|
|
7
|
-
export function getFromStore<T>(token: ReadableToken<T>, store: Store): T
|
|
7
|
+
export function getFromStore<T>(token: ReadableToken<T>, store: Store): T
|
|
8
|
+
export function getFromStore<M extends MoleculeConstructor>(
|
|
9
|
+
token: MoleculeToken<M>,
|
|
10
|
+
store: Store,
|
|
11
|
+
): InstanceType<M> | undefined
|
|
12
|
+
export function getFromStore<
|
|
13
|
+
T,
|
|
14
|
+
M extends MoleculeConstructor,
|
|
15
|
+
Token extends MoleculeToken<M> | ReadableToken<T>,
|
|
16
|
+
>(token: Token, store: Store): InstanceType<M> | T | undefined
|
|
17
|
+
export function getFromStore<
|
|
18
|
+
Token extends MoleculeToken<any> | ReadableToken<any>,
|
|
19
|
+
>(
|
|
20
|
+
token: Token,
|
|
21
|
+
store: Store,
|
|
22
|
+
):
|
|
23
|
+
| (Token extends MoleculeToken<infer M>
|
|
24
|
+
? InstanceType<M>
|
|
25
|
+
: Token extends ReadableToken<infer T>
|
|
26
|
+
? T
|
|
27
|
+
: never)
|
|
28
|
+
| undefined {
|
|
29
|
+
if (token.type === `molecule`) {
|
|
30
|
+
try {
|
|
31
|
+
const molecule = withdraw(token, store)
|
|
32
|
+
return molecule.instance
|
|
33
|
+
} catch (_) {
|
|
34
|
+
return undefined
|
|
35
|
+
}
|
|
36
|
+
}
|
|
8
37
|
const state = withdraw(token, store)
|
|
9
38
|
return readOrComputeValue(state, store)
|
|
10
39
|
}
|
|
@@ -101,10 +101,11 @@ export function makeMoleculeInStore<M extends MoleculeConstructor>(
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
-
join:
|
|
104
|
+
join: <J extends JoinToken<any, any, any, any>>(joinToken: J) => {
|
|
105
105
|
const join = getJoin(joinToken, store)
|
|
106
106
|
join.molecules.set(stringifyJson(key), molecule)
|
|
107
107
|
molecule.joins.set(joinToken.key, join)
|
|
108
|
+
return joinToken
|
|
108
109
|
},
|
|
109
110
|
spawn: (f: MoleculeFamilyToken<any>, k: any, ...p: any[]) =>
|
|
110
111
|
makeMoleculeInStore(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadValues } from '../../dist/chunk-
|
|
1
|
+
import { __spreadValues } from '../../dist/chunk-S4N6XNPH.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';
|
package/json/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare namespace json {
|
|
|
31
31
|
export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J
|
|
34
|
+
declare const parseJson: <S extends Stringified<Serializable>>(str: S | string) => S extends Stringified<infer J> ? J : Serializable;
|
|
35
35
|
type Stringified<J extends Serializable> = string & {
|
|
36
36
|
__json: J;
|
|
37
37
|
};
|
package/json/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stringifyJson, parseJson } from '../../dist/chunk-BF4MVQF6.js';
|
|
2
2
|
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-BF4MVQF6.js';
|
|
3
|
-
import '../../dist/chunk-
|
|
3
|
+
import '../../dist/chunk-S4N6XNPH.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.4",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@testing-library/react": "
|
|
51
|
+
"@testing-library/react": "16.0.0",
|
|
52
52
|
"@types/eslint": "npm:@types/eslint@8.56.10",
|
|
53
53
|
"@types/eslint-v9": "npm:@types/eslint@8.56.10",
|
|
54
54
|
"@types/estree": "1.0.5",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"@types/npmlog": "7.0.0",
|
|
57
57
|
"@types/react": "18.3.3",
|
|
58
58
|
"@types/tmp": "0.2.6",
|
|
59
|
-
"@typescript-eslint/parser": "7.
|
|
60
|
-
"@typescript-eslint/rule-tester": "7.
|
|
59
|
+
"@typescript-eslint/parser": "7.13.1",
|
|
60
|
+
"@typescript-eslint/rule-tester": "7.13.1",
|
|
61
61
|
"@vitest/coverage-v8": "1.6.0",
|
|
62
62
|
"@vitest/ui": "1.6.0",
|
|
63
63
|
"concurrently": "8.2.2",
|
|
64
|
-
"drizzle-kit": "0.
|
|
65
|
-
"drizzle-orm": "0.
|
|
64
|
+
"drizzle-kit": "0.22.7",
|
|
65
|
+
"drizzle-orm": "0.31.2",
|
|
66
66
|
"eslint": "npm:eslint@8.57.0",
|
|
67
|
-
"eslint-v9": "npm:eslint@9.
|
|
68
|
-
"framer-motion": "11.2.
|
|
69
|
-
"happy-dom": "14.
|
|
67
|
+
"eslint-v9": "npm:eslint@9.5.0",
|
|
68
|
+
"framer-motion": "11.2.11",
|
|
69
|
+
"happy-dom": "14.12.3",
|
|
70
70
|
"http-proxy": "1.18.1",
|
|
71
71
|
"npmlog": "7.0.1",
|
|
72
72
|
"postgres": "3.4.4",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"socket.io": "4.7.5",
|
|
78
78
|
"socket.io-client": "4.7.5",
|
|
79
79
|
"tmp": "0.2.3",
|
|
80
|
-
"tsup": "8.0
|
|
81
|
-
"typescript": "5.
|
|
82
|
-
"vite": "5.
|
|
80
|
+
"tsup": "8.1.0",
|
|
81
|
+
"typescript": "5.5.2",
|
|
82
|
+
"vite": "5.3.1",
|
|
83
83
|
"vite-tsconfig-paths": "4.3.2",
|
|
84
84
|
"vitest": "1.6.0"
|
|
85
85
|
},
|
package/react/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../dist/chunk-
|
|
1
|
+
import '../../dist/chunk-S4N6XNPH.js';
|
|
2
2
|
import { IMPLICIT, findInStore, setIntoStore, subscribeToState, getFromStore, getJsonToken, withdraw, subscribeToTimeline } from 'atom.io/internal';
|
|
3
3
|
import * as React5 from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|