atom.io 0.7.0 → 0.8.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.
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +67 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -38
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +42 -26
- package/internal/dist/index.d.ts +42 -26
- package/internal/dist/index.js +85 -76
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +74 -47
- package/internal/dist/index.mjs.map +1 -1
- package/internal/src/atom/create-atom.ts +1 -1
- package/internal/src/caching.ts +25 -1
- package/internal/src/future.ts +37 -0
- package/internal/src/index.ts +1 -0
- package/internal/src/mutable/create-mutable-atom-family.ts +4 -4
- package/internal/src/mutable/create-mutable-atom.ts +6 -5
- package/internal/src/mutable/is-atom-token-mutable.ts +3 -3
- package/internal/src/mutable/tracker-family.ts +4 -4
- package/internal/src/mutable/tracker.ts +20 -19
- package/internal/src/operation.ts +5 -2
- package/internal/src/selector/create-read-write-selector.ts +4 -4
- package/internal/src/selector/create-readonly-selector.ts +1 -1
- package/internal/src/selector/register-selector.ts +2 -2
- package/internal/src/set-state/{set-atom-state.ts → set-atom.ts} +2 -2
- package/internal/src/set-state/set-selector-state.ts +1 -12
- package/internal/src/set-state/set-state-internal.ts +4 -5
- package/internal/src/store/withdraw-new-family-member.ts +7 -7
- package/internal/src/store/withdraw.ts +15 -9
- package/internal/src/subscribe/subscribe-to-root-atoms.ts +1 -1
- package/internal/src/timeline/add-atom-to-timeline.ts +2 -2
- package/internal/src/transaction/apply-transaction.ts +1 -1
- package/internal/src/transaction/redo-transaction.ts +1 -1
- package/internal/src/transaction/undo-transaction.ts +1 -1
- package/package.json +9 -9
- package/react-devtools/dist/index.d.mts +4 -4
- package/react-devtools/dist/index.d.ts +4 -4
- package/react-devtools/dist/index.js +19 -5
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/dist/index.mjs +15 -1
- package/react-devtools/dist/index.mjs.map +1 -1
- package/react-devtools/src/index.ts +1 -1
- package/src/get-set.ts +48 -0
- package/src/index.ts +4 -67
- package/src/subscribe.ts +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as atom_io from 'atom.io';
|
|
2
|
-
import { FamilyMetadata, ƒn, TransactionUpdate, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily,
|
|
2
|
+
import { FamilyMetadata, ƒn, TransactionUpdate, MutableAtomToken, AtomToken, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, Logger } from 'atom.io';
|
|
3
3
|
import { Json } from 'atom.io/json';
|
|
4
4
|
|
|
5
5
|
type ClassSignature = abstract new (...args: any) => any;
|
|
@@ -156,9 +156,9 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
156
156
|
private unsubscribeFromInnerValue;
|
|
157
157
|
private observeCore;
|
|
158
158
|
private updateCore;
|
|
159
|
-
mutableState:
|
|
160
|
-
latestUpdateState:
|
|
161
|
-
constructor(mutableState:
|
|
159
|
+
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
160
|
+
latestUpdateState: AtomToken<typeof this$1.Update | null>;
|
|
161
|
+
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store?: Store);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
interface MutableAtom<T> extends Atom<T> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as atom_io from 'atom.io';
|
|
2
|
-
import { FamilyMetadata, ƒn, TransactionUpdate, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily,
|
|
2
|
+
import { FamilyMetadata, ƒn, TransactionUpdate, MutableAtomToken, AtomToken, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, Logger } from 'atom.io';
|
|
3
3
|
import { Json } from 'atom.io/json';
|
|
4
4
|
|
|
5
5
|
type ClassSignature = abstract new (...args: any) => any;
|
|
@@ -156,9 +156,9 @@ declare class Tracker<Mutable extends Transceiver<any>> {
|
|
|
156
156
|
private unsubscribeFromInnerValue;
|
|
157
157
|
private observeCore;
|
|
158
158
|
private updateCore;
|
|
159
|
-
mutableState:
|
|
160
|
-
latestUpdateState:
|
|
161
|
-
constructor(mutableState:
|
|
159
|
+
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
160
|
+
latestUpdateState: AtomToken<typeof this$1.Update | null>;
|
|
161
|
+
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store?: Store);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
interface MutableAtom<T> extends Atom<T> {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var atom_io = require('atom.io');
|
|
4
4
|
var introspection = require('atom.io/introspection');
|
|
5
|
-
var webEffects = require('atom.io/web-effects');
|
|
6
5
|
var react = require('atom.io/react');
|
|
7
6
|
var framerMotion = require('framer-motion');
|
|
8
7
|
var React = require('react');
|
|
@@ -62,6 +61,21 @@ var __objRest = (source, exclude) => {
|
|
|
62
61
|
return target;
|
|
63
62
|
};
|
|
64
63
|
|
|
64
|
+
// ../__unstable__/web-effects/src/storage.ts
|
|
65
|
+
var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, onSet }) => {
|
|
66
|
+
const savedValue = storage.getItem(key);
|
|
67
|
+
if (savedValue != null)
|
|
68
|
+
setSelf(parse(savedValue));
|
|
69
|
+
onSet(({ newValue }) => {
|
|
70
|
+
if (newValue == null) {
|
|
71
|
+
storage.removeItem(key);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
storage.setItem(key, stringify(newValue));
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
var lazyLocalStorageEffect = persistAtom(localStorage)(JSON);
|
|
78
|
+
|
|
65
79
|
// ../../anvl/src/function/pipe.ts
|
|
66
80
|
function pipe(a2, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
67
81
|
switch (arguments.length) {
|
|
@@ -2765,22 +2779,22 @@ var {
|
|
|
2765
2779
|
var devtoolsAreOpenState = atom_io.atom({
|
|
2766
2780
|
key: `\u{1F441}\u200D\u{1F5E8} Devtools Are Open`,
|
|
2767
2781
|
default: true,
|
|
2768
|
-
effects: [
|
|
2782
|
+
effects: [lazyLocalStorageEffect(`\u{1F441}\u200D\u{1F5E8} Devtools Are Open`)]
|
|
2769
2783
|
});
|
|
2770
2784
|
var devtoolsViewSelectionState = atom_io.atom({
|
|
2771
2785
|
key: `\u{1F441}\u200D\u{1F5E8} Devtools View Selection`,
|
|
2772
2786
|
default: `atoms`,
|
|
2773
|
-
effects: [
|
|
2787
|
+
effects: [lazyLocalStorageEffect(`\u{1F441}\u200D\u{1F5E8} Devtools View`)]
|
|
2774
2788
|
});
|
|
2775
2789
|
var devtoolsViewOptionsState = atom_io.atom({
|
|
2776
2790
|
key: `\u{1F441}\u200D\u{1F5E8} Devtools View Options`,
|
|
2777
2791
|
default: [`atoms`, `selectors`, `transactions`, `timelines`],
|
|
2778
|
-
effects: [
|
|
2792
|
+
effects: [lazyLocalStorageEffect(`\u{1F441}\u200D\u{1F5E8} Devtools View Options`)]
|
|
2779
2793
|
});
|
|
2780
2794
|
var findViewIsOpenState = atom_io.atomFamily({
|
|
2781
2795
|
key: `\u{1F441}\u200D\u{1F5E8} Devtools View Is Open`,
|
|
2782
2796
|
default: false,
|
|
2783
|
-
effects: (key) => [
|
|
2797
|
+
effects: (key) => [lazyLocalStorageEffect(key + `:view-is-open`)]
|
|
2784
2798
|
});
|
|
2785
2799
|
var primitiveRefinery = new Refinery({
|
|
2786
2800
|
number: (input) => typeof input === `number`,
|