@vlian/framework 1.2.50 → 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.49
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,14 +1,14 @@
1
1
  /*!
2
- * @vlian/framework v1.2.49
2
+ * @vlian/framework v1.2.53
3
3
  * Secra Framework - 一个现代化的低代码框架
4
4
  * (c) 2026 Secra Framework Contributors
5
5
  * Licensed under Apache-2.0
6
6
  */
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vlian/utils'), require('@vlian/logger'), require('@vlian/monitoring'), require('react/jsx-runtime'), require('react-dom/client'), require('react'), require('react-router-dom'), require('zod'), require('i18next'), require('react-i18next'), require('@vlian/csrf')) :
9
- typeof define === 'function' && define.amd ? define(['exports', '@vlian/utils', '@vlian/logger', '@vlian/monitoring', 'react/jsx-runtime', 'react-dom/client', 'react', 'react-router-dom', 'zod', 'i18next', 'react-i18next', '@vlian/csrf'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vlianFramework = {}, global.vlianUtils, global.logger, global.monitoring, global.jsxRuntime, global.ReactDOMClient, global.React, global.ReactRouterDOM, global.z, global.i18next, global.ReactI18next, global.csrf));
11
- })(this, (function (exports, vlianUtils, logger, monitoring, jsxRuntime, client, React, reactRouterDom, zod, i18n, reactI18next, csrf) { 'use strict';
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vlian/utils'), require('@vlian/logger'), require('@vlian/monitoring'), require('react/jsx-runtime'), require('react-dom/client'), require('react'), require('react-router-dom'), require('zod'), require('i18next'), require('react-i18next'), require('@vlian/csrf'), require('@/utils')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', '@vlian/utils', '@vlian/logger', '@vlian/monitoring', 'react/jsx-runtime', 'react-dom/client', 'react', 'react-router-dom', 'zod', 'i18next', 'react-i18next', '@vlian/csrf', '@/utils'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vlianFramework = {}, global.vlianUtils, global.logger, global.monitoring, global.jsxRuntime, global.ReactDOMClient, global.React, global.ReactRouterDOM, global.z, global.i18next, global.ReactI18next, global.csrf, global.utils$1));
11
+ })(this, (function (exports, vlianUtils, logger, monitoring, jsxRuntime, client, React, reactRouterDom, zod, i18n, reactI18next, csrf, utils$1) { 'use strict';
12
12
 
13
13
  function _interopNamespaceDefault(e) {
14
14
  var n = Object.create(null);
@@ -12296,7 +12296,8 @@
12296
12296
  }
12297
12297
  try {
12298
12298
  await targetStorage.set(key, value);
12299
- } catch {
12299
+ } catch (e) {
12300
+ utils$1.logger.error(e);
12300
12301
  // ignore persistence errors
12301
12302
  }
12302
12303
  }
@@ -12417,20 +12418,22 @@
12417
12418
  class CacheManager {
12418
12419
  initialize(context) {
12419
12420
  this.snapshot = context.config.cache;
12420
- storage.initialize({
12421
+ this.cacheIn = vlianUtils.createStorage({
12422
+ type: this.snapshot.storageOptions?.type || 'local',
12421
12423
  prefix: this.snapshot.storageOptions?.prefix || 'vlian',
12422
12424
  defaultExpire: this.snapshot.storageOptions?.defaultExpire || 24 * 60 * 60 * 1000,
12423
- tableName: this.snapshot.storageOptions?.tableName,
12424
- cache: {
12425
- enabled: this.snapshot.enabled
12426
- }
12425
+ dbName: this.snapshot.storageOptions?.tableName
12427
12426
  });
12428
12427
  }
12428
+ get cache() {
12429
+ return this.cacheIn;
12430
+ }
12429
12431
  getSnapshot() {
12430
12432
  return this.snapshot;
12431
12433
  }
12432
12434
  constructor(){
12433
12435
  _define_property$3(this, "snapshot", DEFAULT_CONFIG.cache);
12436
+ _define_property$3(this, "cacheIn", void 0);
12434
12437
  }
12435
12438
  }
12436
12439
 
@@ -12471,19 +12474,18 @@
12471
12474
  ...DEFAULT_THEME,
12472
12475
  ...this.config.initial || {}
12473
12476
  };
12474
- 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
+ });
12475
12482
  if (persisted !== null) {
12476
- try {
12477
- const parsed = JSON.parse(persisted);
12478
- this.theme = {
12479
- ...this.theme,
12480
- ...parsed
12481
- };
12482
- } catch {
12483
- // ignore parse errors
12484
- }
12483
+ this.theme = {
12484
+ ...this.theme,
12485
+ ...persisted
12486
+ };
12485
12487
  } else {
12486
- await writePersistedValue(this.config.persistence, JSON.stringify(this.theme));
12488
+ await this.cache.set(key, persisted);
12487
12489
  }
12488
12490
  applyThemeToDocument(this.theme);
12489
12491
  }
@@ -12514,7 +12516,8 @@
12514
12516
  ...nextTheme
12515
12517
  };
12516
12518
  applyThemeToDocument(this.theme);
12517
- 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);
12518
12521
  this.emit(this.theme, prev);
12519
12522
  }
12520
12523
  getSnapshot() {
@@ -12524,6 +12527,7 @@
12524
12527
  _define_property$2(this, "theme", DEFAULT_THEME);
12525
12528
  _define_property$2(this, "config", DEFAULT_CONFIG.theme);
12526
12529
  _define_property$2(this, "listeners", new Set());
12530
+ _define_property$2(this, "cache", undefined);
12527
12531
  }
12528
12532
  }
12529
12533
 
@@ -12797,7 +12801,8 @@
12797
12801
  }
12798
12802
  const context = {
12799
12803
  instanceId: this.instanceId,
12800
- config: this.config
12804
+ config: this.config,
12805
+ cacheManager: this.cacheManager.cache
12801
12806
  };
12802
12807
  const initPromise = (async ()=>{
12803
12808
  await manager.initialize(context);