atom.io 0.12.1 → 0.13.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.
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/internal/dist/index.cjs +1561 -1512
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +24 -14
- package/internal/dist/index.d.ts +24 -14
- package/internal/dist/index.js +1560 -1513
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/metafile-cjs.json +1 -1
- package/internal/dist/metafile-esm.json +1 -1
- package/internal/src/atom/create-atom.ts +4 -4
- package/internal/src/atom/delete-atom.ts +11 -11
- package/internal/src/atom/is-default.ts +5 -5
- package/internal/src/caching.ts +12 -10
- package/internal/src/families/create-atom-family.ts +3 -3
- package/internal/src/families/create-readonly-selector-family.ts +3 -3
- package/internal/src/families/create-selector-family.ts +4 -4
- package/internal/src/index.ts +1 -0
- package/internal/src/keys.ts +4 -4
- package/internal/src/lazy-map.ts +6 -2
- package/internal/src/lineage.ts +18 -0
- package/internal/src/mutable/create-mutable-atom.ts +5 -4
- package/internal/src/mutable/get-json-family.ts +3 -3
- package/internal/src/mutable/tracker.ts +13 -10
- package/internal/src/operation.ts +19 -19
- package/internal/src/selector/create-read-write-selector.ts +5 -4
- package/internal/src/selector/create-readonly-selector.ts +4 -3
- package/internal/src/selector/create-selector.ts +6 -6
- package/internal/src/selector/delete-selector.ts +10 -10
- package/internal/src/selector/get-selector-dependency-keys.ts +2 -2
- package/internal/src/selector/register-selector.ts +4 -4
- package/internal/src/selector/update-selector-atoms.ts +2 -2
- package/internal/src/set-state/copy-mutable-if-needed.ts +4 -3
- package/internal/src/set-state/copy-mutable-in-transaction.ts +10 -16
- package/internal/src/set-state/copy-mutable-into-new-store.ts +1 -1
- package/internal/src/set-state/evict-downstream.ts +5 -5
- package/internal/src/set-state/set-atom.ts +6 -1
- package/internal/src/set-state/stow-update.ts +7 -2
- package/internal/src/store/store.ts +31 -24
- package/internal/src/store/withdraw-new-family-member.ts +3 -4
- package/internal/src/store/withdraw.ts +58 -59
- package/internal/src/subject.ts +14 -0
- package/internal/src/subscribe/recall-state.ts +5 -5
- package/internal/src/timeline/add-atom-to-timeline.ts +37 -27
- package/internal/src/timeline/create-timeline.ts +6 -8
- package/internal/src/timeline/time-travel.ts +22 -4
- package/internal/src/transaction/abort-transaction.ts +5 -3
- package/internal/src/transaction/apply-transaction.ts +80 -58
- package/internal/src/transaction/build-transaction.ts +33 -23
- package/internal/src/transaction/create-transaction.ts +6 -9
- package/internal/src/transaction/index.ts +2 -10
- package/internal/src/transaction/redo-transaction.ts +15 -10
- package/internal/src/transaction/undo-transaction.ts +15 -16
- package/introspection/dist/index.cjs +2 -2
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.js +3 -3
- package/introspection/dist/index.js.map +1 -1
- package/introspection/src/attach-atom-index.ts +2 -2
- package/introspection/src/attach-selector-index.ts +2 -2
- package/package.json +3 -3
- package/react-devtools/dist/index.cjs +22 -8
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.d.cts +17 -9
- package/react-devtools/dist/index.d.ts +17 -9
- package/react-devtools/dist/index.js +22 -8
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/metafile-cjs.json +1 -1
- package/react-devtools/dist/metafile-esm.json +1 -1
- package/react-devtools/src/Updates.tsx +22 -10
- package/src/transaction.ts +7 -2
- package/transceivers/set-rtx/dist/index.cjs.map +1 -1
- package/transceivers/set-rtx/dist/index.d.cts +2 -2
- package/transceivers/set-rtx/dist/index.d.ts +2 -2
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/transceivers/set-rtx/dist/metafile-cjs.json +1 -1
- package/transceivers/set-rtx/dist/metafile-esm.json +1 -1
- package/transceivers/set-rtx/src/set-rtx.ts +3 -3
|
@@ -31,6 +31,11 @@ declare class Subject<T> {
|
|
|
31
31
|
private unsubscribe;
|
|
32
32
|
next(value: T): void;
|
|
33
33
|
}
|
|
34
|
+
declare class StatefulSubject<T> extends Subject<T> {
|
|
35
|
+
state: T;
|
|
36
|
+
constructor(initialState: T);
|
|
37
|
+
next(value: T): void;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
type Selector<T> = {
|
|
36
41
|
key: string;
|
|
@@ -64,15 +69,11 @@ type Transaction<ƒ extends ƒn> = {
|
|
|
64
69
|
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
65
70
|
};
|
|
66
71
|
|
|
67
|
-
type
|
|
72
|
+
type TransactionMeta<ƒ extends ƒn> = {
|
|
68
73
|
phase: `applying` | `building`;
|
|
69
74
|
time: number;
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
type TransactionIdle = {
|
|
73
|
-
phase: `idle`;
|
|
75
|
+
update: TransactionUpdate<ƒ>;
|
|
74
76
|
};
|
|
75
|
-
type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
|
|
76
77
|
|
|
77
78
|
type primitive = boolean | number | string | null;
|
|
78
79
|
|
|
@@ -148,6 +149,11 @@ declare class Junction<const ASide extends string, const BSide extends string, c
|
|
|
148
149
|
has(a: string, b?: string): boolean;
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
interface Lineage {
|
|
153
|
+
parent: typeof this | null;
|
|
154
|
+
child: typeof this | null;
|
|
155
|
+
}
|
|
156
|
+
|
|
151
157
|
interface Transceiver<Signal extends Json.Serializable> {
|
|
152
158
|
do: (update: Signal) => void;
|
|
153
159
|
undo: (update: Signal) => void;
|
|
@@ -216,8 +222,9 @@ type Timeline = {
|
|
|
216
222
|
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
217
223
|
};
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
declare class Store implements Lineage {
|
|
226
|
+
parent: Store | null;
|
|
227
|
+
child: Store | null;
|
|
221
228
|
valueMap: Map<string, any>;
|
|
222
229
|
atoms: Map<string, Atom<any> | MutableAtom<any>>;
|
|
223
230
|
selectors: Map<string, Selector<any>>;
|
|
@@ -237,10 +244,11 @@ declare class Store {
|
|
|
237
244
|
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
238
245
|
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
239
246
|
timelineCreation: Subject<TimelineToken>;
|
|
247
|
+
transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
|
|
240
248
|
operationStatus: Subject<OperationProgress>;
|
|
241
249
|
};
|
|
242
250
|
operation: OperationProgress;
|
|
243
|
-
|
|
251
|
+
transactionMeta: TransactionMeta<ƒn> | null;
|
|
244
252
|
config: {
|
|
245
253
|
name: string;
|
|
246
254
|
};
|
|
@@ -31,6 +31,11 @@ declare class Subject<T> {
|
|
|
31
31
|
private unsubscribe;
|
|
32
32
|
next(value: T): void;
|
|
33
33
|
}
|
|
34
|
+
declare class StatefulSubject<T> extends Subject<T> {
|
|
35
|
+
state: T;
|
|
36
|
+
constructor(initialState: T);
|
|
37
|
+
next(value: T): void;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
type Selector<T> = {
|
|
36
41
|
key: string;
|
|
@@ -64,15 +69,11 @@ type Transaction<ƒ extends ƒn> = {
|
|
|
64
69
|
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
65
70
|
};
|
|
66
71
|
|
|
67
|
-
type
|
|
72
|
+
type TransactionMeta<ƒ extends ƒn> = {
|
|
68
73
|
phase: `applying` | `building`;
|
|
69
74
|
time: number;
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
type TransactionIdle = {
|
|
73
|
-
phase: `idle`;
|
|
75
|
+
update: TransactionUpdate<ƒ>;
|
|
74
76
|
};
|
|
75
|
-
type TransactionStatus<ƒ extends ƒn> = TransactionIdle | TransactionUpdateInProgress<ƒ>;
|
|
76
77
|
|
|
77
78
|
type primitive = boolean | number | string | null;
|
|
78
79
|
|
|
@@ -148,6 +149,11 @@ declare class Junction<const ASide extends string, const BSide extends string, c
|
|
|
148
149
|
has(a: string, b?: string): boolean;
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
interface Lineage {
|
|
153
|
+
parent: typeof this | null;
|
|
154
|
+
child: typeof this | null;
|
|
155
|
+
}
|
|
156
|
+
|
|
151
157
|
interface Transceiver<Signal extends Json.Serializable> {
|
|
152
158
|
do: (update: Signal) => void;
|
|
153
159
|
undo: (update: Signal) => void;
|
|
@@ -216,8 +222,9 @@ type Timeline = {
|
|
|
216
222
|
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
217
223
|
};
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
225
|
+
declare class Store implements Lineage {
|
|
226
|
+
parent: Store | null;
|
|
227
|
+
child: Store | null;
|
|
221
228
|
valueMap: Map<string, any>;
|
|
222
229
|
atoms: Map<string, Atom<any> | MutableAtom<any>>;
|
|
223
230
|
selectors: Map<string, Selector<any>>;
|
|
@@ -237,10 +244,11 @@ declare class Store {
|
|
|
237
244
|
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
238
245
|
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
239
246
|
timelineCreation: Subject<TimelineToken>;
|
|
247
|
+
transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
|
|
240
248
|
operationStatus: Subject<OperationProgress>;
|
|
241
249
|
};
|
|
242
250
|
operation: OperationProgress;
|
|
243
|
-
|
|
251
|
+
transactionMeta: TransactionMeta<ƒn> | null;
|
|
244
252
|
config: {
|
|
245
253
|
name: string;
|
|
246
254
|
};
|
|
@@ -2528,14 +2528,21 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
|
|
|
2528
2528
|
] }),
|
|
2529
2529
|
/* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
|
|
2530
2530
|
/* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
|
|
2531
|
-
transactionUpdate.
|
|
2532
|
-
return /* @__PURE__ */ jsx(
|
|
2531
|
+
transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
2532
|
+
return `newValue` in update ? /* @__PURE__ */ jsx(
|
|
2533
2533
|
article.AtomUpdate,
|
|
2534
2534
|
{
|
|
2535
2535
|
serialNumber: index,
|
|
2536
|
-
atomUpdate
|
|
2536
|
+
atomUpdate: update
|
|
2537
2537
|
},
|
|
2538
|
-
`${transactionUpdate.key}:${index}:${
|
|
2538
|
+
`${transactionUpdate.key}:${index}:${update.key}`
|
|
2539
|
+
) : /* @__PURE__ */ jsx(
|
|
2540
|
+
TransactionUpdateFC,
|
|
2541
|
+
{
|
|
2542
|
+
serialNumber: index,
|
|
2543
|
+
transactionUpdate: update
|
|
2544
|
+
},
|
|
2545
|
+
`${transactionUpdate.key}:${index}:${update.key}`
|
|
2539
2546
|
);
|
|
2540
2547
|
})
|
|
2541
2548
|
] })
|
|
@@ -2552,14 +2559,21 @@ var TimelineUpdateFC = ({ timelineUpdate }) => {
|
|
|
2552
2559
|
timelineUpdate.key,
|
|
2553
2560
|
")"
|
|
2554
2561
|
] }) }),
|
|
2555
|
-
/* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.
|
|
2556
|
-
return /* @__PURE__ */ jsx(
|
|
2562
|
+
/* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
2563
|
+
return `newValue` in update ? /* @__PURE__ */ jsx(
|
|
2557
2564
|
article.AtomUpdate,
|
|
2558
2565
|
{
|
|
2559
2566
|
serialNumber: index,
|
|
2560
|
-
atomUpdate
|
|
2567
|
+
atomUpdate: update
|
|
2561
2568
|
},
|
|
2562
|
-
`${timelineUpdate.key}:${index}:${
|
|
2569
|
+
`${timelineUpdate.key}:${index}:${update.key}`
|
|
2570
|
+
) : /* @__PURE__ */ jsx(
|
|
2571
|
+
TransactionUpdateFC,
|
|
2572
|
+
{
|
|
2573
|
+
serialNumber: index,
|
|
2574
|
+
transactionUpdate: update
|
|
2575
|
+
},
|
|
2576
|
+
`${timelineUpdate.key}:${index}:${update.key}`
|
|
2563
2577
|
);
|
|
2564
2578
|
}) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
|
|
2565
2579
|
return /* @__PURE__ */ jsx(
|