@vlian/framework 1.2.59 → 1.2.60
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/analytics/index.cjs +1 -22
- package/dist/analytics.umd.js +1 -1
- package/dist/components/LocaleSwitch.cjs +1 -116
- package/dist/components/ThemeSwitch.cjs +1 -115
- package/dist/components/index.cjs +1 -20
- package/dist/components/persistence.cjs +1 -58
- package/dist/core/Test.cjs +1 -64
- package/dist/core/app/AppContext.cjs +1 -348
- package/dist/core/app/AppContext.types.cjs +1 -4
- package/dist/core/app/BasicLayout.cjs +1 -122
- package/dist/core/app/DefaultApp.cjs +1 -150
- package/dist/core/app/index.cjs +1 -41
- package/dist/core/config/AppConfig.cjs +1 -139
- package/dist/core/config/ConfigLoader.cjs +1 -323
- package/dist/core/config/ConfigValidator.cjs +2 -133
- package/dist/core/config/index.cjs +1 -28
- package/dist/core/dev/DevTools.cjs +1 -226
- package/dist/core/error/ErrorBoundary.cjs +1 -401
- package/dist/core/error/ErrorHandler.cjs +1 -275
- package/dist/core/error/index.cjs +1 -34
- package/dist/core/event/AppEventBus.cjs +1 -444
- package/dist/core/event/frameworkEvents.cjs +1 -141
- package/dist/core/event/hooks.cjs +1 -69
- package/dist/core/event/index.cjs +1 -41
- package/dist/core/event/types.cjs +1 -62
- package/dist/core/event/useEventBus.cjs +1 -25
- package/dist/core/index.cjs +1 -140
- package/dist/core/initialization/InitializationErrorThrower.cjs +1 -75
- package/dist/core/initialization/index.cjs +1 -26
- package/dist/core/initialization/initialization.cjs +1 -64
- package/dist/core/initialization/initializationErrorState.cjs +1 -66
- package/dist/core/kernel/defaultAdapters.cjs +1 -184
- package/dist/core/kernel/errors.cjs +1 -69
- package/dist/core/kernel/index.cjs +1 -20
- package/dist/core/kernel/startKernel.cjs +1 -200
- package/dist/core/kernel/types.cjs +1 -4
- package/dist/core/middleware.cjs +1 -73
- package/dist/core/plugin/PluginEventBus.cjs +1 -298
- package/dist/core/plugin/PluginSandbox.cjs +1 -137
- package/dist/core/plugin.cjs +1 -494
- package/dist/core/router/RouterManager.cjs +1 -286
- package/dist/core/router/adapter/AdapterManager.cjs +1 -235
- package/dist/core/router/adapter/index.cjs +1 -22
- package/dist/core/router/adapter/react-router/ReactRouterAdapter.cjs +1 -128
- package/dist/core/router/adapter/react-router/index.cjs +1 -20
- package/dist/core/router/adapter/types.cjs +1 -6
- package/dist/core/router/dev/RouterDevTools.cjs +1 -260
- package/dist/core/router/dev/index.cjs +1 -20
- package/dist/core/router/dynamic/DynamicRouteManager.cjs +1 -193
- package/dist/core/router/dynamic/index.cjs +1 -20
- package/dist/core/router/errors/RouterError.cjs +1 -61
- package/dist/core/router/errors/index.cjs +1 -20
- package/dist/core/router/index.cjs +1 -36
- package/dist/core/router/lifecycle/RouterLifecycleManager.cjs +1 -144
- package/dist/core/router/lifecycle/index.cjs +1 -20
- package/dist/core/router/middleware/RouterMiddlewareManager.cjs +1 -193
- package/dist/core/router/middleware/auth.cjs +1 -66
- package/dist/core/router/middleware/index.cjs +1 -22
- package/dist/core/router/middleware/types.cjs +1 -6
- package/dist/core/router/monitoring/RouterMonitoring.cjs +1 -227
- package/dist/core/router/monitoring/index.cjs +1 -20
- package/dist/core/router/navigation/RouterNavigation.cjs +1 -239
- package/dist/core/router/navigation/index.cjs +1 -20
- package/dist/core/router/performance/RouteCache.cjs +1 -305
- package/dist/core/router/performance/RoutePreloader.cjs +1 -292
- package/dist/core/router/performance/index.cjs +1 -21
- package/dist/core/router/plugin/RouterPluginManager.cjs +1 -262
- package/dist/core/router/plugin/index.cjs +1 -21
- package/dist/core/router/plugin/types.cjs +1 -39
- package/dist/core/router/types.cjs +1 -4
- package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.cjs +1 -129
- package/dist/core/router/utils/adapters/react-router/transform.cjs +1 -250
- package/dist/core/router/utils/transform.cjs +1 -780
- package/dist/core/router/validation/RouterConfigValidator.cjs +2 -83
- package/dist/core/router/validation/index.cjs +1 -21
- package/dist/core/router/validation/schema.cjs +1 -159
- package/dist/core/router/version/RouteVersionManager.cjs +1 -205
- package/dist/core/router/version/index.cjs +1 -20
- package/dist/core/splash/SplashScreen.cjs +1 -341
- package/dist/core/splash/index.cjs +1 -22
- package/dist/core/splash/splashScreenUtils.cjs +1 -38
- package/dist/core/startup/AppInstance.cjs +1 -239
- package/dist/core/startup/environment.cjs +1 -169
- package/dist/core/startup/index.cjs +1 -23
- package/dist/core/startup/initializeServices.cjs +1 -226
- package/dist/core/startup/performanceTracker.cjs +1 -179
- package/dist/core/startup/renderApp.cjs +1 -314
- package/dist/core/startup/startApp.cjs +1 -317
- package/dist/core/types.cjs +1 -4
- package/dist/index.cjs +1 -52
- package/dist/index.umd.cjs +1 -27
- package/dist/index.umd.js +1 -1
- package/dist/kernel/constants.cjs +1 -65
- package/dist/kernel/index.cjs +1 -38
- package/dist/kernel/kernel.cjs +1 -295
- package/dist/kernel/manager/cacheManager.cjs +1 -46
- package/dist/kernel/manager/i18n/I18nManager.cjs +1 -91
- package/dist/kernel/manager/i18n/i18n.persistence.cjs +1 -60
- package/dist/kernel/manager/i18n/i18n.schema.cjs +1 -86
- package/dist/kernel/manager/i18n/index.cjs +1 -11
- package/dist/kernel/manager/i18nManager.cjs +1 -11
- package/dist/kernel/manager/index.cjs +1 -28
- package/dist/kernel/manager/logger/LoggerManager.cjs +1 -107
- package/dist/kernel/manager/logger/index.cjs +1 -11
- package/dist/kernel/manager/logger/logger.persistence.cjs +1 -62
- package/dist/kernel/manager/logger/logger.schema.cjs +1 -74
- package/dist/kernel/manager/loggerManager.cjs +1 -11
- package/dist/kernel/manager/theme/ThemeManager.cjs +1 -84
- package/dist/kernel/manager/theme/index.cjs +1 -11
- package/dist/kernel/manager/theme/theme.dom.cjs +1 -61
- package/dist/kernel/manager/theme/theme.persistence.cjs +1 -57
- package/dist/kernel/manager/theme/theme.schema.cjs +1 -122
- package/dist/kernel/manager/themeManager.cjs +1 -11
- package/dist/kernel/types.cjs +1 -4
- package/dist/library/index.cjs +1 -19
- package/dist/library/locale/index.cjs +1 -39
- package/dist/library/locale/langs/en-us/index.cjs +1 -32
- package/dist/library/locale/langs/zh-cn/index.cjs +1 -32
- package/dist/library/locale/types.cjs +1 -4
- package/dist/library/storage/cache.cjs +1 -243
- package/dist/library/storage/encryption.cjs +1 -147
- package/dist/library/storage/index.cjs +1 -124
- package/dist/state/StateManager.cjs +1 -166
- package/dist/state/adapters/AdapterFactory.cjs +1 -89
- package/dist/state/adapters/DefaultAdapter.cjs +1 -75
- package/dist/state/adapters/ReduxAdapter.cjs +1 -443
- package/dist/state/adapters/ZustandAdapter.cjs +1 -69
- package/dist/state/adapters/index.cjs +1 -44
- package/dist/state/adapters/types.cjs +1 -20
- package/dist/state/core/DerivedStateInstance.cjs +1 -174
- package/dist/state/core/StateInstance.cjs +1 -170
- package/dist/state/core/StateRegistry.cjs +1 -110
- package/dist/state/core/StateScope.cjs +1 -137
- package/dist/state/core/index.cjs +1 -30
- package/dist/state/index.cjs +1 -30
- package/dist/state/types.cjs +1 -12
- package/dist/state.umd.js +1 -1
- package/dist/types.cjs +1 -4
- package/dist/utils/analytics.cjs +1 -217
- package/dist/utils/configSecurity.cjs +3 -182
- package/dist/utils/csrf.cjs +1 -18
- package/dist/utils/errors/ErrorCodes.cjs +1 -25
- package/dist/utils/errors.cjs +1 -111
- package/dist/utils/index.cjs +1 -135
- package/dist/utils/logger.cjs +1 -25
- package/dist/utils/logger.types.cjs +1 -11
- package/dist/utils/monitoring.cjs +1 -18
- package/dist/utils/performance.cjs +1 -22
- package/dist/utils/resourceLoader.cjs +1 -22
- package/dist/utils/runtimeSecurity.cjs +1 -11
- package/dist/utils/security.cjs +1 -19
- package/dist/utils/traceId.cjs +1 -37
- package/dist/utils/validation.cjs +1 -19
- package/package.json +7 -3
|
@@ -1,174 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 派生状态实例实现
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "DerivedStateInstance", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return DerivedStateInstance;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function _define_property(obj, key, value) {
|
|
14
|
-
if (key in obj) {
|
|
15
|
-
Object.defineProperty(obj, key, {
|
|
16
|
-
value: value,
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
obj[key] = value;
|
|
23
|
-
}
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
26
|
-
let DerivedStateInstance = class DerivedStateInstance {
|
|
27
|
-
/**
|
|
28
|
-
* 获取当前状态值
|
|
29
|
-
*/ get() {
|
|
30
|
-
if (this.destroyed) {
|
|
31
|
-
throw new Error(`DerivedStateInstance ${String(this.id)} has been destroyed`);
|
|
32
|
-
}
|
|
33
|
-
return this.value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 派生状态不支持直接设置值
|
|
37
|
-
*/ set(_valueOrUpdater) {
|
|
38
|
-
throw new Error('Derived state cannot be set directly. Modify the dependency states instead.');
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 订阅状态变化
|
|
42
|
-
*/ subscribe(subscriber) {
|
|
43
|
-
if (this.destroyed) {
|
|
44
|
-
throw new Error(`DerivedStateInstance ${String(this.id)} has been destroyed`);
|
|
45
|
-
}
|
|
46
|
-
this.subscribers.add(subscriber);
|
|
47
|
-
// 返回取消订阅函数
|
|
48
|
-
return ()=>{
|
|
49
|
-
this.subscribers.delete(subscriber);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 获取状态实例标识符
|
|
54
|
-
*/ getId() {
|
|
55
|
-
return this.id;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 获取状态作用域
|
|
59
|
-
*/ getScope() {
|
|
60
|
-
return this.scope;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* 获取依赖的状态实例
|
|
64
|
-
*/ getDependencies() {
|
|
65
|
-
return this.config.dependencies;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* 手动重新计算派生状态
|
|
69
|
-
*/ recompute() {
|
|
70
|
-
if (this.destroyed || this.recomputing) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.recomputing = true;
|
|
74
|
-
try {
|
|
75
|
-
// 获取所有依赖状态的当前值
|
|
76
|
-
const dependencyValues = this.config.dependencies.map((dep)=>dep.get());
|
|
77
|
-
// 计算新的派生值
|
|
78
|
-
const newValue = this.config.derive(dependencyValues);
|
|
79
|
-
// 检查值是否变化
|
|
80
|
-
const hasChanged = this.config.equalityCheck ? !this.config.equalityCheck(this.value, newValue) : this.value !== newValue;
|
|
81
|
-
if (hasChanged) {
|
|
82
|
-
const previousValue = this.value;
|
|
83
|
-
this.value = newValue;
|
|
84
|
-
// 通知所有订阅者
|
|
85
|
-
this.notifySubscribers(this.value, previousValue);
|
|
86
|
-
}
|
|
87
|
-
} catch (error) {
|
|
88
|
-
console.error(`[DerivedStateInstance] Error recomputing ${String(this.id)}:`, error);
|
|
89
|
-
} finally{
|
|
90
|
-
this.recomputing = false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 销毁状态实例
|
|
95
|
-
*/ destroy() {
|
|
96
|
-
if (this.destroyed) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
this.destroyed = true;
|
|
100
|
-
// 取消所有依赖订阅
|
|
101
|
-
for (const unsubscribe of this.dependencyUnsubscribes){
|
|
102
|
-
unsubscribe();
|
|
103
|
-
}
|
|
104
|
-
this.dependencyUnsubscribes.length = 0;
|
|
105
|
-
// 清理订阅者
|
|
106
|
-
this.subscribers.clear();
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* 检查状态实例是否已销毁
|
|
110
|
-
*/ isDestroyed() {
|
|
111
|
-
return this.destroyed;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* 设置依赖状态订阅
|
|
115
|
-
*/ setupDependencies() {
|
|
116
|
-
for (const dependency of this.config.dependencies){
|
|
117
|
-
const unsubscribe = dependency.subscribe(()=>{
|
|
118
|
-
// 当依赖状态变化时,重新计算派生状态
|
|
119
|
-
this.recompute();
|
|
120
|
-
});
|
|
121
|
-
this.dependencyUnsubscribes.push(unsubscribe);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* 通知所有订阅者
|
|
126
|
-
*/ notifySubscribers(value, previous) {
|
|
127
|
-
const subscribers = Array.from(this.subscribers);
|
|
128
|
-
for (const subscriber of subscribers){
|
|
129
|
-
try {
|
|
130
|
-
subscriber(value, previous);
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error(`[DerivedStateInstance] Error in subscriber for ${String(this.id)}:`, error);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* 构造函数
|
|
138
|
-
*
|
|
139
|
-
* @param config - 派生状态配置
|
|
140
|
-
* @param options - 状态实例配置选项
|
|
141
|
-
*/ constructor(config, options = {}){
|
|
142
|
-
/**
|
|
143
|
-
* 状态实例标识符
|
|
144
|
-
*/ _define_property(this, "id", void 0);
|
|
145
|
-
/**
|
|
146
|
-
* 状态作用域
|
|
147
|
-
*/ _define_property(this, "scope", void 0);
|
|
148
|
-
/**
|
|
149
|
-
* 派生状态配置
|
|
150
|
-
*/ _define_property(this, "config", void 0);
|
|
151
|
-
/**
|
|
152
|
-
* 当前派生值
|
|
153
|
-
*/ _define_property(this, "value", void 0);
|
|
154
|
-
/**
|
|
155
|
-
* 订阅者集合
|
|
156
|
-
*/ _define_property(this, "subscribers", new Set());
|
|
157
|
-
/**
|
|
158
|
-
* 依赖状态的取消订阅函数数组
|
|
159
|
-
*/ _define_property(this, "dependencyUnsubscribes", []);
|
|
160
|
-
/**
|
|
161
|
-
* 是否已销毁
|
|
162
|
-
*/ _define_property(this, "destroyed", false);
|
|
163
|
-
/**
|
|
164
|
-
* 是否正在重新计算
|
|
165
|
-
*/ _define_property(this, "recomputing", false);
|
|
166
|
-
this.config = config;
|
|
167
|
-
this.id = options.id ?? Symbol('DerivedStateInstance');
|
|
168
|
-
this.scope = options.scope;
|
|
169
|
-
// 订阅所有依赖状态的变化
|
|
170
|
-
this.setupDependencies();
|
|
171
|
-
// 初始计算
|
|
172
|
-
this.recompute();
|
|
173
|
-
}
|
|
174
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"DerivedStateInstance",{enumerable:true,get:function(){return DerivedStateInstance}});function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let DerivedStateInstance=class DerivedStateInstance{get(){if(this.destroyed){throw new Error(`DerivedStateInstance ${String(this.id)} has been destroyed`)}return this.value}set(_valueOrUpdater){throw new Error("Derived state cannot be set directly. Modify the dependency states instead.")}subscribe(subscriber){if(this.destroyed){throw new Error(`DerivedStateInstance ${String(this.id)} has been destroyed`)}this.subscribers.add(subscriber);return()=>{this.subscribers.delete(subscriber)}}getId(){return this.id}getScope(){return this.scope}getDependencies(){return this.config.dependencies}recompute(){if(this.destroyed||this.recomputing){return}this.recomputing=true;try{const dependencyValues=this.config.dependencies.map(dep=>dep.get());const newValue=this.config.derive(dependencyValues);const hasChanged=this.config.equalityCheck?!this.config.equalityCheck(this.value,newValue):this.value!==newValue;if(hasChanged){const previousValue=this.value;this.value=newValue;this.notifySubscribers(this.value,previousValue)}}catch(error){console.error(`[DerivedStateInstance] Error recomputing ${String(this.id)}:`,error)}finally{this.recomputing=false}}destroy(){if(this.destroyed){return}this.destroyed=true;for(const unsubscribe of this.dependencyUnsubscribes){unsubscribe()}this.dependencyUnsubscribes.length=0;this.subscribers.clear()}isDestroyed(){return this.destroyed}setupDependencies(){for(const dependency of this.config.dependencies){const unsubscribe=dependency.subscribe(()=>{this.recompute()});this.dependencyUnsubscribes.push(unsubscribe)}}notifySubscribers(value,previous){const subscribers=Array.from(this.subscribers);for(const subscriber of subscribers){try{subscriber(value,previous)}catch(error){console.error(`[DerivedStateInstance] Error in subscriber for ${String(this.id)}:`,error)}}}constructor(config,options={}){_define_property(this,"id",void 0);_define_property(this,"scope",void 0);_define_property(this,"config",void 0);_define_property(this,"value",void 0);_define_property(this,"subscribers",new Set);_define_property(this,"dependencyUnsubscribes",[]);_define_property(this,"destroyed",false);_define_property(this,"recomputing",false);this.config=config;this.id=options.id??Symbol("DerivedStateInstance");this.scope=options.scope;this.setupDependencies();this.recompute()}};
|
|
@@ -1,170 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态实例核心实现
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "StateInstance", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return StateInstance;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function _define_property(obj, key, value) {
|
|
14
|
-
if (key in obj) {
|
|
15
|
-
Object.defineProperty(obj, key, {
|
|
16
|
-
value: value,
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
obj[key] = value;
|
|
23
|
-
}
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
26
|
-
let StateInstance = class StateInstance {
|
|
27
|
-
/**
|
|
28
|
-
* 获取当前状态值
|
|
29
|
-
*/ get() {
|
|
30
|
-
if (this.destroyed) {
|
|
31
|
-
throw new Error(`StateInstance ${String(this.id)} has been destroyed`);
|
|
32
|
-
}
|
|
33
|
-
return this.value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 更新状态值
|
|
37
|
-
*/ set(valueOrUpdater) {
|
|
38
|
-
if (this.destroyed) {
|
|
39
|
-
throw new Error(`StateInstance ${String(this.id)} has been destroyed`);
|
|
40
|
-
}
|
|
41
|
-
const previousValue = this.value;
|
|
42
|
-
let newValue;
|
|
43
|
-
// 处理函数式更新
|
|
44
|
-
if (typeof valueOrUpdater === 'function') {
|
|
45
|
-
newValue = valueOrUpdater(this.value);
|
|
46
|
-
} else {
|
|
47
|
-
newValue = valueOrUpdater;
|
|
48
|
-
}
|
|
49
|
-
// 应用中间件
|
|
50
|
-
let processedValue = newValue;
|
|
51
|
-
for (const middleware of this.middleware){
|
|
52
|
-
processedValue = middleware(processedValue, previousValue);
|
|
53
|
-
}
|
|
54
|
-
// 如果值没有变化,跳过更新
|
|
55
|
-
if (processedValue === this.value) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.value = processedValue;
|
|
59
|
-
if (this.devMode) {
|
|
60
|
-
console.debug(`[StateInstance] Updated: ${String(this.id)}`, {
|
|
61
|
-
previous: previousValue,
|
|
62
|
-
current: this.value
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
// 通知所有订阅者
|
|
66
|
-
this.notifySubscribers(this.value, previousValue);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 订阅状态变化
|
|
70
|
-
*/ subscribe(subscriber) {
|
|
71
|
-
if (this.destroyed) {
|
|
72
|
-
throw new Error(`StateInstance ${String(this.id)} has been destroyed`);
|
|
73
|
-
}
|
|
74
|
-
this.subscribers.add(subscriber);
|
|
75
|
-
if (this.devMode) {
|
|
76
|
-
console.debug(`[StateInstance] Subscribed: ${String(this.id)}`, {
|
|
77
|
-
subscriberCount: this.subscribers.size
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// 返回取消订阅函数
|
|
81
|
-
return ()=>{
|
|
82
|
-
this.subscribers.delete(subscriber);
|
|
83
|
-
if (this.devMode) {
|
|
84
|
-
console.debug(`[StateInstance] Unsubscribed: ${String(this.id)}`, {
|
|
85
|
-
subscriberCount: this.subscribers.size
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* 获取状态实例标识符
|
|
92
|
-
*/ getId() {
|
|
93
|
-
return this.id;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* 获取状态作用域
|
|
97
|
-
*/ getScope() {
|
|
98
|
-
return this.scope;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* 销毁状态实例
|
|
102
|
-
*/ destroy() {
|
|
103
|
-
if (this.destroyed) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
this.destroyed = true;
|
|
107
|
-
this.subscribers.clear();
|
|
108
|
-
this.value = undefined;
|
|
109
|
-
if (this.devMode) {
|
|
110
|
-
console.debug(`[StateInstance] Destroyed: ${String(this.id)}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* 检查状态实例是否已销毁
|
|
115
|
-
*/ isDestroyed() {
|
|
116
|
-
return this.destroyed;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 通知所有订阅者
|
|
120
|
-
*/ notifySubscribers(value, previous) {
|
|
121
|
-
// 使用数组副本避免在迭代过程中修改集合
|
|
122
|
-
const subscribers = Array.from(this.subscribers);
|
|
123
|
-
for (const subscriber of subscribers){
|
|
124
|
-
try {
|
|
125
|
-
subscriber(value, previous);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.error(`[StateInstance] Error in subscriber for ${String(this.id)}:`, error);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 构造函数
|
|
133
|
-
*
|
|
134
|
-
* @param initialValue - 初始状态值
|
|
135
|
-
* @param options - 状态实例配置选项
|
|
136
|
-
*/ constructor(initialValue, options = {}){
|
|
137
|
-
/**
|
|
138
|
-
* 状态实例标识符
|
|
139
|
-
*/ _define_property(this, "id", void 0);
|
|
140
|
-
/**
|
|
141
|
-
* 状态作用域
|
|
142
|
-
*/ _define_property(this, "scope", void 0);
|
|
143
|
-
/**
|
|
144
|
-
* 当前状态值
|
|
145
|
-
*/ _define_property(this, "value", void 0);
|
|
146
|
-
/**
|
|
147
|
-
* 订阅者集合
|
|
148
|
-
*/ _define_property(this, "subscribers", new Set());
|
|
149
|
-
/**
|
|
150
|
-
* 是否已销毁
|
|
151
|
-
*/ _define_property(this, "destroyed", false);
|
|
152
|
-
/**
|
|
153
|
-
* 开发模式标志
|
|
154
|
-
*/ _define_property(this, "devMode", void 0);
|
|
155
|
-
/**
|
|
156
|
-
* 中间件函数数组
|
|
157
|
-
*/ _define_property(this, "middleware", void 0);
|
|
158
|
-
this.value = initialValue;
|
|
159
|
-
this.id = options.id ?? Symbol('StateInstance');
|
|
160
|
-
this.scope = options.scope;
|
|
161
|
-
this.devMode = options.devMode ?? false;
|
|
162
|
-
this.middleware = options.middleware ?? [];
|
|
163
|
-
if (this.devMode) {
|
|
164
|
-
console.debug(`[StateInstance] Created: ${String(this.id)}`, {
|
|
165
|
-
scope: this.scope,
|
|
166
|
-
initialValue: this.value
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StateInstance",{enumerable:true,get:function(){return StateInstance}});function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let StateInstance=class StateInstance{get(){if(this.destroyed){throw new Error(`StateInstance ${String(this.id)} has been destroyed`)}return this.value}set(valueOrUpdater){if(this.destroyed){throw new Error(`StateInstance ${String(this.id)} has been destroyed`)}const previousValue=this.value;let newValue;if(typeof valueOrUpdater==="function"){newValue=valueOrUpdater(this.value)}else{newValue=valueOrUpdater}let processedValue=newValue;for(const middleware of this.middleware){processedValue=middleware(processedValue,previousValue)}if(processedValue===this.value){return}this.value=processedValue;if(this.devMode){console.debug(`[StateInstance] Updated: ${String(this.id)}`,{previous:previousValue,current:this.value})}this.notifySubscribers(this.value,previousValue)}subscribe(subscriber){if(this.destroyed){throw new Error(`StateInstance ${String(this.id)} has been destroyed`)}this.subscribers.add(subscriber);if(this.devMode){console.debug(`[StateInstance] Subscribed: ${String(this.id)}`,{subscriberCount:this.subscribers.size})}return()=>{this.subscribers.delete(subscriber);if(this.devMode){console.debug(`[StateInstance] Unsubscribed: ${String(this.id)}`,{subscriberCount:this.subscribers.size})}}}getId(){return this.id}getScope(){return this.scope}destroy(){if(this.destroyed){return}this.destroyed=true;this.subscribers.clear();this.value=undefined;if(this.devMode){console.debug(`[StateInstance] Destroyed: ${String(this.id)}`)}}isDestroyed(){return this.destroyed}notifySubscribers(value,previous){const subscribers=Array.from(this.subscribers);for(const subscriber of subscribers){try{subscriber(value,previous)}catch(error){console.error(`[StateInstance] Error in subscriber for ${String(this.id)}:`,error)}}}constructor(initialValue,options={}){_define_property(this,"id",void 0);_define_property(this,"scope",void 0);_define_property(this,"value",void 0);_define_property(this,"subscribers",new Set);_define_property(this,"destroyed",false);_define_property(this,"devMode",void 0);_define_property(this,"middleware",void 0);this.value=initialValue;this.id=options.id??Symbol("StateInstance");this.scope=options.scope;this.devMode=options.devMode??false;this.middleware=options.middleware??[];if(this.devMode){console.debug(`[StateInstance] Created: ${String(this.id)}`,{scope:this.scope,initialValue:this.value})}}};
|
|
@@ -1,110 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态注册表实现
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "StateRegistry", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return StateRegistry;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const _StateScope = require("./StateScope");
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
|
-
let StateRegistry = class StateRegistry {
|
|
28
|
-
/**
|
|
29
|
-
* 注册状态实例
|
|
30
|
-
*/ register(instance) {
|
|
31
|
-
const id = instance.getId();
|
|
32
|
-
if (this.instances.has(id)) {
|
|
33
|
-
console.warn(`[StateRegistry] Instance with id ${String(id)} already exists, replacing...`);
|
|
34
|
-
}
|
|
35
|
-
this.instances.set(id, instance);
|
|
36
|
-
// 如果实例有作用域,注册到作用域管理器
|
|
37
|
-
const scope = instance.getScope();
|
|
38
|
-
if (scope) {
|
|
39
|
-
this.scopeManager.register(instance, scope);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 注销状态实例
|
|
44
|
-
*/ unregister(id) {
|
|
45
|
-
const instance = this.instances.get(id);
|
|
46
|
-
if (!instance) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// 从作用域管理器注销
|
|
50
|
-
this.scopeManager.unregister(instance);
|
|
51
|
-
// 销毁实例
|
|
52
|
-
instance.destroy();
|
|
53
|
-
// 从注册表移除
|
|
54
|
-
this.instances.delete(id);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* 根据标识符获取状态实例
|
|
58
|
-
*/ getInstance(id) {
|
|
59
|
-
return this.instances.get(id);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 根据作用域获取所有状态实例
|
|
63
|
-
*/ getInstancesByScope(scope) {
|
|
64
|
-
return this.scopeManager.getInstances(scope);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 获取所有状态实例
|
|
68
|
-
*/ getAllInstances() {
|
|
69
|
-
return Array.from(this.instances.values());
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* 销毁指定作用域的所有状态实例
|
|
73
|
-
*/ destroyScope(scope) {
|
|
74
|
-
const instances = this.scopeManager.getInstances(scope);
|
|
75
|
-
// 销毁所有实例
|
|
76
|
-
for (const instance of instances){
|
|
77
|
-
instance.destroy();
|
|
78
|
-
this.instances.delete(instance.getId());
|
|
79
|
-
}
|
|
80
|
-
// 从作用域管理器清理
|
|
81
|
-
this.scopeManager.destroyScope(scope);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 销毁所有状态实例
|
|
85
|
-
*/ destroyAll() {
|
|
86
|
-
// 销毁所有实例
|
|
87
|
-
for (const instance of this.instances.values()){
|
|
88
|
-
instance.destroy();
|
|
89
|
-
}
|
|
90
|
-
// 清理所有映射
|
|
91
|
-
this.instances.clear();
|
|
92
|
-
this.scopeManager.destroyAll();
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* 获取注册表中的实例数量
|
|
96
|
-
*/ size() {
|
|
97
|
-
return this.instances.size;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 构造函数
|
|
101
|
-
*/ constructor(){
|
|
102
|
-
/**
|
|
103
|
-
* 状态实例映射表(ID -> Instance)
|
|
104
|
-
*/ _define_property(this, "instances", new Map());
|
|
105
|
-
/**
|
|
106
|
-
* 作用域管理器
|
|
107
|
-
*/ _define_property(this, "scopeManager", void 0);
|
|
108
|
-
this.scopeManager = new _StateScope.StateScopeManager();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StateRegistry",{enumerable:true,get:function(){return StateRegistry}});const _StateScope=require("./StateScope");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let StateRegistry=class StateRegistry{register(instance){const id=instance.getId();if(this.instances.has(id)){console.warn(`[StateRegistry] Instance with id ${String(id)} already exists, replacing...`)}this.instances.set(id,instance);const scope=instance.getScope();if(scope){this.scopeManager.register(instance,scope)}}unregister(id){const instance=this.instances.get(id);if(!instance){return}this.scopeManager.unregister(instance);instance.destroy();this.instances.delete(id)}getInstance(id){return this.instances.get(id)}getInstancesByScope(scope){return this.scopeManager.getInstances(scope)}getAllInstances(){return Array.from(this.instances.values())}destroyScope(scope){const instances=this.scopeManager.getInstances(scope);for(const instance of instances){instance.destroy();this.instances.delete(instance.getId())}this.scopeManager.destroyScope(scope)}destroyAll(){for(const instance of this.instances.values()){instance.destroy()}this.instances.clear();this.scopeManager.destroyAll()}size(){return this.instances.size}constructor(){_define_property(this,"instances",new Map);_define_property(this,"scopeManager",void 0);this.scopeManager=new _StateScope.StateScopeManager}};
|
|
@@ -1,137 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态作用域管理
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "StateScopeManager", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return StateScopeManager;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
function _define_property(obj, key, value) {
|
|
14
|
-
if (key in obj) {
|
|
15
|
-
Object.defineProperty(obj, key, {
|
|
16
|
-
value: value,
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
obj[key] = value;
|
|
23
|
-
}
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
26
|
-
let StateScopeManager = class StateScopeManager {
|
|
27
|
-
/**
|
|
28
|
-
* 注册状态实例到作用域
|
|
29
|
-
*
|
|
30
|
-
* @param instance - 状态实例
|
|
31
|
-
* @param scope - 状态作用域
|
|
32
|
-
*/ register(instance, scope) {
|
|
33
|
-
// 如果实例已经有作用域,先移除
|
|
34
|
-
const existingScope = this.instanceToScopeMap.get(instance);
|
|
35
|
-
if (existingScope) {
|
|
36
|
-
this.unregister(instance);
|
|
37
|
-
}
|
|
38
|
-
// 添加到新作用域
|
|
39
|
-
if (!this.scopeMap.has(scope)) {
|
|
40
|
-
this.scopeMap.set(scope, new Set());
|
|
41
|
-
}
|
|
42
|
-
const instances = this.scopeMap.get(scope);
|
|
43
|
-
instances.add(instance);
|
|
44
|
-
this.instanceToScopeMap.set(instance, scope);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 注销状态实例
|
|
48
|
-
*
|
|
49
|
-
* @param instance - 状态实例
|
|
50
|
-
*/ unregister(instance) {
|
|
51
|
-
const scope = this.instanceToScopeMap.get(instance);
|
|
52
|
-
if (!scope) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const instances = this.scopeMap.get(scope);
|
|
56
|
-
if (instances) {
|
|
57
|
-
instances.delete(instance);
|
|
58
|
-
// 如果作用域为空,清理映射
|
|
59
|
-
if (instances.size === 0) {
|
|
60
|
-
this.scopeMap.delete(scope);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
this.instanceToScopeMap.delete(instance);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* 根据作用域获取所有状态实例
|
|
67
|
-
*
|
|
68
|
-
* @param scope - 状态作用域
|
|
69
|
-
* @returns 状态实例数组
|
|
70
|
-
*/ getInstances(scope) {
|
|
71
|
-
const instances = this.scopeMap.get(scope);
|
|
72
|
-
return instances ? Array.from(instances) : [];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 获取状态实例的作用域
|
|
76
|
-
*
|
|
77
|
-
* @param instance - 状态实例
|
|
78
|
-
* @returns 状态作用域,如果不存在则返回 undefined
|
|
79
|
-
*/ getScope(instance) {
|
|
80
|
-
return this.instanceToScopeMap.get(instance);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 销毁指定作用域的所有状态实例
|
|
84
|
-
*
|
|
85
|
-
* @param scope - 状态作用域
|
|
86
|
-
*/ destroyScope(scope) {
|
|
87
|
-
const instances = this.scopeMap.get(scope);
|
|
88
|
-
if (!instances) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
// 销毁所有实例
|
|
92
|
-
for (const instance of instances){
|
|
93
|
-
instance.destroy();
|
|
94
|
-
this.instanceToScopeMap.delete(instance);
|
|
95
|
-
}
|
|
96
|
-
// 清理作用域映射
|
|
97
|
-
this.scopeMap.delete(scope);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 销毁所有作用域和状态实例
|
|
101
|
-
*/ destroyAll() {
|
|
102
|
-
// 销毁所有实例
|
|
103
|
-
for (const instances of this.scopeMap.values()){
|
|
104
|
-
for (const instance of instances){
|
|
105
|
-
instance.destroy();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// 清理所有映射
|
|
109
|
-
this.scopeMap.clear();
|
|
110
|
-
this.instanceToScopeMap.clear();
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* 获取所有作用域
|
|
114
|
-
*
|
|
115
|
-
* @returns 作用域数组
|
|
116
|
-
*/ getAllScopes() {
|
|
117
|
-
return Array.from(this.scopeMap.keys());
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* 获取作用域数量
|
|
121
|
-
*/ getScopeCount() {
|
|
122
|
-
return this.scopeMap.size;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* 获取总实例数量
|
|
126
|
-
*/ getInstanceCount() {
|
|
127
|
-
return this.instanceToScopeMap.size;
|
|
128
|
-
}
|
|
129
|
-
constructor(){
|
|
130
|
-
/**
|
|
131
|
-
* 作用域到状态实例的映射
|
|
132
|
-
*/ _define_property(this, "scopeMap", new Map());
|
|
133
|
-
/**
|
|
134
|
-
* 状态实例到作用域的映射(用于快速查找)
|
|
135
|
-
*/ _define_property(this, "instanceToScopeMap", new Map());
|
|
136
|
-
}
|
|
137
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StateScopeManager",{enumerable:true,get:function(){return StateScopeManager}});function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let StateScopeManager=class StateScopeManager{register(instance,scope){const existingScope=this.instanceToScopeMap.get(instance);if(existingScope){this.unregister(instance)}if(!this.scopeMap.has(scope)){this.scopeMap.set(scope,new Set)}const instances=this.scopeMap.get(scope);instances.add(instance);this.instanceToScopeMap.set(instance,scope)}unregister(instance){const scope=this.instanceToScopeMap.get(instance);if(!scope){return}const instances=this.scopeMap.get(scope);if(instances){instances.delete(instance);if(instances.size===0){this.scopeMap.delete(scope)}}this.instanceToScopeMap.delete(instance)}getInstances(scope){const instances=this.scopeMap.get(scope);return instances?Array.from(instances):[]}getScope(instance){return this.instanceToScopeMap.get(instance)}destroyScope(scope){const instances=this.scopeMap.get(scope);if(!instances){return}for(const instance of instances){instance.destroy();this.instanceToScopeMap.delete(instance)}this.scopeMap.delete(scope)}destroyAll(){for(const instances of this.scopeMap.values()){for(const instance of instances){instance.destroy()}}this.scopeMap.clear();this.instanceToScopeMap.clear()}getAllScopes(){return Array.from(this.scopeMap.keys())}getScopeCount(){return this.scopeMap.size}getInstanceCount(){return this.instanceToScopeMap.size}constructor(){_define_property(this,"scopeMap",new Map);_define_property(this,"instanceToScopeMap",new Map)}};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态管理器核心模块导出
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
function _export(target, all) {
|
|
8
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
_export(exports, {
|
|
14
|
-
get DerivedStateInstance () {
|
|
15
|
-
return _DerivedStateInstance.DerivedStateInstance;
|
|
16
|
-
},
|
|
17
|
-
get StateInstance () {
|
|
18
|
-
return _StateInstance.StateInstance;
|
|
19
|
-
},
|
|
20
|
-
get StateRegistry () {
|
|
21
|
-
return _StateRegistry.StateRegistry;
|
|
22
|
-
},
|
|
23
|
-
get StateScopeManager () {
|
|
24
|
-
return _StateScope.StateScopeManager;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const _StateInstance = require("./StateInstance");
|
|
28
|
-
const _StateScope = require("./StateScope");
|
|
29
|
-
const _StateRegistry = require("./StateRegistry");
|
|
30
|
-
const _DerivedStateInstance = require("./DerivedStateInstance");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get DerivedStateInstance(){return _DerivedStateInstance.DerivedStateInstance},get StateInstance(){return _StateInstance.StateInstance},get StateRegistry(){return _StateRegistry.StateRegistry},get StateScopeManager(){return _StateScope.StateScopeManager}});const _StateInstance=require("./StateInstance");const _StateScope=require("./StateScope");const _StateRegistry=require("./StateRegistry");const _DerivedStateInstance=require("./DerivedStateInstance");
|
package/dist/state/index.cjs
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态管理器模块统一导出
|
|
3
|
-
*/ // 导出核心类型
|
|
4
|
-
"use strict";
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "StateManager", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function() {
|
|
11
|
-
return _StateManager.StateManager;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
_export_star(require("./types"), exports);
|
|
15
|
-
_export_star(require("./core"), exports);
|
|
16
|
-
_export_star(require("./adapters"), exports);
|
|
17
|
-
const _StateManager = require("./StateManager");
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"StateManager",{enumerable:true,get:function(){return _StateManager.StateManager}});_export_star(require("./types"),exports);_export_star(require("./core"),exports);_export_star(require("./adapters"),exports);const _StateManager=require("./StateManager");function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
|
package/dist/state/types.cjs
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 状态管理器类型定义
|
|
3
|
-
*/ /**
|
|
4
|
-
* 状态更新函数类型
|
|
5
|
-
*
|
|
6
|
-
* @template T - 状态值类型
|
|
7
|
-
* @param current - 当前状态值
|
|
8
|
-
* @returns 新的状态值
|
|
9
|
-
*/ "use strict";
|
|
10
|
-
Object.defineProperty(exports, "__esModule", {
|
|
11
|
-
value: true
|
|
12
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
package/dist/state.umd.js
CHANGED