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