forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplugin-types.ts
More file actions
105 lines (96 loc) · 3.12 KB
/
plugin-types.ts
File metadata and controls
105 lines (96 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import {
IPublicApiHotkey,
IPublicApiProject,
IPublicApiSkeleton,
IPublicApiSetters,
IPublicApiMaterial,
IPublicApiEvent,
IPublicApiCommon,
IPublicApiPlugins,
IPublicTypePluginConfig,
IPublicApiLogger,
IPublicTypePreferenceValueType,
IPublicModelEngineConfig,
IPublicTypePlugin,
IPublicApiCanvas,
IPublicApiWorkspace,
IPublicTypePluginMeta,
IPublicTypePluginRegisterOptions,
IPublicModelWindow,
IPublicEnumPluginRegisterLevel,
IPublicApiCommonUI,
IPublicApiCommand,
} from '@felce/lowcode-types';
import PluginContext from './plugin-context';
export type PluginPreference = Map<string, Record<string, IPublicTypePreferenceValueType>>;
export interface ILowCodePluginRuntimeCore {
name: string;
dep: string[];
disabled: boolean;
config: IPublicTypePluginConfig;
logger: IPublicApiLogger;
meta: IPublicTypePluginMeta;
init(forceInit?: boolean): void;
isInited(): boolean;
destroy(): void;
toProxy(): any;
setDisabled(flag: boolean): void;
}
interface ILowCodePluginRuntimeExportsAccessor {
[propName: string]: any;
}
// eslint-disable-next-line max-len
export type ILowCodePluginRuntime = ILowCodePluginRuntimeCore &
ILowCodePluginRuntimeExportsAccessor;
export interface ILowCodePluginContextPrivate {
set hotkey(hotkey: IPublicApiHotkey);
set project(project: IPublicApiProject);
set skeleton(skeleton: IPublicApiSkeleton);
set setters(setters: IPublicApiSetters);
set material(material: IPublicApiMaterial);
set event(event: IPublicApiEvent);
set config(config: IPublicModelEngineConfig);
set common(common: IPublicApiCommon);
set plugins(plugins: IPublicApiPlugins);
set logger(plugins: IPublicApiLogger);
set pluginEvent(event: IPublicApiEvent);
set canvas(canvas: IPublicApiCanvas);
set workspace(workspace: IPublicApiWorkspace);
set editorWindow(window: IPublicModelWindow);
set registerLevel(level: IPublicEnumPluginRegisterLevel);
set isPluginRegisteredInWorkspace(flag: boolean);
set commonUI(commonUI: IPublicApiCommonUI);
set command(command: IPublicApiCommand);
}
export interface ILowCodePluginContextApiAssembler {
assembleApis(
context: ILowCodePluginContextPrivate,
pluginName: string,
meta: IPublicTypePluginMeta,
): void;
}
interface ILowCodePluginManagerPluginAccessor {
[pluginName: string]: ILowCodePluginRuntime | any;
}
export interface ILowCodePluginManagerCore {
register(
pluginModel: IPublicTypePlugin,
pluginOptions?: any,
options?: IPublicTypePluginRegisterOptions,
): Promise<void>;
init(
pluginPreference?: Map<string, Record<string, IPublicTypePreferenceValueType>>,
): Promise<void>;
get(pluginName: string): ILowCodePluginRuntime | undefined;
getAll(): ILowCodePluginRuntime[];
has(pluginName: string): boolean;
delete(pluginName: string): any;
setDisabled(pluginName: string, flag: boolean): void;
dispose(): void;
_getLowCodePluginContext(options: IPluginContextOptions): PluginContext;
}
export type ILowCodePluginManager = ILowCodePluginManagerCore & ILowCodePluginManagerPluginAccessor;
export interface IPluginContextOptions {
pluginName: string;
meta?: IPublicTypePluginMeta;
}