@vlian/framework 1.2.51 → 1.2.54

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @vlian/framework v1.2.50
2
+ * @vlian/framework v1.2.53
3
3
  * Secra Framework - 一个现代化的低代码框架
4
4
  * (c) 2026 Secra Framework Contributors
5
5
  * Licensed under Apache-2.0
package/dist/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @vlian/framework v1.2.50
2
+ * @vlian/framework v1.2.53
3
3
  * Secra Framework - 一个现代化的低代码框架
4
4
  * (c) 2026 Secra Framework Contributors
5
5
  * Licensed under Apache-2.0
@@ -12418,20 +12418,22 @@
12418
12418
  class CacheManager {
12419
12419
  initialize(context) {
12420
12420
  this.snapshot = context.config.cache;
12421
- storage.initialize({
12421
+ this.cacheIn = vlianUtils.createStorage({
12422
+ type: this.snapshot.storageOptions?.type || 'local',
12422
12423
  prefix: this.snapshot.storageOptions?.prefix || 'vlian',
12423
12424
  defaultExpire: this.snapshot.storageOptions?.defaultExpire || 24 * 60 * 60 * 1000,
12424
- tableName: this.snapshot.storageOptions?.tableName,
12425
- cache: {
12426
- enabled: this.snapshot.enabled
12427
- }
12425
+ dbName: this.snapshot.storageOptions?.tableName
12428
12426
  });
12429
12427
  }
12428
+ get cache() {
12429
+ return this.cacheIn;
12430
+ }
12430
12431
  getSnapshot() {
12431
12432
  return this.snapshot;
12432
12433
  }
12433
12434
  constructor(){
12434
12435
  _define_property$3(this, "snapshot", DEFAULT_CONFIG.cache);
12436
+ _define_property$3(this, "cacheIn", void 0);
12435
12437
  }
12436
12438
  }
12437
12439
 
@@ -12472,19 +12474,18 @@
12472
12474
  ...DEFAULT_THEME,
12473
12475
  ...this.config.initial || {}
12474
12476
  };
12475
- const persisted = await readPersistedValue(this.config.persistence);
12477
+ this.cache = context.cacheManager;
12478
+ const { key = "vlian:kernel:theme" } = this.config.persistence || {};
12479
+ const persisted = await this.cache.get(key, {
12480
+ defaultValue: this.theme
12481
+ });
12476
12482
  if (persisted !== null) {
12477
- try {
12478
- const parsed = JSON.parse(persisted);
12479
- this.theme = {
12480
- ...this.theme,
12481
- ...parsed
12482
- };
12483
- } catch {
12484
- // ignore parse errors
12485
- }
12483
+ this.theme = {
12484
+ ...this.theme,
12485
+ ...persisted
12486
+ };
12486
12487
  } else {
12487
- await writePersistedValue(this.config.persistence, JSON.stringify(this.theme));
12488
+ await this.cache.set(key, persisted);
12488
12489
  }
12489
12490
  applyThemeToDocument(this.theme);
12490
12491
  }
@@ -12515,7 +12516,8 @@
12515
12516
  ...nextTheme
12516
12517
  };
12517
12518
  applyThemeToDocument(this.theme);
12518
- await writePersistedValue(this.config.persistence, JSON.stringify(this.theme));
12519
+ const { key = "vlian:kernel:theme" } = this.config.persistence || {};
12520
+ await this.cache?.set(key, this.theme);
12519
12521
  this.emit(this.theme, prev);
12520
12522
  }
12521
12523
  getSnapshot() {
@@ -12525,6 +12527,7 @@
12525
12527
  _define_property$2(this, "theme", DEFAULT_THEME);
12526
12528
  _define_property$2(this, "config", DEFAULT_CONFIG.theme);
12527
12529
  _define_property$2(this, "listeners", new Set());
12530
+ _define_property$2(this, "cache", undefined);
12528
12531
  }
12529
12532
  }
12530
12533
 
@@ -12798,7 +12801,8 @@
12798
12801
  }
12799
12802
  const context = {
12800
12803
  instanceId: this.instanceId,
12801
- config: this.config
12804
+ config: this.config,
12805
+ cacheManager: this.cacheManager.cache
12802
12806
  };
12803
12807
  const initPromise = (async ()=>{
12804
12808
  await manager.initialize(context);