plugin-tls 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{createTierModeOptionsPluginHost-DWMl3oQA.js → createTierModeOptionsPluginHost-BSmyPyZ6.js} +4 -4
- package/dist/{createTierModeOptionsPluginHost-C-if5dn9.cjs → createTierModeOptionsPluginHost-CmgnR5Ur.cjs} +1 -1
- package/dist/index-node.cjs +1 -1
- package/dist/index-node.js +4 -4
- package/dist/index-web.cjs +1 -1
- package/dist/index-web.js +50 -50
- package/dist/index.cjs +1 -1
- package/dist/index.js +144 -113
- package/dist/options/options-manager/ModeOptions.d.ts +1 -1
- package/dist/options/options-manager/ModeOptions.d.ts.map +1 -1
- package/dist/options/options-manager/TierModeOptions.d.ts +1 -1
- package/dist/options/options-manager/TierModeOptions.d.ts.map +1 -1
- package/dist/options/options-plugin-host/tier-mode-options/TierModeOptionsPluginHost.d.ts +1 -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 +1 -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 +1 -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 +1 -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 +1 -1
- 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 +1 -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 +1 -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 +1 -1
- package/dist/options/options-plugin-host/tier-options/createTierOptionsPluginHost.d.ts.map +1 -1
- package/dist/options/plugins/tier-mode-options/decorator.d.ts.map +1 -1
- package/dist/options/plugins/tier-mode-options/plugin.d.ts.map +1 -1
- package/dist/options/plugins/tier-mode-options/type.d.ts +5 -0
- package/dist/options/plugins/tier-mode-options/type.d.ts.map +1 -1
- package/dist/options/plugins/tier-options/decorator.d.ts +2 -1
- package/dist/options/plugins/tier-options/decorator.d.ts.map +1 -1
- package/dist/options/plugins/tier-options/plugin.d.ts.map +1 -1
- package/dist/options/plugins/tier-options/type.d.ts +13 -8
- package/dist/options/plugins/tier-options/type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -750,7 +750,7 @@ class st extends w {
|
|
|
750
750
|
}
|
|
751
751
|
_defaultOptions;
|
|
752
752
|
constructor(t) {
|
|
753
|
-
super(), this.defaultOptions.option = t;
|
|
753
|
+
super(), t && (this.defaultOptions.option = t);
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
function F(s) {
|
|
@@ -861,7 +861,7 @@ function ot(s) {
|
|
|
861
861
|
}
|
|
862
862
|
_defaultOptions;
|
|
863
863
|
constructor(n) {
|
|
864
|
-
super(), this.defaultOptions.option = n;
|
|
864
|
+
super(), n && (this.defaultOptions.option = n);
|
|
865
865
|
}
|
|
866
866
|
};
|
|
867
867
|
}
|
|
@@ -896,7 +896,7 @@ class ut extends w {
|
|
|
896
896
|
return this.modeOptions.plainFullOption;
|
|
897
897
|
}
|
|
898
898
|
constructor(t) {
|
|
899
|
-
super(), this.modeOptions.setOption(t);
|
|
899
|
+
super(), t && this.modeOptions.setOption(t);
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
function lt(s) {
|
|
@@ -931,7 +931,7 @@ function lt(s) {
|
|
|
931
931
|
return this.modeOptions.plainFullOption;
|
|
932
932
|
}
|
|
933
933
|
constructor(n) {
|
|
934
|
-
super(), this.modeOptions.setOption(n);
|
|
934
|
+
super(), n && this.modeOptions.setOption(n);
|
|
935
935
|
}
|
|
936
936
|
};
|
|
937
937
|
}
|
|
@@ -1 +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 v(i,t){return t}function N(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(void 0,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(void 0,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=N;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=v;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;
|
|
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 v(i,t){return t}function N(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(void 0,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(),t&&(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(void 0,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(),n&&(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(),t&&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(),n&&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=N;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=v;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-CmgnR5Ur.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(),t&&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(void 0,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(),t&&(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 a, T as n, c as r, d as o } from "./createTierModeOptionsPluginHost-
|
|
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-BSmyPyZ6.js";
|
|
5
|
+
import { f as P, g as D, p as T, q as E } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
|
|
6
6
|
var p = class extends h {
|
|
7
7
|
refCount = 0;
|
|
8
8
|
get isDestroyed() {
|
|
@@ -182,7 +182,7 @@ class f extends u {
|
|
|
182
182
|
return this.modeOptions.plainFullOption;
|
|
183
183
|
}
|
|
184
184
|
constructor(t) {
|
|
185
|
-
super(), this.modeOptions.setOption(t);
|
|
185
|
+
super(), t && this.modeOptions.setOption(t);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
class _ extends u {
|
|
@@ -206,7 +206,7 @@ class _ extends u {
|
|
|
206
206
|
}
|
|
207
207
|
_defaultOptions;
|
|
208
208
|
constructor(t) {
|
|
209
|
-
super(), this.defaultOptions.option = t;
|
|
209
|
+
super(), t && (this.defaultOptions.option = t);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
export {
|
package/dist/index-web.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./Destroyable-mrBsNabq-IFFuYfKS.cjs"),p=require("com-tools"),i=require("./createTierModeOptionsPluginHost-CmgnR5Ur.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 o=n?.times;if(o){const r=typeof s=="function"?s:s?.handleEvent;if(r)return this.multipleListen(t,r,o)}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 o=0;const r=new AbortController,l=r.signal;return super.addEventListener(t,d=>{++o>=n&&r.abort(),s.call(this,d)},{signal:l}),function(){r.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(),t&&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(void 0,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(),t&&(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,15 +1,15 @@
|
|
|
1
1
|
import { a as o } from "./Destroyable-mrBsNabq-D6TYs3Zn.js";
|
|
2
2
|
import { serialCallAllFuns as g } from "com-tools";
|
|
3
|
-
import { P as d, T as a, c as u, d as l } from "./createTierModeOptionsPluginHost-
|
|
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-BSmyPyZ6.js";
|
|
4
|
+
import { f as P, g as D, p as b, q as x } from "./createTierModeOptionsPluginHost-BSmyPyZ6.js";
|
|
5
5
|
if (!globalThis.CustomEvent) {
|
|
6
|
-
class
|
|
6
|
+
class e extends Event {
|
|
7
7
|
detail;
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
8
|
+
constructor(s, i) {
|
|
9
|
+
super(s, i), this.detail = i?.detail;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
globalThis.CustomEvent =
|
|
12
|
+
globalThis.CustomEvent = e;
|
|
13
13
|
}
|
|
14
14
|
class f extends EventTarget {
|
|
15
15
|
/**
|
|
@@ -23,19 +23,19 @@ class f extends EventTarget {
|
|
|
23
23
|
* @param options - 选项
|
|
24
24
|
* @returns 返回用于移除事件监听器的函数; 也可以通过 `EventTarget#removeEventListener` 方法移除
|
|
25
25
|
*/
|
|
26
|
-
addEventListener(t,
|
|
26
|
+
addEventListener(t, s, i) {
|
|
27
27
|
const r = i?.times;
|
|
28
28
|
if (r) {
|
|
29
|
-
const n = typeof
|
|
29
|
+
const n = typeof s == "function" ? s : s?.handleEvent;
|
|
30
30
|
if (n)
|
|
31
31
|
return this.multipleListen(t, n, r);
|
|
32
32
|
}
|
|
33
|
-
return super.addEventListener(t,
|
|
34
|
-
this.removeEventListener(t,
|
|
33
|
+
return super.addEventListener(t, s, i), () => {
|
|
34
|
+
this.removeEventListener(t, s, i);
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
dispatchEvent(t,
|
|
38
|
-
const i = t instanceof Event ? t : new CustomEvent(t, { detail:
|
|
37
|
+
dispatchEvent(t, s) {
|
|
38
|
+
const i = t instanceof Event ? t : new CustomEvent(t, { detail: s, bubbles: !1, cancelable: !0, composed: !1 });
|
|
39
39
|
return super.dispatchEvent(i);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -49,8 +49,8 @@ class f 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, s, i) {
|
|
53
|
+
return this.addEventListener(t, s, { ...i, once: !0 });
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* 添加监听指定次数的事件监听器;
|
|
@@ -63,11 +63,11 @@ class f extends EventTarget {
|
|
|
63
63
|
* @param times 需要监听的次数,如果小于 1 ,永远不会自动移除事件监听器,需要手动移除
|
|
64
64
|
* @returns removeEventListener():void; 返回用于移除事件监听器的函数; 不能通过 EventTarget 的 removeEventListener 方法移除
|
|
65
65
|
*/
|
|
66
|
-
multipleListen(t,
|
|
66
|
+
multipleListen(t, s, i) {
|
|
67
67
|
let r = 0;
|
|
68
68
|
const n = new AbortController(), p = n.signal;
|
|
69
69
|
return super.addEventListener(t, (c) => {
|
|
70
|
-
++r >= i && n.abort(),
|
|
70
|
+
++r >= i && n.abort(), s.call(this, c);
|
|
71
71
|
}, { signal: p }), function() {
|
|
72
72
|
n.abort();
|
|
73
73
|
};
|
|
@@ -83,42 +83,42 @@ var O = class extends f {
|
|
|
83
83
|
return !this.isDestroyed && this.refCount <= 0;
|
|
84
84
|
}
|
|
85
85
|
_destroyers = [];
|
|
86
|
-
disposeFun(
|
|
87
|
-
return this._destroyers.push(
|
|
86
|
+
disposeFun(e) {
|
|
87
|
+
return this._destroyers.push(e), e;
|
|
88
88
|
}
|
|
89
|
-
cancelDisposeFun(
|
|
90
|
-
let t = this._destroyers.indexOf(
|
|
91
|
-
return this._destroyers.splice(t, 1),
|
|
89
|
+
cancelDisposeFun(e) {
|
|
90
|
+
let t = this._destroyers.indexOf(e);
|
|
91
|
+
return this._destroyers.splice(t, 1), e;
|
|
92
92
|
}
|
|
93
|
-
disposeObj(
|
|
94
|
-
let
|
|
95
|
-
return
|
|
93
|
+
disposeObj(e, t) {
|
|
94
|
+
let s = t ? function() {
|
|
95
|
+
return e.destroySync();
|
|
96
96
|
} : function() {
|
|
97
|
-
return
|
|
97
|
+
return e.destroy();
|
|
98
98
|
};
|
|
99
|
-
return this.disposeFun(
|
|
99
|
+
return this.disposeFun(s), e.__destroyable_destroyer = s, e;
|
|
100
100
|
}
|
|
101
|
-
cancelDisposeObj(
|
|
102
|
-
let t =
|
|
103
|
-
return t && this.cancelDisposeFun(t),
|
|
101
|
+
cancelDisposeObj(e) {
|
|
102
|
+
let t = e.__destroyable_destroyer;
|
|
103
|
+
return t && this.cancelDisposeFun(t), e;
|
|
104
104
|
}
|
|
105
|
-
dispose(
|
|
106
|
-
return typeof
|
|
105
|
+
dispose(e, t) {
|
|
106
|
+
return typeof e == "function" ? this.disposeFun(e) : this.disposeObj(e, t);
|
|
107
107
|
}
|
|
108
|
-
cancelDispose(
|
|
109
|
-
return typeof
|
|
108
|
+
cancelDispose(e) {
|
|
109
|
+
return typeof e == "function" ? this.cancelDisposeFun(e) : this.cancelDisposeObj(e);
|
|
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 e = this._destroyers.length;
|
|
116
|
+
for (; --e >= 0; ) {
|
|
117
|
+
let t = this._destroyers[e];
|
|
118
118
|
try {
|
|
119
119
|
t();
|
|
120
|
-
} catch (
|
|
121
|
-
console.error("销毁函数在同步销毁时出错", this, t,
|
|
120
|
+
} catch (s) {
|
|
121
|
+
console.error("销毁函数在同步销毁时出错", this, t, s);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
this._destroyers.length = 0;
|
|
@@ -131,10 +131,10 @@ var O = class extends f {
|
|
|
131
131
|
}
|
|
132
132
|
destroy() {
|
|
133
133
|
if (!this.canDestroy) return this.isDestroyed;
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
let t = g(
|
|
137
|
-
console.error("销毁函数在串行销毁时出错", this, i,
|
|
134
|
+
let e = this._destroyers.toReversed();
|
|
135
|
+
e.push(this.destroyThis), this._destroyers.length = 0;
|
|
136
|
+
let t = g(e, this, null, (s, i) => {
|
|
137
|
+
console.error("销毁函数在串行销毁时出错", this, i, s);
|
|
138
138
|
});
|
|
139
139
|
return t instanceof Promise ? t.then(() => (o(this), !0)) : (o(this), !0);
|
|
140
140
|
}
|
|
@@ -161,8 +161,8 @@ class h extends O {
|
|
|
161
161
|
/**
|
|
162
162
|
* {@inheritDoc PluginExtendManager.usePlugin}
|
|
163
163
|
*/
|
|
164
|
-
static usePlugin(t, ...
|
|
165
|
-
return this.pluginManager.usePlugin(t, ...
|
|
164
|
+
static usePlugin(t, ...s) {
|
|
165
|
+
return this.pluginManager.usePlugin(t, ...s);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* {@inheritDoc PluginExtendManager.useExtend}
|
|
@@ -195,14 +195,14 @@ class h extends O {
|
|
|
195
195
|
* @param args
|
|
196
196
|
* @returns
|
|
197
197
|
*/
|
|
198
|
-
usePlugin(t, ...
|
|
199
|
-
return this.pluginManager.instUsePlugin(this, t, ...
|
|
198
|
+
usePlugin(t, ...s) {
|
|
199
|
+
return this.pluginManager.instUsePlugin(this, t, ...s);
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* {@inheritDoc PluginExtendManager.useExtend}
|
|
203
203
|
*/
|
|
204
|
-
useExtend(t, ...
|
|
205
|
-
return this.pluginManager.instUseExtend(this, t, ...
|
|
204
|
+
useExtend(t, ...s) {
|
|
205
|
+
return this.pluginManager.instUseExtend(this, t, ...s);
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* 初始化实例
|
|
@@ -252,7 +252,7 @@ class v extends h {
|
|
|
252
252
|
return this.modeOptions.plainFullOption;
|
|
253
253
|
}
|
|
254
254
|
constructor(t) {
|
|
255
|
-
super(), this.modeOptions.setOption(t);
|
|
255
|
+
super(), t && this.modeOptions.setOption(t);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
class M extends h {
|
|
@@ -276,7 +276,7 @@ class M extends h {
|
|
|
276
276
|
}
|
|
277
277
|
_defaultOptions;
|
|
278
278
|
constructor(t) {
|
|
279
|
-
super(), this.defaultOptions.option = t;
|
|
279
|
+
super(), t && (this.defaultOptions.option = t);
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
export {
|
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-C-if5dn9.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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@gby/destroyable"),p=require("com-tools"),n=require("./createTierModeOptionsPluginHost-CmgnR5Ur.cjs"),l=require("type-tls");function m(s,e){return e}function x(s){return function(t){return t}}function M(s,e){return n.mixin(s.prototype,e),e}function P(s){return function(t){return n.mixin(s.prototype,t),t}}function y(s,e){return n.mixin(s.prototype,e),s}function T(s){return function(t){return n.mixin(s.prototype,t),s}}class E extends h.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)}use(e,...t){if(this.hasUsed(e))return this.getUseReturn(e);const i=e.onUse(this.host,...t);return this.plugins.set(e,i),i}instUse(e,t,...i){const{plugins:r}=this;if(this.hasUsed(t))return this.getUseReturn(t);const o=this.use(t,...i);return t.onCreate?.(e),o}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const[o]of this.plugins)o.onCreate&&r.push(o.onCreate.bind(o));return l.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const[o]of this.plugins)o.onInit&&r.push(o.onInit.bind(o));return l.waitAsyncable(i,()=>p.serialCallFuns(r,void 0,[e,...t]))}onDestroy(e){const t=[];for(const[o]of this.plugins)o.onDestroy&&t.push(o.onDestroy.bind(o));t.reverse();const i=p.serialCallFuns(t,void 0,[e]),{parent:r}=this;return r?l.waitAsyncable(i,()=>r.onDestroy(e)):i}}class _ extends h.Destroyable{parent;host;plugins=new Set;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)}use(e){return this.hasUsed(e)||(n.mixinIExtend(this.host.prototype,e),this.plugins.add(e)),e}instUse(e,t,...i){return this.hasUsed(t)||(this.use(t),t.onCreate?.call(e,e,...i)),t}onCreate(e,...t){const i=this.parent?.onCreate(e,...t),r=[];for(const o of this.plugins)o.onCreate&&r.push(o.onCreate);return l.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onInit(e,...t){const i=this.parent?.onInit(e,...t),r=[];for(const o of this.plugins)o.onInit&&r.push(o.onInit);return l.waitAsyncable(i,()=>p.serialCallFuns(r,e,[e,...t]))}onDestroy(e){const t=[];for(const o of this.plugins)o.onDestroy&&t.push(o.onDestroy);t.reverse();const i=p.serialCallFuns(t,e,[e]),{parent:r}=this;return r?l.waitAsyncable(i,()=>r.onDestroy(e)):i}}function c(s,e){const t=[{target:s,props:e}];let i;for(;i=t.shift();){const{target:r,props:o}=i;for(const[u,a]of Object.entries(o)){if(a!=null&&typeof a=="object"&&(!a.constructor||a.constructor===Object)){t.push({target:r[u],props:a});continue}r[u]=a}}return s}function f(s,e){const t={},i=[{target:s,props:e,targetProps:t}];let r;for(;r=i.shift();){const{target:o,props:u,targetProps:a}=r;for(const[g,d]of Object.entries(u)){if(d!=null&&typeof d=="object"&&(!d.constructor||d.constructor===Object)){i.push({target:o[g],props:d,targetProps:a[g]={}});continue}a[g]=o[g]}}return t}function w(s,e){const t=f(s,e);function i(){c(s,e)}function r(){c(s,t)}return{set:i,unset:r}}function b(s,e){const t=e??"defaultOptions",i=`_${t}`;return function(o){const u=n.mixinTarget(o,{get[t](){return s}});n.mixinTarget(u.prototype,{get[t](){return this[i]||(this[i]=structuredClone(u.defaultOptions))}})}}function U(s,e,t){const i=`_${e}`;return n.mixinTarget(s.prototype,{get[e](){return this[i]||(this[i]=structuredClone(s[e]))}}),t}function C(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(e,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(e,t)});return n.mixinTarget(i.prototype,{get modeOptions(){return this._modeOptions||(this._modeOptions=new n.TierModeOptions(e,void 0,this.constructor.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){this.modeOptions.mode=r},get options(){return this.modeOptions.fullOption}}),s}const D={onUse(s,e,t){const i=e??n.commonModeName;n.mixin(s,{isolatedOptions:!1,get modeOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_modeOptions")&&(this._modeOptions=new n.TierModeOptions(i,null,this._modeOptions)),this._modeOptions},_modeOptions:new n.TierModeOptions(i,void 0,t)}),n.mixin(s.prototype,{get modeOptions(){const r=this,o=s;return r._modeOptions||(r._modeOptions=new n.TierModeOptions(o.modeOptions.mode,void 0,o.modeOptions))},get mode(){return this.modeOptions.mode},set mode(r){const o=this;o.modeOptions.mode=r},get options(){return this.modeOptions.plainFullOption}})},onCreate(s,e){e&&s.modeOptions.setOption(e)}},H={onUse(s,e,t){n.mixin(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)}),n.mixin(s.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,s.defaultOptions))}})},onCreate(s,e){e&&(s.defaultOptions.option=e)}};function v(s,e,t){const i=n.mixinTarget(s,{isolatedOptions:!1,get defaultOptions(){return this.isolatedOptions&&!this.hasOwnProperty("_defaultOptions")&&(this._defaultOptions=new n.TierOptions(void 0,this._defaultOptions)),this._defaultOptions},_defaultOptions:new n.TierOptions(e,t)});return n.mixinTarget(i.prototype,{get defaultOptions(){return this._defaultOptions||(this._defaultOptions=new n.TierOptions(void 0,this.constructor.defaultOptions))}}),s}function O(s){const e=n.mixinTarget(s,{isolatedPluginManager:!1,get pluginManager(){return(!this._pluginManager||this.isolatedPluginManager&&!this.hasOwnProperty("_pluginManager"))&&(this._pluginManager=new n.PluginExtendManager(this,this._pluginManager)),this._pluginManager},usePlugin(t,...i){return this.pluginManager.usePlugin(t,...i)},useExtend(t){return this.pluginManager.useExtend(t)},hasUsed(t){return this.pluginManager.hasUsed(t)}});return n.mixinTarget(e.prototype,{get pluginManager(){return this.constructor.pluginManager},usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)},useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)},async init(...t){return super.init&&await super.init(...t),this.pluginManager.onInit(this,...t)},async destroy(){if(await this.pluginManager.onDestroy(this),super.destroy)return super.destroy()}}),s}function I(s){const e=O(s);return new Proxy(e,{construct:function(t,i,r){const o=new t(...i);return e.pluginManager.onCreate(this,...i),o}})}function j(s){return class extends s{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(t,...i){return this.pluginManager.usePlugin(t,...i)}static useExtend(t){return this.pluginManager.useExtend(t)}static hasUsed(t){return this.pluginManager.hasUsed(t)}constructor(...t){super(...t),this.pluginManager.onCreate(this,...t)}usePlugin(t,...i){return this.pluginManager.instUsePlugin(this,t,...i)}useExtend(t,...i){return this.pluginManager.instUseExtend(this,t,...i)}init(...t){if(super.init){const i=super.init(...t);if(i instanceof Promise)return i.then(()=>this.pluginManager.onInit(this,...t))}return this.pluginManager.onInit(this,...t)}destroy(){const t=this.pluginManager.onDestroy(this);return super.destroy?t instanceof Promise?t.finally(()=>super.destroy()):super.destroy():t}}}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=_;exports.PluginManager=E;exports.addDefaultOptions=b;exports.addInstOptions=U;exports.becomePluginHost=O;exports.becomePluginHost_Extends=j;exports.becomePluginHost_Proxy=I;exports.becomeTierModeOptionsHost=C;exports.becomeTierOptionsHost=v;exports.createDefineExtend=x;exports.createExtendTarget=T;exports.createPropertySetter=w;exports.createTargetExtend=P;exports.defineExtend=m;exports.extendTarget=y;exports.getTargetProperties=f;exports.mergeProperties=c;exports.targetExtend=M;exports.tierModeOptionsPlugin=D;exports.tierOptionsPlugin=H;
|