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