@lomray/react-mobx-manager 2.1.2-beta.1 → 2.1.2-beta.2
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 -8
- 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-1245f290.d.ts} +9 -8
- 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-1245f290.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, TInitStore, TStoreDefinition, TStores, TAnyStore } from "./types-1245f290.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-1245f290.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 extends
|
|
126
|
+
getStore<T extends TAnyStore>(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<T extends
|
|
133
|
+
protected lookupStore<T extends TAnyStore>(id: string, params: IStoreParams): TInitStore<T> | 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 extends
|
|
142
|
+
protected createStore<T extends TAnyStore>(store: IConstructableStore<T>, params: Omit<Required<IStoreParams>, 'key'>): T;
|
|
143
143
|
/**
|
|
144
144
|
* Create stores for component
|
|
145
145
|
*/
|
|
@@ -204,13 +204,13 @@ declare class Manager {
|
|
|
204
204
|
* Get observable store props (fields)
|
|
205
205
|
* @private
|
|
206
206
|
*/
|
|
207
|
-
static getObservableProps(store:
|
|
207
|
+
static getObservableProps(store: TAnyStore): Record<string, any>;
|
|
208
208
|
/**
|
|
209
209
|
* Persist store
|
|
210
210
|
*/
|
|
211
211
|
/**
|
|
212
212
|
* Persist store
|
|
213
213
|
*/
|
|
214
|
-
static persistStore<TSt extends
|
|
214
|
+
static persistStore<TSt extends TAnyStore>(store: IConstructableStore<TSt>, id: string): IConstructableStore<TSt>;
|
|
215
215
|
}
|
|
216
216
|
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 extends
|
|
15
|
+
getStore: <T extends TAnyStore>(store: IConstructableStore<T>, params?: Partial<IStoreParams>) => T | undefined;
|
|
16
16
|
componentProps: TProps;
|
|
17
17
|
}
|
|
18
18
|
interface IStoreLifecycle {
|
|
@@ -34,7 +34,7 @@ interface IStorePersisted extends IStore {
|
|
|
34
34
|
addOnChangeListener?: (store: IStorePersisted, manager: Manager) => (() => void) | undefined;
|
|
35
35
|
wakeup?: TWakeup;
|
|
36
36
|
}
|
|
37
|
-
type TInitStore<TSto extends
|
|
37
|
+
type TInitStore<TSto extends TAnyStore = IStore> = TSto & (IStorePersisted | IStore);
|
|
38
38
|
type IConstructableStore<TSto extends IStore = IStore> = (new (props: IConstructorParams) => TInitStore<TSto>) & Partial<IStorePersisted>;
|
|
39
39
|
/**
|
|
40
40
|
* Store params
|
|
@@ -42,7 +42,7 @@ type IConstructableStore<TSto extends IStore = IStore> = (new (props: IConstruct
|
|
|
42
42
|
type IStoreConfig = {
|
|
43
43
|
id?: string;
|
|
44
44
|
};
|
|
45
|
-
type TStoreDefinition<TSto extends
|
|
45
|
+
type TStoreDefinition<TSto extends TAnyStore = any> = 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