coaction 0.1.5 → 0.2.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.
@@ -1,28 +0,0 @@
1
- import type { Store } from "./interface.js";
2
- import { Internal } from "./internal.js";
3
- /**
4
- * createBinder is a function to create a binder for the 3rd party store.
5
- */
6
- export declare function createBinder<F = (...args: any[]) => any>({ handleState, handleStore }: {
7
- /**
8
- * handleState is a function to handle the state object.
9
- */
10
- handleState: <T extends object = object>(state: T) => {
11
- /**
12
- * copyState is a copy of the state object.
13
- */
14
- copyState: T;
15
- /**
16
- * key is the key of the state object.
17
- */
18
- key?: keyof T;
19
- /**
20
- * bind is a function to bind the state object.
21
- */
22
- bind: (state: T) => T;
23
- };
24
- /**
25
- * handleStore is a function to handle the store object.
26
- */
27
- handleStore: (store: Store<object>, rawState: object, state: object, internal: Internal<object>) => void;
28
- }): F;
@@ -1,5 +0,0 @@
1
- import type { Creator } from "./interface.js";
2
- /**
3
- * Create a simple store or a shared store. The shared store can be used in a worker or another thread.
4
- */
5
- export declare const create: Creator;
@@ -1,4 +0,0 @@
1
- export { create } from "./create.js";
2
- export { createBinder } from "./binder.js";
3
- export { wrapStore } from "./wrapStore.js";
4
- export type { Store, StoreOptions, ISlices, Slice, Slices, Middleware, ClientStoreOptions, SliceState, Asyncify, StoreWithAsyncFunction as AsyncStore } from "./interface.js";
@@ -1,48 +0,0 @@
1
- import type { Draft, Patches } from 'mutative';
2
- import type { CreateState, Listener } from "./interface.js";
3
- export interface Internal<T extends CreateState = CreateState> {
4
- /**
5
- * The store module.
6
- */
7
- module: T;
8
- /**
9
- * The root state.
10
- */
11
- rootState: T | Draft<T>;
12
- /**
13
- * The backup state.
14
- */
15
- backupState: T | Draft<T>;
16
- /**
17
- * Finalize the draft.
18
- */
19
- finalizeDraft: () => [T, Patches, Patches];
20
- /**
21
- * The mutable instance.
22
- */
23
- mutableInstance: any;
24
- /**
25
- * The sequence number.
26
- */
27
- sequence: number;
28
- /**
29
- * Whether the batch is running.
30
- */
31
- isBatching: boolean;
32
- /**
33
- * The listeners.
34
- */
35
- listeners: Set<Listener>;
36
- /**
37
- * The act is used to run the function in the action for mutable state.
38
- */
39
- actMutable?: <T extends () => any>(fn: T) => ReturnType<T>;
40
- /**
41
- * Get the mutable raw instance via the initial state.
42
- */
43
- toMutableRaw?: (key: any) => any;
44
- /**
45
- * The update immutable function.
46
- */
47
- updateImmutable?: (state: T) => void;
48
- }
@@ -1,5 +0,0 @@
1
- import type { Store, StoreReturn } from "./interface.js";
2
- /**
3
- * wrapStore is a function to wrap the store and return function to get the state with store.
4
- */
5
- export declare const wrapStore: (store: Store<any>, getState?: (...args: any[]) => any) => StoreReturn<any>;