dzkcc-mflow 0.0.30 → 0.0.32
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/core/Api.d.ts +27 -43
- package/dist/core/Core.d.ts +15 -15
- package/dist/core/Core.js +10 -10
- package/dist/mflow-tools.zip +0 -0
- package/package.json +1 -1
package/dist/core/Api.d.ts
CHANGED
|
@@ -1,79 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* View 类型映射接口(由业务层扩展)
|
|
13
|
-
*/
|
|
14
|
-
export interface ViewTypeMap extends Record<string, any> {
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* ModelNames 接口(由业务层扩展)
|
|
2
|
+
* ModelNames 接口(由业务层扩展以提供代码补全和类型推断)
|
|
3
|
+
* @example
|
|
4
|
+
* ```typescript
|
|
5
|
+
* // 在 .d.ts 文件中扩展
|
|
6
|
+
* interface ModelNamesType {
|
|
7
|
+
* readonly User: unique symbol;
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
18
10
|
*/
|
|
19
11
|
export interface ModelNamesType extends Record<string, symbol> {
|
|
20
12
|
}
|
|
21
13
|
/**
|
|
22
|
-
* ManagerNames
|
|
14
|
+
* ManagerNames 接口(由业务层扩展以提供代码补全和类型推断)
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // 在 .d.ts 文件中扩展
|
|
18
|
+
* interface ManagerNamesType {
|
|
19
|
+
* readonly Home: unique symbol;
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
23
22
|
*/
|
|
24
23
|
export interface ManagerNamesType extends Record<string, symbol> {
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
|
|
26
|
+
* ViewNames 接口(由业务层扩展以提供代码补全和类型推断)
|
|
27
|
+
*/
|
|
29
28
|
export interface ViewNamesType extends Record<string, symbol> {
|
|
30
29
|
}
|
|
31
|
-
/**
|
|
32
|
-
* 从 symbol 推断对应的字符串 key
|
|
33
|
-
*/
|
|
34
|
-
type GetKeyFromSymbol<S extends symbol, Names extends Record<string, symbol>> = {
|
|
35
|
-
[K in keyof Names]: Names[K] extends S ? K : never;
|
|
36
|
-
}[keyof Names];
|
|
37
|
-
/**
|
|
38
|
-
* 从 Model Symbol 推断类型
|
|
39
|
-
*/
|
|
40
|
-
export type InferModelType<S extends symbol> = GetKeyFromSymbol<S, ModelNamesType> extends keyof ModelTypeMap ? ModelTypeMap[GetKeyFromSymbol<S, ModelNamesType>] : IModel;
|
|
41
|
-
/**
|
|
42
|
-
* 从 Manager Symbol 推断类型
|
|
43
|
-
*/
|
|
44
|
-
export type InferManagerType<S extends symbol> = GetKeyFromSymbol<S, ManagerNamesType> extends keyof ManagerTypeMap ? ManagerTypeMap[GetKeyFromSymbol<S, ManagerNamesType>] : IManager;
|
|
45
30
|
/**
|
|
46
31
|
* 核心接口 - 管理 Model 和 Manager 的生命周期
|
|
47
32
|
*
|
|
48
|
-
*
|
|
33
|
+
* 类型推断由业务层的 .d.ts 文件通过函数重载提供
|
|
49
34
|
*/
|
|
50
35
|
export interface ICore {
|
|
51
36
|
/** 注册 Model - 通过 Symbol 自动实例化 */
|
|
52
37
|
regModel(modelSymbol: symbol): void;
|
|
53
38
|
/**
|
|
54
|
-
* 获取 Model
|
|
39
|
+
* 获取 Model 实例
|
|
55
40
|
* @param modelSymbol Model 的 Symbol,使用 ModelNames.XXX
|
|
56
|
-
* @returns Model
|
|
41
|
+
* @returns Model 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
57
42
|
* @example
|
|
58
43
|
* ```typescript
|
|
59
|
-
* //
|
|
44
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
60
45
|
* const userModel = core.getModel(ModelNames.User);
|
|
61
46
|
* ```
|
|
62
47
|
*/
|
|
63
|
-
getModel
|
|
48
|
+
getModel(modelSymbol: symbol): any;
|
|
64
49
|
/** 注册 Manager - 通过 Symbol 自动实例化 */
|
|
65
50
|
regManager(managerSymbol: symbol): void;
|
|
66
51
|
/**
|
|
67
|
-
* 获取 Manager
|
|
52
|
+
* 获取 Manager 实例
|
|
68
53
|
* @param managerSymbol Manager 的 Symbol,使用 ManagerNames.XXX
|
|
69
|
-
* @returns Manager
|
|
54
|
+
* @returns Manager 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
70
55
|
* @example
|
|
71
56
|
* ```typescript
|
|
72
|
-
* //
|
|
57
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
73
58
|
* const gameManager = core.getManager(ManagerNames.Game);
|
|
74
59
|
* ```
|
|
75
60
|
*/
|
|
76
|
-
getManager
|
|
61
|
+
getManager(managerSymbol: symbol): any;
|
|
77
62
|
}
|
|
78
63
|
/**
|
|
79
64
|
* Model 基接口 - 数据模型
|
|
@@ -268,4 +253,3 @@ export interface IRedDotManager extends IManager {
|
|
|
268
253
|
/** 移除红点监听 */
|
|
269
254
|
off(path: string, listener: Function): void;
|
|
270
255
|
}
|
|
271
|
-
export {};
|
package/dist/core/Core.d.ts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { ICore, IManager
|
|
1
|
+
import { ICore, IManager } from "./Api";
|
|
2
2
|
export declare abstract class AbstractCore<T extends AbstractCore<T>> implements ICore {
|
|
3
3
|
private readonly container;
|
|
4
4
|
constructor();
|
|
5
5
|
protected abstract initialize(): void;
|
|
6
6
|
regModel(modelSymbol: symbol): void;
|
|
7
7
|
/**
|
|
8
|
-
* 获取 Model
|
|
8
|
+
* 获取 Model 实例
|
|
9
9
|
* @param modelSymbol Model 的 Symbol,使用 ModelNames.XXX
|
|
10
|
-
* @returns Model
|
|
10
|
+
* @returns Model 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* //
|
|
13
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
14
14
|
* const userModel = core.getModel(ModelNames.User);
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
getModel
|
|
17
|
+
getModel(modelSymbol: symbol): any;
|
|
18
18
|
regManager(managerSymbol: symbol): void;
|
|
19
19
|
/**
|
|
20
|
-
* 获取 Manager
|
|
20
|
+
* 获取 Manager 实例
|
|
21
21
|
* @param managerSymbol Manager 的 Symbol,使用 ManagerNames.XXX
|
|
22
|
-
* @returns Manager
|
|
22
|
+
* @returns Manager 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
23
23
|
* @example
|
|
24
24
|
* ```typescript
|
|
25
|
-
* //
|
|
25
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
26
26
|
* const gameManager = core.getManager(ManagerNames.Game);
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
getManager
|
|
29
|
+
getManager(managerSymbol: symbol): any;
|
|
30
30
|
}
|
|
31
31
|
export declare abstract class AbstractManager implements IManager {
|
|
32
32
|
abstract initialize(): void;
|
|
33
33
|
dispose(): void;
|
|
34
34
|
/**
|
|
35
|
-
* 获取 Model
|
|
35
|
+
* 获取 Model 实例
|
|
36
36
|
* @param modelSymbol Model 的 Symbol,使用 ModelNames.XXX
|
|
37
|
-
* @returns Model
|
|
37
|
+
* @returns Model 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
38
38
|
*/
|
|
39
|
-
protected getModel
|
|
39
|
+
protected getModel(modelSymbol: symbol): any;
|
|
40
40
|
/**
|
|
41
|
-
* 获取 Manager
|
|
41
|
+
* 获取 Manager 实例
|
|
42
42
|
* @param managerSymbol Manager 的 Symbol,使用 ManagerNames.XXX
|
|
43
|
-
* @returns Manager
|
|
43
|
+
* @returns Manager 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
44
44
|
*/
|
|
45
|
-
protected getManager
|
|
45
|
+
protected getManager(managerSymbol: symbol): any;
|
|
46
46
|
}
|
package/dist/core/Core.js
CHANGED
|
@@ -28,12 +28,12 @@ class AbstractCore {
|
|
|
28
28
|
model.initialize();
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* 获取 Model
|
|
31
|
+
* 获取 Model 实例
|
|
32
32
|
* @param modelSymbol Model 的 Symbol,使用 ModelNames.XXX
|
|
33
|
-
* @returns Model
|
|
33
|
+
* @returns Model 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
34
34
|
* @example
|
|
35
35
|
* ```typescript
|
|
36
|
-
* //
|
|
36
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
37
37
|
* const userModel = core.getModel(ModelNames.User);
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
@@ -48,12 +48,12 @@ class AbstractCore {
|
|
|
48
48
|
manager.initialize();
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* 获取 Manager
|
|
51
|
+
* 获取 Manager 实例
|
|
52
52
|
* @param managerSymbol Manager 的 Symbol,使用 ManagerNames.XXX
|
|
53
|
-
* @returns Manager
|
|
53
|
+
* @returns Manager 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* //
|
|
56
|
+
* // 类型由 .d.ts 文件的重载自动推断
|
|
57
57
|
* const gameManager = core.getManager(ManagerNames.Game);
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
@@ -65,9 +65,9 @@ class AbstractManager {
|
|
|
65
65
|
dispose() {
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* 获取 Model
|
|
68
|
+
* 获取 Model 实例
|
|
69
69
|
* @param modelSymbol Model 的 Symbol,使用 ModelNames.XXX
|
|
70
|
-
* @returns Model
|
|
70
|
+
* @returns Model 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
71
71
|
*/
|
|
72
72
|
getModel(modelSymbol) {
|
|
73
73
|
// 保持框架独立性,不与具体应用入口(app类)耦合
|
|
@@ -75,9 +75,9 @@ class AbstractManager {
|
|
|
75
75
|
return ServiceLocator.getService('core').getModel(modelSymbol);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* 获取 Manager
|
|
78
|
+
* 获取 Manager 实例
|
|
79
79
|
* @param managerSymbol Manager 的 Symbol,使用 ManagerNames.XXX
|
|
80
|
-
* @returns Manager
|
|
80
|
+
* @returns Manager 实例(具体类型由 .d.ts 文件的函数重载推断)
|
|
81
81
|
*/
|
|
82
82
|
getManager(managerSymbol) {
|
|
83
83
|
return ServiceLocator.getService('core').getManager(managerSymbol);
|
package/dist/mflow-tools.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED