ccstate 3.0.0 → 4.1.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/README.md +32 -45
- package/core/index.cjs +13 -3
- package/core/index.cjs.map +1 -0
- package/core/index.d.cts +3 -1
- package/core/index.d.cts.map +1 -0
- package/core/index.d.ts +3 -1
- package/core/index.d.ts.map +1 -0
- package/core/index.js +13 -4
- package/core/index.js.map +1 -0
- package/debug/index.cjs +10 -7
- package/debug/index.cjs.map +1 -0
- package/debug/index.d.cts +1 -0
- package/debug/index.d.cts.map +1 -0
- package/debug/index.d.ts +1 -0
- package/debug/index.d.ts.map +1 -0
- package/debug/index.js +10 -7
- package/debug/index.js.map +1 -0
- package/index.cjs +18 -7
- package/index.cjs.map +1 -0
- package/index.d.cts +3 -1
- package/index.d.cts.map +1 -0
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -0
- package/index.js +18 -8
- package/index.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,20 +7,18 @@
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|
[](https://github.com/e7h4n/ccstate/actions/workflows/ci.yaml)
|
|
10
|
-
[](https://codspeed.io/e7h4n/ccstate)
|
|
11
10
|
[](https://opensource.org/licenses/MIT)
|
|
12
11
|
|
|
13
|
-
CCState is a
|
|
12
|
+
CCState is a modern signals-based state management library that elegantly implements async computed and read-write capability isolation based on signal features, making it suitable for medium to large web applications.
|
|
14
13
|
|
|
15
|
-
The name of CCState comes from three basic
|
|
14
|
+
The name of CCState comes from three basic types: `Computed`, `Command`, and `State`.
|
|
16
15
|
|
|
17
16
|
## Quick Features
|
|
18
17
|
|
|
19
|
-
- 💯 Simple & Intuitive: Crystal-clear API design with just
|
|
18
|
+
- 💯 Simple & Intuitive: Crystal-clear API design with just three types and two operations
|
|
20
19
|
- ✅ Rock-solid Reliability: Comprehensive test coverage reaching 100% branch coverage
|
|
21
|
-
-
|
|
22
|
-
- 💡 Framework Agnostic: Seamlessly works with [React](docs/react.md), [Vue](docs/vue.md), or any UI framework
|
|
23
|
-
- 🚀 Blazing Fast: Optimized performance from day one, 2x-7x faster than Jotai across scenarios
|
|
20
|
+
- ✈️ Intuitive async computation: using async/await or try/catch to process async flow as regular JavaScript without any additional concept
|
|
21
|
+
- 💡 Framework Agnostic: Seamlessly works with [React](docs/react.md), [Vue](docs/vue.md), [Solid.js](docs/solid.md), [Vanilla](docs/vanilla.md), or any UI framework
|
|
24
22
|
|
|
25
23
|
## Getting Started
|
|
26
24
|
|
|
@@ -37,16 +35,18 @@ pnpm add ccstate
|
|
|
37
35
|
yarn add ccstate
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
### Create
|
|
38
|
+
### Create Signals
|
|
41
39
|
|
|
42
40
|
Use `state` to store a simple value unit, and use `computed` to create a derived computation logic:
|
|
43
41
|
|
|
44
42
|
```ts
|
|
45
|
-
//
|
|
43
|
+
// signals.js
|
|
46
44
|
import { state, computed } from 'ccstate';
|
|
47
45
|
|
|
46
|
+
// a simple value unit which supports read/write
|
|
48
47
|
export const userId$ = state('');
|
|
49
48
|
|
|
49
|
+
// intuitive async computation logic
|
|
50
50
|
export const user$ = computed(async (get) => {
|
|
51
51
|
const userId = get(userId$);
|
|
52
52
|
if (!userId) return null;
|
|
@@ -56,14 +56,14 @@ export const user$ = computed(async (get) => {
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
### Use
|
|
59
|
+
### Use signals in React
|
|
60
60
|
|
|
61
|
-
Use `useGet` and `useSet` hooks in React to get/set
|
|
61
|
+
Use `useGet` and `useSet` hooks in React to get/set signals, and use `useResolved` to get Promise value.
|
|
62
62
|
|
|
63
63
|
```jsx
|
|
64
|
-
// App.
|
|
64
|
+
// App.jsx
|
|
65
65
|
import { useGet, useSet, useResolved } from 'ccstate-react';
|
|
66
|
-
import { userId$, user$ } from './
|
|
66
|
+
import { userId$, user$ } from './signals';
|
|
67
67
|
|
|
68
68
|
export default function App() {
|
|
69
69
|
const userId = useGet(userId$);
|
|
@@ -87,27 +87,6 @@ export default function App() {
|
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Use `createStore` and `StoreProvider` to provide a CCState store to React, all states and computations will only affect this isolated store.
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
// main.jsx
|
|
94
|
-
import { createStore } from 'ccstate';
|
|
95
|
-
import { StoreProvider } from 'ccstate-react';
|
|
96
|
-
import { createRoot } from 'react-dom/client';
|
|
97
|
-
|
|
98
|
-
import App from './App';
|
|
99
|
-
|
|
100
|
-
const rootElement = document.getElementById('root');
|
|
101
|
-
const root = createRoot(rootElement);
|
|
102
|
-
|
|
103
|
-
const store = createStore();
|
|
104
|
-
root.render(
|
|
105
|
-
<StoreProvider value={store}>
|
|
106
|
-
<App />
|
|
107
|
-
</StoreProvider>,
|
|
108
|
-
);
|
|
109
|
-
```
|
|
110
|
-
|
|
111
90
|
That's it! [Click here to see the full example](https://codesandbox.io/p/sandbox/cr3xg6).
|
|
112
91
|
|
|
113
92
|
Through these examples, you should have understood the basic usage of CCState. Next, you can read to learn about CCState's core APIs.
|
|
@@ -134,13 +113,14 @@ const user$ = state<({
|
|
|
134
113
|
name: 'e7h4n',
|
|
135
114
|
avatar: 'https://avatars.githubusercontent.com/u/813596',
|
|
136
115
|
} | undefined>(undefined);
|
|
116
|
+
|
|
137
117
|
store.set({
|
|
138
118
|
name: 'yc-kanyun',
|
|
139
119
|
avatar: 'https://avatars.githubusercontent.com/u/168416598'
|
|
140
120
|
});
|
|
141
121
|
```
|
|
142
122
|
|
|
143
|
-
These examples should be very easy to understand. You might notice a detail in the examples: all variables returned by `state` have a `$` suffix. This is a naming convention used to distinguish an CCState
|
|
123
|
+
These examples should be very easy to understand. You might notice a detail in the examples: all variables returned by `state` have a `$` suffix. This is a naming convention used to distinguish an CCState signal type from other regular types. CCState signal types must be accessed through the store's get/set methods, and since it's common to convert an CCState signal type to a regular type using get, the `$` suffix helps avoid naming conflicts.
|
|
144
124
|
|
|
145
125
|
### Store
|
|
146
126
|
|
|
@@ -156,7 +136,7 @@ const otherStore = createStore(); // another new Map()
|
|
|
156
136
|
otherStore.get(count$); // anotherMap[$count] ?? $count.init, returns 0
|
|
157
137
|
```
|
|
158
138
|
|
|
159
|
-
This should be easy to understand. If `Store` only needed to support `State` types, a simple Map would be sufficient. However, CCState needs to support two additional
|
|
139
|
+
This should be easy to understand. If `Store` only needed to support `State` types, a simple Map would be sufficient. However, CCState needs to support two additional signal types. Next, let's introduce `Computed`, CCState's reactive computation unit.
|
|
160
140
|
|
|
161
141
|
### Computed
|
|
162
142
|
|
|
@@ -181,13 +161,13 @@ Does this example seem less intuitive than `State`? Here's a mental model that m
|
|
|
181
161
|
- `computed(fn)` returns an object `{read: fn}`, which is assigned to `user$`
|
|
182
162
|
- When `store.get(user$)` encounters an object which has a read function, it calls that function: `user$.read(store.get)`
|
|
183
163
|
|
|
184
|
-
This way, `Computed` receives a get accessor that can access other
|
|
164
|
+
This way, `Computed` receives a get accessor that can access other signal in the store. This get accessor is similar to `store.get` and can be used to read both `State` and `Computed`. The reason CCState specifically passes a get method to `Computed`, rather than allowing direct access to the store within `Computed`, is to shield the logic within `Computed` from other store methods like `store.set`. The key characteristic of `Computed` is that it can only read states from the store but cannot modify them. In other words, `Computed` is side-effect free.
|
|
185
165
|
|
|
186
166
|
In most cases, side-effect free computation logic is extremely useful. They can be executed any number of times and have few requirements regarding execution timing. `Computed` is one of the most powerful features in CCState, and you should try to write your logic as `Computed` whenever possible, unless you need to perform set operations on the `Store`.
|
|
187
167
|
|
|
188
168
|
### Command
|
|
189
169
|
|
|
190
|
-
`Command` is CCState's logic unit for organizing side effects. It has both `set` and `get` accessors from the store, allowing it to not only read other
|
|
170
|
+
`Command` is CCState's logic unit for organizing side effects. It has both `set` and `get` accessors from the store, allowing it to not only read other signal types but also modify `State` or call other `Command`.
|
|
191
171
|
|
|
192
172
|
```typescript
|
|
193
173
|
import { command, createStore } from 'ccstate';
|
|
@@ -288,6 +268,14 @@ That's it! Next, you can learn how to use CCState in React.
|
|
|
288
268
|
|
|
289
269
|
[Using in Vue](docs/vue.md)
|
|
290
270
|
|
|
271
|
+
## Using in Solid.js
|
|
272
|
+
|
|
273
|
+
[Using in Solid.js](docs/solid.md)
|
|
274
|
+
|
|
275
|
+
## Using in Vanilla
|
|
276
|
+
|
|
277
|
+
[Using in Vanilla](docs/vanilla.md)
|
|
278
|
+
|
|
291
279
|
### Testing & Debugging
|
|
292
280
|
|
|
293
281
|
Testing Value/Computed should be as simple as testing a Map.
|
|
@@ -337,9 +325,9 @@ While Jotai is a great state management solution that has benefited the Motiff p
|
|
|
337
325
|
- Should reduce reactive capabilities, especially the `onMount` capability - the framework shouldn't provide this ability
|
|
338
326
|
- Some implicit magic operations, especially Promise wrapping, make the application execution process less transparent
|
|
339
327
|
|
|
340
|
-
To address these issues, I got an idea: "What concepts in Jotai are essential? And which concepts create mental overhead for developers?". Rather than just discussing it theoretically, I decided to try implementing it myself. So I created CCState to express my thoughts on state management. Before detailing the differences from Jotai, we need to understand CCState's
|
|
328
|
+
To address these issues, I got an idea: "What concepts in Jotai are essential? And which concepts create mental overhead for developers?". Rather than just discussing it theoretically, I decided to try implementing it myself. So I created CCState to express my thoughts on state management. Before detailing the differences from Jotai, we need to understand CCState's signal types and subscription system.
|
|
341
329
|
|
|
342
|
-
### More semantic
|
|
330
|
+
### More semantic atom types
|
|
343
331
|
|
|
344
332
|
Like Jotai, CCState is also an Atom State solution. However, unlike Jotai, CCState doesn't expose Raw Atom, instead dividing Atoms into three types:
|
|
345
333
|
|
|
@@ -360,7 +348,7 @@ export const userIdChange$ = command(({ get, set }) => {
|
|
|
360
348
|
});
|
|
361
349
|
|
|
362
350
|
// ...
|
|
363
|
-
import { userId$, userIdChange$ } from './
|
|
351
|
+
import { userId$, userIdChange$ } from './signals';
|
|
364
352
|
|
|
365
353
|
function setupPage() {
|
|
366
354
|
const store = createStore();
|
|
@@ -441,7 +429,7 @@ export function App() {
|
|
|
441
429
|
When designing CCState, we wanted the trigger points for value changes to be completely detached from React's Mount/Unmount lifecycle and completely decoupled from React's rendering behavior.
|
|
442
430
|
|
|
443
431
|
```jsx
|
|
444
|
-
//
|
|
432
|
+
// signals.js
|
|
445
433
|
export const userId$ = state(0)
|
|
446
434
|
export const init$ = command(({set}) => {
|
|
447
435
|
const userId = // ... parse userId from location search
|
|
@@ -821,10 +809,9 @@ So, I think the only way to implement `Computed`'s effect-less is to separate th
|
|
|
821
809
|
|
|
822
810
|
Here are some new ideas:
|
|
823
811
|
|
|
824
|
-
- Integration with svelte
|
|
825
|
-
- Enhance
|
|
812
|
+
- Integration with svelte
|
|
813
|
+
- Enhance debug ability
|
|
826
814
|
- Support viewing current subscription graph and related atom values
|
|
827
|
-
- Enable logging and breakpoints for specific atoms in devtools
|
|
828
815
|
- Performance improvements
|
|
829
816
|
- Mount atomState directly on atoms when there's only one store in the application to reduce WeakMap lookup overhead
|
|
830
817
|
- Support static declaration of upstream dependencies for Computed to improve performance by disabling runtime dependency analysis
|
package/core/index.cjs
CHANGED
|
@@ -537,7 +537,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
537
537
|
}
|
|
538
538
|
var computedInterceptor = (_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.interceptor) === null || _this$options === void 0 ? void 0 : _this$options.computed;
|
|
539
539
|
if (!computedInterceptor) {
|
|
540
|
-
return this.computeComputedAtom(atom);
|
|
540
|
+
return this.computeComputedAtom(atom, ignoreMounted);
|
|
541
541
|
}
|
|
542
542
|
var result = {
|
|
543
543
|
called: false
|
|
@@ -545,7 +545,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
545
545
|
computedInterceptor(atom, function () {
|
|
546
546
|
result = {
|
|
547
547
|
called: true,
|
|
548
|
-
data: _this2.computeComputedAtom(atom)
|
|
548
|
+
data: _this2.computeComputedAtom(atom, ignoreMounted)
|
|
549
549
|
};
|
|
550
550
|
return result.data.val;
|
|
551
551
|
});
|
|
@@ -559,6 +559,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
559
559
|
value: function computeComputedAtom(atom) {
|
|
560
560
|
var _this3 = this,
|
|
561
561
|
_this$options2;
|
|
562
|
+
var ignoreMounted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
562
563
|
var self = atom;
|
|
563
564
|
var atomState = this.atomStateMap.get(self);
|
|
564
565
|
if (!atomState) {
|
|
@@ -572,7 +573,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
572
573
|
var readDeps = new Map();
|
|
573
574
|
atomState.dependencies = readDeps;
|
|
574
575
|
var wrappedGet = function wrappedGet(depAtom) {
|
|
575
|
-
var depState = _this3.readAtomState(depAtom);
|
|
576
|
+
var depState = _this3.readAtomState(depAtom, ignoreMounted);
|
|
576
577
|
|
|
577
578
|
// get 可能发生在异步过程中,当重复调用时,只有最新的 get 过程会修改 deps
|
|
578
579
|
if (atomState.dependencies === readDeps) {
|
|
@@ -1015,8 +1016,17 @@ function createStore() {
|
|
|
1015
1016
|
var listenerManager = new ListenerManager();
|
|
1016
1017
|
return new StoreImpl(atomManager, listenerManager);
|
|
1017
1018
|
}
|
|
1019
|
+
var defaultStore = undefined;
|
|
1020
|
+
function getDefaultStore() {
|
|
1021
|
+
if (!defaultStore) {
|
|
1022
|
+
defaultStore = createStore();
|
|
1023
|
+
}
|
|
1024
|
+
return defaultStore;
|
|
1025
|
+
}
|
|
1018
1026
|
|
|
1019
1027
|
exports.command = command;
|
|
1020
1028
|
exports.computed = computed;
|
|
1021
1029
|
exports.createStore = createStore;
|
|
1030
|
+
exports.getDefaultStore = getDefaultStore;
|
|
1022
1031
|
exports.state = state;
|
|
1032
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/core/atom.ts","../../src/core/atom-manager.ts","../../src/core/store.ts"],"sourcesContent":["import type { Computed, Command, Read, State, Write } from '../../types/core/atom';\n\ninterface Options {\n debugLabel?: string;\n}\n\nlet globalId = 0;\n\nconst generateToString = (prefix: string, debugLabel?: string) => {\n const id = globalId++;\n const label = `${prefix}${String(id)}${debugLabel ? ':' + debugLabel : ''}`;\n return () => label;\n};\n\nexport function state<T>(init: T, options?: Options): State<T> {\n const ret: State<T> = {\n init,\n toString: generateToString('V', options?.debugLabel),\n };\n\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n\nexport function computed<T>(read: Read<T>, options?: Options): Computed<T> {\n const ret: Computed<T> = {\n read,\n toString: generateToString('C', options?.debugLabel),\n };\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n\nexport function command<T, Args extends unknown[]>(write: Write<T, Args>, options?: Options): Command<T, Args> {\n const ret: Command<T, Args> = {\n write,\n toString: generateToString('F', options?.debugLabel),\n };\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n","import type { ReadableAtom, Command, Getter, Computed, State } from '../../types/core/atom';\nimport type { StoreOptions } from '../../types/core/store';\n\ntype DataWithCalledState<T> =\n | {\n called: false;\n }\n | {\n called: true;\n data: T;\n };\n\nexport interface StateState<T> {\n mounted?: Mounted;\n val: T;\n epoch: number;\n}\n\nexport interface ComputedState<T> {\n mounted?: Mounted;\n val: T;\n dependencies: Map<ReadableAtom<unknown>, number>;\n epoch: number;\n abortController?: AbortController;\n}\n\ntype CommonReadableState<T> = StateState<T> | ComputedState<T>;\n\ntype AtomState<T> = StateState<T> | ComputedState<T>;\n\ninterface Mounted {\n listeners: Set<Command<unknown, []>>;\n readDepts: Set<ReadableAtom<unknown>>;\n}\n\nfunction canReadAsCompute<T>(atom: ReadableAtom<T>): atom is Computed<T> {\n return 'read' in atom;\n}\n\nfunction isComputedState<T>(state: CommonReadableState<T>): state is ComputedState<T> {\n return 'dependencies' in state;\n}\n\nexport class AtomManager {\n private atomStateMap = new WeakMap<ReadableAtom<unknown>, AtomState<unknown>>();\n\n constructor(private readonly options?: StoreOptions) {}\n\n private tryGetCachedState = <T>(atom: Computed<T>, ignoreMounted: boolean): ComputedState<T> | undefined => {\n const atomState = this.atomStateMap.get(atom) as ComputedState<T> | undefined;\n if (!atomState) {\n return undefined;\n }\n\n if (atomState.mounted && !ignoreMounted) {\n return atomState;\n }\n\n for (const [dep, epoch] of atomState.dependencies.entries()) {\n const depState = this.readAtomState(dep);\n if (depState.epoch !== epoch) {\n return undefined;\n }\n }\n\n return atomState;\n };\n\n private readComputedAtom<T>(atom: Computed<T>, ignoreMounted = false): ComputedState<T> {\n const cachedState = this.tryGetCachedState(atom, ignoreMounted);\n if (cachedState) {\n return cachedState;\n }\n\n const computedInterceptor = this.options?.interceptor?.computed;\n if (!computedInterceptor) {\n return this.computeComputedAtom(atom, ignoreMounted);\n }\n\n let result: DataWithCalledState<ComputedState<T>> = {\n called: false,\n } as DataWithCalledState<ComputedState<T>>;\n\n computedInterceptor(atom, () => {\n result = {\n called: true,\n data: this.computeComputedAtom(atom, ignoreMounted),\n };\n\n return result.data.val;\n });\n\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n\n return result.data;\n }\n\n private computeComputedAtom<T>(atom: Computed<T>, ignoreMounted = false): ComputedState<T> {\n const self: Computed<T> = atom;\n let atomState: ComputedState<T> | undefined = this.atomStateMap.get(self) as ComputedState<T> | undefined;\n if (!atomState) {\n atomState = {\n dependencies: new Map<ReadableAtom<unknown>, number>(),\n epoch: -1,\n } as ComputedState<T>;\n this.atomStateMap.set(self, atomState);\n }\n\n const lastDeps = atomState.dependencies;\n const readDeps = new Map<ReadableAtom<unknown>, number>();\n atomState.dependencies = readDeps;\n const wrappedGet: Getter = (depAtom) => {\n const depState = this.readAtomState(depAtom, ignoreMounted);\n\n // get 可能发生在异步过程中,当重复调用时,只有最新的 get 过程会修改 deps\n if (atomState.dependencies === readDeps) {\n readDeps.set(depAtom, depState.epoch);\n\n const selfMounted = !!atomState.mounted;\n if (selfMounted && !depState.mounted) {\n this.mount(depAtom).readDepts.add(self);\n } else if (selfMounted && depState.mounted) {\n depState.mounted.readDepts.add(self);\n }\n }\n\n return depState.val;\n };\n\n const getInterceptor = this.options?.interceptor?.get;\n const ret = self.read(\n function <U>(depAtom: ReadableAtom<U>) {\n if (!getInterceptor) {\n return wrappedGet(depAtom);\n }\n\n let result: DataWithCalledState<U> = {\n called: false,\n } as DataWithCalledState<U>;\n\n const fn = () => {\n result = {\n called: true,\n data: wrappedGet(depAtom),\n };\n\n return result.data;\n };\n\n getInterceptor(depAtom, fn);\n\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n return result.data;\n },\n {\n get signal() {\n atomState.abortController?.abort(`abort ${self.debugLabel ?? 'anonymous'} atom`);\n atomState.abortController = new AbortController();\n return atomState.abortController.signal;\n },\n },\n );\n\n if (atomState.val !== ret) {\n atomState.val = ret;\n atomState.epoch += 1;\n }\n\n for (const key of lastDeps.keys()) {\n if (!readDeps.has(key)) {\n const depState = this.atomStateMap.get(key);\n if (depState?.mounted) {\n depState.mounted.readDepts.delete(self);\n this.tryUnmount(key);\n }\n }\n }\n\n return atomState;\n }\n\n private readStateAtom<T>(atom: State<T>): StateState<T> {\n const atomState = this.atomStateMap.get(atom);\n if (!atomState) {\n const initState = {\n val: atom.init,\n epoch: 0,\n };\n this.atomStateMap.set(atom, initState);\n return initState as StateState<T>;\n }\n\n return atomState as StateState<T>;\n }\n\n public readAtomState<T>(atom: State<T>, ignoreMounted?: boolean): StateState<T>;\n public readAtomState<T>(atom: Computed<T>, ignoreMounted?: boolean): ComputedState<T>;\n public readAtomState<T>(atom: State<T> | Computed<T>, ignoreMounted?: boolean): CommonReadableState<T>;\n public readAtomState<T>(\n atom: State<T> | Computed<T>,\n ignoreMounted = false,\n ): StateState<T> | ComputedState<T> | CommonReadableState<T> {\n if (canReadAsCompute(atom)) {\n return this.readComputedAtom(atom, ignoreMounted);\n }\n\n return this.readStateAtom(atom);\n }\n\n private tryGetMount(atom: ReadableAtom<unknown>): Mounted | undefined {\n return this.atomStateMap.get(atom)?.mounted;\n }\n\n public mount<T>(atom: ReadableAtom<T>): Mounted {\n const mounted = this.tryGetMount(atom);\n if (mounted) {\n return mounted;\n }\n\n this.options?.interceptor?.mount?.(atom);\n\n const atomState = this.readAtomState(atom);\n\n atomState.mounted = atomState.mounted ?? {\n listeners: new Set(),\n readDepts: new Set(),\n };\n\n if (isComputedState(atomState)) {\n for (const [dep] of Array.from(atomState.dependencies)) {\n const mounted = this.mount(dep);\n mounted.readDepts.add(atom);\n }\n }\n\n return atomState.mounted;\n }\n\n public tryUnmount<T>(atom: ReadableAtom<T>): void {\n const atomState = this.atomStateMap.get(atom);\n if (!atomState?.mounted || atomState.mounted.listeners.size || atomState.mounted.readDepts.size) {\n return;\n }\n\n this.options?.interceptor?.unmount?.(atom);\n\n if (isComputedState(atomState)) {\n for (const [dep] of Array.from(atomState.dependencies)) {\n const depState = this.readAtomState(dep);\n depState.mounted?.readDepts.delete(atom);\n this.tryUnmount(dep);\n }\n }\n\n atomState.mounted = undefined;\n }\n\n public inited(atom: ReadableAtom<unknown>) {\n return this.atomStateMap.has(atom);\n }\n}\n\nexport class ListenerManager {\n private pendingListeners = new Set<Command<unknown, []>>();\n\n markPendingListeners(atomManager: AtomManager, atom: ReadableAtom<unknown>) {\n let queue: ReadableAtom<unknown>[] = [atom];\n while (queue.length > 0) {\n const nextQueue: ReadableAtom<unknown>[] = [];\n for (const atom of queue) {\n const atomState = atomManager.readAtomState(atom, true);\n\n if (atomState.mounted?.listeners) {\n for (const listener of atomState.mounted.listeners) {\n this.pendingListeners.add(listener);\n }\n }\n\n const readDepts = atomState.mounted?.readDepts;\n if (readDepts) {\n for (const dep of Array.from(readDepts)) {\n nextQueue.push(dep);\n }\n }\n }\n\n queue = nextQueue;\n }\n }\n\n *notify(): Generator<Command<unknown, []>, void, unknown> {\n const pendingListeners = this.pendingListeners;\n this.pendingListeners = new Set();\n\n for (const listener of pendingListeners) {\n yield listener;\n }\n }\n}\n","import type { ReadableAtom, Command, Getter, State, Updater, Setter } from '../../types/core/atom';\nimport type { Store, StoreOptions, SubscribeOptions } from '../../types/core/store';\nimport { AtomManager, ListenerManager } from './atom-manager';\n\ntype DataWithCalledState<T> =\n | {\n called: false;\n }\n | {\n called: true;\n data: T;\n };\n\nexport class StoreImpl implements Store {\n constructor(\n protected readonly atomManager: AtomManager,\n protected readonly listenerManager: ListenerManager,\n protected readonly options?: StoreOptions,\n ) {}\n\n private innerSet = <T, Args extends unknown[]>(\n atom: State<T> | Command<T, Args>,\n ...args: [T | Updater<T>] | Args\n ): undefined | T => {\n if ('read' in atom) {\n return;\n }\n\n if ('write' in atom) {\n const ret = atom.write({ get: this.get, set: this.set }, ...(args as Args));\n return ret;\n }\n\n const newValue =\n typeof args[0] === 'function'\n ? (args[0] as Updater<T>)(this.atomManager.readAtomState(atom).val)\n : (args[0] as T);\n\n if (!this.atomManager.inited(atom)) {\n this.atomManager.readAtomState(atom).val = newValue;\n this.listenerManager.markPendingListeners(this.atomManager, atom);\n return;\n }\n const atomState = this.atomManager.readAtomState(atom);\n atomState.val = newValue;\n atomState.epoch += 1;\n this.listenerManager.markPendingListeners(this.atomManager, atom);\n return undefined;\n };\n\n get: Getter = <T>(atom: ReadableAtom<T>): T => {\n if (!this.options?.interceptor?.get) {\n return this.atomManager.readAtomState(atom).val;\n }\n let result: DataWithCalledState<T> = {\n called: false,\n } as DataWithCalledState<T>;\n\n const fnWithRet = () => {\n result = {\n called: true,\n data: this.atomManager.readAtomState(atom).val,\n };\n return result.data;\n };\n\n this.options.interceptor.get(atom, fnWithRet);\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n\n return result.data;\n };\n\n private notify = () => {\n for (const listener of this.listenerManager.notify()) {\n let notifyed = false;\n const fn = () => {\n notifyed = true;\n return listener.write({ get: this.get, set: this.set });\n };\n if (this.options?.interceptor?.notify) {\n this.options.interceptor.notify(listener, fn);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- notify must call fn sync\n if (!notifyed) {\n throw new Error('interceptor must call fn sync');\n }\n } else {\n fn();\n }\n }\n };\n\n set: Setter = <T, Args extends unknown[]>(\n atom: State<T> | Command<T, Args>,\n ...args: [T | Updater<T>] | Args\n ): undefined | T => {\n let ret: T | undefined;\n const fn = () => {\n try {\n ret = this.innerSet(atom, ...args) as T | undefined;\n } finally {\n this.notify();\n }\n return ret;\n };\n\n if (this.options?.interceptor?.set) {\n if ('write' in atom) {\n this.options.interceptor.set(atom, fn, ...(args as Args));\n } else {\n this.options.interceptor.set(atom, fn, args[0] as T | Updater<T>);\n }\n } else {\n fn();\n }\n\n return ret;\n };\n\n private _subSingleAtom(\n target$: ReadableAtom<unknown>,\n cb$: Command<unknown, unknown[]>,\n options?: SubscribeOptions,\n ): () => void {\n let unsub: (() => void) | undefined;\n const fn = () => {\n let subscribed = true;\n const mounted = this.atomManager.mount(target$);\n mounted.listeners.add(cb$);\n\n unsub = () => {\n if (!subscribed) {\n return;\n }\n\n const fn = () => {\n subscribed = false;\n mounted.listeners.delete(cb$);\n\n if (mounted.readDepts.size === 0 && mounted.listeners.size === 0) {\n this.atomManager.tryUnmount(target$);\n }\n\n options?.signal?.addEventListener('abort', fn);\n };\n\n if (this.options?.interceptor?.unsub) {\n this.options.interceptor.unsub(target$, cb$, fn);\n\n // subscribed should be false if interceptor called fn sync\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (subscribed) {\n throw new Error('interceptor must call fn sync');\n }\n } else {\n fn();\n }\n };\n\n options?.signal?.addEventListener('abort', unsub);\n };\n\n if (this.options?.interceptor?.sub) {\n this.options.interceptor.sub(target$, cb$, fn);\n } else {\n fn();\n }\n\n if (!unsub) {\n throw new Error('interceptor must call fn sync');\n }\n\n return unsub;\n }\n\n sub(\n targets$: ReadableAtom<unknown>[] | ReadableAtom<unknown>,\n cb$: Command<unknown, unknown[]>,\n options?: SubscribeOptions,\n ): () => void {\n if (Array.isArray(targets$) && targets$.length === 0) {\n return () => void 0;\n }\n\n if (Array.isArray(targets$) && targets$.length === 1) {\n return this._subSingleAtom(targets$[0], cb$, options);\n } else if (!Array.isArray(targets$)) {\n return this._subSingleAtom(targets$, cb$, options);\n }\n\n const unsubscribes = new Set<() => void>();\n targets$.forEach((atom) => {\n unsubscribes.add(this._subSingleAtom(atom, cb$, options));\n });\n\n const unsub = () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n\n return unsub;\n }\n}\n\nexport function createStore(): Store {\n const atomManager = new AtomManager();\n const listenerManager = new ListenerManager();\n\n return new StoreImpl(atomManager, listenerManager);\n}\n\nlet defaultStore: Store | undefined = undefined;\nexport function getDefaultStore(): Store {\n if (!defaultStore) {\n defaultStore = createStore();\n }\n return defaultStore;\n}\n"],"names":["globalId","generateToString","prefix","debugLabel","id","label","concat","String","state","init","options","ret","toString","computed","read","command","write","canReadAsCompute","atom","isComputedState","AtomManager","_this","_classCallCheck","_defineProperty","WeakMap","ignoreMounted","atomState","atomStateMap","get","undefined","mounted","_iterator","_createForOfIteratorHelper","dependencies","entries","_step","s","n","done","_step$value","_slicedToArray","value","dep","epoch","depState","readAtomState","err","e","f","_createClass","key","readComputedAtom","_this$options","_this2","arguments","length","cachedState","tryGetCachedState","computedInterceptor","interceptor","computeComputedAtom","result","called","data","val","Error","_this3","_this$options2","self","Map","set","lastDeps","readDeps","wrappedGet","depAtom","selfMounted","mount","readDepts","add","getInterceptor","fn","signal","_atomState$abortContr","_self$debugLabel","abortController","abort","AbortController","_iterator2","keys","_step2","has","tryUnmount","readStateAtom","initState","tryGetMount","_this$atomStateMap$ge","_this$options3","_this$options3$mount","_atomState$mounted","call","listeners","Set","_i","_Array$from","Array","from","_Array$from$_i","_this$options4","_this$options4$unmoun","size","unmount","_i2","_Array$from2","_depState$mounted","_Array$from2$_i","inited","ListenerManager","markPendingListeners","atomManager","queue","nextQueue","_iterator3","_step3","_atomState$mounted2","_atomState$mounted3","_iterator4","_step4","listener","pendingListeners","_i3","_Array$from3","push","_regeneratorRuntime","mark","notify","_iterator5","_step5","wrap","notify$","_context","prev","next","t0","finish","stop","StoreImpl","listenerManager","_len","args","_key","apply","_toConsumableArray","newValue","fnWithRet","_loop","notifyed","_len2","_key2","innerSet","_this$options$interce","_subSingleAtom","target$","cb$","unsub","_options$signal2","subscribed","_this2$options","_options$signal","addEventListener","sub","targets$","isArray","unsubscribes","forEach","unsubscribe","createStore","defaultStore","getDefaultStore"],"mappings":";;AAMA,IAAIA,QAAQ,GAAG,CAAC;AAEhB,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,MAAc,EAAEC,UAAmB,EAAK;EAChE,IAAMC,EAAE,GAAGJ,QAAQ,EAAE;EACrB,IAAMK,KAAK,MAAAC,MAAA,CAAMJ,MAAM,CAAAI,CAAAA,MAAA,CAAGC,MAAM,CAACH,EAAE,CAAC,CAAAE,CAAAA,MAAA,CAAGH,UAAU,GAAG,GAAG,GAAGA,UAAU,GAAG,EAAE,CAAE;EAC3E,OAAO,YAAA;AAAA,IAAA,OAAME,KAAK;AAAA,GAAA;AACpB,CAAC;AAEM,SAASG,KAAKA,CAAIC,IAAO,EAAEC,OAAiB,EAAY;AAC7D,EAAA,IAAMC,GAAa,GAAG;AACpBF,IAAAA,IAAI,EAAJA,IAAI;IACJG,QAAQ,EAAEX,gBAAgB,CAAC,GAAG,EAAES,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAPA,OAAO,CAAEP,UAAU;GACpD;AAED,EAAA,IAAIO,OAAO,KAAPA,IAAAA,IAAAA,OAAO,eAAPA,OAAO,CAAEP,UAAU,EAAE;AACvBQ,IAAAA,GAAG,CAACR,UAAU,GAAGO,OAAO,CAACP,UAAU;AACrC;AACA,EAAA,OAAOQ,GAAG;AACZ;AAEO,SAASE,QAAQA,CAAIC,IAAa,EAAEJ,OAAiB,EAAe;AACzE,EAAA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A,CAAAD,GAAA,CAAA;AAAA,SAAA,SAAA;AAAAyC,UAAAA,UAAA,CAAAvC,CAAA,EAAA;AAAA;OACF;AAED,MAAA,OAAOmH,KAAK;AACd;AAAC,GAAA,CAAA,CAAA;AAAA,CAAA,EAAA;AAGI,SAASY,WAAWA,GAAU;AACnC,EAAA,IAAMzD,WAAW,GAAG,IAAIlG,WAAW,EAAE;AACrC,EAAA,IAAM8H,eAAe,GAAG,IAAI9B,eAAe,EAAE;AAE7C,EAAA,OAAO,IAAI6B,SAAS,CAAC3B,WAAW,EAAE4B,eAAe,CAAC;AACpD;AAEA,IAAI8B,YAA+B,GAAGnJ,SAAS;AACxC,SAASoJ,eAAeA,GAAU;EACvC,IAAI,CAACD,YAAY,EAAE;IACjBA,YAAY,GAAGD,WAAW,EAAE;AAC9B;AACA,EAAA,OAAOC,YAAY;AACrB;;;;;;;;"}
|
package/core/index.d.cts
CHANGED
|
@@ -48,5 +48,7 @@ type CallbackFunc<T> = Command<T, []>;
|
|
|
48
48
|
type Subscribe = (atoms$: ReadableAtom<unknown>[] | ReadableAtom<unknown>, callback: CallbackFunc<unknown>, options?: SubscribeOptions) => () => void;
|
|
49
49
|
|
|
50
50
|
declare function createStore(): Store;
|
|
51
|
+
declare function getDefaultStore(): Store;
|
|
51
52
|
|
|
52
|
-
export { type Command, type Computed, type Getter, type Read, type Setter, type State, type Store, type Subscribe, type Updater, type Write, command, computed, createStore, state };
|
|
53
|
+
export { type Command, type Computed, type Getter, type Read, type Setter, type State, type Store, type Subscribe, type Updater, type Write, command, computed, createStore, getDefaultStore, state };
|
|
54
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/core/index.d.ts
CHANGED
|
@@ -48,5 +48,7 @@ type CallbackFunc<T> = Command<T, []>;
|
|
|
48
48
|
type Subscribe = (atoms$: ReadableAtom<unknown>[] | ReadableAtom<unknown>, callback: CallbackFunc<unknown>, options?: SubscribeOptions) => () => void;
|
|
49
49
|
|
|
50
50
|
declare function createStore(): Store;
|
|
51
|
+
declare function getDefaultStore(): Store;
|
|
51
52
|
|
|
52
|
-
export { type Command, type Computed, type Getter, type Read, type Setter, type State, type Store, type Subscribe, type Updater, type Write, command, computed, createStore, state };
|
|
53
|
+
export { type Command, type Computed, type Getter, type Read, type Setter, type State, type Store, type Subscribe, type Updater, type Write, command, computed, createStore, getDefaultStore, state };
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/core/index.js
CHANGED
|
@@ -535,7 +535,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
535
535
|
}
|
|
536
536
|
var computedInterceptor = (_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.interceptor) === null || _this$options === void 0 ? void 0 : _this$options.computed;
|
|
537
537
|
if (!computedInterceptor) {
|
|
538
|
-
return this.computeComputedAtom(atom);
|
|
538
|
+
return this.computeComputedAtom(atom, ignoreMounted);
|
|
539
539
|
}
|
|
540
540
|
var result = {
|
|
541
541
|
called: false
|
|
@@ -543,7 +543,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
543
543
|
computedInterceptor(atom, function () {
|
|
544
544
|
result = {
|
|
545
545
|
called: true,
|
|
546
|
-
data: _this2.computeComputedAtom(atom)
|
|
546
|
+
data: _this2.computeComputedAtom(atom, ignoreMounted)
|
|
547
547
|
};
|
|
548
548
|
return result.data.val;
|
|
549
549
|
});
|
|
@@ -557,6 +557,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
557
557
|
value: function computeComputedAtom(atom) {
|
|
558
558
|
var _this3 = this,
|
|
559
559
|
_this$options2;
|
|
560
|
+
var ignoreMounted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
560
561
|
var self = atom;
|
|
561
562
|
var atomState = this.atomStateMap.get(self);
|
|
562
563
|
if (!atomState) {
|
|
@@ -570,7 +571,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
570
571
|
var readDeps = new Map();
|
|
571
572
|
atomState.dependencies = readDeps;
|
|
572
573
|
var wrappedGet = function wrappedGet(depAtom) {
|
|
573
|
-
var depState = _this3.readAtomState(depAtom);
|
|
574
|
+
var depState = _this3.readAtomState(depAtom, ignoreMounted);
|
|
574
575
|
|
|
575
576
|
// get 可能发生在异步过程中,当重复调用时,只有最新的 get 过程会修改 deps
|
|
576
577
|
if (atomState.dependencies === readDeps) {
|
|
@@ -1013,5 +1014,13 @@ function createStore() {
|
|
|
1013
1014
|
var listenerManager = new ListenerManager();
|
|
1014
1015
|
return new StoreImpl(atomManager, listenerManager);
|
|
1015
1016
|
}
|
|
1017
|
+
var defaultStore = undefined;
|
|
1018
|
+
function getDefaultStore() {
|
|
1019
|
+
if (!defaultStore) {
|
|
1020
|
+
defaultStore = createStore();
|
|
1021
|
+
}
|
|
1022
|
+
return defaultStore;
|
|
1023
|
+
}
|
|
1016
1024
|
|
|
1017
|
-
export { command, computed, createStore, state };
|
|
1025
|
+
export { command, computed, createStore, getDefaultStore, state };
|
|
1026
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/core/atom.ts","../../src/core/atom-manager.ts","../../src/core/store.ts"],"sourcesContent":["import type { Computed, Command, Read, State, Write } from '../../types/core/atom';\n\ninterface Options {\n debugLabel?: string;\n}\n\nlet globalId = 0;\n\nconst generateToString = (prefix: string, debugLabel?: string) => {\n const id = globalId++;\n const label = `${prefix}${String(id)}${debugLabel ? ':' + debugLabel : ''}`;\n return () => label;\n};\n\nexport function state<T>(init: T, options?: Options): State<T> {\n const ret: State<T> = {\n init,\n toString: generateToString('V', options?.debugLabel),\n };\n\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n\nexport function computed<T>(read: Read<T>, options?: Options): Computed<T> {\n const ret: Computed<T> = {\n read,\n toString: generateToString('C', options?.debugLabel),\n };\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n\nexport function command<T, Args extends unknown[]>(write: Write<T, Args>, options?: Options): Command<T, Args> {\n const ret: Command<T, Args> = {\n write,\n toString: generateToString('F', options?.debugLabel),\n };\n if (options?.debugLabel) {\n ret.debugLabel = options.debugLabel;\n }\n return ret;\n}\n","import type { ReadableAtom, Command, Getter, Computed, State } from '../../types/core/atom';\nimport type { StoreOptions } from '../../types/core/store';\n\ntype DataWithCalledState<T> =\n | {\n called: false;\n }\n | {\n called: true;\n data: T;\n };\n\nexport interface StateState<T> {\n mounted?: Mounted;\n val: T;\n epoch: number;\n}\n\nexport interface ComputedState<T> {\n mounted?: Mounted;\n val: T;\n dependencies: Map<ReadableAtom<unknown>, number>;\n epoch: number;\n abortController?: AbortController;\n}\n\ntype CommonReadableState<T> = StateState<T> | ComputedState<T>;\n\ntype AtomState<T> = StateState<T> | ComputedState<T>;\n\ninterface Mounted {\n listeners: Set<Command<unknown, []>>;\n readDepts: Set<ReadableAtom<unknown>>;\n}\n\nfunction canReadAsCompute<T>(atom: ReadableAtom<T>): atom is Computed<T> {\n return 'read' in atom;\n}\n\nfunction isComputedState<T>(state: CommonReadableState<T>): state is ComputedState<T> {\n return 'dependencies' in state;\n}\n\nexport class AtomManager {\n private atomStateMap = new WeakMap<ReadableAtom<unknown>, AtomState<unknown>>();\n\n constructor(private readonly options?: StoreOptions) {}\n\n private tryGetCachedState = <T>(atom: Computed<T>, ignoreMounted: boolean): ComputedState<T> | undefined => {\n const atomState = this.atomStateMap.get(atom) as ComputedState<T> | undefined;\n if (!atomState) {\n return undefined;\n }\n\n if (atomState.mounted && !ignoreMounted) {\n return atomState;\n }\n\n for (const [dep, epoch] of atomState.dependencies.entries()) {\n const depState = this.readAtomState(dep);\n if (depState.epoch !== epoch) {\n return undefined;\n }\n }\n\n return atomState;\n };\n\n private readComputedAtom<T>(atom: Computed<T>, ignoreMounted = false): ComputedState<T> {\n const cachedState = this.tryGetCachedState(atom, ignoreMounted);\n if (cachedState) {\n return cachedState;\n }\n\n const computedInterceptor = this.options?.interceptor?.computed;\n if (!computedInterceptor) {\n return this.computeComputedAtom(atom, ignoreMounted);\n }\n\n let result: DataWithCalledState<ComputedState<T>> = {\n called: false,\n } as DataWithCalledState<ComputedState<T>>;\n\n computedInterceptor(atom, () => {\n result = {\n called: true,\n data: this.computeComputedAtom(atom, ignoreMounted),\n };\n\n return result.data.val;\n });\n\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n\n return result.data;\n }\n\n private computeComputedAtom<T>(atom: Computed<T>, ignoreMounted = false): ComputedState<T> {\n const self: Computed<T> = atom;\n let atomState: ComputedState<T> | undefined = this.atomStateMap.get(self) as ComputedState<T> | undefined;\n if (!atomState) {\n atomState = {\n dependencies: new Map<ReadableAtom<unknown>, number>(),\n epoch: -1,\n } as ComputedState<T>;\n this.atomStateMap.set(self, atomState);\n }\n\n const lastDeps = atomState.dependencies;\n const readDeps = new Map<ReadableAtom<unknown>, number>();\n atomState.dependencies = readDeps;\n const wrappedGet: Getter = (depAtom) => {\n const depState = this.readAtomState(depAtom, ignoreMounted);\n\n // get 可能发生在异步过程中,当重复调用时,只有最新的 get 过程会修改 deps\n if (atomState.dependencies === readDeps) {\n readDeps.set(depAtom, depState.epoch);\n\n const selfMounted = !!atomState.mounted;\n if (selfMounted && !depState.mounted) {\n this.mount(depAtom).readDepts.add(self);\n } else if (selfMounted && depState.mounted) {\n depState.mounted.readDepts.add(self);\n }\n }\n\n return depState.val;\n };\n\n const getInterceptor = this.options?.interceptor?.get;\n const ret = self.read(\n function <U>(depAtom: ReadableAtom<U>) {\n if (!getInterceptor) {\n return wrappedGet(depAtom);\n }\n\n let result: DataWithCalledState<U> = {\n called: false,\n } as DataWithCalledState<U>;\n\n const fn = () => {\n result = {\n called: true,\n data: wrappedGet(depAtom),\n };\n\n return result.data;\n };\n\n getInterceptor(depAtom, fn);\n\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n return result.data;\n },\n {\n get signal() {\n atomState.abortController?.abort(`abort ${self.debugLabel ?? 'anonymous'} atom`);\n atomState.abortController = new AbortController();\n return atomState.abortController.signal;\n },\n },\n );\n\n if (atomState.val !== ret) {\n atomState.val = ret;\n atomState.epoch += 1;\n }\n\n for (const key of lastDeps.keys()) {\n if (!readDeps.has(key)) {\n const depState = this.atomStateMap.get(key);\n if (depState?.mounted) {\n depState.mounted.readDepts.delete(self);\n this.tryUnmount(key);\n }\n }\n }\n\n return atomState;\n }\n\n private readStateAtom<T>(atom: State<T>): StateState<T> {\n const atomState = this.atomStateMap.get(atom);\n if (!atomState) {\n const initState = {\n val: atom.init,\n epoch: 0,\n };\n this.atomStateMap.set(atom, initState);\n return initState as StateState<T>;\n }\n\n return atomState as StateState<T>;\n }\n\n public readAtomState<T>(atom: State<T>, ignoreMounted?: boolean): StateState<T>;\n public readAtomState<T>(atom: Computed<T>, ignoreMounted?: boolean): ComputedState<T>;\n public readAtomState<T>(atom: State<T> | Computed<T>, ignoreMounted?: boolean): CommonReadableState<T>;\n public readAtomState<T>(\n atom: State<T> | Computed<T>,\n ignoreMounted = false,\n ): StateState<T> | ComputedState<T> | CommonReadableState<T> {\n if (canReadAsCompute(atom)) {\n return this.readComputedAtom(atom, ignoreMounted);\n }\n\n return this.readStateAtom(atom);\n }\n\n private tryGetMount(atom: ReadableAtom<unknown>): Mounted | undefined {\n return this.atomStateMap.get(atom)?.mounted;\n }\n\n public mount<T>(atom: ReadableAtom<T>): Mounted {\n const mounted = this.tryGetMount(atom);\n if (mounted) {\n return mounted;\n }\n\n this.options?.interceptor?.mount?.(atom);\n\n const atomState = this.readAtomState(atom);\n\n atomState.mounted = atomState.mounted ?? {\n listeners: new Set(),\n readDepts: new Set(),\n };\n\n if (isComputedState(atomState)) {\n for (const [dep] of Array.from(atomState.dependencies)) {\n const mounted = this.mount(dep);\n mounted.readDepts.add(atom);\n }\n }\n\n return atomState.mounted;\n }\n\n public tryUnmount<T>(atom: ReadableAtom<T>): void {\n const atomState = this.atomStateMap.get(atom);\n if (!atomState?.mounted || atomState.mounted.listeners.size || atomState.mounted.readDepts.size) {\n return;\n }\n\n this.options?.interceptor?.unmount?.(atom);\n\n if (isComputedState(atomState)) {\n for (const [dep] of Array.from(atomState.dependencies)) {\n const depState = this.readAtomState(dep);\n depState.mounted?.readDepts.delete(atom);\n this.tryUnmount(dep);\n }\n }\n\n atomState.mounted = undefined;\n }\n\n public inited(atom: ReadableAtom<unknown>) {\n return this.atomStateMap.has(atom);\n }\n}\n\nexport class ListenerManager {\n private pendingListeners = new Set<Command<unknown, []>>();\n\n markPendingListeners(atomManager: AtomManager, atom: ReadableAtom<unknown>) {\n let queue: ReadableAtom<unknown>[] = [atom];\n while (queue.length > 0) {\n const nextQueue: ReadableAtom<unknown>[] = [];\n for (const atom of queue) {\n const atomState = atomManager.readAtomState(atom, true);\n\n if (atomState.mounted?.listeners) {\n for (const listener of atomState.mounted.listeners) {\n this.pendingListeners.add(listener);\n }\n }\n\n const readDepts = atomState.mounted?.readDepts;\n if (readDepts) {\n for (const dep of Array.from(readDepts)) {\n nextQueue.push(dep);\n }\n }\n }\n\n queue = nextQueue;\n }\n }\n\n *notify(): Generator<Command<unknown, []>, void, unknown> {\n const pendingListeners = this.pendingListeners;\n this.pendingListeners = new Set();\n\n for (const listener of pendingListeners) {\n yield listener;\n }\n }\n}\n","import type { ReadableAtom, Command, Getter, State, Updater, Setter } from '../../types/core/atom';\nimport type { Store, StoreOptions, SubscribeOptions } from '../../types/core/store';\nimport { AtomManager, ListenerManager } from './atom-manager';\n\ntype DataWithCalledState<T> =\n | {\n called: false;\n }\n | {\n called: true;\n data: T;\n };\n\nexport class StoreImpl implements Store {\n constructor(\n protected readonly atomManager: AtomManager,\n protected readonly listenerManager: ListenerManager,\n protected readonly options?: StoreOptions,\n ) {}\n\n private innerSet = <T, Args extends unknown[]>(\n atom: State<T> | Command<T, Args>,\n ...args: [T | Updater<T>] | Args\n ): undefined | T => {\n if ('read' in atom) {\n return;\n }\n\n if ('write' in atom) {\n const ret = atom.write({ get: this.get, set: this.set }, ...(args as Args));\n return ret;\n }\n\n const newValue =\n typeof args[0] === 'function'\n ? (args[0] as Updater<T>)(this.atomManager.readAtomState(atom).val)\n : (args[0] as T);\n\n if (!this.atomManager.inited(atom)) {\n this.atomManager.readAtomState(atom).val = newValue;\n this.listenerManager.markPendingListeners(this.atomManager, atom);\n return;\n }\n const atomState = this.atomManager.readAtomState(atom);\n atomState.val = newValue;\n atomState.epoch += 1;\n this.listenerManager.markPendingListeners(this.atomManager, atom);\n return undefined;\n };\n\n get: Getter = <T>(atom: ReadableAtom<T>): T => {\n if (!this.options?.interceptor?.get) {\n return this.atomManager.readAtomState(atom).val;\n }\n let result: DataWithCalledState<T> = {\n called: false,\n } as DataWithCalledState<T>;\n\n const fnWithRet = () => {\n result = {\n called: true,\n data: this.atomManager.readAtomState(atom).val,\n };\n return result.data;\n };\n\n this.options.interceptor.get(atom, fnWithRet);\n if (!result.called) {\n throw new Error('interceptor must call fn sync');\n }\n\n return result.data;\n };\n\n private notify = () => {\n for (const listener of this.listenerManager.notify()) {\n let notifyed = false;\n const fn = () => {\n notifyed = true;\n return listener.write({ get: this.get, set: this.set });\n };\n if (this.options?.interceptor?.notify) {\n this.options.interceptor.notify(listener, fn);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- notify must call fn sync\n if (!notifyed) {\n throw new Error('interceptor must call fn sync');\n }\n } else {\n fn();\n }\n }\n };\n\n set: Setter = <T, Args extends unknown[]>(\n atom: State<T> | Command<T, Args>,\n ...args: [T | Updater<T>] | Args\n ): undefined | T => {\n let ret: T | undefined;\n const fn = () => {\n try {\n ret = this.innerSet(atom, ...args) as T | undefined;\n } finally {\n this.notify();\n }\n return ret;\n };\n\n if (this.options?.interceptor?.set) {\n if ('write' in atom) {\n this.options.interceptor.set(atom, fn, ...(args as Args));\n } else {\n this.options.interceptor.set(atom, fn, args[0] as T | Updater<T>);\n }\n } else {\n fn();\n }\n\n return ret;\n };\n\n private _subSingleAtom(\n target$: ReadableAtom<unknown>,\n cb$: Command<unknown, unknown[]>,\n options?: SubscribeOptions,\n ): () => void {\n let unsub: (() => void) | undefined;\n const fn = () => {\n let subscribed = true;\n const mounted = this.atomManager.mount(target$);\n mounted.listeners.add(cb$);\n\n unsub = () => {\n if (!subscribed) {\n return;\n }\n\n const fn = () => {\n subscribed = false;\n mounted.listeners.delete(cb$);\n\n if (mounted.readDepts.size === 0 && mounted.listeners.size === 0) {\n this.atomManager.tryUnmount(target$);\n }\n\n options?.signal?.addEventListener('abort', fn);\n };\n\n if (this.options?.interceptor?.unsub) {\n this.options.interceptor.unsub(target$, cb$, fn);\n\n // subscribed should be false if interceptor called fn sync\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (subscribed) {\n throw new Error('interceptor must call fn sync');\n }\n } else {\n fn();\n }\n };\n\n options?.signal?.addEventListener('abort', unsub);\n };\n\n if (this.options?.interceptor?.sub) {\n this.options.interceptor.sub(target$, cb$, fn);\n } else {\n fn();\n }\n\n if (!unsub) {\n throw new Error('interceptor must call fn sync');\n }\n\n return unsub;\n }\n\n sub(\n targets$: ReadableAtom<unknown>[] | ReadableAtom<unknown>,\n cb$: Command<unknown, unknown[]>,\n options?: SubscribeOptions,\n ): () => void {\n if (Array.isArray(targets$) && targets$.length === 0) {\n return () => void 0;\n }\n\n if (Array.isArray(targets$) && targets$.length === 1) {\n return this._subSingleAtom(targets$[0], cb$, options);\n } else if (!Array.isArray(targets$)) {\n return this._subSingleAtom(targets$, cb$, options);\n }\n\n const unsubscribes = new Set<() => void>();\n targets$.forEach((atom) => {\n unsubscribes.add(this._subSingleAtom(atom, cb$, options));\n });\n\n const unsub = () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n\n return unsub;\n }\n}\n\nexport function createStore(): Store {\n const atomManager = new AtomManager();\n const listenerManager = new ListenerManager();\n\n return new StoreImpl(atomManager, listenerManager);\n}\n\nlet defaultStore: Store | undefined = undefined;\nexport function getDefaultStore(): Store {\n if (!defaultStore) {\n defaultStore = createStore();\n }\n return defaultStore;\n}\n"],"names":["globalId","generateToString","prefix","debugLabel","id","label","concat","String","state","init","options","ret","toString","computed","read","command","write","canReadAsCompute","atom","isComputedState","AtomManager","_this","_classCallCheck","_defineProperty","WeakMap","ignoreMounted","atomState","atomStateMap","get","undefined","mounted","_iterator","_createForOfIteratorHelper","dependencies","entries","_step","s","n","done","_step$value","_slicedToArray","value","dep","epoch","depState","readAtomState","err","e","f","_createClass","key","readComputedAtom","_this$options","_this2","arguments","length","cachedState","tryGetCachedState","computedInterceptor","interceptor","computeComputedAtom","result","called","data","val","Error","_this3","_this$options2","self","Map","set","lastDeps","readDeps","wrappedGet","depAtom","selfMounted","mount","readDepts","add","getInterceptor","fn","signal","_atomState$abortContr","_self$debugLabel","abortController","abort","AbortController","_iterator2","keys","_step2","has","tryUnmount","readStateAtom","initState","tryGetMount","_this$atomStateMap$ge","_this$options3","_this$options3$mount","_atomState$mounted","call","listeners","Set","_i","_Array$from","Array","from","_Array$from$_i","_this$options4","_this$options4$unmoun","size","unmount","_i2","_Array$from2","_depState$mounted","_Array$from2$_i","inited","ListenerManager","markPendingListeners","atomManager","queue","nextQueue","_iterator3","_step3","_atomState$mounted2","_atomState$mounted3","_iterator4","_step4","listener","pendingListeners","_i3","_Array$from3","push","_regeneratorRuntime","mark","notify","_iterator5","_step5","wrap","notify$","_context","prev","next","t0","finish","stop","StoreImpl","listenerManager","_len","args","_key","apply","_toConsumableArray","newValue","fnWithRet","_loop","notifyed","_len2","_key2","innerSet","_this$options$interce","_subSingleAtom","target$","cb$","unsub","_options$signal2","subscribed","_this2$options","_options$signal","addEventListener","sub","targets$","isArray","unsubscribes","forEach","unsubscribe","createStore","defaultStore","getDefaultStore"],"mappings":"AAM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S,CAAC3B,WAAW,EAAE4B,eAAe,CAAC;AACpD;AAEA,IAAI8B,YAA+B,GAAGnJ,SAAS;AACxC,SAASoJ,eAAeA,GAAU;EACvC,IAAI,CAACD,YAAY,EAAE;IACjBA,YAAY,GAAGD,WAAW,EAAE;AAC9B;AACA,EAAA,OAAOC,YAAY;AACrB;;;;"}
|
package/debug/index.cjs
CHANGED
|
@@ -559,7 +559,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
559
559
|
}
|
|
560
560
|
var computedInterceptor = (_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.interceptor) === null || _this$options === void 0 ? void 0 : _this$options.computed;
|
|
561
561
|
if (!computedInterceptor) {
|
|
562
|
-
return this.computeComputedAtom(atom);
|
|
562
|
+
return this.computeComputedAtom(atom, ignoreMounted);
|
|
563
563
|
}
|
|
564
564
|
var result = {
|
|
565
565
|
called: false
|
|
@@ -567,7 +567,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
567
567
|
computedInterceptor(atom, function () {
|
|
568
568
|
result = {
|
|
569
569
|
called: true,
|
|
570
|
-
data: _this2.computeComputedAtom(atom)
|
|
570
|
+
data: _this2.computeComputedAtom(atom, ignoreMounted)
|
|
571
571
|
};
|
|
572
572
|
return result.data.val;
|
|
573
573
|
});
|
|
@@ -581,6 +581,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
581
581
|
value: function computeComputedAtom(atom) {
|
|
582
582
|
var _this3 = this,
|
|
583
583
|
_this$options2;
|
|
584
|
+
var ignoreMounted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
584
585
|
var self = atom;
|
|
585
586
|
var atomState = this.atomStateMap.get(self);
|
|
586
587
|
if (!atomState) {
|
|
@@ -594,7 +595,7 @@ var AtomManager = /*#__PURE__*/function () {
|
|
|
594
595
|
var readDeps = new Map();
|
|
595
596
|
atomState.dependencies = readDeps;
|
|
596
597
|
var wrappedGet = function wrappedGet(depAtom) {
|
|
597
|
-
var depState = _this3.readAtomState(depAtom);
|
|
598
|
+
var depState = _this3.readAtomState(depAtom, ignoreMounted);
|
|
598
599
|
|
|
599
600
|
// get 可能发生在异步过程中,当重复调用时,只有最新的 get 过程会修改 deps
|
|
600
601
|
if (atomState.dependencies === readDeps) {
|
|
@@ -1153,15 +1154,15 @@ var ConsoleInterceptor = /*#__PURE__*/_createClass(function ConsoleInterceptor(w
|
|
|
1153
1154
|
console.groupEnd();
|
|
1154
1155
|
});
|
|
1155
1156
|
_defineProperty(this, "set", function (atom$, fn) {
|
|
1157
|
+
var _console;
|
|
1156
1158
|
if (!_this.shouldLog(atom$, 'set')) {
|
|
1157
1159
|
fn();
|
|
1158
1160
|
return;
|
|
1159
1161
|
}
|
|
1160
|
-
console.group('[R][SET] ' + atom$.toString());
|
|
1161
1162
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1162
1163
|
args[_key - 2] = arguments[_key];
|
|
1163
1164
|
}
|
|
1164
|
-
console.
|
|
1165
|
+
(_console = console).group.apply(_console, ['[R][SET] ' + atom$.toString(), '('].concat(args, [')']));
|
|
1165
1166
|
console.log('ret:', fn());
|
|
1166
1167
|
console.groupEnd();
|
|
1167
1168
|
});
|
|
@@ -1209,11 +1210,12 @@ var ConsoleInterceptor = /*#__PURE__*/_createClass(function ConsoleInterceptor(w
|
|
|
1209
1210
|
function createDebugStore() {
|
|
1210
1211
|
var watches = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1211
1212
|
var defaultActions = arguments.length > 1 ? arguments[1] : undefined;
|
|
1213
|
+
var parsedDefaultActions = defaultActions ? new Set(defaultActions) : undefined;
|
|
1212
1214
|
var parsedWatches = watches.map(function (watch) {
|
|
1213
1215
|
if (typeof watch === 'string' || watch instanceof RegExp) {
|
|
1214
1216
|
return {
|
|
1215
1217
|
target: watch,
|
|
1216
|
-
actions:
|
|
1218
|
+
actions: parsedDefaultActions
|
|
1217
1219
|
};
|
|
1218
1220
|
}
|
|
1219
1221
|
if ('target' in watch) {
|
|
@@ -1221,7 +1223,7 @@ function createDebugStore() {
|
|
|
1221
1223
|
}
|
|
1222
1224
|
return {
|
|
1223
1225
|
target: watch,
|
|
1224
|
-
actions:
|
|
1226
|
+
actions: parsedDefaultActions
|
|
1225
1227
|
};
|
|
1226
1228
|
});
|
|
1227
1229
|
var interceptor = new ConsoleInterceptor(parsedWatches);
|
|
@@ -1229,3 +1231,4 @@ function createDebugStore() {
|
|
|
1229
1231
|
}
|
|
1230
1232
|
|
|
1231
1233
|
exports.createDebugStore = createDebugStore;
|
|
1234
|
+
//# sourceMappingURL=index.cjs.map
|