@lomray/react-mobx-manager 2.1.2-beta.1 → 2.1.2-beta.3
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/lib/context.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/manager.d.ts +8 -10
- package/lib/on-change-listener.d.ts +1 -1
- package/lib/storages/async-storage.d.ts +1 -1
- package/lib/storages/local-storage.d.ts +1 -1
- package/lib/suspense-query.d.ts +1 -1
- package/lib/{types-01f82098.d.ts → types-a4b71460.d.ts} +10 -9
- package/lib/wakeup.d.ts +1 -1
- package/lib/with-stores.d.ts +1 -1
- package/package.json +1 -1
package/lib/context.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FC, ReactElement } from "react";
|
|
4
4
|
import Manager from "./manager.js";
|
|
5
|
-
import { TStores } from "./types-
|
|
5
|
+
import { TStores } from "./types-a4b71460.js";
|
|
6
6
|
interface IStoreManagerProvider {
|
|
7
7
|
storeManager: Manager;
|
|
8
8
|
shouldInit?: boolean;
|
package/lib/index.d.ts
CHANGED
package/lib/manager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import StoreStatus from "./store-status.js";
|
|
2
|
-
import { IConstructableStore, IManagerOptions, IManagerParams, IStorage,
|
|
2
|
+
import { IConstructableStore, IManagerOptions, IManagerParams, IStorage, IStoreParams, TAnyStore, TInitStore, TStoreDefinition, TStores } from "./types-a4b71460.js";
|
|
3
3
|
/**
|
|
4
4
|
* Mobx stores manager
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ declare class Manager {
|
|
|
11
11
|
/**
|
|
12
12
|
* Created stores
|
|
13
13
|
*/
|
|
14
|
-
protected readonly stores: Map<string, TInitStore<IStore>>;
|
|
14
|
+
protected readonly stores: Map<string, TInitStore<import("./types-a4b71460.js").IStore>>;
|
|
15
15
|
/**
|
|
16
16
|
* Relations between stores
|
|
17
17
|
* @protected
|
|
@@ -116,21 +116,21 @@ declare class Manager {
|
|
|
116
116
|
* Get store identity
|
|
117
117
|
* @protected
|
|
118
118
|
*/
|
|
119
|
-
protected getStoreId<T extends
|
|
119
|
+
protected getStoreId<T extends TAnyStore>(store: IConstructableStore<T> | TInitStore, params?: IStoreParams): string;
|
|
120
120
|
/**
|
|
121
121
|
* Get exist store
|
|
122
122
|
*/
|
|
123
123
|
/**
|
|
124
124
|
* Get exist store
|
|
125
125
|
*/
|
|
126
|
-
getStore<T
|
|
126
|
+
getStore<T>(store: IConstructableStore<T>, params?: IStoreParams): T | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Lookup store
|
|
129
129
|
*/
|
|
130
130
|
/**
|
|
131
131
|
* Lookup store
|
|
132
132
|
*/
|
|
133
|
-
protected lookupStore
|
|
133
|
+
protected lookupStore(id: string, params: IStoreParams): TInitStore<TAnyStore> | undefined;
|
|
134
134
|
/**
|
|
135
135
|
* Create new store instance
|
|
136
136
|
* @protected
|
|
@@ -139,7 +139,7 @@ declare class Manager {
|
|
|
139
139
|
* Create new store instance
|
|
140
140
|
* @protected
|
|
141
141
|
*/
|
|
142
|
-
protected createStore<T
|
|
142
|
+
protected createStore<T>(store: IConstructableStore<T>, params: Omit<Required<IStoreParams>, 'key'>): T;
|
|
143
143
|
/**
|
|
144
144
|
* Create stores for component
|
|
145
145
|
*/
|
|
@@ -198,19 +198,17 @@ declare class Manager {
|
|
|
198
198
|
toPersistedJSON(): Record<string, any>;
|
|
199
199
|
/**
|
|
200
200
|
* Get observable store props (fields)
|
|
201
|
-
* @private
|
|
202
201
|
*/
|
|
203
202
|
/**
|
|
204
203
|
* Get observable store props (fields)
|
|
205
|
-
* @private
|
|
206
204
|
*/
|
|
207
|
-
static getObservableProps(store:
|
|
205
|
+
static getObservableProps(store: TAnyStore): Record<string, any>;
|
|
208
206
|
/**
|
|
209
207
|
* Persist store
|
|
210
208
|
*/
|
|
211
209
|
/**
|
|
212
210
|
* Persist store
|
|
213
211
|
*/
|
|
214
|
-
static persistStore<TSt
|
|
212
|
+
static persistStore<TSt>(store: IConstructableStore<TSt>, id: string): IConstructableStore<TSt>;
|
|
215
213
|
}
|
|
216
214
|
export { Manager as default };
|
package/lib/suspense-query.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare global {
|
|
|
12
12
|
}
|
|
13
13
|
interface IConstructorParams<TProps = Record<string, any>> {
|
|
14
14
|
storeManager: Manager;
|
|
15
|
-
getStore: <T
|
|
15
|
+
getStore: <T>(store: IConstructableStore<T>, params?: Partial<IStoreParams>) => T | undefined;
|
|
16
16
|
componentProps: TProps;
|
|
17
17
|
}
|
|
18
18
|
interface IStoreLifecycle {
|
|
@@ -34,15 +34,15 @@ interface IStorePersisted extends IStore {
|
|
|
34
34
|
addOnChangeListener?: (store: IStorePersisted, manager: Manager) => (() => void) | undefined;
|
|
35
35
|
wakeup?: TWakeup;
|
|
36
36
|
}
|
|
37
|
-
type TInitStore<TSto
|
|
38
|
-
type IConstructableStore<TSto
|
|
37
|
+
type TInitStore<TSto = IStore> = TSto & TAnyStore;
|
|
38
|
+
type IConstructableStore<TSto = IStore> = (new (props: IConstructorParams) => TInitStore<TSto>) & Partial<IStorePersisted>;
|
|
39
39
|
/**
|
|
40
40
|
* Store params
|
|
41
41
|
*/
|
|
42
42
|
type IStoreConfig = {
|
|
43
43
|
id?: string;
|
|
44
44
|
};
|
|
45
|
-
type TStoreDefinition<TSto
|
|
45
|
+
type TStoreDefinition<TSto = TAnyStore> = IConstructableStore<TSto> | ({
|
|
46
46
|
store: IConstructableStore<TSto>;
|
|
47
47
|
} & IStoreConfig);
|
|
48
48
|
type TMapStores = Record<string, TStoreDefinition>;
|
|
@@ -70,8 +70,9 @@ interface IManagerOptions {
|
|
|
70
70
|
unused?: number;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
+
type TAnyStore = IStore | IStorePersisted;
|
|
73
74
|
type TStores = {
|
|
74
|
-
[storeKey: string]:
|
|
75
|
+
[storeKey: string]: TAnyStore;
|
|
75
76
|
};
|
|
76
77
|
/**
|
|
77
78
|
* Convert class type to class constructor
|
|
@@ -102,13 +103,13 @@ interface IMobxManagerEvents {
|
|
|
102
103
|
store: IConstructableStore;
|
|
103
104
|
};
|
|
104
105
|
[Events.MOUNT_STORE]: {
|
|
105
|
-
store:
|
|
106
|
+
store: TAnyStore;
|
|
106
107
|
};
|
|
107
108
|
[Events.UNMOUNT_STORE]: {
|
|
108
|
-
store:
|
|
109
|
+
store: TAnyStore;
|
|
109
110
|
};
|
|
110
111
|
[Events.DELETE_STORE]: {
|
|
111
|
-
store:
|
|
112
|
+
store: TAnyStore;
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
|
-
export { IWindowManager, IConstructorParams, IStoreLifecycle, IStore, IStorePersisted, TInitStore, IConstructableStore, IStoreConfig, TStoreDefinition, TMapStores, IManagerParams, TWakeup, IStorage, IManagerOptions, TStores, ClassReturnType, StoresType, IStoreParams, IWithStoreOptions, IMobxManagerEvents };
|
|
115
|
+
export { IWindowManager, IConstructorParams, IStoreLifecycle, IStore, IStorePersisted, TInitStore, IConstructableStore, IStoreConfig, TStoreDefinition, TMapStores, IManagerParams, TWakeup, IStorage, IManagerOptions, TAnyStore, TStores, ClassReturnType, StoresType, IStoreParams, IWithStoreOptions, IMobxManagerEvents };
|
package/lib/wakeup.d.ts
CHANGED
package/lib/with-stores.d.ts
CHANGED