@vlian/framework 1.2.43 → 1.2.44

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.42
2
+ * @vlian/framework v1.2.43
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.42
2
+ * @vlian/framework v1.2.43
3
3
  * Secra Framework - 一个现代化的低代码框架
4
4
  * (c) 2026 Secra Framework Contributors
5
5
  * Licensed under Apache-2.0
@@ -12234,17 +12234,15 @@
12234
12234
  }
12235
12235
  };
12236
12236
 
12237
- function resolveWebStorage(driver) {
12238
- if (typeof window === 'undefined') {
12237
+ function resolveStorageInstance(driver) {
12238
+ if (driver === 'none' || typeof window === 'undefined') {
12239
12239
  return null;
12240
12240
  }
12241
- if (driver === 'localStorage') {
12242
- return window.localStorage;
12243
- }
12244
- if (driver === 'sessionStorage') {
12245
- return window.sessionStorage;
12241
+ const instance = driver === 'localStorage' ? storage.local : driver === 'sessionStorage' ? storage.session : storage.indexedDB;
12242
+ if (!instance || typeof instance.get !== 'function' || typeof instance.set !== 'function') {
12243
+ return null;
12246
12244
  }
12247
- return null;
12245
+ return instance;
12248
12246
  }
12249
12247
  async function readPersistedValue(persistence) {
12250
12248
  if (!persistence || persistence.enabled === false) {
@@ -12255,26 +12253,19 @@
12255
12253
  if (!key) {
12256
12254
  return null;
12257
12255
  }
12258
- if (driver === 'indexedDB') {
12259
- try {
12260
- const value = await storage.indexedDB.get(key);
12261
- if (value === null || value === undefined) {
12262
- return null;
12263
- }
12264
- if (typeof value === 'string') {
12265
- return value;
12266
- }
12267
- return JSON.stringify(value);
12268
- } catch {
12269
- return null;
12270
- }
12271
- }
12272
- const targetStorage = resolveWebStorage(driver);
12256
+ const targetStorage = resolveStorageInstance(driver);
12273
12257
  if (!targetStorage) {
12274
12258
  return null;
12275
12259
  }
12276
12260
  try {
12277
- return targetStorage.getItem(key);
12261
+ const value = await targetStorage.get(key);
12262
+ if (value === null || value === undefined) {
12263
+ return null;
12264
+ }
12265
+ if (typeof value === 'string') {
12266
+ return value;
12267
+ }
12268
+ return JSON.stringify(value);
12278
12269
  } catch {
12279
12270
  return null;
12280
12271
  }
@@ -12288,20 +12279,12 @@
12288
12279
  if (!key) {
12289
12280
  return;
12290
12281
  }
12291
- if (driver === 'indexedDB') {
12292
- try {
12293
- await storage.indexedDB.set(key, value);
12294
- } catch {
12295
- // ignore persistence errors
12296
- }
12297
- return;
12298
- }
12299
- const targetStorage = resolveWebStorage(driver);
12282
+ const targetStorage = resolveStorageInstance(driver);
12300
12283
  if (!targetStorage) {
12301
12284
  return;
12302
12285
  }
12303
12286
  try {
12304
- targetStorage.setItem(key, value);
12287
+ await targetStorage.set(key, value);
12305
12288
  } catch {
12306
12289
  // ignore persistence errors
12307
12290
  }