dsh-background-by-model 0.8.0 → 0.8.1

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/index.js CHANGED
@@ -93,37 +93,6 @@ const DEFAULT_PART_OPACITIES = {
93
93
  code: .81,
94
94
  input: .88
95
95
  };
96
- /**
97
- * Interface blur (px, 0..60), global (Interface page):
98
- * `bg` main background (AppFrame grid)
99
- * `sidebar` sidebar column
100
- * `card` cards/panels (center + details columns, dialog option panels)
101
- * `settings` settings panel
102
- * `chat` conversation text region (message column of the chat view)
103
- * `trajectory` trajectory view surface
104
- * `rightbar` file-preview panel — the right sidebar a file click opens
105
- * `input` input/control surfaces ([data-composer-card], [data-cordis-panel])
106
- */
107
- const PART_BLUR_KEYS = [
108
- "bg",
109
- "sidebar",
110
- "card",
111
- "settings",
112
- "chat",
113
- "trajectory",
114
- "rightbar",
115
- "input"
116
- ];
117
- const DEFAULT_PART_BLURS = {
118
- bg: 0,
119
- sidebar: 0,
120
- card: 0,
121
- settings: 0,
122
- chat: 0,
123
- trajectory: 0,
124
- rightbar: 0,
125
- input: 60
126
- };
127
96
  /** Longest allowed switch duration; 0 is a hard cut. */
128
97
  const TRANSITION_MAX_MS = 3e3;
129
98
  /** Every accepted `effect`, in UI order. */
@@ -209,6 +178,7 @@ function defaultHolidayRule(def) {
209
178
  enabled: true,
210
179
  color,
211
180
  wallpaperOpacity: 1,
181
+ brightness: 100,
212
182
  blur: 0,
213
183
  rotate: defaultRotation()
214
184
  };
@@ -238,6 +208,7 @@ function blankRule(id) {
238
208
  enabled: true,
239
209
  color: null,
240
210
  wallpaperOpacity: 1,
211
+ brightness: 100,
241
212
  blur: 0,
242
213
  rotate: defaultRotation()
243
214
  };
@@ -421,7 +392,8 @@ function normalizeRule(raw) {
421
392
  if (images.length === 0 && !hadList) return null;
422
393
  const rotate = normalizeRotation(r.rotate);
423
394
  if (images.length < 2) rotate.enabled = false;
424
- return {
395
+ const brightness = r.brightness === void 0 ? void 0 : clamp(r.brightness, 0, 200, 100);
396
+ const rule = {
425
397
  id,
426
398
  images,
427
399
  match: typeof r.match === "string" ? r.match : "",
@@ -431,6 +403,8 @@ function normalizeRule(raw) {
431
403
  blur: clamp(r.blur, 0, 60, 0),
432
404
  rotate
433
405
  };
406
+ if (brightness !== void 0) rule.brightness = brightness;
407
+ return rule;
434
408
  }
435
409
  /**
436
410
  * Coerce one persisted holiday entry.
@@ -454,6 +428,7 @@ function normalizeHolidayRule(def, raw) {
454
428
  ...base,
455
429
  enabled: r.enabled !== false,
456
430
  wallpaperOpacity: clamp01(r.wallpaperOpacity, base.wallpaperOpacity),
431
+ brightness: clamp(r.brightness, 0, 200, base.brightness ?? 100),
457
432
  blur: clamp(r.blur, 0, 60, base.blur),
458
433
  images: base.images.map((image) => ({
459
434
  slot: image.slot,
@@ -503,20 +478,17 @@ function normalizeConfig(raw) {
503
478
  const r = raw ?? {};
504
479
  const rules = Array.isArray(r.rules) ? r.rules.map(normalizeRule).filter((x) => x !== null) : [blankRule("r1")];
505
480
  const ops = r.opacities ?? {};
506
- const bl = r.blurs ?? {};
507
- const blurs = {};
508
- for (const k of PART_BLUR_KEYS) blurs[k] = clamp(bl[k], 0, 60, DEFAULT_PART_BLURS[k]);
509
481
  const opacities = {};
510
482
  for (const k of PART_OPACITY_KEYS) opacities[k] = clamp01(ops[k], DEFAULT_PART_OPACITIES[k]);
511
483
  return {
512
484
  rules,
513
485
  opacities,
514
- blurs,
515
486
  transition: normalizeTransition(r.transition, legacyFadeMs(r.rules)),
516
487
  settingsOpacity: clamp01(r.settingsOpacity, 1),
517
488
  chatTextOpacity: clamp01(r.chatTextOpacity, DEFAULT_CHAT_TEXT_OPACITY),
518
489
  trajectoryOpacity: clamp01(r.trajectoryOpacity, DEFAULT_TRAJECTORY_OPACITY),
519
490
  rightbarOpacity: normalizeRightbarOpacity(r.rightbarOpacity),
491
+ pageOpacity: clamp01(r.pageOpacity, 0),
520
492
  autoExtract: r.autoExtract !== false,
521
493
  holidays: normalizeHolidays(r.holidays)
522
494
  };
@@ -700,7 +672,7 @@ const HOLIDAY_FETCH_TIMEOUT = 1e4;
700
672
  const PRESET_ASSETS_REPO = "HarmlessFunny/assets";
701
673
  const PRESET_ASSETS_REF = "v0.1.0";
702
674
  const PRESET_ASSET_DIR = "dsh-background-by-model/preset";
703
- /** The shape gate: `{"version": 6}` — see SCHEMA_VERSION in ./schema. */
675
+ /** The shape gate: `{"version": 9}` — see SCHEMA_VERSION in ./schema. */
704
676
  const PRESET_MANIFEST = "preset.json";
705
677
  const PRESET_CONFIG = "theme-config.json";
706
678
  /** Images are named after the slot they fill, exactly as they are on disk. */
@@ -793,10 +765,10 @@ async function migrateLegacy(raw) {
793
765
  enabled: true,
794
766
  color: Array.isArray(r.color) ? r.color : null,
795
767
  wallpaperOpacity: typeof r.wallpaperOpacity === "number" ? r.wallpaperOpacity : 1,
768
+ brightness: typeof r.brightness === "number" ? r.brightness : 100,
796
769
  blur: typeof r.blur === "number" ? r.blur : 0
797
770
  }],
798
771
  opacities: r.opacities,
799
- blurs: r.blurs,
800
772
  settingsOpacity: r.settingsOpacity,
801
773
  chatTextOpacity: r.chatTextOpacity,
802
774
  trajectoryOpacity: r.trajectoryOpacity,
@@ -831,7 +803,8 @@ const LEGACY_CONFIG_KEYS = /* @__PURE__ */ new Set([
831
803
  "bgMode",
832
804
  "wallpaperOpacity",
833
805
  "blur",
834
- "bgState"
806
+ "bgState",
807
+ "blurs"
835
808
  ]);
836
809
  const LEGACY_RULE_KEYS = /* @__PURE__ */ new Set([
837
810
  "slot",
@@ -850,7 +823,7 @@ function warnUnknownConfigKeys(raw, normalized) {
850
823
  };
851
824
  const known = new Set(Object.keys(normalized));
852
825
  for (const key of Object.keys(r)) if (!known.has(key) && !LEGACY_CONFIG_KEYS.has(key)) warned(key);
853
- const groups = [["blurs", normalized.blurs], ["opacities", normalized.opacities]];
826
+ const groups = [["opacities", normalized.opacities]];
854
827
  for (const [group, have] of groups) {
855
828
  const got = r[group];
856
829
  if (got === null || typeof got !== "object") continue;
@@ -1153,7 +1126,7 @@ async function fetchPresetConfig() {
1153
1126
  ok: false,
1154
1127
  error: "not a profile"
1155
1128
  };
1156
- if (declared > 6) return {
1129
+ if (declared > 9) return {
1157
1130
  ok: false,
1158
1131
  error: "newer version"
1159
1132
  };
@@ -1462,7 +1435,7 @@ async function handleRpcMethod(ctx, endpoint, payload) {
1462
1435
  value: {
1463
1436
  config: await readConfig(),
1464
1437
  slots: await listSlots(),
1465
- schema: 6
1438
+ schema: 9
1466
1439
  }
1467
1440
  };
1468
1441
  case "writeConfig": return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-background-by-model",
3
- "version": "0.8.0",
4
- "description": "Appearance plugin for DeepSeek Harness: an ordered list of model rules, each carrying its own wallpapers — every image with its own framing and theme color — plus layout mode, opacity and blur; the background follows the model you switch to, and a rule can rotate through several images on its own rhythm.",
3
+ "version": "0.8.1",
4
+ "description": "Appearance plugin for DeepSeek Harness: an ordered list of model rules, each carrying its own wallpapers — every image with its own framing and theme color — plus layout mode, opacity, brightness and blur; the background follows the model you switch to, and a rule can rotate through several images on its own rhythm.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "dsh",