plugin-tls 5.1.1 → 5.2.1
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/{createTierModeOptionsPluginHost-D-fKYlcA.js → createTierModeOptionsPluginHost-Bvne8SqN.js} +90 -58
- package/dist/createTierModeOptionsPluginHost-D2REw5Vz.cjs +1 -0
- package/dist/index-node.cjs +1 -1
- package/dist/index-node.js +30 -14
- package/dist/index-web.cjs +1 -1
- package/dist/index-web.js +80 -64
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHost.d.ts +10 -4
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHost.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-options/createTierOptionsPluginHost.d.ts +7 -1
- package/dist/options/options-plugin-host/tier-options/createTierOptionsPluginHost.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/createTierModeOptionsPluginHost-DyDtXKNW.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Destroyable as x, createDestroyableSubClass as T } from "@gby/destroyable";
|
|
2
|
-
import { deepmergeInto as f, deepmerge as
|
|
2
|
+
import { deepmergeInto as f, deepmerge as _ } from "deepmerge-ts";
|
|
3
3
|
import { waitAsyncable as g } from "type-tls";
|
|
4
4
|
import { omitMembers as D, removeUndefined as E, pickMembers as v, serialCallFuns as O } from "com-tools";
|
|
5
|
-
function
|
|
5
|
+
function l(s, ...t) {
|
|
6
6
|
for (const e of t) {
|
|
7
7
|
const n = Object.getOwnPropertyDescriptors(e);
|
|
8
8
|
Object.defineProperties(s, n);
|
|
@@ -26,31 +26,31 @@ function B(s) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function z(s, t) {
|
|
29
|
-
return
|
|
29
|
+
return l(s, t), t;
|
|
30
30
|
}
|
|
31
31
|
function K(s) {
|
|
32
32
|
return function(e) {
|
|
33
|
-
return
|
|
33
|
+
return l(s, e), e;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
function $(s, t) {
|
|
37
|
-
return
|
|
37
|
+
return l(s, t), s;
|
|
38
38
|
}
|
|
39
39
|
function q(s) {
|
|
40
40
|
return function(e) {
|
|
41
|
-
return
|
|
41
|
+
return l(s, e), s;
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const y = ["onCreate", "onInit", "onDestroy"];
|
|
45
45
|
function G(s) {
|
|
46
46
|
const t = { ...s };
|
|
47
|
-
for (const e of
|
|
47
|
+
for (const e of y)
|
|
48
48
|
typeof t[e] == "function" && delete t[e];
|
|
49
49
|
return t;
|
|
50
50
|
}
|
|
51
51
|
function N(s, t) {
|
|
52
52
|
let e = Object.getOwnPropertyDescriptors(t);
|
|
53
|
-
for (const n of
|
|
53
|
+
for (const n of y)
|
|
54
54
|
typeof t[n] == "function" && delete e[n];
|
|
55
55
|
return Object.defineProperties(s, e), s;
|
|
56
56
|
}
|
|
@@ -63,26 +63,26 @@ function J(s) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
function Q(s, t) {
|
|
66
|
-
return
|
|
66
|
+
return l(s.prototype, t), t;
|
|
67
67
|
}
|
|
68
68
|
function W(s) {
|
|
69
69
|
return function(e) {
|
|
70
|
-
return
|
|
70
|
+
return l(s.prototype, e), e;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
function X(s, t) {
|
|
74
|
-
return
|
|
74
|
+
return l(s.prototype, t), s;
|
|
75
75
|
}
|
|
76
76
|
function Y(s) {
|
|
77
77
|
return function(e) {
|
|
78
|
-
return
|
|
78
|
+
return l(s.prototype, e), s;
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function V(s) {
|
|
82
82
|
return s && typeof s.onUse == "function";
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
class
|
|
84
|
+
const c = /* @__PURE__ */ Symbol("extend");
|
|
85
|
+
class h extends x {
|
|
86
86
|
/**
|
|
87
87
|
* 父级插件管理者
|
|
88
88
|
*
|
|
@@ -130,7 +130,7 @@ class c extends x {
|
|
|
130
130
|
* @returns
|
|
131
131
|
*/
|
|
132
132
|
isPlugin(t) {
|
|
133
|
-
return this.hasUsed(t) ? this.getUseReturn(t) !==
|
|
133
|
+
return this.hasUsed(t) ? this.getUseReturn(t) !== c : V(t);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* 使用插件、注册插件
|
|
@@ -138,7 +138,7 @@ class c extends x {
|
|
|
138
138
|
* @param args - 传递给插件的选项
|
|
139
139
|
*/
|
|
140
140
|
useExtend(t) {
|
|
141
|
-
return this.hasUsed(t) || (N(this.host.prototype, t), this.plugins.set(t,
|
|
141
|
+
return this.hasUsed(t) || (N(this.host.prototype, t), this.plugins.set(t, c)), t;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 插件宿主实例的注册插件的方法
|
|
@@ -184,7 +184,7 @@ class c extends x {
|
|
|
184
184
|
const n = this.parent?.onCreate(t, ...e), i = [];
|
|
185
185
|
for (const [r, o] of this.plugins)
|
|
186
186
|
if (r.onCreate) {
|
|
187
|
-
const u = o ===
|
|
187
|
+
const u = o === c ? r.onCreate : r.onCreate.bind(r);
|
|
188
188
|
i.push(u);
|
|
189
189
|
}
|
|
190
190
|
return g(n, () => O(i, t, [t, ...e]));
|
|
@@ -201,7 +201,7 @@ class c extends x {
|
|
|
201
201
|
const n = this.parent?.onInit(t, ...e), i = [];
|
|
202
202
|
for (const [r, o] of this.plugins)
|
|
203
203
|
if (r.onInit) {
|
|
204
|
-
const u = o ===
|
|
204
|
+
const u = o === c ? r.onInit : r.onInit.bind(r);
|
|
205
205
|
i.push(u);
|
|
206
206
|
}
|
|
207
207
|
return g(n, () => O(i, t, [t, ...e]));
|
|
@@ -217,7 +217,7 @@ class c extends x {
|
|
|
217
217
|
const e = [];
|
|
218
218
|
for (const [r, o] of this.plugins)
|
|
219
219
|
if (r.onDestroy) {
|
|
220
|
-
const u = o ===
|
|
220
|
+
const u = o === c ? r.onDestroy : r.onDestroy.bind(r);
|
|
221
221
|
e.push(u);
|
|
222
222
|
}
|
|
223
223
|
e.reverse();
|
|
@@ -225,7 +225,7 @@ class c extends x {
|
|
|
225
225
|
return i ? g(n, () => i.onDestroy(t)) : n;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function P(s) {
|
|
229
229
|
const t = s.split(".");
|
|
230
230
|
return t[0] === "" && t.shift(), t;
|
|
231
231
|
}
|
|
@@ -235,7 +235,7 @@ function M(s, t) {
|
|
|
235
235
|
return s;
|
|
236
236
|
}
|
|
237
237
|
function Z(s, t) {
|
|
238
|
-
return M(s,
|
|
238
|
+
return M(s, P(t));
|
|
239
239
|
}
|
|
240
240
|
function b(s, t, e) {
|
|
241
241
|
const n = t.pop(), i = t.length;
|
|
@@ -251,7 +251,7 @@ function b(s, t, e) {
|
|
|
251
251
|
return s[n] = e, s;
|
|
252
252
|
}
|
|
253
253
|
function tt(s, t, e) {
|
|
254
|
-
return b(s,
|
|
254
|
+
return b(s, P(t), e);
|
|
255
255
|
}
|
|
256
256
|
const m = {
|
|
257
257
|
UndefinedAndNull: function(t) {
|
|
@@ -378,7 +378,7 @@ class U {
|
|
|
378
378
|
n && (r = M(i, t)) && typeof r == "object" ? f(r, e) : b(this.option, t, e), this.updateFullOption();
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
class
|
|
381
|
+
class a extends U {
|
|
382
382
|
constructor(t, e) {
|
|
383
383
|
super(), t && (this.option = t), e && (this.extends = e);
|
|
384
384
|
}
|
|
@@ -407,7 +407,7 @@ class l extends U {
|
|
|
407
407
|
const { extends: e, option: n } = this;
|
|
408
408
|
if (t = n, e) {
|
|
409
409
|
const i = e.plainFullOption;
|
|
410
|
-
t =
|
|
410
|
+
t = _(i, n);
|
|
411
411
|
}
|
|
412
412
|
return this._plainFullOption = t;
|
|
413
413
|
}
|
|
@@ -447,7 +447,7 @@ function et(s, t) {
|
|
|
447
447
|
const { name: e } = t, n = `_${e}`;
|
|
448
448
|
return {
|
|
449
449
|
get: function() {
|
|
450
|
-
return this[n] || (this[n] = new
|
|
450
|
+
return this[n] || (this[n] = new a(void 0, this.constructor[e]));
|
|
451
451
|
}
|
|
452
452
|
};
|
|
453
453
|
}
|
|
@@ -541,7 +541,7 @@ class k extends U {
|
|
|
541
541
|
* @param extend - 继承哪个模式
|
|
542
542
|
*/
|
|
543
543
|
setModeOption(t, e, n, i) {
|
|
544
|
-
const { modes: r } = this, o = r[t] || (r[t] = new
|
|
544
|
+
const { modes: r } = this, o = r[t] || (r[t] = new a());
|
|
545
545
|
if (o.setOption(e, n), i) {
|
|
546
546
|
const u = r[i];
|
|
547
547
|
u && (o.extends = u);
|
|
@@ -549,7 +549,7 @@ class k extends U {
|
|
|
549
549
|
return this.updateFullOption(), o;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
class
|
|
552
|
+
class d extends k {
|
|
553
553
|
constructor(t, e, n) {
|
|
554
554
|
super(t, e), n && (this.extends = n);
|
|
555
555
|
}
|
|
@@ -574,7 +574,7 @@ class p extends k {
|
|
|
574
574
|
const { modes: e, extends: n } = this, i = e[t]?.plainFullOption;
|
|
575
575
|
if (n) {
|
|
576
576
|
const r = n.getFullModeOption(t);
|
|
577
|
-
return i ?
|
|
577
|
+
return i ? _(r, i) : r;
|
|
578
578
|
}
|
|
579
579
|
return i;
|
|
580
580
|
}
|
|
@@ -642,11 +642,11 @@ function nt(s, t) {
|
|
|
642
642
|
const { name: e } = t, n = `_${e}`;
|
|
643
643
|
return {
|
|
644
644
|
get: function() {
|
|
645
|
-
return this[n] || (this[n] = new
|
|
645
|
+
return this[n] || (this[n] = new d(this.constructor[e].mode, void 0, this.constructor[e]));
|
|
646
646
|
}
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
class
|
|
649
|
+
class w extends x {
|
|
650
650
|
/**
|
|
651
651
|
* 是否使用独立的插件管理器
|
|
652
652
|
* @defaultValue false
|
|
@@ -656,9 +656,9 @@ class F extends x {
|
|
|
656
656
|
* 插件管理器
|
|
657
657
|
*/
|
|
658
658
|
static get pluginManager() {
|
|
659
|
-
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new
|
|
659
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new h(this, this._pluginManager)), this._pluginManager;
|
|
660
660
|
}
|
|
661
|
-
static _pluginManager = new
|
|
661
|
+
static _pluginManager = new h(this);
|
|
662
662
|
/**
|
|
663
663
|
* 插件管理器 {@link PluginHost.pluginManager}
|
|
664
664
|
*/
|
|
@@ -729,23 +729,31 @@ class F extends x {
|
|
|
729
729
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
class st extends
|
|
732
|
+
class st extends w {
|
|
733
|
+
/**
|
|
734
|
+
* 是否使用独立的选项
|
|
735
|
+
* @defaultValue false
|
|
736
|
+
*/
|
|
737
|
+
static isolatedOptions = !1;
|
|
733
738
|
/**
|
|
734
739
|
* 全局级别的默认选项
|
|
735
740
|
*/
|
|
736
|
-
static defaultOptions
|
|
741
|
+
static get defaultOptions() {
|
|
742
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(this, this._defaultOptions)), this._defaultOptions;
|
|
743
|
+
}
|
|
744
|
+
static _defaultOptions = new a();
|
|
737
745
|
/**
|
|
738
746
|
* 实例级的默认选项
|
|
739
747
|
*/
|
|
740
748
|
get defaultOptions() {
|
|
741
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
749
|
+
return this._defaultOptions || (this._defaultOptions = new a(void 0, this.constructor.defaultOptions));
|
|
742
750
|
}
|
|
743
751
|
_defaultOptions;
|
|
744
752
|
constructor(t) {
|
|
745
753
|
super(), this.defaultOptions.option = t;
|
|
746
754
|
}
|
|
747
755
|
}
|
|
748
|
-
function
|
|
756
|
+
function F(s) {
|
|
749
757
|
const t = T(s);
|
|
750
758
|
return class extends t {
|
|
751
759
|
/**
|
|
@@ -757,9 +765,9 @@ function w(s) {
|
|
|
757
765
|
* 插件管理器
|
|
758
766
|
*/
|
|
759
767
|
static get pluginManager() {
|
|
760
|
-
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new
|
|
768
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new h(this, this._pluginManager)), this._pluginManager;
|
|
761
769
|
}
|
|
762
|
-
static _pluginManager = new
|
|
770
|
+
static _pluginManager = new h(this);
|
|
763
771
|
/**
|
|
764
772
|
* 插件管理器 {@link PluginHostSub.pluginManager}
|
|
765
773
|
*/
|
|
@@ -831,17 +839,25 @@ function w(s) {
|
|
|
831
839
|
};
|
|
832
840
|
}
|
|
833
841
|
function ot(s) {
|
|
834
|
-
const t =
|
|
842
|
+
const t = F(s);
|
|
835
843
|
return class extends t {
|
|
844
|
+
/**
|
|
845
|
+
* 是否使用独立的选项
|
|
846
|
+
* @defaultValue false
|
|
847
|
+
*/
|
|
848
|
+
static isolatedOptions = !1;
|
|
836
849
|
/**
|
|
837
850
|
* 全局级别的默认选项
|
|
838
851
|
*/
|
|
839
|
-
static defaultOptions
|
|
852
|
+
static get defaultOptions() {
|
|
853
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new a(this, this._defaultOptions)), this._defaultOptions;
|
|
854
|
+
}
|
|
855
|
+
static _defaultOptions = new a();
|
|
840
856
|
/**
|
|
841
857
|
* 实例级的默认选项
|
|
842
858
|
*/
|
|
843
859
|
get defaultOptions() {
|
|
844
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
860
|
+
return this._defaultOptions || (this._defaultOptions = new a(void 0, this.constructor.defaultOptions));
|
|
845
861
|
}
|
|
846
862
|
_defaultOptions;
|
|
847
863
|
constructor(n) {
|
|
@@ -849,17 +865,25 @@ function ot(s) {
|
|
|
849
865
|
}
|
|
850
866
|
};
|
|
851
867
|
}
|
|
852
|
-
const
|
|
853
|
-
class ut extends
|
|
868
|
+
const p = "common";
|
|
869
|
+
class ut extends w {
|
|
870
|
+
/**
|
|
871
|
+
* 是否使用独立的选项
|
|
872
|
+
* @defaultValue false
|
|
873
|
+
*/
|
|
874
|
+
static isolatedOptions = !1;
|
|
854
875
|
/**
|
|
855
876
|
* 全局级别的默认选项
|
|
856
877
|
*/
|
|
857
|
-
static modeOptions
|
|
878
|
+
static get modeOptions() {
|
|
879
|
+
return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new d(p, null, this._modeOptions)), this._modeOptions;
|
|
880
|
+
}
|
|
881
|
+
static _modeOptions = new d(p);
|
|
858
882
|
/**
|
|
859
883
|
* 实例级的默认选项
|
|
860
884
|
*/
|
|
861
885
|
get modeOptions() {
|
|
862
|
-
return this._modeOptions || (this._modeOptions = new p
|
|
886
|
+
return this._modeOptions || (this._modeOptions = new d(p, void 0, this.constructor.modeOptions));
|
|
863
887
|
}
|
|
864
888
|
_modeOptions;
|
|
865
889
|
get mode() {
|
|
@@ -876,17 +900,25 @@ class ut extends F {
|
|
|
876
900
|
}
|
|
877
901
|
}
|
|
878
902
|
function lt(s) {
|
|
879
|
-
const t =
|
|
903
|
+
const t = F(s);
|
|
880
904
|
return class extends t {
|
|
905
|
+
/**
|
|
906
|
+
* 是否使用独立的选项
|
|
907
|
+
* @defaultValue false
|
|
908
|
+
*/
|
|
909
|
+
static isolatedOptions = !1;
|
|
881
910
|
/**
|
|
882
911
|
* 全局级别的默认选项
|
|
883
912
|
*/
|
|
884
|
-
static modeOptions
|
|
913
|
+
static get modeOptions() {
|
|
914
|
+
return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new d(p, null, this._modeOptions)), this._modeOptions;
|
|
915
|
+
}
|
|
916
|
+
static _modeOptions = new d(p);
|
|
885
917
|
/**
|
|
886
918
|
* 实例级的默认选项
|
|
887
919
|
*/
|
|
888
920
|
get modeOptions() {
|
|
889
|
-
return this._modeOptions || (this._modeOptions = new p
|
|
921
|
+
return this._modeOptions || (this._modeOptions = new d(p, void 0, this.constructor.modeOptions));
|
|
890
922
|
}
|
|
891
923
|
_modeOptions;
|
|
892
924
|
get mode() {
|
|
@@ -904,7 +936,7 @@ function lt(s) {
|
|
|
904
936
|
};
|
|
905
937
|
}
|
|
906
938
|
export {
|
|
907
|
-
|
|
939
|
+
P as A,
|
|
908
940
|
G as B,
|
|
909
941
|
b as C,
|
|
910
942
|
tt as D,
|
|
@@ -913,28 +945,28 @@ export {
|
|
|
913
945
|
nt as G,
|
|
914
946
|
et as H,
|
|
915
947
|
k as M,
|
|
916
|
-
|
|
917
|
-
|
|
948
|
+
h as P,
|
|
949
|
+
d as T,
|
|
918
950
|
N as a,
|
|
919
951
|
$ as b,
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
952
|
+
p as c,
|
|
953
|
+
a as d,
|
|
954
|
+
w as e,
|
|
923
955
|
ut as f,
|
|
924
956
|
st as g,
|
|
925
957
|
J as h,
|
|
926
958
|
B as i,
|
|
927
959
|
Y as j,
|
|
928
960
|
q as k,
|
|
929
|
-
|
|
930
|
-
|
|
961
|
+
F as l,
|
|
962
|
+
l as m,
|
|
931
963
|
W as n,
|
|
932
964
|
K as o,
|
|
933
965
|
lt as p,
|
|
934
966
|
ot as q,
|
|
935
967
|
L as r,
|
|
936
968
|
A as s,
|
|
937
|
-
|
|
969
|
+
c as t,
|
|
938
970
|
M as u,
|
|
939
971
|
Z as v,
|
|
940
972
|
X as w,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const x=require("@gby/destroyable"),f=require("deepmerge-ts"),m=require("type-tls"),h=require("com-tools");function a(i,...t){for(const e of t){const n=Object.getOwnPropertyDescriptors(e);Object.defineProperties(i,n)}return i}function E(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e&&h.omitMembers(n,e),Object.defineProperties(i,n),i}function V(i,t,e){let n=Object.getOwnPropertyDescriptors(t);return e?Object.defineProperties(i,h.removeUndefined(h.pickMembers(n,e))):Object.defineProperties(i,n),i}function N(i,t){return t}function v(i){return function(e){return e}}function H(i,t){return a(i,t),t}function I(i){return function(e){return a(i,e),e}}function k(i,t){return a(i,t),i}function C(i){return function(e){return a(i,e),i}}const T=["onCreate","onInit","onDestroy"];function j(i){const t={...i};for(const e of T)typeof t[e]=="function"&&delete t[e];return t}function U(i,t){let e=Object.getOwnPropertyDescriptors(t);for(const n of T)typeof t[n]=="function"&&delete e[n];return Object.defineProperties(i,e),i}function S(i,t){return t}function B(i){return function(e){return e}}function R(i,t){return a(i.prototype,t),t}function A(i){return function(e){return a(i.prototype,e),e}}function q(i,t){return a(i.prototype,t),i}function z(i){return function(e){return a(i.prototype,e),i}}function w(i){return i&&typeof i.onUse=="function"}const c=Symbol("extend");class g extends x.Destroyable{parent;host;plugins=new Map;constructor(t,e){super(),this.parent=e,t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.parent?.hasUsed(t)||this.plugins.has(t)}getUseReturn(t){const{parent:e}=this;return e?.hasUsed(t)?e.getUseReturn(t):this.plugins.get(t)}isPlugin(t){return this.hasUsed(t)?this.getUseReturn(t)!==c:w(t)}useExtend(t){return this.hasUsed(t)||(U(this.host.prototype,t),this.plugins.set(t,c)),t}instUseExtend(t,e,...n){return this.hasUsed(e)||(this.useExtend(e),e.onCreate?.call(t,t,...n)),e}usePlugin(t,...e){if(this.hasUsed(t))return this.getUseReturn(t);const n=t.onUse(this.host,...e);return this.plugins.set(t,n),n}instUsePlugin(t,e,...n){if(this.hasUsed(e))return this.getUseReturn(e);const s=this.usePlugin(e,...n);return e.onCreate?.(t),s}onCreate(t,...e){const n=this.parent?.onCreate(t,...e),s=[];for(const[r,o]of this.plugins)if(r.onCreate){const l=o===c?r.onCreate:r.onCreate.bind(r);s.push(l)}return m.waitAsyncable(n,()=>h.serialCallFuns(s,t,[t,...e]))}onInit(t,...e){const n=this.parent?.onInit(t,...e),s=[];for(const[r,o]of this.plugins)if(r.onInit){const l=o===c?r.onInit:r.onInit.bind(r);s.push(l)}return m.waitAsyncable(n,()=>h.serialCallFuns(s,t,[t,...e]))}onDestroy(t){const e=[];for(const[r,o]of this.plugins)if(r.onDestroy){const l=o===c?r.onDestroy:r.onDestroy.bind(r);e.push(l)}e.reverse();const n=h.serialCallFuns(e,t,[t]),{parent:s}=this;return s?m.waitAsyncable(n,()=>s.onDestroy(t)):n}}function y(i){const t=i.split(".");return t[0]===""&&t.shift(),t}function O(i,t){for(const e of t)if(i=i[e],i==null)return;return i}function K(i,t){return O(i,y(t))}function P(i,t,e){const n=t.pop(),s=t.length;let r=0;for(;r<s;){const o=i[t[r]];if(o==null)break;i=o,r++}t=t.slice(r);for(const o of t)i=i[o]={};return i[n]=e,i}function $(i,t,e){return P(i,y(t),e)}const M={UndefinedAndNull:function(t){return t==null},Undefined:function(t){return t===void 0},Null:function(t){return t===null}};class F{freezeMember=!0;fullOption=new Proxy(this,{get:function(t,e,n){const s=t.plainFullOption[e];return t.freezeMember?Object.freeze(s):s},set:function(t,e,n,s){return t.setMember(e,n,!1),!0},has:function(t,e){return e in t.plainFullOption},getOwnPropertyDescriptor:function(t,e){return Object.getOwnPropertyDescriptor(t.plainFullOption,e)},ownKeys:function(t){return Reflect.ownKeys(t.plainFullOption)},deleteProperty:function(t,e){return t.setMember(e,void 0),!0},defineProperty:function(t,e,n){return Object.defineProperty(t.option,e,n),!0}});setOption(t,e){const n=e?f.deepmergeInto(this.option,t):Object.assign(this.option,t);return this.updateFullOption(),n}get undefinedValue(){return this._undefinedValue}set undefinedValue(t){this._undefinedValue=t,this.isUndefined=M[t]||M.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=M.UndefinedAndNull;getMember(t){return this.option[t]}setMember(t,e,n){const s=this.option;if(e===void 0)delete s[t];else{const r=s[t];n&&r&&typeof r=="object"?f.deepmergeInto(r,e):s[t]=e}this.updateFullOption()}getValue(t){return O(this.option,t)}setValue(t,e,n){const s=this.option;let r;n&&(r=O(s,t))&&typeof r=="object"?f.deepmergeInto(r,e):P(this.option,t,e),this.updateFullOption()}}class u extends F{constructor(t,e){super(),t&&(this.option=t),e&&(this.extends=e)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;option={};get plainFullOption(){let t=this._plainFullOption;if(t)return t;const{extends:e,option:n}=this;if(t=n,e){const s=e.plainFullOption;t=f.deepmerge(s,n)}return this._plainFullOption=t}_plainFullOption=null;updateFullOption(){this._plainFullOption=null}getMember(t){const e=this.option[t];if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=super.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function L(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new u(void 0,this.constructor[e]))}}}class D extends F{constructor(t,e){super(),e&&this.setModeOption(t,e),this.mode=t}modes={};get mode(){return this._mode||(this.mode=this.modeNames[0])}set mode(t){this._mode=t,this.hasMode(t)||this.setModeOption(t,{}),this.updateFullOption()}_mode;get modeNames(){return this._modeNames||(this._modeNames=this.getModeNames())}_modeNames=null;getModeNames(){return Object.keys(this.modes)}hasMode(t){return!!this.modes[t]}get optionManager(){return this.modes[this.mode]}get option(){return this.optionManager.option}get plainFullOption(){return this._plainFullOption??(this._plainFullOption=this.getFullModeOption(this.mode))}_plainFullOption=null;updateFullOption(){this._plainFullOption=null,this._modeNames=null}getModeOption(t){return this.modes[t].option}getFullModeOption(t){return this.modes[t]?.plainFullOption}setModeOption(t,e,n,s){const{modes:r}=this,o=r[t]||(r[t]=new u);if(o.setOption(e,n),s){const l=r[s];l&&(o.extends=l)}return this.updateFullOption(),o}}class d extends D{constructor(t,e,n){super(t,e),n&&(this.extends=n)}get extends(){return this._extends}set extends(t){this._extends=t,this.updateFullOption()}_extends=null;getFullModeOption(t){const{modes:e,extends:n}=this,s=e[t]?.plainFullOption;if(n){const r=n.getFullModeOption(t);return s?f.deepmerge(r,s):r}return s}getModeNames(){const{modes:t,extends:e}=this,n=Object.keys(t);if(!e)return n;const s=e.getModeNames();return[...new Set([...n,...s])]}hasModeOnTier(t){if(this.hasMode(t))return!0;const e=this.extends;return e?e.hasModeOnTier(t):!1}get optionManager(){return this.getModeOptionManager(this.mode)}getModeOptionManager(t){const e=this.modes[t];return e||(this.extends?.getModeOptionManager(t)?this.setModeOption(t,{}):null)}getMember(t){const e=this.optionManager.getMember(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getMember(t)}getValue(t){const e=this.optionManager.getValue(t);if(!this.isUndefined(e))return e;const n=this.extends;if(n)return n.getValue(t)}}function G(i,t){const{name:e}=t,n=`_${e}`;return{get:function(){return this[n]||(this[n]=new d(this.constructor[e].mode,void 0,this.constructor[e]))}}}class _ extends x.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...e){return this.pluginManager.usePlugin(t,...e)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...e){return this.pluginManager.instUsePlugin(this,t,...e)}useExtend(t,...e){return this.pluginManager.instUseExtend(this,t,...e)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class J extends _{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(this,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}function b(i){const t=x.createDestroyableSubClass(i);return class extends t{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(n,...s){return this.pluginManager.usePlugin(n,...s)}static useExtend(n){return this.pluginManager.useExtend(n)}static hasUsed(n){return this.pluginManager.hasUsed(n)}usePlugin(n,...s){return this.pluginManager.instUsePlugin(this,n,...s)}useExtend(n,...s){return this.pluginManager.instUseExtend(this,n,...s)}init(...n){return this.pluginManager.onInit(this,...n)}destroyThis(){const n=this.pluginManager.onDestroy(this);return n instanceof Promise?n.finally(()=>super.destroyThis()):super.destroyThis()}}}function Q(i){const t=b(i);return class extends t{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new u(this,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new u;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new u(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),this.defaultOptions.option=n}}}const p="common";class W extends _{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new d(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new d(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(p,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}function X(i){const t=b(i);return class extends t{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new d(p,null,this._modeOptions)),this._modeOptions}static _modeOptions=new d(p);get modeOptions(){return this._modeOptions||(this._modeOptions=new d(p,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(n){this.modeOptions.mode=n}get options(){return this.modeOptions.plainFullOption}constructor(n){super(),this.modeOptions.setOption(n)}}}exports.ModeOptions=D;exports.PluginExtendManager=g;exports.PluginHost=_;exports.TierModeOptions=d;exports.TierModeOptionsPluginHost=W;exports.TierOptions=u;exports.TierOptionsPluginHost=J;exports.commonModeName=p;exports.createDefineIExtend=B;exports.createDefineMixin=v;exports.createIExtendTarget=z;exports.createMixinTarget=C;exports.createPluginHost=b;exports.createTargetIExtend=A;exports.createTargetMixin=I;exports.createTierModeOptionsPluginHost=X;exports.createTierOptionsPluginHost=Q;exports.defineIExtend=S;exports.defineMixin=N;exports.extendMark=c;exports.getPropertyValue=O;exports.getPropertyValueByPath=K;exports.iextendTarget=q;exports.isPlugin=w;exports.mixin=a;exports.mixinByOmit=E;exports.mixinByPick=V;exports.mixinIExtend=U;exports.mixinTarget=k;exports.parsePropertyPath=y;exports.pickHostExtendMembers=j;exports.setPropertyValue=P;exports.setPropertyValueByPath=$;exports.targetIExtend=R;exports.targetMixin=H;exports.tierModeOptionsDecorator=G;exports.tierOptionsDecorator=L;
|
package/dist/index-node.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),u=require("com-tools"),a=require("node:events"),s=require("./createTierModeOptionsPluginHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),u=require("com-tools"),a=require("node:events"),s=require("./createTierModeOptionsPluginHost-D2REw5Vz.cjs");var d=class extends a.EventEmitter{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let i=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(i),e.__destroyable_destroyer=i,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(i){console.error("销毁函数在同步销毁时出错",this,t,i)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return n.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=u.serialCallAllFuns(e,this,null,(i,r)=>{console.error("销毁函数在串行销毁时出错",this,r,i)});return t instanceof Promise?t.then(()=>(n.a(this),!0)):(n.a(this),!0)}};class o extends d{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new s.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new s.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class l extends o{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new s.TierModeOptions(s.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new s.TierModeOptions(s.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new s.TierModeOptions(s.commonModeName,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class p extends o{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new s.TierOptions(this,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new s.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new s.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}exports.TierModeOptionsPluginHost=s.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=s.TierOptionsPluginHost;exports.commonModeName=s.commonModeName;exports.createTierModeOptionsPluginHost=s.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=s.createTierOptionsPluginHost;exports.PluginHostEventEmitter=o;exports.TierModeOptionsPluginHostEventEmitter=l;exports.TierOptionsPluginHostEventEmitter=p;
|
package/dist/index-node.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as i } from "./Destroyable-mrBsNabq-D6TYs3Zn.js";
|
|
2
2
|
import { serialCallAllFuns as l } from "com-tools";
|
|
3
3
|
import { EventEmitter as h } from "node:events";
|
|
4
|
-
import { P as
|
|
5
|
-
import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-
|
|
4
|
+
import { P as a, T as n, c as r, d as o } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
5
|
+
import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
6
6
|
var p = class extends h {
|
|
7
7
|
refCount = 0;
|
|
8
8
|
get isDestroyed() {
|
|
@@ -69,7 +69,7 @@ var p = class extends h {
|
|
|
69
69
|
return t instanceof Promise ? t.then(() => (i(this), !0)) : (i(this), !0);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
class
|
|
72
|
+
class u extends p {
|
|
73
73
|
/**
|
|
74
74
|
* 是否使用独立的插件管理器
|
|
75
75
|
* @defaultValue false
|
|
@@ -79,9 +79,9 @@ class a extends p {
|
|
|
79
79
|
* 插件管理器
|
|
80
80
|
*/
|
|
81
81
|
static get pluginManager() {
|
|
82
|
-
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new
|
|
82
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new a(this, this._pluginManager)), this._pluginManager;
|
|
83
83
|
}
|
|
84
|
-
static _pluginManager = new
|
|
84
|
+
static _pluginManager = new a(this);
|
|
85
85
|
/**
|
|
86
86
|
* 插件管理器 {@link PluginHost.pluginManager}
|
|
87
87
|
*/
|
|
@@ -152,16 +152,24 @@ class a extends p {
|
|
|
152
152
|
return t instanceof Promise ? t.finally(() => super.destroyThis()) : super.destroyThis();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
class f extends
|
|
155
|
+
class f extends u {
|
|
156
|
+
/**
|
|
157
|
+
* 是否使用独立的选项
|
|
158
|
+
* @defaultValue false
|
|
159
|
+
*/
|
|
160
|
+
static isolatedOptions = !1;
|
|
156
161
|
/**
|
|
157
162
|
* 全局级别的默认选项
|
|
158
163
|
*/
|
|
159
|
-
static modeOptions
|
|
164
|
+
static get modeOptions() {
|
|
165
|
+
return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new n(r, null, this._modeOptions)), this._modeOptions;
|
|
166
|
+
}
|
|
167
|
+
static _modeOptions = new n(r);
|
|
160
168
|
/**
|
|
161
169
|
* 实例级的默认选项
|
|
162
170
|
*/
|
|
163
171
|
get modeOptions() {
|
|
164
|
-
return this._modeOptions || (this._modeOptions = new n(
|
|
172
|
+
return this._modeOptions || (this._modeOptions = new n(r, void 0, this.constructor.modeOptions));
|
|
165
173
|
}
|
|
166
174
|
_modeOptions;
|
|
167
175
|
get mode() {
|
|
@@ -177,16 +185,24 @@ class f extends a {
|
|
|
177
185
|
super(), this.modeOptions.setOption(t);
|
|
178
186
|
}
|
|
179
187
|
}
|
|
180
|
-
class
|
|
188
|
+
class _ extends u {
|
|
189
|
+
/**
|
|
190
|
+
* 是否使用独立的选项
|
|
191
|
+
* @defaultValue false
|
|
192
|
+
*/
|
|
193
|
+
static isolatedOptions = !1;
|
|
181
194
|
/**
|
|
182
195
|
* 全局级别的默认选项
|
|
183
196
|
*/
|
|
184
|
-
static defaultOptions
|
|
197
|
+
static get defaultOptions() {
|
|
198
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new o(this, this._defaultOptions)), this._defaultOptions;
|
|
199
|
+
}
|
|
200
|
+
static _defaultOptions = new o();
|
|
185
201
|
/**
|
|
186
202
|
* 实例级的默认选项
|
|
187
203
|
*/
|
|
188
204
|
get defaultOptions() {
|
|
189
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
205
|
+
return this._defaultOptions || (this._defaultOptions = new o(void 0, this.constructor.defaultOptions));
|
|
190
206
|
}
|
|
191
207
|
_defaultOptions;
|
|
192
208
|
constructor(t) {
|
|
@@ -194,12 +210,12 @@ class m extends a {
|
|
|
194
210
|
}
|
|
195
211
|
}
|
|
196
212
|
export {
|
|
197
|
-
|
|
213
|
+
u as PluginHostEventEmitter,
|
|
198
214
|
P as TierModeOptionsPluginHost,
|
|
199
215
|
f as TierModeOptionsPluginHostEventEmitter,
|
|
200
216
|
D as TierOptionsPluginHost,
|
|
201
|
-
|
|
202
|
-
|
|
217
|
+
_ as TierOptionsPluginHostEventEmitter,
|
|
218
|
+
r as commonModeName,
|
|
203
219
|
T as createTierModeOptionsPluginHost,
|
|
204
220
|
E as createTierOptionsPluginHost
|
|
205
221
|
};
|
package/dist/index-web.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-D2REw5Vz.cjs");if(!globalThis.CustomEvent){class e extends Event{detail;constructor(s,n){super(s,n),this.detail=n?.detail}}globalThis.CustomEvent=e}class h extends EventTarget{addEventListener(t,s,n){const r=n?.times;if(r){const o=typeof s=="function"?s:s?.handleEvent;if(o)return this.multipleListen(t,o,r)}return super.addEventListener(t,s,n),()=>{this.removeEventListener(t,s,n)}}dispatchEvent(t,s){const n=t instanceof Event?t:new CustomEvent(t,{detail:s,bubbles:!1,cancelable:!0,composed:!1});return super.dispatchEvent(n)}onceListen(t,s,n){return this.addEventListener(t,s,{...n,once:!0})}multipleListen(t,s,n){let r=0;const o=new AbortController,l=o.signal;return super.addEventListener(t,d=>{++r>=n&&o.abort(),s.call(this,d)},{signal:l}),function(){o.abort()}}}var c=class extends h{refCount=0;get isDestroyed(){return this._isDestroyed}_isDestroyed=!1;get canDestroy(){return!this.isDestroyed&&this.refCount<=0}_destroyers=[];disposeFun(e){return this._destroyers.push(e),e}cancelDisposeFun(e){let t=this._destroyers.indexOf(e);return this._destroyers.splice(t,1),e}disposeObj(e,t){let s=t?function(){return e.destroySync()}:function(){return e.destroy()};return this.disposeFun(s),e.__destroyable_destroyer=s,e}cancelDisposeObj(e){let t=e.__destroyable_destroyer;return t&&this.cancelDisposeFun(t),e}dispose(e,t){return typeof e=="function"?this.disposeFun(e):this.disposeObj(e,t)}cancelDispose(e){return typeof e=="function"?this.cancelDisposeFun(e):this.cancelDisposeObj(e)}destroyThis(){}destroySync(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.length;for(;--e>=0;){let t=this._destroyers[e];try{t()}catch(s){console.error("销毁函数在同步销毁时出错",this,t,s)}}this._destroyers.length=0;try{this.destroyThis()}catch(t){console.error("destroyThis 在异步销毁时出错",this,t)}return a.a(this),!0}destroy(){if(!this.canDestroy)return this.isDestroyed;let e=this._destroyers.toReversed();e.push(this.destroyThis),this._destroyers.length=0;let t=p.serialCallAllFuns(e,this,null,(s,n)=>{console.error("销毁函数在串行销毁时出错",this,n,s)});return t instanceof Promise?t.then(()=>(a.a(this),!0)):(a.a(this),!0)}};class u extends c{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new i.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new i.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(t,...s){return this.pluginManager.usePlugin(t,...s)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}usePlugin(t,...s){return this.pluginManager.instUsePlugin(this,t,...s)}useExtend(t,...s){return this.pluginManager.instUseExtend(this,t,...s)}init(...t){return this.pluginManager.onInit(this,...t)}destroyThis(){const t=this.pluginManager.onDestroy(this);return t instanceof Promise?t.finally(()=>super.destroyThis()):super.destroyThis()}}class g extends u{static isolatedOptions=!1;static get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new i.TierModeOptions(i.commonModeName,null,this._modeOptions)),this._modeOptions}static _modeOptions=new i.TierModeOptions(i.commonModeName);get modeOptions(){return this._modeOptions||(this._modeOptions=new i.TierModeOptions(i.commonModeName,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(t){this.modeOptions.mode=t}get options(){return this.modeOptions.plainFullOption}constructor(t){super(),this.modeOptions.setOption(t)}}class O extends u{static isolatedOptions=!1;static get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new i.TierOptions(this,this._defaultOptions)),this._defaultOptions}static _defaultOptions=new i.TierOptions;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new i.TierOptions(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(t){super(),this.defaultOptions.option=t}}exports.TierModeOptionsPluginHost=i.TierModeOptionsPluginHost;exports.TierOptionsPluginHost=i.TierOptionsPluginHost;exports.commonModeName=i.commonModeName;exports.createTierModeOptionsPluginHost=i.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=i.createTierOptionsPluginHost;exports.PluginHostEventTarget=u;exports.TierModeOptionsPluginHostEventTarget=g;exports.TierOptionsPluginHostEventTarget=O;
|
package/dist/index-web.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { a as o } from "./Destroyable-mrBsNabq-D6TYs3Zn.js";
|
|
2
2
|
import { serialCallAllFuns as g } from "com-tools";
|
|
3
|
-
import { P as
|
|
4
|
-
import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-
|
|
3
|
+
import { P as d, T as a, c as u, d as l } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
4
|
+
import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
5
5
|
if (!globalThis.CustomEvent) {
|
|
6
|
-
class
|
|
6
|
+
class s extends Event {
|
|
7
7
|
detail;
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
8
|
+
constructor(e, i) {
|
|
9
|
+
super(e, i), this.detail = i?.detail;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
globalThis.CustomEvent =
|
|
12
|
+
globalThis.CustomEvent = s;
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class f extends EventTarget {
|
|
15
15
|
/**
|
|
16
16
|
* 添加事件监听器;会返回一个用于移除事件监听器的函数;
|
|
17
17
|
* @remarks
|
|
@@ -23,20 +23,20 @@ class y extends EventTarget {
|
|
|
23
23
|
* @param options - 选项
|
|
24
24
|
* @returns 返回用于移除事件监听器的函数; 也可以通过 `EventTarget#removeEventListener` 方法移除
|
|
25
25
|
*/
|
|
26
|
-
addEventListener(t,
|
|
27
|
-
const r =
|
|
26
|
+
addEventListener(t, e, i) {
|
|
27
|
+
const r = i?.times;
|
|
28
28
|
if (r) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
return this.multipleListen(t,
|
|
29
|
+
const n = typeof e == "function" ? e : e?.handleEvent;
|
|
30
|
+
if (n)
|
|
31
|
+
return this.multipleListen(t, n, r);
|
|
32
32
|
}
|
|
33
|
-
return super.addEventListener(t,
|
|
34
|
-
this.removeEventListener(t,
|
|
33
|
+
return super.addEventListener(t, e, i), () => {
|
|
34
|
+
this.removeEventListener(t, e, i);
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
dispatchEvent(t,
|
|
38
|
-
const
|
|
39
|
-
return super.dispatchEvent(
|
|
37
|
+
dispatchEvent(t, e) {
|
|
38
|
+
const i = t instanceof Event ? t : new CustomEvent(t, { detail: e, bubbles: !1, cancelable: !0, composed: !1 });
|
|
39
|
+
return super.dispatchEvent(i);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* 添加一次性的事件监听器;
|
|
@@ -49,8 +49,8 @@ class y extends EventTarget {
|
|
|
49
49
|
* @param options - 选项
|
|
50
50
|
* @returns removeEventListener():void; 返回用于移除一次性事件监听器的函数; 也可以通过 EventTarget 的 removeEventListener 方法移除
|
|
51
51
|
*/
|
|
52
|
-
onceListen(t,
|
|
53
|
-
return this.addEventListener(t,
|
|
52
|
+
onceListen(t, e, i) {
|
|
53
|
+
return this.addEventListener(t, e, { ...i, once: !0 });
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* 添加监听指定次数的事件监听器;
|
|
@@ -63,17 +63,17 @@ class y extends EventTarget {
|
|
|
63
63
|
* @param times 需要监听的次数,如果小于 1 ,永远不会自动移除事件监听器,需要手动移除
|
|
64
64
|
* @returns removeEventListener():void; 返回用于移除事件监听器的函数; 不能通过 EventTarget 的 removeEventListener 方法移除
|
|
65
65
|
*/
|
|
66
|
-
multipleListen(t,
|
|
66
|
+
multipleListen(t, e, i) {
|
|
67
67
|
let r = 0;
|
|
68
|
-
const
|
|
68
|
+
const n = new AbortController(), p = n.signal;
|
|
69
69
|
return super.addEventListener(t, (c) => {
|
|
70
|
-
++r >=
|
|
70
|
+
++r >= i && n.abort(), e.call(this, c);
|
|
71
71
|
}, { signal: p }), function() {
|
|
72
|
-
|
|
72
|
+
n.abort();
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
var
|
|
76
|
+
var O = class extends f {
|
|
77
77
|
refCount = 0;
|
|
78
78
|
get isDestroyed() {
|
|
79
79
|
return this._isDestroyed;
|
|
@@ -83,42 +83,42 @@ var f = class extends y {
|
|
|
83
83
|
return !this.isDestroyed && this.refCount <= 0;
|
|
84
84
|
}
|
|
85
85
|
_destroyers = [];
|
|
86
|
-
disposeFun(
|
|
87
|
-
return this._destroyers.push(
|
|
86
|
+
disposeFun(s) {
|
|
87
|
+
return this._destroyers.push(s), s;
|
|
88
88
|
}
|
|
89
|
-
cancelDisposeFun(
|
|
90
|
-
let t = this._destroyers.indexOf(
|
|
91
|
-
return this._destroyers.splice(t, 1),
|
|
89
|
+
cancelDisposeFun(s) {
|
|
90
|
+
let t = this._destroyers.indexOf(s);
|
|
91
|
+
return this._destroyers.splice(t, 1), s;
|
|
92
92
|
}
|
|
93
|
-
disposeObj(
|
|
94
|
-
let
|
|
95
|
-
return
|
|
93
|
+
disposeObj(s, t) {
|
|
94
|
+
let e = t ? function() {
|
|
95
|
+
return s.destroySync();
|
|
96
96
|
} : function() {
|
|
97
|
-
return
|
|
97
|
+
return s.destroy();
|
|
98
98
|
};
|
|
99
|
-
return this.disposeFun(
|
|
99
|
+
return this.disposeFun(e), s.__destroyable_destroyer = e, s;
|
|
100
100
|
}
|
|
101
|
-
cancelDisposeObj(
|
|
102
|
-
let t =
|
|
103
|
-
return t && this.cancelDisposeFun(t),
|
|
101
|
+
cancelDisposeObj(s) {
|
|
102
|
+
let t = s.__destroyable_destroyer;
|
|
103
|
+
return t && this.cancelDisposeFun(t), s;
|
|
104
104
|
}
|
|
105
|
-
dispose(
|
|
106
|
-
return typeof
|
|
105
|
+
dispose(s, t) {
|
|
106
|
+
return typeof s == "function" ? this.disposeFun(s) : this.disposeObj(s, t);
|
|
107
107
|
}
|
|
108
|
-
cancelDispose(
|
|
109
|
-
return typeof
|
|
108
|
+
cancelDispose(s) {
|
|
109
|
+
return typeof s == "function" ? this.cancelDisposeFun(s) : this.cancelDisposeObj(s);
|
|
110
110
|
}
|
|
111
111
|
destroyThis() {
|
|
112
112
|
}
|
|
113
113
|
destroySync() {
|
|
114
114
|
if (!this.canDestroy) return this.isDestroyed;
|
|
115
|
-
let
|
|
116
|
-
for (; --
|
|
117
|
-
let t = this._destroyers[
|
|
115
|
+
let s = this._destroyers.length;
|
|
116
|
+
for (; --s >= 0; ) {
|
|
117
|
+
let t = this._destroyers[s];
|
|
118
118
|
try {
|
|
119
119
|
t();
|
|
120
|
-
} catch (
|
|
121
|
-
console.error("销毁函数在同步销毁时出错", this, t,
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.error("销毁函数在同步销毁时出错", this, t, e);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
this._destroyers.length = 0;
|
|
@@ -131,15 +131,15 @@ var f = class extends y {
|
|
|
131
131
|
}
|
|
132
132
|
destroy() {
|
|
133
133
|
if (!this.canDestroy) return this.isDestroyed;
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
let t = g(
|
|
137
|
-
console.error("销毁函数在串行销毁时出错", this,
|
|
134
|
+
let s = this._destroyers.toReversed();
|
|
135
|
+
s.push(this.destroyThis), this._destroyers.length = 0;
|
|
136
|
+
let t = g(s, this, null, (e, i) => {
|
|
137
|
+
console.error("销毁函数在串行销毁时出错", this, i, e);
|
|
138
138
|
});
|
|
139
139
|
return t instanceof Promise ? t.then(() => (o(this), !0)) : (o(this), !0);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
class h extends
|
|
142
|
+
class h extends O {
|
|
143
143
|
/**
|
|
144
144
|
* 是否使用独立的插件管理器
|
|
145
145
|
* @defaultValue false
|
|
@@ -149,9 +149,9 @@ class h extends f {
|
|
|
149
149
|
* 插件管理器
|
|
150
150
|
*/
|
|
151
151
|
static get pluginManager() {
|
|
152
|
-
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new
|
|
152
|
+
return this.isolatedPluginManager && !this.hasOwnProperty("_pluginManager") && (this._pluginManager = new d(this, this._pluginManager)), this._pluginManager;
|
|
153
153
|
}
|
|
154
|
-
static _pluginManager = new
|
|
154
|
+
static _pluginManager = new d(this);
|
|
155
155
|
/**
|
|
156
156
|
* 插件管理器 {@link PluginHost.pluginManager}
|
|
157
157
|
*/
|
|
@@ -161,8 +161,8 @@ class h extends f {
|
|
|
161
161
|
/**
|
|
162
162
|
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
163
163
|
*/
|
|
164
|
-
static usePlugin(t, ...
|
|
165
|
-
return this.pluginManager.usePlugin(t, ...
|
|
164
|
+
static usePlugin(t, ...e) {
|
|
165
|
+
return this.pluginManager.usePlugin(t, ...e);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* {@inheritDoc PluginExtendManager.useExtend}
|
|
@@ -195,14 +195,14 @@ class h extends f {
|
|
|
195
195
|
* @param args
|
|
196
196
|
* @returns
|
|
197
197
|
*/
|
|
198
|
-
usePlugin(t, ...
|
|
199
|
-
return this.pluginManager.instUsePlugin(this, t, ...
|
|
198
|
+
usePlugin(t, ...e) {
|
|
199
|
+
return this.pluginManager.instUsePlugin(this, t, ...e);
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* {@inheritDoc PluginExtendManager.useExtend}
|
|
203
203
|
*/
|
|
204
|
-
useExtend(t, ...
|
|
205
|
-
return this.pluginManager.instUseExtend(this, t, ...
|
|
204
|
+
useExtend(t, ...e) {
|
|
205
|
+
return this.pluginManager.instUseExtend(this, t, ...e);
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* 初始化实例
|
|
@@ -223,15 +223,23 @@ class h extends f {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
class M extends h {
|
|
226
|
+
/**
|
|
227
|
+
* 是否使用独立的选项
|
|
228
|
+
* @defaultValue false
|
|
229
|
+
*/
|
|
230
|
+
static isolatedOptions = !1;
|
|
226
231
|
/**
|
|
227
232
|
* 全局级别的默认选项
|
|
228
233
|
*/
|
|
229
|
-
static modeOptions
|
|
234
|
+
static get modeOptions() {
|
|
235
|
+
return this.isolatedOptions && !this.hasOwnProperty("_modeOptions") && (this._modeOptions = new a(u, null, this._modeOptions)), this._modeOptions;
|
|
236
|
+
}
|
|
237
|
+
static _modeOptions = new a(u);
|
|
230
238
|
/**
|
|
231
239
|
* 实例级的默认选项
|
|
232
240
|
*/
|
|
233
241
|
get modeOptions() {
|
|
234
|
-
return this._modeOptions || (this._modeOptions = new u
|
|
242
|
+
return this._modeOptions || (this._modeOptions = new a(u, void 0, this.constructor.modeOptions));
|
|
235
243
|
}
|
|
236
244
|
_modeOptions;
|
|
237
245
|
get mode() {
|
|
@@ -248,15 +256,23 @@ class M extends h {
|
|
|
248
256
|
}
|
|
249
257
|
}
|
|
250
258
|
class v extends h {
|
|
259
|
+
/**
|
|
260
|
+
* 是否使用独立的选项
|
|
261
|
+
* @defaultValue false
|
|
262
|
+
*/
|
|
263
|
+
static isolatedOptions = !1;
|
|
251
264
|
/**
|
|
252
265
|
* 全局级别的默认选项
|
|
253
266
|
*/
|
|
254
|
-
static defaultOptions
|
|
267
|
+
static get defaultOptions() {
|
|
268
|
+
return this.isolatedOptions && !this.hasOwnProperty("_defaultOptions") && (this._defaultOptions = new l(this, this._defaultOptions)), this._defaultOptions;
|
|
269
|
+
}
|
|
270
|
+
static _defaultOptions = new l();
|
|
255
271
|
/**
|
|
256
272
|
* 实例级的默认选项
|
|
257
273
|
*/
|
|
258
274
|
get defaultOptions() {
|
|
259
|
-
return this._defaultOptions || (this._defaultOptions = new
|
|
275
|
+
return this._defaultOptions || (this._defaultOptions = new l(void 0, this.constructor.defaultOptions));
|
|
260
276
|
}
|
|
261
277
|
_defaultOptions;
|
|
262
278
|
constructor(t) {
|
|
@@ -269,7 +285,7 @@ export {
|
|
|
269
285
|
M as TierModeOptionsPluginHostEventTarget,
|
|
270
286
|
D as TierOptionsPluginHost,
|
|
271
287
|
v as TierOptionsPluginHostEventTarget,
|
|
272
|
-
|
|
288
|
+
u as commonModeName,
|
|
273
289
|
b as createTierModeOptionsPluginHost,
|
|
274
290
|
x as createTierOptionsPluginHost
|
|
275
291
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-D2REw5Vz.cjs"),g=require("type-tls");function m(r,t){return t}function M(r){return function(e){return e}}function O(r,t){return n.mixin(r.prototype,t),t}function P(r){return function(e){return n.mixin(r.prototype,e),e}}function y(r,t){return n.mixin(r.prototype,t),r}function T(r){return function(e){return n.mixin(r.prototype,e),r}}class E extends h.Destroyable{parent;host;plugins=new Map;constructor(t,e){super(),this.parent=e,t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.parent?.hasUsed(t)||this.plugins.has(t)}getUseReturn(t){const{parent:e}=this;return e?.hasUsed(t)?e.getUseReturn(t):this.plugins.get(t)}use(t,...e){if(this.hasUsed(t))return this.getUseReturn(t);const i=t.onUse(this.host,...e);return this.plugins.set(t,i),i}instUse(t,e,...i){const{plugins:s}=this;if(this.hasUsed(e))return this.getUseReturn(e);const o=this.use(e,...i);return e.onCreate?.(t),o}onCreate(t,...e){const i=this.parent?.onCreate(t,...e),s=[];for(const[o]of this.plugins)o.onCreate&&s.push(o.onCreate.bind(o));return g.waitAsyncable(i,()=>p.serialCallFuns(s,void 0,[t,...e]))}onInit(t,...e){const i=this.parent?.onInit(t,...e),s=[];for(const[o]of this.plugins)o.onInit&&s.push(o.onInit.bind(o));return g.waitAsyncable(i,()=>p.serialCallFuns(s,void 0,[t,...e]))}onDestroy(t){const e=[];for(const[o]of this.plugins)o.onDestroy&&e.push(o.onDestroy.bind(o));e.reverse();const i=p.serialCallFuns(e,void 0,[t]),{parent:s}=this;return s?g.waitAsyncable(i,()=>s.onDestroy(t)):i}}class b extends h.Destroyable{parent;host;plugins=new Set;constructor(t,e){super(),this.parent=e,t&&(this.host=t)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(t){return this.parent?.hasUsed(t)||this.plugins.has(t)}use(t){return this.hasUsed(t)||(n.mixinIExtend(this.host.prototype,t),this.plugins.add(t)),t}instUse(t,e,...i){return this.hasUsed(e)||(this.use(e),e.onCreate?.call(t,t,...i)),e}onCreate(t,...e){const i=this.parent?.onCreate(t,...e),s=[];for(const o of this.plugins)o.onCreate&&s.push(o.onCreate);return g.waitAsyncable(i,()=>p.serialCallFuns(s,t,[t,...e]))}onInit(t,...e){const i=this.parent?.onInit(t,...e),s=[];for(const o of this.plugins)o.onInit&&s.push(o.onInit);return g.waitAsyncable(i,()=>p.serialCallFuns(s,t,[t,...e]))}onDestroy(t){const e=[];for(const o of this.plugins)o.onDestroy&&e.push(o.onDestroy);e.reverse();const i=p.serialCallFuns(e,t,[t]),{parent:s}=this;return s?g.waitAsyncable(i,()=>s.onDestroy(t)):i}}function d(r,t){const e=[{target:r,props:t}];let i;for(;i=e.shift();){const{target:s,props:o}=i;for(const[u,a]of Object.entries(o)){if(a!=null&&typeof a=="object"&&(!a.constructor||a.constructor===Object)){e.push({target:s[u],props:a});continue}s[u]=a}}return r}function f(r,t){const e={},i=[{target:r,props:t,targetProps:e}];let s;for(;s=i.shift();){const{target:o,props:u,targetProps:a}=s;for(const[c,l]of Object.entries(u)){if(l!=null&&typeof l=="object"&&(!l.constructor||l.constructor===Object)){i.push({target:o[c],props:l,targetProps:a[c]={}});continue}a[c]=o[c]}}return e}function w(r,t){const e=f(r,t);function i(){d(r,t)}function s(){d(r,e)}return{set:i,unset:s}}function U(r,t){const e=t??"defaultOptions",i=`_${e}`;return function(o){const u=n.mixinTarget(o,{get[e](){return r}});n.mixinTarget(u.prototype,{get[e](){return this[i]||(this[i]=structuredClone(u.defaultOptions))}})}}function C(r,t,e){const i=`_${t}`;return n.mixinTarget(r.prototype,{get[t](){return this[i]||(this[i]=structuredClone(r[t]))}}),e}function D(r,t,e){const i=n.mixinTarget(r,{modeOptions:new n.TierModeOptions(t,e)});return n.mixinTarget(i.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new n.TierModeOptions(t,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){this.modeOptions.mode=s},get options(){return this.modeOptions.fullOption}}),r}const _={onUse(r,t,e){const i=t??n.commonModeName;n.mixin(r,{modeOptions:new n.TierModeOptions(i,void 0,e)}),n.mixin(r.prototype,{get modeOptions(){const s=this,o=r;return s._modeOptions||(s._modeOptions=new n.TierModeOptions(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(s){const o=this;o.modeOptions.mode=s},get options(){return this.modeOptions.plainFullOption}})},onCreate(r,t){r.modeOptions.setOption(t)}},H={onUse(r,t,e){n.mixin(r,{defaultOptions:new n.TierOptions(t,e)}),n.mixin(r.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,r.defaultOptions))}})},onCreate(r,t){r.defaultOptions.option=t}};function I(r,t){const e=n.mixinTarget(r,{defaultOptions:new n.TierOptions(t)});return n.mixinTarget(e.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,this.constructor.defaultOptions))}}),r}function x(r){const t=n.mixinTarget(r,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager},usePlugin(e,...i){return this.pluginManager.usePlugin(e,...i)},useExtend(e){return this.pluginManager.useExtend(e)},hasUsed(e){return this.pluginManager.hasUsed(e)}});return n.mixinTarget(t.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(e,...i){return this.pluginManager.instUsePlugin(this,e,...i)},useExtend(e,...i){return this.pluginManager.instUseExtend(this,e,...i)},async init(...e){return super.init&&await super.init(...e),this.pluginManager.onInit(this,...e)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),r}function v(r){const t=x(r);return new Proxy(t,{construct:function(e,i,s){const o=new e(...i);return t.pluginManager.onCreate(this,...i),o}})}function j(r){return class extends r{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager}static _pluginManager=new n.PluginExtendManager(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(e,...i){return this.pluginManager.usePlugin(e,...i)}static useExtend(e){return this.pluginManager.useExtend(e)}static hasUsed(e){return this.pluginManager.hasUsed(e)}constructor(...e){super(...e),this.pluginManager.onCreate(this,...e)}usePlugin(e,...i){return this.pluginManager.instUsePlugin(this,e,...i)}useExtend(e,...i){return this.pluginManager.instUseExtend(this,e,...i)}init(...e){if(super.init){const i=super.init(...e);if(i instanceof Promise)return i.then(()=>this.pluginManager.onInit(this,...e))}return this.pluginManager.onInit(this,...e)}destroy(){const e=this.pluginManager.onDestroy(this);return super.destroy?e instanceof Promise?e.finally(()=>super.destroy()):super.destroy():e}}}exports.ModeOptions=n.ModeOptions;exports.PluginExtendManager=n.PluginExtendManager;exports.PluginHost=n.PluginHost;exports.TierModeOptions=n.TierModeOptions;exports.TierModeOptionsPluginHost=n.TierModeOptionsPluginHost;exports.TierOptions=n.TierOptions;exports.TierOptionsPluginHost=n.TierOptionsPluginHost;exports.commonModeName=n.commonModeName;exports.createDefineIExtend=n.createDefineIExtend;exports.createDefineMixin=n.createDefineMixin;exports.createIExtendTarget=n.createIExtendTarget;exports.createMixinTarget=n.createMixinTarget;exports.createPluginHost=n.createPluginHost;exports.createTargetIExtend=n.createTargetIExtend;exports.createTargetMixin=n.createTargetMixin;exports.createTierModeOptionsPluginHost=n.createTierModeOptionsPluginHost;exports.createTierOptionsPluginHost=n.createTierOptionsPluginHost;exports.defineIExtend=n.defineIExtend;exports.defineMixin=n.defineMixin;exports.extendMark=n.extendMark;exports.getPropertyValue=n.getPropertyValue;exports.getPropertyValueByPath=n.getPropertyValueByPath;exports.iextendTarget=n.iextendTarget;exports.isPlugin=n.isPlugin;exports.mixin=n.mixin;exports.mixinByOmit=n.mixinByOmit;exports.mixinByPick=n.mixinByPick;exports.mixinIExtend=n.mixinIExtend;exports.mixinTarget=n.mixinTarget;exports.parsePropertyPath=n.parsePropertyPath;exports.pickHostExtendMembers=n.pickHostExtendMembers;exports.setPropertyValue=n.setPropertyValue;exports.setPropertyValueByPath=n.setPropertyValueByPath;exports.targetIExtend=n.targetIExtend;exports.targetMixin=n.targetMixin;exports.tierModeOptionsDecorator=n.tierModeOptionsDecorator;exports.tierOptionsDecorator=n.tierOptionsDecorator;exports.ExtendManager=b;exports.PluginManager=E;exports.addDefaultOptions=U;exports.addInstOptions=C;exports.becomePluginHost=x;exports.becomePluginHost_Extends=j;exports.becomePluginHost_Proxy=v;exports.becomeTierModeOptionsHost=D;exports.becomeTierOptionsHost=I;exports.createDefineExtend=M;exports.createExtendTarget=T;exports.createPropertySetter=w;exports.createTargetExtend=P;exports.defineExtend=m;exports.extendTarget=y;exports.getTargetProperties=f;exports.mergeProperties=d;exports.targetExtend=O;exports.tierModeOptionsPlugin=_;exports.tierOptionsPlugin=H;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Destroyable as O } from "@gby/destroyable";
|
|
2
2
|
import { serialCallFuns as c } from "com-tools";
|
|
3
|
-
import { m as a, a as y, b as u, T as d, c as P, d as f, P as M } from "./createTierModeOptionsPluginHost-
|
|
4
|
-
import { M as J, e as Q, f as X, g as Y, h as Z, i as L, j as K, k as tt, l as et, n as nt, o as st, p as rt, q as it, r as ot, s as ut, t as at, u as pt, v as ct, w as gt, x as lt, y as ht, z as dt, A as ft, B as Mt, C as mt, D as Ot, E as yt, F as Pt, G as xt, H as Tt } from "./createTierModeOptionsPluginHost-
|
|
3
|
+
import { m as a, a as y, b as u, T as d, c as P, d as f, P as M } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
4
|
+
import { M as J, e as Q, f as X, g as Y, h as Z, i as L, j as K, k as tt, l as et, n as nt, o as st, p as rt, q as it, r as ot, s as ut, t as at, u as pt, v as ct, w as gt, x as lt, y as ht, z as dt, A as ft, B as Mt, C as mt, D as Ot, E as yt, F as Pt, G as xt, H as Tt } from "./createTierModeOptionsPluginHost-Bvne8SqN.js";
|
|
5
5
|
import { waitAsyncable as g } from "type-tls";
|
|
6
6
|
function C(s, e) {
|
|
7
7
|
return e;
|
|
@@ -12,10 +12,16 @@ import type { EventMap } from "@gby/destroyable";
|
|
|
12
12
|
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.created(this)` 不是在最后的执行;
|
|
13
13
|
*/
|
|
14
14
|
export declare class TierModeOptionsPluginHost<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, Mode extends string | number = string, EM extends EventMap<EM> = any> extends PluginHost<Host, HostClass, EM> {
|
|
15
|
+
/**
|
|
16
|
+
* 是否使用独立的选项
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
*/
|
|
19
|
+
static isolatedOptions: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* 全局级别的默认选项
|
|
17
22
|
*/
|
|
18
|
-
static
|
|
23
|
+
static get modeOptions(): TierModeOptions<string, any>;
|
|
24
|
+
static _modeOptions: TierModeOptions<string, any>;
|
|
19
25
|
/**
|
|
20
26
|
* 实例级的默认选项
|
|
21
27
|
*/
|
package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierModeOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TierModeOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD;;;;;;;;GAQG;AACH,qBAAa,yBAAyB,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAEjP;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,WAAW,iCAKrB;IACD,MAAM,CAAC,YAAY,+BAAoD;IAGvE;;OAEG;IACH,IAAI,WAAW,mCAEd;IACD,SAAS,CAAC,YAAY,EAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAExD,IAAI,IAAI,SAEP;IACD,IAAI,IAAI,CAAC,KAAK,MAAA,EAEb;IAED,IAAI,OAAO,YAEV;gBAGW,OAAO,EAAE,OAAO;CAI7B"}
|
|
@@ -12,10 +12,16 @@ import type { EventMap } from "@gby/destroyable";
|
|
|
12
12
|
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.created(this)` 不是在最后的执行;
|
|
13
13
|
*/
|
|
14
14
|
export declare class TierModeOptionsPluginHostEventEmitter<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, Mode extends string | number = string, EM extends EventMap<EM> = any> extends PluginHostEventEmitter<Host, HostClass, EM> {
|
|
15
|
+
/**
|
|
16
|
+
* 是否使用独立的选项
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
*/
|
|
19
|
+
static isolatedOptions: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* 全局级别的默认选项
|
|
17
22
|
*/
|
|
18
|
-
static
|
|
23
|
+
static get modeOptions(): TierModeOptions<string, any>;
|
|
24
|
+
static _modeOptions: TierModeOptions<string, any>;
|
|
19
25
|
/**
|
|
20
26
|
* 实例级的默认选项
|
|
21
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierModeOptionsPluginHostEventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD;;;;;;;;GAQG;AACH,qBAAa,qCAAqC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACzQ;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"TierModeOptionsPluginHostEventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAErF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD;;;;;;;;GAQG;AACH,qBAAa,qCAAqC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACzQ;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,WAAW,iCAKrB;IACD,MAAM,CAAC,YAAY,+BAAoD;IAEvE;;OAEG;IACH,IAAI,WAAW,mCAEd;IACD,SAAS,CAAC,YAAY,EAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAExD,IAAI,IAAI,SAEP;IACD,IAAI,IAAI,CAAC,KAAK,MAAA,EAEb;IAED,IAAI,OAAO,YAEV;gBAGW,OAAO,EAAE,OAAO;CAI7B"}
|
package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.d.ts
CHANGED
|
@@ -11,10 +11,16 @@ import type { AbstractConstructor, ClassType } from "type-tls";
|
|
|
11
11
|
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.created(this)` 不是在最后的执行;
|
|
12
12
|
*/
|
|
13
13
|
export declare class TierModeOptionsPluginHostEventTarget<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, Mode extends string | number = string, EM extends Record<string, any> = Record<string, any>> extends PluginHostEventTarget<Host, HostClass, EM> {
|
|
14
|
+
/**
|
|
15
|
+
* 是否使用独立的选项
|
|
16
|
+
* @defaultValue false
|
|
17
|
+
*/
|
|
18
|
+
static isolatedOptions: boolean;
|
|
14
19
|
/**
|
|
15
20
|
* 全局级别的默认选项
|
|
16
21
|
*/
|
|
17
|
-
static
|
|
22
|
+
static get modeOptions(): TierModeOptions<string, any>;
|
|
23
|
+
static _modeOptions: TierModeOptions<string, any>;
|
|
18
24
|
/**
|
|
19
25
|
* 实例级的默认选项
|
|
20
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierModeOptionsPluginHostEventTarget.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAI9D;;;;;;;;GAQG;AACH,qBAAa,oCAAoC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAE,SAAQ,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAC7R;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"TierModeOptionsPluginHostEventTarget.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHostEventTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAI9D;;;;;;;;GAQG;AACH,qBAAa,oCAAoC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAE,SAAQ,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAC7R;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,WAAW,iCAKrB;IACD,MAAM,CAAC,YAAY,+BAAoD;IAEvE;;OAEG;IACH,IAAI,WAAW,mCAEd;IACD,SAAS,CAAC,YAAY,EAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAExD,IAAI,IAAI,SAEP;IACD,IAAI,IAAI,CAAC,KAAK,MAAA,EAEb;IAED,IAAI,OAAO,YAEV;gBAGW,OAAO,EAAE,OAAO;CAI7B"}
|
package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts
CHANGED
|
@@ -47,10 +47,16 @@ export declare function createTierModeOptionsPluginHost<P extends new (...args:
|
|
|
47
47
|
isPrototypeOf: ((v: Object) => boolean) & ((v: Object) => boolean);
|
|
48
48
|
propertyIsEnumerable: ((v: PropertyKey) => boolean) & ((v: PropertyKey) => boolean);
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* 是否使用独立的选项
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
isolatedOptions: boolean;
|
|
50
55
|
/**
|
|
51
56
|
* 全局级别的默认选项
|
|
52
57
|
*/
|
|
53
|
-
|
|
58
|
+
get modeOptions(): TierModeOptions<string, any>;
|
|
59
|
+
_modeOptions: TierModeOptions<string, any>;
|
|
54
60
|
isolatedPluginManager: boolean;
|
|
55
61
|
get pluginManager(): import("../../..").PluginExtendManager<any, any, any>;
|
|
56
62
|
_pluginManager: import("../../..").PluginExtendManager<any, any, any>;
|
package/dist/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTierModeOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG/D;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,EAAC,OAAO,SAAS,EAAE,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC;SAEpH,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"createTierModeOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-mode-options/createTierModeOptionsPluginHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG/D;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,EAAC,OAAO,SAAS,EAAE,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC;SAEpH,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,kCAsCpE,OAAO;QApB5B;;WAEG;;sBAIY,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAvB7C;;;OAGG;;IAGH;;OAEG;;;;;;;;;MAkCN"}
|
|
@@ -6,16 +6,22 @@ import type { EventMap } from "@gby/destroyable";
|
|
|
6
6
|
* 层级选项插件的宿主
|
|
7
7
|
* @remarks
|
|
8
8
|
*
|
|
9
|
-
* 子类需要在构建函数中调用 `this.
|
|
9
|
+
* 子类需要在构建函数中调用 `this.defaultOptions.created(this);`
|
|
10
10
|
*
|
|
11
|
-
* 之所以没写在该类中的函数中,是因为 `this.
|
|
12
|
-
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.
|
|
11
|
+
* 之所以没写在该类中的函数中,是因为 `this.defaultOptions.created(this)` 通常会在构建函数执行的最后时才调用;
|
|
12
|
+
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.defaultOptions.created(this)` 不是在最后的执行;
|
|
13
13
|
*/
|
|
14
14
|
export declare class TierOptionsPluginHost<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, EM extends EventMap<EM> = any> extends PluginHost<Host, HostClass, EM> {
|
|
15
|
+
/**
|
|
16
|
+
* 是否使用独立的选项
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
*/
|
|
19
|
+
static isolatedOptions: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* 全局级别的默认选项
|
|
17
22
|
*/
|
|
18
|
-
static
|
|
23
|
+
static get defaultOptions(): TierOptions<any>;
|
|
24
|
+
static _defaultOptions: TierOptions<any>;
|
|
19
25
|
/**
|
|
20
26
|
* 实例级的默认选项
|
|
21
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHost.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,UAAU,CAAC,IAAI,EAAE,SAAS,EAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"TierOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHost.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOjD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,UAAU,CAAC,IAAI,EAAE,SAAS,EAAC,EAAE,CAAC;IAEpM;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,cAAc,qBAKxB;IACD,MAAM,CAAC,eAAe,mBAA0B;IAEhD;;OAEG;IACH,IAAI,cAAc,yBAEjB;IACD,SAAS,CAAC,eAAe,EAAG,WAAW,CAAC,OAAO,CAAC,CAAC;gBAErC,OAAO,EAAE,OAAO;CAI7B"}
|
package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts
CHANGED
|
@@ -12,10 +12,16 @@ import type { EventMap } from "@gby/destroyable";
|
|
|
12
12
|
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.created(this)` 不是在最后的执行;
|
|
13
13
|
*/
|
|
14
14
|
export declare class TierOptionsPluginHostEventEmitter<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, EM extends EventMap<EM> = any> extends PluginHostEventEmitter<Host, HostClass, EM> {
|
|
15
|
+
/**
|
|
16
|
+
* 是否使用独立的选项
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
*/
|
|
19
|
+
static isolatedOptions: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* 全局级别的默认选项
|
|
17
22
|
*/
|
|
18
|
-
static
|
|
23
|
+
static get defaultOptions(): TierOptions<any>;
|
|
24
|
+
static _defaultOptions: TierOptions<any>;
|
|
19
25
|
/**
|
|
20
26
|
* 实例级的默认选项
|
|
21
27
|
*/
|
package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierOptionsPluginHostEventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD;;;;;;;;GAQG;AACH,qBAAa,iCAAiC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAC7N;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"TierOptionsPluginHostEventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHostEventEmitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAC,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD;;;;;;;;GAQG;AACH,qBAAa,iCAAiC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAC7N;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,cAAc,qBAKxB;IACD,MAAM,CAAC,eAAe,mBAA0B;IAGhD;;OAEG;IACH,IAAI,cAAc,yBAEjB;IACD,SAAS,CAAC,eAAe,EAAG,WAAW,CAAC,OAAO,CAAC,CAAC;gBAErC,OAAO,EAAE,OAAO;CAI7B"}
|
|
@@ -11,10 +11,16 @@ import type { AbstractConstructor, ClassType } from "type-tls";
|
|
|
11
11
|
* 如果像下面写在该类的构建函数中,然后子类通过 `super()` 来调用,这样就会导致 `this.pluginManager.created(this)` 不是在最后的执行;
|
|
12
12
|
*/
|
|
13
13
|
export declare class TierOptionsPluginHostEventTarget<Host, HostClass extends AbstractConstructor<Host> = ClassType<Host>, Options extends {} = any, EM extends Record<string, any> = Record<string, any>> extends PluginHostEventTarget<Host, HostClass, EM> {
|
|
14
|
+
/**
|
|
15
|
+
* 是否使用独立的选项
|
|
16
|
+
* @defaultValue false
|
|
17
|
+
*/
|
|
18
|
+
static isolatedOptions: boolean;
|
|
14
19
|
/**
|
|
15
20
|
* 全局级别的默认选项
|
|
16
21
|
*/
|
|
17
|
-
static
|
|
22
|
+
static get defaultOptions(): TierOptions<any>;
|
|
23
|
+
static _defaultOptions: TierOptions<any>;
|
|
18
24
|
/**
|
|
19
25
|
* 实例级的默认选项
|
|
20
26
|
*/
|
package/dist/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TierOptionsPluginHostEventTarget.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAO/D;;;;;;;;GAQG;AACH,qBAAa,gCAAgC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAE,SAAQ,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAClP;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"TierOptionsPluginHostEventTarget.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/TierOptionsPluginHostEventTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAO/D;;;;;;;;GAQG;AACH,qBAAa,gCAAgC,CAAC,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAE,SAAQ,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IAClP;;;OAGG;IACH,MAAM,CAAC,eAAe,UAAS;IAE/B;;OAEG;IACH,MAAM,KAAK,cAAc,qBAKxB;IACD,MAAM,CAAC,eAAe,mBAA0B;IAGhD;;OAEG;IACH,IAAI,cAAc,yBAEjB;IACD,SAAS,CAAC,eAAe,EAAG,WAAW,CAAC,OAAO,CAAC,CAAC;gBAErC,OAAO,EAAE,OAAO;CAI7B"}
|
|
@@ -44,10 +44,16 @@ export declare function createTierOptionsPluginHost<P extends new (...args: any)
|
|
|
44
44
|
isPrototypeOf: ((v: Object) => boolean) & ((v: Object) => boolean);
|
|
45
45
|
propertyIsEnumerable: ((v: PropertyKey) => boolean) & ((v: PropertyKey) => boolean);
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* 是否使用独立的选项
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
isolatedOptions: boolean;
|
|
47
52
|
/**
|
|
48
53
|
* 全局级别的默认选项
|
|
49
54
|
*/
|
|
50
|
-
|
|
55
|
+
get defaultOptions(): TierOptions<any>;
|
|
56
|
+
_defaultOptions: TierOptions<any>;
|
|
51
57
|
isolatedPluginManager: boolean;
|
|
52
58
|
get pluginManager(): import("../../..").PluginExtendManager<any, any, any>;
|
|
53
59
|
_pluginManager: import("../../..").PluginExtendManager<any, any, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTierOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/createTierOptionsPluginHost.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"createTierOptionsPluginHost.d.ts","sourceRoot":"","sources":["../../../../src/options/options-plugin-host/tier-options/createTierOptionsPluginHost.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG/D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,EAAE,OAAO,SAAS,EAAE,EAAE,WAAW,EAAE,CAAC;SAG9E,IAAI,EAAE,SAAS,SAAS,mBAAmB,CAAC,IAAI,CAAC,kCA8BhE,OAAO;QAX5B;;WAEG;;yBAOe,WAAW,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA3BtC;;;OAGG;;IAGH;;OAEG;;;;;;;;;MA2BN"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const x=require("@gby/destroyable"),h=require("deepmerge-ts"),m=require("type-tls"),p=require("com-tools");function u(i,...e){for(const t of e){const n=Object.getOwnPropertyDescriptors(t);Object.defineProperties(i,n)}return i}function E(i,e,t){let n=Object.getOwnPropertyDescriptors(e);return t&&p.omitMembers(n,t),Object.defineProperties(i,n),i}function V(i,e,t){let n=Object.getOwnPropertyDescriptors(e);return t?Object.defineProperties(i,p.removeUndefined(p.pickMembers(n,t))):Object.defineProperties(i,n),i}function N(i,e){return e}function v(i){return function(t){return t}}function H(i,e){return u(i,e),e}function I(i){return function(t){return u(i,t),t}}function k(i,e){return u(i,e),i}function C(i){return function(t){return u(i,t),i}}const T=["onCreate","onInit","onDestroy"];function j(i){const e={...i};for(const t of T)typeof e[t]=="function"&&delete e[t];return e}function U(i,e){let t=Object.getOwnPropertyDescriptors(e);for(const n of T)typeof e[n]=="function"&&delete t[n];return Object.defineProperties(i,t),i}function S(i,e){return e}function B(i){return function(t){return t}}function R(i,e){return u(i.prototype,e),e}function A(i){return function(t){return u(i.prototype,t),t}}function q(i,e){return u(i.prototype,e),i}function z(i){return function(t){return u(i.prototype,t),i}}function F(i){return i&&typeof i.onUse=="function"}const d=Symbol("extend");class g extends x.Destroyable{parent;host;plugins=new Map;constructor(e,t){super(),this.parent=t,e&&(this.host=e)}destroyThis(){return this.plugins.clear(),this.host=null,super.destroyThis()}hasUsed(e){return this.parent?.hasUsed(e)||this.plugins.has(e)}getUseReturn(e){const{parent:t}=this;return t?.hasUsed(e)?t.getUseReturn(e):this.plugins.get(e)}isPlugin(e){return this.hasUsed(e)?this.getUseReturn(e)!==d:F(e)}useExtend(e){return this.hasUsed(e)||(U(this.host.prototype,e),this.plugins.set(e,d)),e}instUseExtend(e,t,...n){return this.hasUsed(t)||(this.useExtend(t),t.onCreate?.call(e,e,...n)),t}usePlugin(e,...t){if(this.hasUsed(e))return this.getUseReturn(e);const n=e.onUse(this.host,...t);return this.plugins.set(e,n),n}instUsePlugin(e,t,...n){if(this.hasUsed(t))return this.getUseReturn(t);const s=this.usePlugin(t,...n);return t.onCreate?.(e),s}onCreate(e,...t){const n=this.parent?.onCreate(e,...t),s=[];for(const[r,o]of this.plugins)if(r.onCreate){const a=o===d?r.onCreate:r.onCreate.bind(r);s.push(a)}return m.waitAsyncable(n,()=>p.serialCallFuns(s,e,[e,...t]))}onInit(e,...t){const n=this.parent?.onInit(e,...t),s=[];for(const[r,o]of this.plugins)if(r.onInit){const a=o===d?r.onInit:r.onInit.bind(r);s.push(a)}return m.waitAsyncable(n,()=>p.serialCallFuns(s,e,[e,...t]))}onDestroy(e){const t=[];for(const[r,o]of this.plugins)if(r.onDestroy){const a=o===d?r.onDestroy:r.onDestroy.bind(r);t.push(a)}t.reverse();const n=p.serialCallFuns(t,e,[e]),{parent:s}=this;return s?m.waitAsyncable(n,()=>s.onDestroy(e)):n}}function y(i){const e=i.split(".");return e[0]===""&&e.shift(),e}function O(i,e){for(const t of e)if(i=i[t],i==null)return;return i}function K(i,e){return O(i,y(e))}function P(i,e,t){const n=e.pop(),s=e.length;let r=0;for(;r<s;){const o=i[e[r]];if(o==null)break;i=o,r++}e=e.slice(r);for(const o of e)i=i[o]={};return i[n]=t,i}function $(i,e,t){return P(i,y(e),t)}const M={UndefinedAndNull:function(e){return e==null},Undefined:function(e){return e===void 0},Null:function(e){return e===null}};class w{freezeMember=!0;fullOption=new Proxy(this,{get:function(e,t,n){const s=e.plainFullOption[t];return e.freezeMember?Object.freeze(s):s},set:function(e,t,n,s){return e.setMember(t,n,!1),!0},has:function(e,t){return t in e.plainFullOption},getOwnPropertyDescriptor:function(e,t){return Object.getOwnPropertyDescriptor(e.plainFullOption,t)},ownKeys:function(e){return Reflect.ownKeys(e.plainFullOption)},deleteProperty:function(e,t){return e.setMember(t,void 0),!0},defineProperty:function(e,t,n){return Object.defineProperty(e.option,t,n),!0}});setOption(e,t){const n=t?h.deepmergeInto(this.option,e):Object.assign(this.option,e);return this.updateFullOption(),n}get undefinedValue(){return this._undefinedValue}set undefinedValue(e){this._undefinedValue=e,this.isUndefined=M[e]||M.UndefinedAndNull}_undefinedValue="UndefinedAndNull";isUndefined=M.UndefinedAndNull;getMember(e){return this.option[e]}setMember(e,t,n){const s=this.option;if(t===void 0)delete s[e];else{const r=s[e];n&&r&&typeof r=="object"?h.deepmergeInto(r,t):s[e]=t}this.updateFullOption()}getValue(e){return O(this.option,e)}setValue(e,t,n){const s=this.option;let r;n&&(r=O(s,e))&&typeof r=="object"?h.deepmergeInto(r,t):P(this.option,e,t),this.updateFullOption()}}class l extends w{constructor(e,t){super(),e&&(this.option=e),t&&(this.extends=t)}get extends(){return this._extends}set extends(e){this._extends=e,this.updateFullOption()}_extends=null;option={};get plainFullOption(){let e=this._plainFullOption;if(e)return e;const{extends:t,option:n}=this;if(e=n,t){const s=t.plainFullOption;e=h.deepmerge(s,n)}return this._plainFullOption=e}_plainFullOption=null;updateFullOption(){this._plainFullOption=null}getMember(e){const t=this.option[e];if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getMember(e)}getValue(e){const t=super.getValue(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getValue(e)}}function L(i,e){const{name:t}=e,n=`_${t}`;return{get:function(){return this[n]||(this[n]=new l(void 0,this.constructor[t]))}}}class D extends w{constructor(e,t){super(),t&&this.setModeOption(e,t),this.mode=e}modes={};get mode(){return this._mode||(this.mode=this.modeNames[0])}set mode(e){this._mode=e,this.hasMode(e)||this.setModeOption(e,{}),this.updateFullOption()}_mode;get modeNames(){return this._modeNames||(this._modeNames=this.getModeNames())}_modeNames=null;getModeNames(){return Object.keys(this.modes)}hasMode(e){return!!this.modes[e]}get optionManager(){return this.modes[this.mode]}get option(){return this.optionManager.option}get plainFullOption(){return this._plainFullOption??(this._plainFullOption=this.getFullModeOption(this.mode))}_plainFullOption=null;updateFullOption(){this._plainFullOption=null,this._modeNames=null}getModeOption(e){return this.modes[e].option}getFullModeOption(e){return this.modes[e]?.plainFullOption}setModeOption(e,t,n,s){const{modes:r}=this,o=r[e]||(r[e]=new l);if(o.setOption(t,n),s){const a=r[s];a&&(o.extends=a)}return this.updateFullOption(),o}}class c extends D{constructor(e,t,n){super(e,t),n&&(this.extends=n)}get extends(){return this._extends}set extends(e){this._extends=e,this.updateFullOption()}_extends=null;getFullModeOption(e){const{modes:t,extends:n}=this,s=t[e]?.plainFullOption;if(n){const r=n.getFullModeOption(e);return s?h.deepmerge(r,s):r}return s}getModeNames(){const{modes:e,extends:t}=this,n=Object.keys(e);if(!t)return n;const s=t.getModeNames();return[...new Set([...n,...s])]}hasModeOnTier(e){if(this.hasMode(e))return!0;const t=this.extends;return t?t.hasModeOnTier(e):!1}get optionManager(){return this.getModeOptionManager(this.mode)}getModeOptionManager(e){const t=this.modes[e];return t||(this.extends?.getModeOptionManager(e)?this.setModeOption(e,{}):null)}getMember(e){const t=this.optionManager.getMember(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getMember(e)}getValue(e){const t=this.optionManager.getValue(e);if(!this.isUndefined(t))return t;const n=this.extends;if(n)return n.getValue(e)}}function G(i,e){const{name:t}=e,n=`_${t}`;return{get:function(){return this[n]||(this[n]=new c(this.constructor[t].mode,void 0,this.constructor[t]))}}}class _ extends x.Destroyable{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(e,...t){return this.pluginManager.usePlugin(e,...t)}static useExtend(e){return this.pluginManager.useExtend(e)}static hasUsed(e){return this.pluginManager.hasUsed(e)}usePlugin(e,...t){return this.pluginManager.instUsePlugin(this,e,...t)}useExtend(e,...t){return this.pluginManager.instUseExtend(this,e,...t)}init(...e){return this.pluginManager.onInit(this,...e)}destroyThis(){const e=this.pluginManager.onDestroy(this);return e instanceof Promise?e.finally(()=>super.destroyThis()):super.destroyThis()}}class J extends _{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(e){super(),this.defaultOptions.option=e}}function b(i){const e=x.createDestroyableSubClass(i);return class extends e{static isolatedPluginManager=!1;static get pluginManager(){return this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager")&&(this._pluginManager=new g(this,this._pluginManager)),this._pluginManager}static _pluginManager=new g(this);get pluginManager(){return this.constructor.pluginManager}static usePlugin(n,...s){return this.pluginManager.usePlugin(n,...s)}static useExtend(n){return this.pluginManager.useExtend(n)}static hasUsed(n){return this.pluginManager.hasUsed(n)}usePlugin(n,...s){return this.pluginManager.instUsePlugin(this,n,...s)}useExtend(n,...s){return this.pluginManager.instUseExtend(this,n,...s)}init(...n){return this.pluginManager.onInit(this,...n)}destroyThis(){const n=this.pluginManager.onDestroy(this);return n instanceof Promise?n.finally(()=>super.destroyThis()):super.destroyThis()}}}function Q(i){const e=b(i);return class extends e{static defaultOptions=new l;get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new l(void 0,this.constructor.defaultOptions))}_defaultOptions;constructor(n){super(),this.defaultOptions.option=n}}}const f="common";class W extends _{static modeOptions=new c(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new c(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(e){this.modeOptions.mode=e}get options(){return this.modeOptions.plainFullOption}constructor(e){super(),this.modeOptions.setOption(e)}}function X(i){const e=b(i);return class extends e{static modeOptions=new c(f);get modeOptions(){return this._modeOptions||(this._modeOptions=new c(f,void 0,this.constructor.modeOptions))}_modeOptions;get mode(){return this.modeOptions.mode}set mode(n){this.modeOptions.mode=n}get options(){return this.modeOptions.plainFullOption}constructor(n){super(),this.modeOptions.setOption(n)}}}exports.ModeOptions=D;exports.PluginExtendManager=g;exports.PluginHost=_;exports.TierModeOptions=c;exports.TierModeOptionsPluginHost=W;exports.TierOptions=l;exports.TierOptionsPluginHost=J;exports.commonModeName=f;exports.createDefineIExtend=B;exports.createDefineMixin=v;exports.createIExtendTarget=z;exports.createMixinTarget=C;exports.createPluginHost=b;exports.createTargetIExtend=A;exports.createTargetMixin=I;exports.createTierModeOptionsPluginHost=X;exports.createTierOptionsPluginHost=Q;exports.defineIExtend=S;exports.defineMixin=N;exports.extendMark=d;exports.getPropertyValue=O;exports.getPropertyValueByPath=K;exports.iextendTarget=q;exports.isPlugin=F;exports.mixin=u;exports.mixinByOmit=E;exports.mixinByPick=V;exports.mixinIExtend=U;exports.mixinTarget=k;exports.parsePropertyPath=y;exports.pickHostExtendMembers=j;exports.setPropertyValue=P;exports.setPropertyValueByPath=$;exports.targetIExtend=R;exports.targetMixin=H;exports.tierModeOptionsDecorator=G;exports.tierOptionsDecorator=L;
|