dsh-any-background 0.1.7 → 0.1.8
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/LICENSE +21 -21
- package/README.md +40 -209
- package/README.zh.md +43 -211
- package/cordis.patch.yml +8 -8
- package/lib/client.js +2866 -963
- package/lib/client.js.map +1 -1
- package/lib/index.js +47 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -44,7 +44,10 @@ const DEFAULT_CONFIG = {
|
|
|
44
44
|
y: 0,
|
|
45
45
|
iw: 0,
|
|
46
46
|
ih: 0
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
backgroundType: "image",
|
|
49
|
+
generatedBg: null,
|
|
50
|
+
regenerateOnReload: false
|
|
48
51
|
};
|
|
49
52
|
const dataDir = () => dshHomePath(DATA_DIR);
|
|
50
53
|
const configPath = () => dshHomePath(DATA_DIR, CONFIG_FILE);
|
|
@@ -62,6 +65,14 @@ function normalizeConfig(raw) {
|
|
|
62
65
|
clamp(c[2], 0, 1, .25)
|
|
63
66
|
] : null;
|
|
64
67
|
const bg = r.bgState ?? {};
|
|
68
|
+
const bgType = [
|
|
69
|
+
"image",
|
|
70
|
+
"mesh",
|
|
71
|
+
"shader",
|
|
72
|
+
"pattern"
|
|
73
|
+
].includes(r.backgroundType) ? r.backgroundType : DEFAULT_CONFIG.backgroundType;
|
|
74
|
+
const gen = r.generatedBg && typeof r.generatedBg === "object" ? r.generatedBg : null;
|
|
75
|
+
const generatedBg = gen && gen.type === bgType ? normalizeGeneratedBg(r.generatedBg) : null;
|
|
65
76
|
const legacy = typeof r.opacity === "number" ? r.opacity : null;
|
|
66
77
|
const ops = r.opacities ?? {};
|
|
67
78
|
const bl = r.blurs ?? {};
|
|
@@ -87,8 +98,42 @@ function normalizeConfig(raw) {
|
|
|
87
98
|
y: typeof bg.y === "number" && isFinite(bg.y) ? bg.y : 0,
|
|
88
99
|
iw: typeof bg.iw === "number" && bg.iw > 0 ? bg.iw : 0,
|
|
89
100
|
ih: typeof bg.ih === "number" && bg.ih > 0 ? bg.ih : 0
|
|
90
|
-
}
|
|
101
|
+
},
|
|
102
|
+
backgroundType: bgType,
|
|
103
|
+
generatedBg,
|
|
104
|
+
regenerateOnReload: typeof r.regenerateOnReload === "boolean" ? r.regenerateOnReload : DEFAULT_CONFIG.regenerateOnReload
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function normalizeGeneratedBg(p) {
|
|
108
|
+
if (p.type === "mesh") return {
|
|
109
|
+
type: "mesh",
|
|
110
|
+
seed: typeof p.seed === "number" ? p.seed : 0,
|
|
111
|
+
scale: clamp(p.scale, .3, 3, 1),
|
|
112
|
+
intensity: clamp(p.intensity, 0, 1, .6)
|
|
113
|
+
};
|
|
114
|
+
if (p.type === "shader") return {
|
|
115
|
+
type: "shader",
|
|
116
|
+
preset: [
|
|
117
|
+
"aurora",
|
|
118
|
+
"nebula",
|
|
119
|
+
"noise"
|
|
120
|
+
].includes(p.preset) ? p.preset : "aurora",
|
|
121
|
+
speed: clamp(p.speed, 0, 2, .3),
|
|
122
|
+
scale: clamp(p.scale, .3, 3, 1),
|
|
123
|
+
seed: typeof p.seed === "number" ? Math.floor(p.seed) : 0
|
|
124
|
+
};
|
|
125
|
+
if (p.type === "pattern") return {
|
|
126
|
+
type: "pattern",
|
|
127
|
+
preset: [
|
|
128
|
+
"dots",
|
|
129
|
+
"waves",
|
|
130
|
+
"poly"
|
|
131
|
+
].includes(p.preset) ? p.preset : "dots",
|
|
132
|
+
density: clamp(p.density, 0, 1, .5),
|
|
133
|
+
scale: clamp(p.scale, .3, 3, 1),
|
|
134
|
+
seed: typeof p.seed === "number" ? Math.floor(p.seed) : 0
|
|
91
135
|
};
|
|
136
|
+
return null;
|
|
92
137
|
}
|
|
93
138
|
async function ensureDir() {
|
|
94
139
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-any-background",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Appearance plugin for DeepSeek Harness: custom theme color (PS-style color wheel), background wallpaper with opacity/blur controls, and separate main/settings interface opacity.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|