@linxin666/dsh-client-ui-skin-center 0.3.14 → 0.3.16

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/lib/client.js CHANGED
@@ -4969,7 +4969,7 @@ window.__ModuleLoader__.load({
4969
4969
  /** The building package's version, when the bundle carries it. */
4970
4970
  function bakedVersion() {
4971
4971
  try {
4972
- return "0.3.14";
4972
+ return "0.3.16";
4973
4973
  } catch {
4974
4974
  return;
4975
4975
  }
package/lib/index.js CHANGED
@@ -9414,36 +9414,49 @@ const SkinWallpaperConfigSchema = z.object({
9414
9414
  const apply = mountOnce("@linxin666/dsh-client-ui-skin-center", applyImpl);
9415
9415
  function applyImpl(ctx) {
9416
9416
  ctx.inject(["settings"], (settingsCtx) => {
9417
- settingsCtx.settings.installSection(ctx, SKIN_BACKGROUND_NAMESPACE, SkinBackgroundConfigSchema, {}, {
9418
- setSource: (source) => {
9419
- const migration = migrateBackgroundFromSettings({
9420
- activeStatePath: defaultActiveStatePath(),
9421
- readSettings: source
9422
- });
9423
- for (const note of migration.notes) if (migration.migrated) console.info(`[ui-skin-center] background migration: ${note}`);
9424
- else console.error(`[ui-skin-center] background migration: ${note}`);
9425
- },
9426
- onChange: () => {}
9427
- });
9417
+ try {
9418
+ if (typeof settingsCtx.settings?.installSection === "function") settingsCtx.settings.installSection(ctx, SKIN_BACKGROUND_NAMESPACE, SkinBackgroundConfigSchema, {}, {
9419
+ setSource: (source) => {
9420
+ const migration = migrateBackgroundFromSettings({
9421
+ activeStatePath: defaultActiveStatePath(),
9422
+ readSettings: source
9423
+ });
9424
+ for (const note of migration.notes) if (migration.migrated) console.info(`[ui-skin-center] background migration: ${note}`);
9425
+ else console.error(`[ui-skin-center] background migration: ${note}`);
9426
+ },
9427
+ onChange: () => {}
9428
+ });
9429
+ else if (typeof settingsCtx.settings?.register === "function") settingsCtx.settings.register(SKIN_BACKGROUND_NAMESPACE, SkinBackgroundConfigSchema, { base: {} });
9430
+ } catch {}
9428
9431
  });
9429
9432
  ctx.inject(["settings"], (settingsCtx) => {
9430
- settingsCtx.settings.installSection(ctx, SKIN_CUSTOM_THEME_NAMESPACE, SkinCustomThemeConfigSchema, {
9431
- ...CUSTOM_THEME_DEFAULTS,
9432
- light: { ...CUSTOM_THEME_DEFAULTS.light },
9433
- dark: { ...CUSTOM_THEME_DEFAULTS.dark }
9434
- }, {
9435
- setSource: () => {},
9436
- onChange: () => {}
9437
- });
9433
+ try {
9434
+ const baseTheme = {
9435
+ ...CUSTOM_THEME_DEFAULTS,
9436
+ light: { ...CUSTOM_THEME_DEFAULTS.light },
9437
+ dark: { ...CUSTOM_THEME_DEFAULTS.dark }
9438
+ };
9439
+ if (typeof settingsCtx.settings?.installSection === "function") settingsCtx.settings.installSection(ctx, SKIN_CUSTOM_THEME_NAMESPACE, SkinCustomThemeConfigSchema, baseTheme, {
9440
+ setSource: () => {},
9441
+ onChange: () => {}
9442
+ });
9443
+ else if (typeof settingsCtx.settings?.register === "function") settingsCtx.settings.register(SKIN_CUSTOM_THEME_NAMESPACE, SkinCustomThemeConfigSchema, { base: baseTheme });
9444
+ } catch {}
9438
9445
  });
9439
9446
  let wallpaperSource = () => ({});
9440
9447
  ctx.inject(["settings"], (settingsCtx) => {
9441
- settingsCtx.settings.installSection(ctx, SKIN_WALLPAPER_NAMESPACE, SkinWallpaperConfigSchema, {}, {
9442
- setSource: (source) => {
9443
- wallpaperSource = source;
9444
- },
9445
- onChange: () => {}
9446
- });
9448
+ try {
9449
+ if (typeof settingsCtx.settings?.installSection === "function") settingsCtx.settings.installSection(ctx, SKIN_WALLPAPER_NAMESPACE, SkinWallpaperConfigSchema, {}, {
9450
+ setSource: (source) => {
9451
+ wallpaperSource = source;
9452
+ },
9453
+ onChange: () => {}
9454
+ });
9455
+ else if (typeof settingsCtx.settings?.register === "function") {
9456
+ const scope = settingsCtx.settings.register(SKIN_WALLPAPER_NAMESPACE, SkinWallpaperConfigSchema, { base: {} });
9457
+ wallpaperSource = () => scope?.get?.() ?? {};
9458
+ }
9459
+ } catch {}
9447
9460
  });
9448
9461
  const routes = [...makeSkinCenterV2Routes(), ...makeWeRoutes({
9449
9462
  getConfig: () => wallpaperSource(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-skin-center",
3
3
  "description": "In-GUI skin center for the dsh web GUI — the single skin package: skins are pure asset directories (built-in plus $DSH_HOME/skins) loaded and rendered only by the skin center; live try-on and one-click apply switch atomically in the page (no reload, no cordis.patch.yml rewrite, no restart)",
4
- "version": "0.3.14",
4
+ "version": "0.3.16",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {