plugin-tls 2.0.1 → 3.1.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.
- package/dist/index.d.ts +3 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +927 -372
- package/dist/index.umd.cjs +1 -1
- package/dist/options/index.d.ts +4 -0
- package/dist/options/index.d.ts.map +1 -0
- package/dist/options/options-manager/ModeOptions.d.ts.map +1 -0
- package/dist/options/options-manager/OptionsManager.d.ts.map +1 -0
- package/dist/options/options-manager/TierModeOptions.d.ts.map +1 -0
- package/dist/options/options-manager/TierOptions.d.ts.map +1 -0
- package/dist/options/options-manager/defaultOptions.d.ts.map +1 -0
- package/dist/options/options-manager/index.d.ts +6 -0
- package/dist/options/options-manager/index.d.ts.map +1 -0
- package/dist/options/options-manager/tools.d.ts.map +1 -0
- package/dist/options/options-plugin-host/index.d.ts +3 -0
- package/dist/options/options-plugin-host/index.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts +28 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.d.ts +29 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.d.ts +28 -0
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts +60 -0
- package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/index.d.ts +6 -0
- package/dist/options/options-plugin-host/tier-mode-options/index.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-mode-options/type.d.ts +7 -0
- package/dist/options/options-plugin-host/tier-mode-options/type.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHost.d.ts +25 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHost.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts +26 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.d.ts +25 -0
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-options/createTierOptionsPluginHost.d.ts +57 -0
- package/dist/options/options-plugin-host/tier-options/createTierOptionsPluginHost.d.ts.map +1 -0
- package/dist/options/options-plugin-host/tier-options/index.d.ts +5 -0
- package/dist/options/options-plugin-host/tier-options/index.d.ts.map +1 -0
- package/dist/options/plugins/index.d.ts +3 -0
- package/dist/options/plugins/index.d.ts.map +1 -0
- package/dist/options/plugins/tier-mode-options/decorator.d.ts +14 -0
- package/dist/options/plugins/tier-mode-options/decorator.d.ts.map +1 -0
- package/dist/options/plugins/tier-mode-options/plugin.d.ts +3 -0
- package/dist/options/plugins/tier-mode-options/plugin.d.ts.map +1 -0
- package/dist/options/plugins/tier-mode-options/type.d.ts +35 -0
- package/dist/options/plugins/tier-mode-options/type.d.ts.map +1 -0
- package/dist/options/plugins/tier-mode-options-plugin.d.ts +4 -0
- package/dist/options/plugins/tier-mode-options-plugin.d.ts.map +1 -0
- package/dist/options/plugins/tier-options/decorator.d.ts +14 -0
- package/dist/options/plugins/tier-options/decorator.d.ts.map +1 -0
- package/dist/options/plugins/tier-options/plugin.d.ts +11 -0
- package/dist/options/plugins/tier-options/plugin.d.ts.map +1 -0
- package/dist/options/plugins/tier-options/type.d.ts +36 -0
- package/dist/options/plugins/tier-options/type.d.ts.map +1 -0
- package/dist/options/plugins/tier-options-plugin.d.ts +4 -0
- package/dist/options/plugins/tier-options-plugin.d.ts.map +1 -0
- package/dist/plugin-host/PluginHost.d.ts +50 -227
- package/dist/plugin-host/PluginHost.d.ts.map +1 -1
- package/dist/plugin-host/PluginHostEventEmitter.d.ts +72 -0
- package/dist/plugin-host/PluginHostEventEmitter.d.ts.map +1 -0
- package/dist/plugin-host/PluginHostEventTarget.d.ts +70 -0
- package/dist/plugin-host/PluginHostEventTarget.d.ts.map +1 -0
- package/dist/plugin-host/createPluginHost.d.ts +95 -0
- package/dist/plugin-host/createPluginHost.d.ts.map +1 -0
- package/dist/plugin-host/decorator.d.ts +174 -0
- package/dist/plugin-host/decorator.d.ts.map +1 -0
- package/dist/plugin-host/index.d.ts +7 -0
- package/dist/plugin-host/index.d.ts.map +1 -0
- package/dist/plugin-host/type.d.ts +65 -0
- package/dist/plugin-host/type.d.ts.map +1 -0
- package/dist/plugin-manager/ExtendManager.d.ts +66 -0
- package/dist/plugin-manager/ExtendManager.d.ts.map +1 -0
- package/dist/plugin-manager/IExtend.d.ts +64 -0
- package/dist/plugin-manager/IExtend.d.ts.map +1 -0
- package/dist/plugin-manager/IPlugin.d.ts +56 -0
- package/dist/plugin-manager/IPlugin.d.ts.map +1 -0
- package/dist/plugin-manager/PluginExtendManager.d.ts +92 -0
- package/dist/plugin-manager/PluginExtendManager.d.ts.map +1 -0
- package/dist/plugin-manager/PluginManager.d.ts +31 -84
- package/dist/plugin-manager/PluginManager.d.ts.map +1 -1
- package/dist/plugin-manager/index.d.ts +7 -0
- package/dist/plugin-manager/index.d.ts.map +1 -0
- package/dist/plugin-manager/mixin.d.ts.map +1 -0
- package/package.json +4 -3
- package/dist/extend/extend.d.ts +0 -222
- package/dist/extend/extend.d.ts.map +0 -1
- package/dist/extend/mixin.d.ts.map +0 -1
- package/dist/options-manager/ModeOptions.d.ts.map +0 -1
- package/dist/options-manager/OptionsManager.d.ts.map +0 -1
- package/dist/options-manager/TierModeOptions.d.ts.map +0 -1
- package/dist/options-manager/TierOptions.d.ts.map +0 -1
- package/dist/options-manager/defaultOptions.d.ts.map +0 -1
- package/dist/options-manager/tools.d.ts.map +0 -1
- package/dist/plugin-host/TierModeOptionsPluginHost.d.ts +0 -167
- package/dist/plugin-host/TierModeOptionsPluginHost.d.ts.map +0 -1
- package/dist/plugin-host/TierOptionsPluginHost.d.ts +0 -153
- package/dist/plugin-host/TierOptionsPluginHost.d.ts.map +0 -1
- package/dist/plugin-manager/PluginManagerWithInit.d.ts +0 -36
- package/dist/plugin-manager/PluginManagerWithInit.d.ts.map +0 -1
- /package/dist/{options-manager → options/options-manager}/ModeOptions.d.ts +0 -0
- /package/dist/{options-manager → options/options-manager}/OptionsManager.d.ts +0 -0
- /package/dist/{options-manager → options/options-manager}/TierModeOptions.d.ts +0 -0
- /package/dist/{options-manager → options/options-manager}/TierOptions.d.ts +0 -0
- /package/dist/{options-manager → options/options-manager}/defaultOptions.d.ts +0 -0
- /package/dist/{options-manager → options/options-manager}/tools.d.ts +0 -0
- /package/dist/{extend → plugin-manager}/mixin.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,243 +1,398 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Destroyable as M, DestroyableEventEmitter as N, DestroyableEventTarget as H, createDestroyableSubClass as V } from "@gby/destroyable";
|
|
2
|
+
import { serialCallFuns as g } from "com-tools";
|
|
3
|
+
import { deepmergeInto as P, deepmerge as w } from "deepmerge-ts";
|
|
4
|
+
function d(s, ...t) {
|
|
4
5
|
for (const e of t) {
|
|
5
|
-
const
|
|
6
|
-
Object.defineProperties(
|
|
6
|
+
const n = Object.getOwnPropertyDescriptors(e);
|
|
7
|
+
Object.defineProperties(s, n);
|
|
7
8
|
}
|
|
8
|
-
return
|
|
9
|
+
return s;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function B(s, t) {
|
|
11
12
|
return t;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function K() {
|
|
14
15
|
return function(t, e) {
|
|
15
16
|
return e;
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
19
|
+
function R(s, t) {
|
|
20
|
+
return d(s, t), t;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function W(s) {
|
|
22
23
|
return function(e) {
|
|
23
|
-
return
|
|
24
|
+
return d(s, e), e;
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
27
|
+
function c(s, t) {
|
|
28
|
+
return d(s, t), s;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function G(s) {
|
|
30
31
|
return function(e) {
|
|
31
|
-
return
|
|
32
|
+
return d(s, e), s;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
const k = ["onCreate", "onInit", "onDestroy"];
|
|
36
|
+
function T(s) {
|
|
37
|
+
const t = { ...s };
|
|
38
|
+
for (const e of k)
|
|
39
|
+
typeof t[e] == "function" && delete t[e];
|
|
35
40
|
return t;
|
|
36
41
|
}
|
|
37
|
-
function
|
|
38
|
-
l(n.prototype, t);
|
|
39
|
-
const e = t._constructor;
|
|
40
|
-
typeof e == "function" && (n._constructors ?? (n._constructors = [])).push(e);
|
|
41
|
-
const i = t._destroy;
|
|
42
|
-
return typeof i == "function" && (n._destroys ?? (n._destroys = [])).push(i), t;
|
|
43
|
-
}
|
|
44
|
-
function q(n) {
|
|
45
|
-
return function(e) {
|
|
46
|
-
return O(n, e), e;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function T(n, t) {
|
|
50
|
-
return O(n, t), n;
|
|
51
|
-
}
|
|
52
|
-
function B(n) {
|
|
53
|
-
return function(e) {
|
|
54
|
-
return O(n, e), n;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function m(n, t, e) {
|
|
58
|
-
for (const i of n)
|
|
59
|
-
i.apply(t, e);
|
|
60
|
-
}
|
|
61
|
-
function K(n) {
|
|
62
|
-
return {
|
|
63
|
-
constructed: function(t, e) {
|
|
64
|
-
m(n._constructors ?? [], t, e);
|
|
65
|
-
},
|
|
66
|
-
initialized: function(t, e) {
|
|
67
|
-
m(n._inits ?? [], t, e);
|
|
68
|
-
},
|
|
69
|
-
destroyed: function(t, e) {
|
|
70
|
-
m(n._destroys ?? [], t, e);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function R(n, t) {
|
|
42
|
+
function J(s, t) {
|
|
75
43
|
return t;
|
|
76
44
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
const e = t._init;
|
|
80
|
-
return typeof e == "function" && (n._inits ?? (n._inits = [])).push(e), t;
|
|
81
|
-
}
|
|
82
|
-
function G(n) {
|
|
83
|
-
return function(e) {
|
|
84
|
-
return y(n, e), e;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function J(n, t) {
|
|
88
|
-
return y(n, t), n;
|
|
45
|
+
function I(s) {
|
|
46
|
+
return s && typeof s.onUse == "function";
|
|
89
47
|
}
|
|
90
|
-
|
|
91
|
-
return function(e) {
|
|
92
|
-
return y(n, e), n;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
class g {
|
|
48
|
+
class L extends M {
|
|
96
49
|
/**
|
|
97
50
|
* 插件的宿主
|
|
98
51
|
*/
|
|
99
52
|
host;
|
|
100
53
|
/**
|
|
101
|
-
*
|
|
54
|
+
* 所有注册的插件
|
|
102
55
|
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* 注册的插件
|
|
106
|
-
*/
|
|
107
|
-
plugins = [];
|
|
56
|
+
plugins = /* @__PURE__ */ new Map();
|
|
108
57
|
/**
|
|
109
58
|
* @param host - 插件的宿主
|
|
110
59
|
*/
|
|
111
60
|
constructor(t) {
|
|
112
|
-
t && (this.host = t);
|
|
61
|
+
super(), t && (this.host = t);
|
|
62
|
+
}
|
|
63
|
+
destroyThis() {
|
|
64
|
+
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
113
65
|
}
|
|
114
66
|
/**
|
|
115
67
|
* 使用插件、注册插件
|
|
116
68
|
* @param plugin - 插件
|
|
117
|
-
* @param
|
|
69
|
+
* @param args - 传递给插件的选项
|
|
118
70
|
*/
|
|
119
71
|
use(t, ...e) {
|
|
120
|
-
const {
|
|
121
|
-
if (
|
|
122
|
-
|
|
72
|
+
const { plugins: n } = this;
|
|
73
|
+
if (n.has(t)) return n.get(t);
|
|
74
|
+
const i = t.onUse(this.host, ...e);
|
|
75
|
+
return n.set(t, i), i;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 插件宿主实例的注册插件的方法
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* 会调用每个插件的 {@link IPlugin.use } 方法
|
|
82
|
+
* @param hostInst - 插件宿主的新实例
|
|
83
|
+
*/
|
|
84
|
+
instUse(t, e, ...n) {
|
|
85
|
+
const { plugins: i } = this;
|
|
86
|
+
if (i.has(e)) return i.get(e);
|
|
87
|
+
const o = this.use(e, ...n);
|
|
88
|
+
return e.onCreate?.(t), o;
|
|
123
89
|
}
|
|
124
90
|
/**
|
|
125
91
|
* 插件宿主创建实例时调用
|
|
126
92
|
*
|
|
127
93
|
* @remarks
|
|
128
|
-
* 会调用每个插件的 {@link IPlugin.
|
|
94
|
+
* 会调用每个插件的 {@link IPlugin.onCreate} 方法
|
|
95
|
+
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
129
96
|
* @param hostInst - 插件宿主的新实例
|
|
130
97
|
*/
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
for (const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
98
|
+
onCreate(t, ...e) {
|
|
99
|
+
const n = [];
|
|
100
|
+
for (const [i] of this.plugins)
|
|
101
|
+
i.onCreate && n.push(i.onCreate.bind(i));
|
|
102
|
+
return g(n, void 0, [t, ...e]);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 插件宿主创建实例时调用
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* 会调用每个插件的 {@link IPlugin.onCreate } 方法
|
|
109
|
+
* @param hostInst - 插件宿主的新实例
|
|
110
|
+
* @param args - 初始化宿主实例时的参数
|
|
111
|
+
*/
|
|
112
|
+
onInit(t, ...e) {
|
|
113
|
+
const n = [];
|
|
114
|
+
for (const [i] of this.plugins)
|
|
115
|
+
i.onInit && n.push(i.onInit.bind(i));
|
|
116
|
+
return g(n, void 0, [t, ...e]);
|
|
137
117
|
}
|
|
138
118
|
/**
|
|
139
119
|
* 插件宿主被销毁时调用
|
|
140
120
|
*
|
|
141
121
|
* @remarks
|
|
142
|
-
* 会调用每个插件的 {@link IPlugin.
|
|
122
|
+
* 会调用每个插件的 {@link IPlugin.onDestroy} 方法
|
|
143
123
|
* @param hostInst - 被销毁的插件实例
|
|
144
124
|
*/
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
for (const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
125
|
+
onDestroy(t) {
|
|
126
|
+
const e = [];
|
|
127
|
+
for (const [n] of this.plugins)
|
|
128
|
+
n.onDestroy && e.push(n.onDestroy.bind(n));
|
|
129
|
+
return e.reverse(), g(e, void 0, [t]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
class Q extends M {
|
|
133
|
+
/**
|
|
134
|
+
* 插件的宿主
|
|
135
|
+
*/
|
|
136
|
+
host;
|
|
137
|
+
/**
|
|
138
|
+
* 所有注册的插件
|
|
139
|
+
*/
|
|
140
|
+
plugins = /* @__PURE__ */ new Set();
|
|
141
|
+
/**
|
|
142
|
+
* @param host - 插件的宿主
|
|
143
|
+
*/
|
|
144
|
+
constructor(t) {
|
|
145
|
+
super(), t && (this.host = t);
|
|
146
|
+
}
|
|
147
|
+
destroyThis() {
|
|
148
|
+
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 使用插件、注册插件
|
|
152
|
+
* @param plugin - 插件
|
|
153
|
+
* @param args - 传递给插件的选项
|
|
154
|
+
*/
|
|
155
|
+
use(t) {
|
|
156
|
+
const { plugins: e } = this;
|
|
157
|
+
return e.has(t) ? !1 : (d(this.host.prototype, T(t)), e.add(t), !0);
|
|
151
158
|
}
|
|
152
159
|
/**
|
|
153
160
|
* 插件宿主实例的注册插件的方法
|
|
154
161
|
*
|
|
155
162
|
* @remarks
|
|
156
|
-
* 会调用每个插件的 {@link
|
|
163
|
+
* 会调用每个插件的 {@link IExtend.use } 方法
|
|
164
|
+
* @param hostInst - 插件宿主的新实例
|
|
165
|
+
*/
|
|
166
|
+
instUse(t, e, ...n) {
|
|
167
|
+
const { plugins: i } = this;
|
|
168
|
+
return i.has(e) ? !1 : (this.use(e), e.onCreate?.call(t, t, ...n), !0);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 插件宿主创建实例时调用
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* 会调用每个插件的 {@link IExtend.onCreate} 方法
|
|
175
|
+
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
176
|
+
* @param hostInst - 插件宿主的新实例
|
|
177
|
+
*/
|
|
178
|
+
onCreate(t, ...e) {
|
|
179
|
+
const n = [];
|
|
180
|
+
for (const i of this.plugins)
|
|
181
|
+
i.onCreate && n.push(i.onCreate);
|
|
182
|
+
return g(n, t, [t, ...e]);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 插件宿主创建实例时调用
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* 会调用每个插件的 {@link IExtend.onCreate } 方法
|
|
157
189
|
* @param hostInst - 插件宿主的新实例
|
|
190
|
+
* @param args - 初始化宿主实例时的参数
|
|
158
191
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
192
|
+
onInit(t, ...e) {
|
|
193
|
+
const n = [];
|
|
194
|
+
for (const i of this.plugins)
|
|
195
|
+
i.onInit && n.push(i.onInit);
|
|
196
|
+
return g(n, t, [t, ...e]);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 插件宿主被销毁时调用
|
|
200
|
+
*
|
|
201
|
+
* @remarks
|
|
202
|
+
* 会调用每个插件的 {@link IExtend.onDestroy} 方法
|
|
203
|
+
* @param hostInst - 被销毁的插件实例
|
|
204
|
+
*/
|
|
205
|
+
onDestroy(t) {
|
|
206
|
+
const e = [];
|
|
207
|
+
for (const n of this.plugins)
|
|
208
|
+
n.onDestroy && e.push(n.onDestroy);
|
|
209
|
+
return e.reverse(), g(e, t, [t]);
|
|
162
210
|
}
|
|
163
211
|
}
|
|
164
|
-
|
|
212
|
+
const O = /* @__PURE__ */ Symbol("extend");
|
|
213
|
+
class p extends M {
|
|
214
|
+
/**
|
|
215
|
+
* 插件的宿主
|
|
216
|
+
*/
|
|
217
|
+
host;
|
|
218
|
+
/**
|
|
219
|
+
* 所有注册的插件
|
|
220
|
+
*/
|
|
221
|
+
plugins = /* @__PURE__ */ new Map();
|
|
222
|
+
/**
|
|
223
|
+
* @param host - 插件的宿主
|
|
224
|
+
*/
|
|
225
|
+
constructor(t) {
|
|
226
|
+
super(), t && (this.host = t);
|
|
227
|
+
}
|
|
228
|
+
destroyThis() {
|
|
229
|
+
return this.plugins.clear(), this.host = null, super.destroyThis();
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 判断一个对象是否是插件
|
|
233
|
+
* @param target
|
|
234
|
+
* @returns
|
|
235
|
+
*/
|
|
236
|
+
isPlugin(t) {
|
|
237
|
+
const { plugins: e } = this;
|
|
238
|
+
return e.has(t) ? e.get(t) !== O : I(t);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 使用插件、注册插件
|
|
242
|
+
* @param ext - 插件
|
|
243
|
+
* @param args - 传递给插件的选项
|
|
244
|
+
*/
|
|
245
|
+
useExtend(t) {
|
|
246
|
+
const { plugins: e } = this;
|
|
247
|
+
return e.has(t) ? !1 : (d(this.host.prototype, T(t)), e.set(t, O), !0);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* 插件宿主实例的注册插件的方法
|
|
251
|
+
*
|
|
252
|
+
* @remarks
|
|
253
|
+
* 会调用每个插件的 {@link IExtend.use } 方法
|
|
254
|
+
* @param hostInst - 插件宿主的新实例
|
|
255
|
+
*/
|
|
256
|
+
instUseExtend(t, e, ...n) {
|
|
257
|
+
const { plugins: i } = this;
|
|
258
|
+
return i.has(e) ? !1 : (this.useExtend(e), e.onCreate?.call(t, t, ...n), !0);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* 使用插件、注册插件
|
|
262
|
+
* @param plugin - 插件
|
|
263
|
+
* @param args - 传递给插件的选项
|
|
264
|
+
*/
|
|
265
|
+
usePlugin(t, ...e) {
|
|
266
|
+
const { plugins: n } = this;
|
|
267
|
+
if (n.has(t)) return n.get(t);
|
|
268
|
+
const i = t.onUse(this.host, ...e);
|
|
269
|
+
return n.set(t, i), i;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 插件宿主实例的注册插件的方法
|
|
273
|
+
*
|
|
274
|
+
* @remarks
|
|
275
|
+
* 会调用每个插件的 {@link IPlugin.use } 方法
|
|
276
|
+
* @param hostInst - 插件宿主的新实例
|
|
277
|
+
*/
|
|
278
|
+
instUsePlugin(t, e, ...n) {
|
|
279
|
+
const { plugins: i } = this;
|
|
280
|
+
if (i.has(e)) return i.get(e);
|
|
281
|
+
const o = this.usePlugin(e, ...n);
|
|
282
|
+
return e.onCreate?.(t), o;
|
|
283
|
+
}
|
|
165
284
|
/**
|
|
166
285
|
* 插件宿主创建实例时调用
|
|
167
286
|
*
|
|
168
287
|
* @remarks
|
|
169
|
-
* 会调用每个插件的 {@link IPlugin.
|
|
288
|
+
* 会调用每个插件的 {@link IPlugin.onCreate} 方法
|
|
289
|
+
* 如果插件的 created 方法返回 Promise,则会等待 Promise resolve
|
|
170
290
|
* @param hostInst - 插件宿主的新实例
|
|
171
291
|
*/
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
for (const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
292
|
+
onCreate(t, ...e) {
|
|
293
|
+
const n = [];
|
|
294
|
+
for (const [i, o] of this.plugins)
|
|
295
|
+
if (i.onCreate) {
|
|
296
|
+
const r = o === O ? i.onCreate : i.onCreate.bind(i);
|
|
297
|
+
n.push(r);
|
|
298
|
+
}
|
|
299
|
+
return g(n, t, [t, ...e]);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* 插件宿主创建实例时调用
|
|
303
|
+
*
|
|
304
|
+
* @remarks
|
|
305
|
+
* 会调用每个插件的 {@link IPlugin.onCreate } 方法
|
|
306
|
+
* @param hostInst - 插件宿主的新实例
|
|
307
|
+
* @param args - 初始化宿主实例时的参数
|
|
308
|
+
*/
|
|
309
|
+
onInit(t, ...e) {
|
|
310
|
+
const n = [];
|
|
311
|
+
for (const [i, o] of this.plugins)
|
|
312
|
+
if (i.onInit) {
|
|
313
|
+
const r = o === O ? i.onInit : i.onInit.bind(i);
|
|
314
|
+
n.push(r);
|
|
315
|
+
}
|
|
316
|
+
return g(n, t, [t, ...e]);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* 插件宿主被销毁时调用
|
|
320
|
+
*
|
|
321
|
+
* @remarks
|
|
322
|
+
* 会调用每个插件的 {@link IPlugin.onDestroy} 方法
|
|
323
|
+
* @param hostInst - 被销毁的插件实例
|
|
324
|
+
*/
|
|
325
|
+
onDestroy(t) {
|
|
326
|
+
const e = [];
|
|
327
|
+
for (const [n, i] of this.plugins)
|
|
328
|
+
if (n.onDestroy) {
|
|
329
|
+
const o = i === O ? n.onDestroy : n.onDestroy.bind(n);
|
|
330
|
+
e.push(o);
|
|
331
|
+
}
|
|
332
|
+
return e.reverse(), g(e, t, [t]);
|
|
178
333
|
}
|
|
179
334
|
}
|
|
180
|
-
function X(
|
|
181
|
-
const e = t ?? "defaultOptions",
|
|
335
|
+
function X(s, t) {
|
|
336
|
+
const e = t ?? "defaultOptions", n = `_${e}`;
|
|
182
337
|
return function(o) {
|
|
183
|
-
const r =
|
|
338
|
+
const r = c(o, {
|
|
184
339
|
/**
|
|
185
340
|
* 全局级别的默认选项
|
|
186
341
|
*/
|
|
187
342
|
get [e]() {
|
|
188
|
-
return
|
|
343
|
+
return s;
|
|
189
344
|
}
|
|
190
345
|
});
|
|
191
|
-
|
|
346
|
+
c(r.prototype, {
|
|
192
347
|
/**
|
|
193
348
|
* 实例级的默认选项
|
|
194
349
|
*/
|
|
195
350
|
get [e]() {
|
|
196
|
-
return this[
|
|
351
|
+
return this[n] || (this[n] = structuredClone(r.defaultOptions));
|
|
197
352
|
}
|
|
198
353
|
});
|
|
199
354
|
};
|
|
200
355
|
}
|
|
201
|
-
function Y(
|
|
202
|
-
const
|
|
203
|
-
return
|
|
356
|
+
function Y(s, t, e) {
|
|
357
|
+
const n = `_${t}`;
|
|
358
|
+
return c(s.prototype, {
|
|
204
359
|
/**
|
|
205
360
|
* 实例级的默认选项
|
|
206
361
|
*/
|
|
207
362
|
get [t]() {
|
|
208
|
-
return this[
|
|
363
|
+
return this[n] || (this[n] = structuredClone(s[t]));
|
|
209
364
|
}
|
|
210
365
|
}), e;
|
|
211
366
|
}
|
|
212
|
-
function
|
|
213
|
-
const t =
|
|
367
|
+
function b(s) {
|
|
368
|
+
const t = s.split(".");
|
|
214
369
|
return t[0] === "" && t.shift(), t;
|
|
215
370
|
}
|
|
216
|
-
function
|
|
371
|
+
function y(s, t) {
|
|
217
372
|
for (const e of t)
|
|
218
|
-
if (
|
|
219
|
-
return
|
|
373
|
+
if (s = s[e], s == null) return;
|
|
374
|
+
return s;
|
|
220
375
|
}
|
|
221
|
-
function Z(
|
|
222
|
-
return
|
|
376
|
+
function Z(s, t) {
|
|
377
|
+
return y(s, b(t));
|
|
223
378
|
}
|
|
224
|
-
function
|
|
225
|
-
const
|
|
379
|
+
function E(s, t, e) {
|
|
380
|
+
const n = t.pop(), i = t.length;
|
|
226
381
|
let o = 0;
|
|
227
|
-
for (; o <
|
|
228
|
-
const r =
|
|
382
|
+
for (; o < i; ) {
|
|
383
|
+
const r = s[t[o]];
|
|
229
384
|
if (r == null) break;
|
|
230
|
-
|
|
385
|
+
s = r, o++;
|
|
231
386
|
}
|
|
232
387
|
t = t.slice(o);
|
|
233
388
|
for (const r of t)
|
|
234
|
-
|
|
235
|
-
return n
|
|
389
|
+
s = s[r] = {};
|
|
390
|
+
return s[n] = e, s;
|
|
236
391
|
}
|
|
237
|
-
function tt(
|
|
238
|
-
return
|
|
392
|
+
function tt(s, t, e) {
|
|
393
|
+
return E(s, b(t), e);
|
|
239
394
|
}
|
|
240
|
-
const
|
|
395
|
+
const x = {
|
|
241
396
|
UndefinedAndNull: function(t) {
|
|
242
397
|
return t == null;
|
|
243
398
|
},
|
|
@@ -263,13 +418,13 @@ class v {
|
|
|
263
418
|
*/
|
|
264
419
|
fullOption = new Proxy(this, {
|
|
265
420
|
// @ts-ignore
|
|
266
|
-
get: function(t, e,
|
|
267
|
-
const
|
|
268
|
-
return t.freezeMember ? Object.freeze(
|
|
421
|
+
get: function(t, e, n) {
|
|
422
|
+
const i = t.plainFullOption[e];
|
|
423
|
+
return t.freezeMember ? Object.freeze(i) : i;
|
|
269
424
|
},
|
|
270
425
|
// @ts-ignore
|
|
271
|
-
set: function(t, e,
|
|
272
|
-
return t.setMember(e,
|
|
426
|
+
set: function(t, e, n, i) {
|
|
427
|
+
return t.setMember(e, n, !1), !0;
|
|
273
428
|
},
|
|
274
429
|
// @ts-ignore
|
|
275
430
|
has: function(t, e) {
|
|
@@ -288,8 +443,8 @@ class v {
|
|
|
288
443
|
return t.setMember(e, void 0), !0;
|
|
289
444
|
},
|
|
290
445
|
// @ts-ignore
|
|
291
|
-
defineProperty: function(t, e,
|
|
292
|
-
return Object.defineProperty(t.option, e,
|
|
446
|
+
defineProperty: function(t, e, n) {
|
|
447
|
+
return Object.defineProperty(t.option, e, n), !0;
|
|
293
448
|
}
|
|
294
449
|
});
|
|
295
450
|
/**
|
|
@@ -300,8 +455,8 @@ class v {
|
|
|
300
455
|
* @param deep - 是否要进行深度合并
|
|
301
456
|
*/
|
|
302
457
|
setOption(t, e) {
|
|
303
|
-
const
|
|
304
|
-
return this.updateFullOption(),
|
|
458
|
+
const n = e ? P(this.option, t) : Object.assign(this.option, t);
|
|
459
|
+
return this.updateFullOption(), n;
|
|
305
460
|
}
|
|
306
461
|
/**
|
|
307
462
|
* 未定义值的类型
|
|
@@ -310,13 +465,13 @@ class v {
|
|
|
310
465
|
return this._undefinedValue;
|
|
311
466
|
}
|
|
312
467
|
set undefinedValue(t) {
|
|
313
|
-
this._undefinedValue = t, this.isUndefined =
|
|
468
|
+
this._undefinedValue = t, this.isUndefined = x[t] || x.UndefinedAndNull;
|
|
314
469
|
}
|
|
315
470
|
_undefinedValue = "UndefinedAndNull";
|
|
316
471
|
/**
|
|
317
472
|
* 未定义值的判断函数
|
|
318
473
|
*/
|
|
319
|
-
isUndefined =
|
|
474
|
+
isUndefined = x.UndefinedAndNull;
|
|
320
475
|
/**
|
|
321
476
|
* 获取选项成员
|
|
322
477
|
* @param key
|
|
@@ -331,13 +486,13 @@ class v {
|
|
|
331
486
|
* @param value
|
|
332
487
|
* @param deep - 是否要进行深度合并
|
|
333
488
|
*/
|
|
334
|
-
setMember(t, e,
|
|
335
|
-
const
|
|
489
|
+
setMember(t, e, n) {
|
|
490
|
+
const i = this.option;
|
|
336
491
|
if (e === void 0)
|
|
337
|
-
delete
|
|
492
|
+
delete i[t];
|
|
338
493
|
else {
|
|
339
|
-
const o =
|
|
340
|
-
|
|
494
|
+
const o = i[t];
|
|
495
|
+
n && o && typeof o == "object" ? P(o, e) : i[t] = e;
|
|
341
496
|
}
|
|
342
497
|
this.updateFullOption();
|
|
343
498
|
}
|
|
@@ -347,7 +502,7 @@ class v {
|
|
|
347
502
|
* @returns
|
|
348
503
|
*/
|
|
349
504
|
getValue(t) {
|
|
350
|
-
return
|
|
505
|
+
return y(this.option, t);
|
|
351
506
|
}
|
|
352
507
|
/**
|
|
353
508
|
* 设置属性路径对应的值
|
|
@@ -356,13 +511,13 @@ class v {
|
|
|
356
511
|
* @param deep - 是否要进行深度合并
|
|
357
512
|
* @returns
|
|
358
513
|
*/
|
|
359
|
-
setValue(t, e,
|
|
360
|
-
const
|
|
514
|
+
setValue(t, e, n) {
|
|
515
|
+
const i = this.option;
|
|
361
516
|
let o;
|
|
362
|
-
|
|
517
|
+
n && (o = y(i, t)) && typeof o == "object" ? P(o, e) : E(this.option, t, e), this.updateFullOption();
|
|
363
518
|
}
|
|
364
519
|
}
|
|
365
|
-
class
|
|
520
|
+
class u extends v {
|
|
366
521
|
constructor(t, e) {
|
|
367
522
|
super(), t && (this.option = t), e && (this.extends = e);
|
|
368
523
|
}
|
|
@@ -388,10 +543,10 @@ class p extends v {
|
|
|
388
543
|
get plainFullOption() {
|
|
389
544
|
let t = this._plainFullOption;
|
|
390
545
|
if (t) return t;
|
|
391
|
-
const { extends: e, option:
|
|
392
|
-
if (t =
|
|
393
|
-
const
|
|
394
|
-
t = w(
|
|
546
|
+
const { extends: e, option: n } = this;
|
|
547
|
+
if (t = n, e) {
|
|
548
|
+
const i = e.plainFullOption;
|
|
549
|
+
t = w(i, n);
|
|
395
550
|
}
|
|
396
551
|
return this._plainFullOption = t;
|
|
397
552
|
}
|
|
@@ -410,9 +565,9 @@ class p extends v {
|
|
|
410
565
|
getMember(t) {
|
|
411
566
|
const e = this.option[t];
|
|
412
567
|
if (!this.isUndefined(e)) return e;
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
return
|
|
568
|
+
const n = this.extends;
|
|
569
|
+
if (n)
|
|
570
|
+
return n.getMember(t);
|
|
416
571
|
}
|
|
417
572
|
/**
|
|
418
573
|
* 获取属性路径对应的值
|
|
@@ -422,20 +577,20 @@ class p extends v {
|
|
|
422
577
|
getValue(t) {
|
|
423
578
|
const e = super.getValue(t);
|
|
424
579
|
if (!this.isUndefined(e)) return e;
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
427
|
-
return
|
|
580
|
+
const n = this.extends;
|
|
581
|
+
if (n)
|
|
582
|
+
return n.getValue(t);
|
|
428
583
|
}
|
|
429
584
|
}
|
|
430
|
-
function et(
|
|
431
|
-
const { name: e } = t,
|
|
585
|
+
function et(s, t) {
|
|
586
|
+
const { name: e } = t, n = `_${e}`;
|
|
432
587
|
return {
|
|
433
588
|
get: function() {
|
|
434
|
-
return this[
|
|
589
|
+
return this[n] || (this[n] = new u(void 0, this.constructor[e]));
|
|
435
590
|
}
|
|
436
591
|
};
|
|
437
592
|
}
|
|
438
|
-
class
|
|
593
|
+
class S extends v {
|
|
439
594
|
constructor(t, e) {
|
|
440
595
|
super(), e && this.setModeOption(t, e), this.mode = t;
|
|
441
596
|
}
|
|
@@ -524,18 +679,18 @@ class E extends v {
|
|
|
524
679
|
* @param deep - 是否要进行深度合并
|
|
525
680
|
* @param extend - 继承哪个模式
|
|
526
681
|
*/
|
|
527
|
-
setModeOption(t, e,
|
|
528
|
-
const { modes: o } = this, r = o[t] || (o[t] = new
|
|
529
|
-
if (r.setOption(e,
|
|
530
|
-
const
|
|
531
|
-
|
|
682
|
+
setModeOption(t, e, n, i) {
|
|
683
|
+
const { modes: o } = this, r = o[t] || (o[t] = new u());
|
|
684
|
+
if (r.setOption(e, n), i) {
|
|
685
|
+
const l = o[i];
|
|
686
|
+
l && (r.extends = l);
|
|
532
687
|
}
|
|
533
688
|
return this.updateFullOption(), r;
|
|
534
689
|
}
|
|
535
690
|
}
|
|
536
|
-
class
|
|
537
|
-
constructor(t, e,
|
|
538
|
-
super(t, e),
|
|
691
|
+
class a extends S {
|
|
692
|
+
constructor(t, e, n) {
|
|
693
|
+
super(t, e), n && (this.extends = n);
|
|
539
694
|
}
|
|
540
695
|
/**
|
|
541
696
|
* 继承的选项
|
|
@@ -555,22 +710,22 @@ class c extends E {
|
|
|
555
710
|
* @returns
|
|
556
711
|
*/
|
|
557
712
|
getFullModeOption(t) {
|
|
558
|
-
const { modes: e, extends:
|
|
559
|
-
if (
|
|
560
|
-
const o =
|
|
561
|
-
return
|
|
713
|
+
const { modes: e, extends: n } = this, i = e[t]?.plainFullOption;
|
|
714
|
+
if (n) {
|
|
715
|
+
const o = n.getFullModeOption(t);
|
|
716
|
+
return i ? w(o, i) : o;
|
|
562
717
|
}
|
|
563
|
-
return
|
|
718
|
+
return i;
|
|
564
719
|
}
|
|
565
720
|
/**
|
|
566
721
|
* 获取所有的模式名字
|
|
567
722
|
* @returns
|
|
568
723
|
*/
|
|
569
724
|
getModeNames() {
|
|
570
|
-
const { modes: t, extends: e } = this,
|
|
571
|
-
if (!e) return
|
|
572
|
-
const
|
|
573
|
-
return [.../* @__PURE__ */ new Set([...
|
|
725
|
+
const { modes: t, extends: e } = this, n = Object.keys(t);
|
|
726
|
+
if (!e) return n;
|
|
727
|
+
const i = e.getModeNames();
|
|
728
|
+
return [.../* @__PURE__ */ new Set([...n, ...i])];
|
|
574
729
|
}
|
|
575
730
|
/**
|
|
576
731
|
* 在整个层级上判断是否有某个模式
|
|
@@ -605,9 +760,9 @@ class c extends E {
|
|
|
605
760
|
getMember(t) {
|
|
606
761
|
const e = this.optionManager.getMember(t);
|
|
607
762
|
if (!this.isUndefined(e)) return e;
|
|
608
|
-
const
|
|
609
|
-
if (
|
|
610
|
-
return
|
|
763
|
+
const n = this.extends;
|
|
764
|
+
if (n)
|
|
765
|
+
return n.getMember(t);
|
|
611
766
|
}
|
|
612
767
|
/**
|
|
613
768
|
* 获取属性路径对应的值
|
|
@@ -617,28 +772,32 @@ class c extends E {
|
|
|
617
772
|
getValue(t) {
|
|
618
773
|
const e = this.optionManager.getValue(t);
|
|
619
774
|
if (!this.isUndefined(e)) return e;
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
return
|
|
775
|
+
const n = this.extends;
|
|
776
|
+
if (n)
|
|
777
|
+
return n.getValue(t);
|
|
623
778
|
}
|
|
624
779
|
}
|
|
625
|
-
function nt(
|
|
626
|
-
const { name: e } = t,
|
|
780
|
+
function nt(s, t) {
|
|
781
|
+
const { name: e } = t, n = `_${e}`;
|
|
627
782
|
return {
|
|
628
783
|
get: function() {
|
|
629
|
-
return this[
|
|
784
|
+
return this[n] || (this[n] = new a(this.constructor[e].mode, void 0, this.constructor[e]));
|
|
630
785
|
}
|
|
631
786
|
};
|
|
632
787
|
}
|
|
633
|
-
class
|
|
788
|
+
class F extends M {
|
|
789
|
+
/**
|
|
790
|
+
* 是否使用独立的插件管理器
|
|
791
|
+
* @defaultValue false
|
|
792
|
+
*/
|
|
793
|
+
static isolatedPluginManager = !1;
|
|
634
794
|
/**
|
|
635
795
|
* 插件管理器
|
|
636
796
|
*/
|
|
637
797
|
static get pluginManager() {
|
|
638
|
-
|
|
639
|
-
return t || (t = this._pluginManager = new g(this)), t;
|
|
798
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new p(this)), this._pluginManager;
|
|
640
799
|
}
|
|
641
|
-
static _pluginManager;
|
|
800
|
+
static _pluginManager = new p(this);
|
|
642
801
|
/**
|
|
643
802
|
* 插件管理器 {@link PluginHost.pluginManager}
|
|
644
803
|
*/
|
|
@@ -646,100 +805,316 @@ class N extends V {
|
|
|
646
805
|
return this.constructor.pluginManager;
|
|
647
806
|
}
|
|
648
807
|
/**
|
|
649
|
-
* {@inheritDoc
|
|
808
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
809
|
+
*/
|
|
810
|
+
static usePlugin(t, ...e) {
|
|
811
|
+
return this.pluginManager.usePlugin(t, ...e);
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
650
815
|
*/
|
|
651
|
-
static
|
|
652
|
-
return this.pluginManager.
|
|
816
|
+
static useExtend(t) {
|
|
817
|
+
return this.pluginManager.useExtend(t);
|
|
653
818
|
}
|
|
654
819
|
/**
|
|
655
820
|
* 需要在子类中调用
|
|
656
821
|
*
|
|
657
|
-
* 之所以没写在该类中的函数中,是因为 `this.pluginManager.
|
|
658
|
-
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.
|
|
822
|
+
* 之所以没写在该类中的函数中,是因为 `this.pluginManager.onCreate(this,...args)` 通常会在构建函数执行的最后时才调用;
|
|
823
|
+
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.onCreate(this,...args)` 不是在最后的执行;
|
|
659
824
|
*/
|
|
660
|
-
// constructor() {
|
|
661
|
-
//
|
|
825
|
+
// constructor(...args:any) {
|
|
826
|
+
// super();
|
|
827
|
+
// // @ts-ignore
|
|
828
|
+
// this.pluginManager.onCreate(this,...args);
|
|
662
829
|
// }
|
|
663
830
|
/**
|
|
664
831
|
* 实例的注册插件的方法
|
|
665
832
|
* @param plugin
|
|
666
|
-
* @param
|
|
833
|
+
* @param args
|
|
667
834
|
* @returns
|
|
668
835
|
*/
|
|
669
|
-
|
|
670
|
-
return this.pluginManager.
|
|
836
|
+
usePlugin(t, ...e) {
|
|
837
|
+
return this.pluginManager.instUsePlugin(this, t, ...e);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
841
|
+
*/
|
|
842
|
+
useExtend(t, ...e) {
|
|
843
|
+
return this.pluginManager.instUseExtend(this, t, ...e);
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* 初始化实例
|
|
847
|
+
* @remarks
|
|
848
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
849
|
+
* @param args
|
|
850
|
+
*/
|
|
851
|
+
init(...t) {
|
|
852
|
+
return this.pluginManager.onInit(this, ...t);
|
|
671
853
|
}
|
|
672
854
|
/**
|
|
673
855
|
* 销毁实例
|
|
674
856
|
* @returns
|
|
675
857
|
*/
|
|
676
858
|
destroyThis() {
|
|
677
|
-
|
|
859
|
+
const t = this.pluginManager.onDestroy(this);
|
|
860
|
+
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
678
861
|
}
|
|
679
862
|
}
|
|
680
|
-
|
|
681
|
-
|
|
863
|
+
class U extends N {
|
|
864
|
+
/**
|
|
865
|
+
* 是否使用独立的插件管理器
|
|
866
|
+
* @defaultValue false
|
|
867
|
+
*/
|
|
868
|
+
static isolatedPluginManager = !1;
|
|
869
|
+
/**
|
|
870
|
+
* 插件管理器
|
|
871
|
+
*/
|
|
872
|
+
static get pluginManager() {
|
|
873
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new p(this)), this._pluginManager;
|
|
874
|
+
}
|
|
875
|
+
static _pluginManager = new p(this);
|
|
876
|
+
/**
|
|
877
|
+
* 插件管理器 {@link PluginHost.pluginManager}
|
|
878
|
+
*/
|
|
879
|
+
get pluginManager() {
|
|
880
|
+
return this.constructor.pluginManager;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
884
|
+
*/
|
|
885
|
+
static usePlugin(t, ...e) {
|
|
886
|
+
return this.pluginManager.usePlugin(t, ...e);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
890
|
+
*/
|
|
891
|
+
static useExtend(t) {
|
|
892
|
+
return this.pluginManager.useExtend(t);
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* 需要在子类中调用
|
|
896
|
+
*
|
|
897
|
+
* 之所以没写在该类中的函数中,是因为 `this.pluginManager.onCreate(this,...args)` 通常会在构建函数执行的最后时才调用;
|
|
898
|
+
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.onCreate(this,...args)` 不是在最后的执行;
|
|
899
|
+
*/
|
|
900
|
+
// constructor(...args:any) {
|
|
901
|
+
// super();
|
|
902
|
+
// // @ts-ignore
|
|
903
|
+
// this.pluginManager.onCreate(this,...args);
|
|
904
|
+
// }
|
|
905
|
+
/**
|
|
906
|
+
* 实例的注册插件的方法
|
|
907
|
+
* @param plugin
|
|
908
|
+
* @param args
|
|
909
|
+
* @returns
|
|
910
|
+
*/
|
|
911
|
+
usePlugin(t, ...e) {
|
|
912
|
+
return this.pluginManager.instUsePlugin(this, t, ...e);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
916
|
+
*/
|
|
917
|
+
useExtend(t, ...e) {
|
|
918
|
+
return this.pluginManager.instUseExtend(this, t, ...e);
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* 初始化实例
|
|
922
|
+
* @remarks
|
|
923
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
924
|
+
* @param args
|
|
925
|
+
*/
|
|
926
|
+
init(...t) {
|
|
927
|
+
return this.pluginManager.onInit(this, ...t);
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* 销毁实例
|
|
931
|
+
* @returns
|
|
932
|
+
*/
|
|
933
|
+
destroyThis() {
|
|
934
|
+
const t = this.pluginManager.onDestroy(this);
|
|
935
|
+
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
class D extends H {
|
|
939
|
+
/**
|
|
940
|
+
* 是否使用独立的插件管理器
|
|
941
|
+
* @defaultValue false
|
|
942
|
+
*/
|
|
943
|
+
static isolatedPluginManager = !1;
|
|
944
|
+
/**
|
|
945
|
+
* 插件管理器
|
|
946
|
+
*/
|
|
947
|
+
static get pluginManager() {
|
|
948
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new p(this)), this._pluginManager;
|
|
949
|
+
}
|
|
950
|
+
static _pluginManager = new p(this);
|
|
951
|
+
/**
|
|
952
|
+
* 插件管理器 {@link PluginHost.pluginManager}
|
|
953
|
+
*/
|
|
954
|
+
get pluginManager() {
|
|
955
|
+
return this.constructor.pluginManager;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
959
|
+
*/
|
|
960
|
+
static usePlugin(t, ...e) {
|
|
961
|
+
return this.pluginManager.usePlugin(t, ...e);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
965
|
+
*/
|
|
966
|
+
static useExtend(t) {
|
|
967
|
+
return this.pluginManager.useExtend(t);
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* 需要在子类中调用
|
|
971
|
+
*
|
|
972
|
+
* 之所以没写在该类中的函数中,是因为 `this.pluginManager.onCreate(this,...args)` 通常会在构建函数执行的最后时才调用;
|
|
973
|
+
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.onCreate(this,...args)` 不是在最后的执行;
|
|
974
|
+
*/
|
|
975
|
+
// constructor(...args:any) {
|
|
976
|
+
// super();
|
|
977
|
+
// // @ts-ignore
|
|
978
|
+
// this.pluginManager.onCreate(this,...args);
|
|
979
|
+
// }
|
|
980
|
+
/**
|
|
981
|
+
* 实例的注册插件的方法
|
|
982
|
+
* @param plugin
|
|
983
|
+
* @param args
|
|
984
|
+
* @returns
|
|
985
|
+
*/
|
|
986
|
+
usePlugin(t, ...e) {
|
|
987
|
+
return this.pluginManager.instUsePlugin(this, t, ...e);
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
991
|
+
*/
|
|
992
|
+
useExtend(t, ...e) {
|
|
993
|
+
return this.pluginManager.instUseExtend(this, t, ...e);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* 初始化实例
|
|
997
|
+
* @remarks
|
|
998
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
999
|
+
* @param args
|
|
1000
|
+
*/
|
|
1001
|
+
init(...t) {
|
|
1002
|
+
return this.pluginManager.onInit(this, ...t);
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* 销毁实例
|
|
1006
|
+
* @returns
|
|
1007
|
+
*/
|
|
1008
|
+
destroyThis() {
|
|
1009
|
+
const t = this.pluginManager.onDestroy(this);
|
|
1010
|
+
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
function C(s) {
|
|
1014
|
+
const t = V(s);
|
|
682
1015
|
return class extends t {
|
|
683
1016
|
/**
|
|
684
|
-
*
|
|
1017
|
+
* 是否使用独立的插件管理器
|
|
1018
|
+
* @defaultValue false
|
|
1019
|
+
*/
|
|
1020
|
+
static isolatedPluginManager = !1;
|
|
1021
|
+
/**
|
|
1022
|
+
* 插件管理器
|
|
685
1023
|
*/
|
|
686
1024
|
static get pluginManager() {
|
|
687
|
-
|
|
688
|
-
return i || (i = this._pluginManager = new g(this)), i;
|
|
1025
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new p(this)), this._pluginManager;
|
|
689
1026
|
}
|
|
690
|
-
static _pluginManager;
|
|
1027
|
+
static _pluginManager = new p(this);
|
|
691
1028
|
/**
|
|
692
|
-
*
|
|
1029
|
+
* 插件管理器 {@link PluginHostSub.pluginManager}
|
|
693
1030
|
*/
|
|
694
1031
|
get pluginManager() {
|
|
695
1032
|
return this.constructor.pluginManager;
|
|
696
1033
|
}
|
|
697
1034
|
/**
|
|
698
|
-
* {@inheritDoc
|
|
1035
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
1036
|
+
*/
|
|
1037
|
+
static usePlugin(n, ...i) {
|
|
1038
|
+
return this.pluginManager.usePlugin(n, ...i);
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
699
1042
|
*/
|
|
700
|
-
static
|
|
701
|
-
return this.pluginManager.
|
|
1043
|
+
static useExtend(n) {
|
|
1044
|
+
return this.pluginManager.useExtend(n);
|
|
702
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* 需要在子类中调用
|
|
1048
|
+
*
|
|
1049
|
+
* 之所以没写在该类中的函数中,是因为 `this.pluginManager.onCreate(this)` 通常会在构建函数执行的最后时才调用;
|
|
1050
|
+
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.onCreate(this)` 不是在最后的执行;
|
|
1051
|
+
*/
|
|
703
1052
|
// constructor() {
|
|
704
|
-
//
|
|
1053
|
+
// super();
|
|
1054
|
+
// this.pluginManager.onCreate(this);
|
|
705
1055
|
// }
|
|
706
|
-
/**
|
|
707
1056
|
/**
|
|
708
1057
|
* 实例的注册插件的方法
|
|
709
1058
|
* @param plugin
|
|
710
|
-
* @param
|
|
1059
|
+
* @param args
|
|
711
1060
|
* @returns
|
|
712
1061
|
*/
|
|
713
|
-
|
|
714
|
-
return this.pluginManager.
|
|
1062
|
+
usePlugin(n, ...i) {
|
|
1063
|
+
return this.pluginManager.instUsePlugin(this, n, ...i);
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
1067
|
+
*/
|
|
1068
|
+
useExtend(n, ...i) {
|
|
1069
|
+
return this.pluginManager.instUseExtend(this, n, ...i);
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* 初始化实例
|
|
1073
|
+
* @remarks
|
|
1074
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
1075
|
+
* @param args
|
|
1076
|
+
*/
|
|
1077
|
+
init(...n) {
|
|
1078
|
+
return this.pluginManager.onInit(this, ...n);
|
|
715
1079
|
}
|
|
716
1080
|
/**
|
|
717
1081
|
* 销毁实例
|
|
718
1082
|
* @returns
|
|
719
1083
|
*/
|
|
720
1084
|
destroyThis() {
|
|
721
|
-
|
|
1085
|
+
const n = this.pluginManager.onDestroy(this);
|
|
1086
|
+
return n instanceof Promise ? n.finally(() => super.destroyThis()) : super.destroyThis();
|
|
722
1087
|
}
|
|
723
1088
|
};
|
|
724
1089
|
}
|
|
725
|
-
function
|
|
726
|
-
const t =
|
|
1090
|
+
function j(s) {
|
|
1091
|
+
const t = c(s, {
|
|
1092
|
+
/**
|
|
1093
|
+
* 是否使用独立的插件管理器
|
|
1094
|
+
* @defaultValue false
|
|
1095
|
+
*/
|
|
1096
|
+
isolatedPluginManager: !1,
|
|
727
1097
|
/**
|
|
728
1098
|
* PluginHost 的插件管理器
|
|
729
1099
|
*/
|
|
730
1100
|
get pluginManager() {
|
|
731
|
-
|
|
732
|
-
return e || (e = this._pluginManager = new g(this)), e;
|
|
1101
|
+
return (!this._pluginManager || this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager")) && (this._pluginManager = new p(this)), this._pluginManager;
|
|
733
1102
|
},
|
|
734
1103
|
// _pluginManager: PluginManager<HOST,Plugin>;
|
|
735
1104
|
/**
|
|
736
|
-
* {@inheritDoc
|
|
1105
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
737
1106
|
*/
|
|
738
|
-
|
|
739
|
-
return this.pluginManager.
|
|
1107
|
+
usePlugin(e, ...n) {
|
|
1108
|
+
return this.pluginManager.usePlugin(e, ...n);
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
1112
|
+
*/
|
|
1113
|
+
useExtend(e) {
|
|
1114
|
+
return this.pluginManager.useExtend(e);
|
|
740
1115
|
}
|
|
741
1116
|
});
|
|
742
|
-
return
|
|
1117
|
+
return c(t.prototype, {
|
|
743
1118
|
/**
|
|
744
1119
|
* 插件管理器
|
|
745
1120
|
*/
|
|
@@ -752,132 +1127,242 @@ function D(n) {
|
|
|
752
1127
|
* @param options
|
|
753
1128
|
* @returns
|
|
754
1129
|
*/
|
|
755
|
-
|
|
756
|
-
return this.pluginManager.
|
|
1130
|
+
usePlugin(e, ...n) {
|
|
1131
|
+
return this.pluginManager.instUsePlugin(this, e, ...n);
|
|
1132
|
+
},
|
|
1133
|
+
/**
|
|
1134
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
1135
|
+
*/
|
|
1136
|
+
useExtend(e, ...n) {
|
|
1137
|
+
return this.pluginManager.instUseExtend(this, e, ...n);
|
|
1138
|
+
},
|
|
1139
|
+
/**
|
|
1140
|
+
* 初始化实例
|
|
1141
|
+
* @param args
|
|
1142
|
+
*/
|
|
1143
|
+
async init(...e) {
|
|
1144
|
+
return super.init && await super.init(...e), this.pluginManager.onInit(this, ...e);
|
|
757
1145
|
},
|
|
758
1146
|
/**
|
|
759
1147
|
* 销毁实例
|
|
760
1148
|
* @returns
|
|
761
1149
|
*/
|
|
762
|
-
destroy() {
|
|
763
|
-
|
|
1150
|
+
async destroy() {
|
|
1151
|
+
if (await this.pluginManager.onDestroy(this), super.destroy) return super.destroy();
|
|
764
1152
|
}
|
|
765
|
-
}),
|
|
1153
|
+
}), s;
|
|
766
1154
|
}
|
|
767
|
-
function
|
|
768
|
-
const t =
|
|
769
|
-
return new Proxy(
|
|
770
|
-
construct: function(e,
|
|
771
|
-
const o = new e(...
|
|
772
|
-
return t.pluginManager.
|
|
1155
|
+
function it(s) {
|
|
1156
|
+
const t = j(s);
|
|
1157
|
+
return new Proxy(t, {
|
|
1158
|
+
construct: function(e, n, i) {
|
|
1159
|
+
const o = new e(...n);
|
|
1160
|
+
return t.pluginManager.onCreate(this, ...n), o;
|
|
773
1161
|
}
|
|
774
1162
|
});
|
|
775
1163
|
}
|
|
776
|
-
function rt(
|
|
777
|
-
return class extends
|
|
1164
|
+
function rt(s) {
|
|
1165
|
+
return class extends s {
|
|
1166
|
+
/**
|
|
1167
|
+
* 是否使用独立的插件管理器
|
|
1168
|
+
* @defaultValue false
|
|
1169
|
+
*/
|
|
1170
|
+
static isolatedPluginManager = !1;
|
|
778
1171
|
/**
|
|
779
1172
|
* 插件管理器
|
|
780
1173
|
*/
|
|
781
1174
|
static get pluginManager() {
|
|
782
|
-
|
|
783
|
-
return e || (e = this._pluginManager = new g(this)), e;
|
|
1175
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new p(this)), this._pluginManager;
|
|
784
1176
|
}
|
|
785
|
-
static _pluginManager;
|
|
1177
|
+
static _pluginManager = new p(this);
|
|
786
1178
|
/**
|
|
787
|
-
* 插件管理器 {@link
|
|
1179
|
+
* 插件管理器 {@link PluginHostExtends.pluginManager}
|
|
788
1180
|
*/
|
|
789
1181
|
get pluginManager() {
|
|
790
1182
|
return this.constructor.pluginManager;
|
|
791
1183
|
}
|
|
792
1184
|
/**
|
|
793
|
-
* {@inheritDoc
|
|
1185
|
+
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
794
1186
|
*/
|
|
795
|
-
static
|
|
796
|
-
return this.pluginManager.
|
|
1187
|
+
static usePlugin(e, ...n) {
|
|
1188
|
+
return this.pluginManager.usePlugin(e, ...n);
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
1192
|
+
*/
|
|
1193
|
+
static useExtend(e) {
|
|
1194
|
+
return this.pluginManager.useExtend(e);
|
|
797
1195
|
}
|
|
798
1196
|
constructor(...e) {
|
|
799
|
-
super(...e), this.pluginManager.
|
|
1197
|
+
super(...e), this.pluginManager.onCreate(this, ...e);
|
|
800
1198
|
}
|
|
801
1199
|
/**
|
|
802
1200
|
* 实例的注册插件的方法
|
|
803
1201
|
* @param plugin
|
|
804
|
-
* @param
|
|
1202
|
+
* @param args
|
|
805
1203
|
* @returns
|
|
806
1204
|
*/
|
|
807
|
-
|
|
808
|
-
return this.pluginManager.
|
|
1205
|
+
usePlugin(e, ...n) {
|
|
1206
|
+
return this.pluginManager.instUsePlugin(this, e, ...n);
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* {@inheritDoc PluginExtendManager.useExtend}
|
|
1210
|
+
*/
|
|
1211
|
+
useExtend(e, ...n) {
|
|
1212
|
+
return this.pluginManager.instUseExtend(this, e, ...n);
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* 初始化实例
|
|
1216
|
+
* @remarks
|
|
1217
|
+
* 会调用 {@link PluginExtendManager.onInit}
|
|
1218
|
+
* @param args
|
|
1219
|
+
*/
|
|
1220
|
+
init(...e) {
|
|
1221
|
+
if (super.init) {
|
|
1222
|
+
const n = super.init(...e);
|
|
1223
|
+
if (n instanceof Promise)
|
|
1224
|
+
return n.then(() => this.pluginManager.onInit(this, ...e));
|
|
1225
|
+
}
|
|
1226
|
+
return this.pluginManager.onInit(this, ...e);
|
|
809
1227
|
}
|
|
810
1228
|
/**
|
|
811
1229
|
* 销毁实例
|
|
812
1230
|
* @returns
|
|
813
1231
|
*/
|
|
814
1232
|
destroy() {
|
|
815
|
-
|
|
1233
|
+
const e = this.pluginManager.onDestroy(this);
|
|
1234
|
+
return super.destroy ? e instanceof Promise ? e.finally(() => super.destroy()) : super.destroy() : e;
|
|
816
1235
|
}
|
|
817
1236
|
};
|
|
818
1237
|
}
|
|
819
|
-
class ut extends
|
|
1238
|
+
class ut extends F {
|
|
1239
|
+
/**
|
|
1240
|
+
* 全局级别的默认选项
|
|
1241
|
+
*/
|
|
1242
|
+
static defaultOptions = new u();
|
|
1243
|
+
/**
|
|
1244
|
+
* 实例级的默认选项
|
|
1245
|
+
*/
|
|
1246
|
+
get defaultOptions() {
|
|
1247
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1248
|
+
}
|
|
1249
|
+
_defaultOptions;
|
|
1250
|
+
constructor(t) {
|
|
1251
|
+
super(), this.defaultOptions.option = t;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
class at extends U {
|
|
820
1255
|
/**
|
|
821
1256
|
* 全局级别的默认选项
|
|
822
1257
|
*/
|
|
823
|
-
static defaultOptions = new
|
|
1258
|
+
static defaultOptions = new u();
|
|
824
1259
|
/**
|
|
825
1260
|
* 实例级的默认选项
|
|
826
1261
|
*/
|
|
827
1262
|
get defaultOptions() {
|
|
828
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1263
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
829
1264
|
}
|
|
830
1265
|
_defaultOptions;
|
|
831
1266
|
constructor(t) {
|
|
832
1267
|
super(), this.defaultOptions.option = t;
|
|
833
1268
|
}
|
|
834
1269
|
}
|
|
835
|
-
|
|
836
|
-
|
|
1270
|
+
class lt extends D {
|
|
1271
|
+
/**
|
|
1272
|
+
* 全局级别的默认选项
|
|
1273
|
+
*/
|
|
1274
|
+
static defaultOptions = new u();
|
|
1275
|
+
/**
|
|
1276
|
+
* 实例级的默认选项
|
|
1277
|
+
*/
|
|
1278
|
+
get defaultOptions() {
|
|
1279
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1280
|
+
}
|
|
1281
|
+
_defaultOptions;
|
|
1282
|
+
constructor(t) {
|
|
1283
|
+
super(), this.defaultOptions.option = t;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
function dt(s) {
|
|
1287
|
+
const t = C(s);
|
|
837
1288
|
return class extends t {
|
|
838
1289
|
/**
|
|
839
1290
|
* 全局级别的默认选项
|
|
840
1291
|
*/
|
|
841
|
-
static defaultOptions = new
|
|
1292
|
+
static defaultOptions = new u();
|
|
842
1293
|
/**
|
|
843
1294
|
* 实例级的默认选项
|
|
844
1295
|
*/
|
|
845
1296
|
get defaultOptions() {
|
|
846
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
1297
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
847
1298
|
}
|
|
848
1299
|
_defaultOptions;
|
|
849
|
-
constructor(
|
|
850
|
-
super(), this.defaultOptions.option =
|
|
1300
|
+
constructor(n) {
|
|
1301
|
+
super(), this.defaultOptions.option = n;
|
|
851
1302
|
}
|
|
852
1303
|
};
|
|
853
1304
|
}
|
|
854
|
-
function ct(n, t) {
|
|
855
|
-
const e = a(n, {
|
|
856
|
-
/**
|
|
857
|
-
* 全局级别的默认选项
|
|
858
|
-
*/
|
|
859
|
-
defaultOptions: new p(t)
|
|
860
|
-
});
|
|
861
|
-
return a(e.prototype, {
|
|
862
|
-
/**
|
|
863
|
-
* 实例级的默认选项
|
|
864
|
-
*/
|
|
865
|
-
get defaultOptions() {
|
|
866
|
-
return this._defaultOptions || (this._defaultOptions = new p(void 0, this.constructor.defaultOptions));
|
|
867
|
-
}
|
|
868
|
-
}), n;
|
|
869
|
-
}
|
|
870
1305
|
const h = "common";
|
|
871
|
-
class
|
|
1306
|
+
class gt extends F {
|
|
1307
|
+
/**
|
|
1308
|
+
* 全局级别的默认选项
|
|
1309
|
+
*/
|
|
1310
|
+
static modeOptions = new a(h);
|
|
1311
|
+
/**
|
|
1312
|
+
* 实例级的默认选项
|
|
1313
|
+
*/
|
|
1314
|
+
get modeOptions() {
|
|
1315
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1316
|
+
}
|
|
1317
|
+
_modeOptions;
|
|
1318
|
+
get mode() {
|
|
1319
|
+
return this.modeOptions.mode;
|
|
1320
|
+
}
|
|
1321
|
+
set mode(t) {
|
|
1322
|
+
this.modeOptions.mode = t;
|
|
1323
|
+
}
|
|
1324
|
+
get options() {
|
|
1325
|
+
return this.modeOptions.plainFullOption;
|
|
1326
|
+
}
|
|
1327
|
+
constructor(t) {
|
|
1328
|
+
super(), this.modeOptions.setOption(t);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
class ct extends U {
|
|
1332
|
+
/**
|
|
1333
|
+
* 全局级别的默认选项
|
|
1334
|
+
*/
|
|
1335
|
+
static modeOptions = new a(h);
|
|
1336
|
+
/**
|
|
1337
|
+
* 实例级的默认选项
|
|
1338
|
+
*/
|
|
1339
|
+
get modeOptions() {
|
|
1340
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
1341
|
+
}
|
|
1342
|
+
_modeOptions;
|
|
1343
|
+
get mode() {
|
|
1344
|
+
return this.modeOptions.mode;
|
|
1345
|
+
}
|
|
1346
|
+
set mode(t) {
|
|
1347
|
+
this.modeOptions.mode = t;
|
|
1348
|
+
}
|
|
1349
|
+
get options() {
|
|
1350
|
+
return this.modeOptions.plainFullOption;
|
|
1351
|
+
}
|
|
1352
|
+
constructor(t) {
|
|
1353
|
+
super(), this.modeOptions.setOption(t);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
class ht extends D {
|
|
872
1357
|
/**
|
|
873
1358
|
* 全局级别的默认选项
|
|
874
1359
|
*/
|
|
875
|
-
static modeOptions = new
|
|
1360
|
+
static modeOptions = new a(h);
|
|
876
1361
|
/**
|
|
877
1362
|
* 实例级的默认选项
|
|
878
1363
|
*/
|
|
879
1364
|
get modeOptions() {
|
|
880
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1365
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
881
1366
|
}
|
|
882
1367
|
_modeOptions;
|
|
883
1368
|
get mode() {
|
|
@@ -893,146 +1378,216 @@ class dt extends N {
|
|
|
893
1378
|
super(), this.modeOptions.setOption(t);
|
|
894
1379
|
}
|
|
895
1380
|
}
|
|
896
|
-
function
|
|
897
|
-
const t =
|
|
1381
|
+
function Ot(s) {
|
|
1382
|
+
const t = C(s);
|
|
898
1383
|
return class extends t {
|
|
899
1384
|
/**
|
|
900
1385
|
* 全局级别的默认选项
|
|
901
1386
|
*/
|
|
902
|
-
static modeOptions = new
|
|
1387
|
+
static modeOptions = new a(h);
|
|
903
1388
|
/**
|
|
904
1389
|
* 实例级的默认选项
|
|
905
1390
|
*/
|
|
906
1391
|
get modeOptions() {
|
|
907
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1392
|
+
return this._modeOptions || (this._modeOptions = new a(h, void 0, this.constructor.modeOptions));
|
|
908
1393
|
}
|
|
909
1394
|
_modeOptions;
|
|
910
1395
|
get mode() {
|
|
911
1396
|
return this.modeOptions.mode;
|
|
912
1397
|
}
|
|
913
|
-
set mode(
|
|
914
|
-
this.modeOptions.mode =
|
|
1398
|
+
set mode(n) {
|
|
1399
|
+
this.modeOptions.mode = n;
|
|
915
1400
|
}
|
|
916
1401
|
get options() {
|
|
917
1402
|
return this.modeOptions.plainFullOption;
|
|
918
1403
|
}
|
|
919
|
-
constructor(
|
|
920
|
-
super(), this.modeOptions.setOption(
|
|
1404
|
+
constructor(n) {
|
|
1405
|
+
super(), this.modeOptions.setOption(n);
|
|
921
1406
|
}
|
|
922
1407
|
};
|
|
923
1408
|
}
|
|
924
|
-
function
|
|
925
|
-
const
|
|
1409
|
+
function mt(s, t, e) {
|
|
1410
|
+
const n = c(s, {
|
|
926
1411
|
/**
|
|
927
1412
|
* 全局级别的默认选项
|
|
928
1413
|
*/
|
|
929
|
-
modeOptions: new
|
|
1414
|
+
modeOptions: new a(t, e)
|
|
930
1415
|
});
|
|
931
|
-
return
|
|
1416
|
+
return c(n.prototype, {
|
|
932
1417
|
/**
|
|
933
1418
|
* 实例级的默认选项
|
|
934
1419
|
*/
|
|
935
1420
|
get modeOptions() {
|
|
936
|
-
return this._modeOptions || (this._modeOptions = new
|
|
1421
|
+
return this._modeOptions || (this._modeOptions = new a(t, void 0, this.constructor.modeOptions));
|
|
937
1422
|
},
|
|
938
1423
|
get mode() {
|
|
939
1424
|
return this.modeOptions.mode;
|
|
940
1425
|
},
|
|
941
|
-
set mode(
|
|
942
|
-
this.modeOptions.mode =
|
|
1426
|
+
set mode(i) {
|
|
1427
|
+
this.modeOptions.mode = i;
|
|
943
1428
|
},
|
|
944
1429
|
get options() {
|
|
945
1430
|
return this.modeOptions.fullOption;
|
|
946
1431
|
}
|
|
947
|
-
}),
|
|
1432
|
+
}), s;
|
|
948
1433
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
e
|
|
1434
|
+
const Mt = {
|
|
1435
|
+
onUse(s, t, e) {
|
|
1436
|
+
const n = t ?? h;
|
|
1437
|
+
d(s, {
|
|
1438
|
+
modeOptions: new a(
|
|
1439
|
+
n,
|
|
1440
|
+
void 0,
|
|
1441
|
+
e
|
|
1442
|
+
)
|
|
1443
|
+
}), d(s.prototype, {
|
|
1444
|
+
get modeOptions() {
|
|
1445
|
+
const i = this, o = s;
|
|
1446
|
+
return i._modeOptions || (i._modeOptions = new a(
|
|
1447
|
+
o.modeOptions.mode,
|
|
1448
|
+
void 0,
|
|
1449
|
+
o.modeOptions
|
|
1450
|
+
));
|
|
1451
|
+
},
|
|
1452
|
+
get mode() {
|
|
1453
|
+
return this.modeOptions.mode;
|
|
1454
|
+
},
|
|
1455
|
+
set mode(i) {
|
|
1456
|
+
const o = this;
|
|
1457
|
+
o.modeOptions.mode = i;
|
|
1458
|
+
},
|
|
1459
|
+
get options() {
|
|
1460
|
+
return this.modeOptions.plainFullOption;
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
},
|
|
1464
|
+
onCreate(s, t) {
|
|
1465
|
+
s.modeOptions.setOption(t);
|
|
1466
|
+
}
|
|
1467
|
+
}, Pt = {
|
|
1468
|
+
onUse(s, t, e) {
|
|
1469
|
+
d(s, {
|
|
1470
|
+
/**
|
|
1471
|
+
* 全局级别的默认选项
|
|
1472
|
+
*/
|
|
1473
|
+
defaultOptions: new u(t, e)
|
|
1474
|
+
}), d(s.prototype, {
|
|
1475
|
+
/**
|
|
1476
|
+
* 实例级的默认选项
|
|
1477
|
+
*/
|
|
1478
|
+
get defaultOptions() {
|
|
1479
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, s.defaultOptions));
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
},
|
|
1483
|
+
onCreate(s, t) {
|
|
1484
|
+
s.defaultOptions.option = t;
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
function xt(s, t) {
|
|
1488
|
+
const e = c(s, {
|
|
1489
|
+
/**
|
|
1490
|
+
* 全局级别的默认选项
|
|
1491
|
+
*/
|
|
1492
|
+
defaultOptions: new u(t)
|
|
1493
|
+
});
|
|
1494
|
+
return c(e.prototype, {
|
|
1495
|
+
/**
|
|
1496
|
+
* 实例级的默认选项
|
|
1497
|
+
*/
|
|
1498
|
+
get defaultOptions() {
|
|
1499
|
+
return this._defaultOptions || (this._defaultOptions = new u(void 0, this.constructor.defaultOptions));
|
|
1500
|
+
}
|
|
1501
|
+
}), s;
|
|
1502
|
+
}
|
|
1503
|
+
function _(s, t) {
|
|
1504
|
+
const e = [{ target: s, props: t }];
|
|
1505
|
+
let n;
|
|
1506
|
+
for (; n = e.shift(); ) {
|
|
1507
|
+
const { target: i, props: o } = n;
|
|
1508
|
+
for (const [r, l] of Object.entries(o)) {
|
|
1509
|
+
if (l != null && typeof l == "object" && (!l.constructor || l.constructor === Object)) {
|
|
1510
|
+
e.push({ target: i[r], props: l });
|
|
957
1511
|
continue;
|
|
958
1512
|
}
|
|
959
|
-
|
|
1513
|
+
i[r] = l;
|
|
960
1514
|
}
|
|
961
1515
|
}
|
|
962
|
-
return
|
|
1516
|
+
return s;
|
|
963
1517
|
}
|
|
964
|
-
function
|
|
965
|
-
const e = {},
|
|
966
|
-
let
|
|
967
|
-
for (;
|
|
968
|
-
const { target: o, props: r, targetProps:
|
|
969
|
-
for (const [
|
|
970
|
-
if (
|
|
971
|
-
|
|
1518
|
+
function A(s, t) {
|
|
1519
|
+
const e = {}, n = [{ target: s, props: t, targetProps: e }];
|
|
1520
|
+
let i;
|
|
1521
|
+
for (; i = n.shift(); ) {
|
|
1522
|
+
const { target: o, props: r, targetProps: l } = i;
|
|
1523
|
+
for (const [m, f] of Object.entries(r)) {
|
|
1524
|
+
if (f != null && typeof f == "object" && (!f.constructor || f.constructor === Object)) {
|
|
1525
|
+
n.push({ target: o[m], props: f, targetProps: l[m] = {} });
|
|
972
1526
|
continue;
|
|
973
1527
|
}
|
|
974
|
-
|
|
1528
|
+
l[m] = o[m];
|
|
975
1529
|
}
|
|
976
1530
|
}
|
|
977
1531
|
return e;
|
|
978
1532
|
}
|
|
979
|
-
function
|
|
980
|
-
const e =
|
|
981
|
-
function
|
|
982
|
-
|
|
1533
|
+
function yt(s, t) {
|
|
1534
|
+
const e = A(s, t);
|
|
1535
|
+
function n() {
|
|
1536
|
+
_(s, t);
|
|
983
1537
|
}
|
|
984
|
-
function
|
|
985
|
-
|
|
1538
|
+
function i() {
|
|
1539
|
+
_(s, e);
|
|
986
1540
|
}
|
|
987
|
-
return { set:
|
|
1541
|
+
return { set: n, unset: i };
|
|
988
1542
|
}
|
|
989
1543
|
export {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1544
|
+
Q as ExtendManager,
|
|
1545
|
+
S as ModeOptions,
|
|
1546
|
+
p as PluginExtendManager,
|
|
1547
|
+
F as PluginHost,
|
|
1548
|
+
U as PluginHostEventEmitter,
|
|
1549
|
+
D as PluginHostEventTarget,
|
|
1550
|
+
L as PluginManager,
|
|
1551
|
+
a as TierModeOptions,
|
|
1552
|
+
gt as TierModeOptionsPluginHost,
|
|
1553
|
+
ct as TierModeOptionsPluginHostEventEmitter,
|
|
1554
|
+
ht as TierModeOptionsPluginHostEventTarget,
|
|
1555
|
+
u as TierOptions,
|
|
997
1556
|
ut as TierOptionsPluginHost,
|
|
1557
|
+
at as TierOptionsPluginHostEventEmitter,
|
|
1558
|
+
lt as TierOptionsPluginHostEventTarget,
|
|
998
1559
|
X as addDefaultOptions,
|
|
999
1560
|
Y as addInstOptions,
|
|
1000
|
-
|
|
1001
|
-
D as becomePluginHost,
|
|
1561
|
+
j as becomePluginHost,
|
|
1002
1562
|
rt as becomePluginHost_Extends,
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1563
|
+
it as becomePluginHost_Proxy,
|
|
1564
|
+
mt as becomeTierModeOptionsHost,
|
|
1565
|
+
xt as becomeTierOptionsHost,
|
|
1006
1566
|
h as commonModeName,
|
|
1007
|
-
K as
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
at as createTierOptionsPluginHost,
|
|
1019
|
-
S as defineExtend,
|
|
1020
|
-
R as defineExtendWithInit,
|
|
1021
|
-
A as defineMixin,
|
|
1022
|
-
T as extendTarget,
|
|
1023
|
-
J as extendTargetWithInit,
|
|
1024
|
-
x as getPropertyValue,
|
|
1567
|
+
K as createDefineMixin,
|
|
1568
|
+
G as createMixinTarget,
|
|
1569
|
+
C as createPluginHost,
|
|
1570
|
+
yt as createPropertySetter,
|
|
1571
|
+
W as createTargetMixin,
|
|
1572
|
+
Ot as createTierModeOptionsPluginHost,
|
|
1573
|
+
dt as createTierOptionsPluginHost,
|
|
1574
|
+
J as defineExtend,
|
|
1575
|
+
B as defineMixin,
|
|
1576
|
+
O as extendMark,
|
|
1577
|
+
y as getPropertyValue,
|
|
1025
1578
|
Z as getPropertyValueByPath,
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
b as
|
|
1579
|
+
A as getTargetProperties,
|
|
1580
|
+
I as isPlugin,
|
|
1581
|
+
_ as mergeProperties,
|
|
1582
|
+
d as mixin,
|
|
1583
|
+
c as mixinTarget,
|
|
1584
|
+
b as parsePropertyPath,
|
|
1585
|
+
T as pickHostExtendMembers,
|
|
1586
|
+
E as setPropertyValue,
|
|
1032
1587
|
tt as setPropertyValueByPath,
|
|
1033
|
-
|
|
1034
|
-
y as targetExtendWithInit,
|
|
1035
|
-
z as targetMixin,
|
|
1588
|
+
R as targetMixin,
|
|
1036
1589
|
nt as tierModeOptionsDecorator,
|
|
1037
|
-
|
|
1590
|
+
Mt as tierModeOptionsPlugin,
|
|
1591
|
+
et as tierOptionsDecorator,
|
|
1592
|
+
Pt as tierOptionsPlugin
|
|
1038
1593
|
};
|