dsh-theme-engine 26.12.5-193000 → 26.12.5-194800
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/README.en.md +1 -1
- package/README.md +1 -1
- package/client/client.js +41 -5
- package/client/src/07-styles.js +14 -0
- package/client/src/12-apply.js +26 -4
- package/host/web-frame.js +37 -5
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[](#requirements)
|
|
16
16
|
[](https://github.com/ShuoweiFu/DSH-Theme-Engine/stargazers)
|
|
17
17
|
|
|
18
|
-
Version **v.26.12.05.
|
|
18
|
+
Version **v.26.12.05.194800** · Apache-2.0 · DSH Desktop on Windows only
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[](#运行环境)
|
|
16
16
|
[](https://github.com/ShuoweiFu/DSH-Theme-Engine/stargazers)
|
|
17
17
|
|
|
18
|
-
当前版本 **v.26.12.05.
|
|
18
|
+
当前版本 **v.26.12.05.194800** · Apache-2.0 · 只跑在 Windows 上的 DSH 桌面版
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
package/client/client.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
const LEGACY_STORAGE_KEYS = ["dsh-liquid-glass.settings.v2"];
|
|
10
10
|
const API = "/liquid-glass";
|
|
11
11
|
/** Bumped whenever the mapping or the settings contract changes; visible via /liquid-glass/state. */
|
|
12
|
-
const CLIENT_BUILD = "v.26.12.05.
|
|
12
|
+
const CLIENT_BUILD = "v.26.12.05.194810";
|
|
13
13
|
const LOAD_TAG = String((globalThis.__lgLoadCount = (globalThis.__lgLoadCount || 0) + 1));
|
|
14
14
|
/**
|
|
15
15
|
* Appearance values are archived per colour mode. These ids and keys are
|
|
@@ -2351,6 +2351,20 @@ html[data-lg-mode="dark"] div[data-shortcut-modal="settings"] {
|
|
|
2351
2351
|
outline-offset: 2px;
|
|
2352
2352
|
}
|
|
2353
2353
|
|
|
2354
|
+
/* A native <select> popup is painted by the platform, not by the sheet: it
|
|
2355
|
+
* keeps the select's own text colour and pairs it with a light list, so white
|
|
2356
|
+
* theme text landed white-on-white. Pin both ends of the list to the ink we
|
|
2357
|
+
* actually chose, and the popup stays readable on any wallpaper. */
|
|
2358
|
+
html[data-lg-ink="dark"] select option {
|
|
2359
|
+
background-color: #ffffff;
|
|
2360
|
+
color: #0c0e14;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
html[data-lg-ink="light"] select option {
|
|
2364
|
+
background-color: #1b1e26;
|
|
2365
|
+
color: #f6f8fc;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2354
2368
|
.lg-switch {
|
|
2355
2369
|
position: relative;
|
|
2356
2370
|
flex: none;
|
|
@@ -5647,8 +5661,14 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
5647
5661
|
const intelColor = useIntelColor();
|
|
5648
5662
|
const intelToken = useIntelToken();
|
|
5649
5663
|
const inkRef = useRef(null);
|
|
5650
|
-
|
|
5664
|
+
// While a web wallpaper owns the backdrop, the shader canvas is hidden and
|
|
5665
|
+
// its texture is the *desktop* capture, not the picture on screen. Letting
|
|
5666
|
+
// it vote flipped a bright wallpaper back to white text within a minute of
|
|
5667
|
+
// the preview having decided black. Only the preview votes in that mode.
|
|
5668
|
+
const webBackdropRef = useRef(false);
|
|
5669
|
+
const onInk = useCallback((next, origin) => {
|
|
5651
5670
|
if (!next || typeof next.lum !== "number") return;
|
|
5671
|
+
if (origin !== "preview" && webBackdropRef.current) return;
|
|
5652
5672
|
const quantise = (value) => Math.round((Number(value) || 0) * 50) / 50;
|
|
5653
5673
|
const sample = { lum: quantise(next.lum), content: quantise(next.content ?? next.lum), busy: quantise(next.busy) };
|
|
5654
5674
|
const prev = inkRef.current;
|
|
@@ -5787,6 +5807,7 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
5787
5807
|
// effect can post through.
|
|
5788
5808
|
const webFrameRef = useRef(null);
|
|
5789
5809
|
const webPropsRef = useRef({});
|
|
5810
|
+
const webPreviewRef = useRef("");
|
|
5790
5811
|
const liquid = liquidRef.current;
|
|
5791
5812
|
const wallpaperUrl = value.wallpaper && state.url ? state.url : "";
|
|
5792
5813
|
const wallpaperKind = state.kind === "video" ? "video" : state.kind === "animation" ? "animation" : "image";
|
|
@@ -5924,7 +5945,7 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
5924
5945
|
// GPU; everything else hints low-power so laptops stay on the iGPU.
|
|
5925
5946
|
const powerPreference = preferredPower(value.preset, hw.tier);
|
|
5926
5947
|
let cancelled = false;
|
|
5927
|
-
const liquid = mode === "webgpu" ? createWebGpuCanvas({ onFault, onInk, onBeat: audioBeat, powerPreference }) : createLiquidCanvas({ onFault, onInk, onBeat: audioBeat, powerPreference });
|
|
5948
|
+
const liquid = mode === "webgpu" ? createWebGpuCanvas({ onFault, onInk: (sample) => onInk(sample, "glass"), onBeat: audioBeat, powerPreference }) : createLiquidCanvas({ onFault, onInk: (sample) => onInk(sample, "glass"), onBeat: audioBeat, powerPreference });
|
|
5928
5949
|
if (!liquid) {
|
|
5929
5950
|
reportClientError(`renderMode ${mode}: unavailable`, true);
|
|
5930
5951
|
if (mode === "webgpu") {
|
|
@@ -6471,13 +6492,21 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6471
6492
|
// the desktop capture, which for a web wallpaper is somebody else.
|
|
6472
6493
|
const adoptSurface = (text) => {
|
|
6473
6494
|
if (value.source !== "web") return;
|
|
6495
|
+
// The author's own preview image is a render of the picture; the page's
|
|
6496
|
+
// body colour is not (a canvas wallpaper clears to #000 and paints over
|
|
6497
|
+
// it). When a preview exists it decides the ink, so this report is
|
|
6498
|
+
// ignored instead of flipping the page to white on a light wallpaper.
|
|
6499
|
+
if (webPreviewRef.current) {
|
|
6500
|
+
webLog(`ink sample <- page surface skipped, preview decides: ${text}`);
|
|
6501
|
+
return;
|
|
6502
|
+
}
|
|
6474
6503
|
const match = /rgba?\(([^)]+)\)/.exec(String(text || ""));
|
|
6475
6504
|
if (!match) return;
|
|
6476
6505
|
const parts = match[1].split(",").map((n) => Number(n));
|
|
6477
6506
|
const alpha = parts.length > 3 ? parts[3] : 1;
|
|
6478
6507
|
if (!Number.isFinite(parts[0]) || alpha < 0.5) return;
|
|
6479
6508
|
const lum = relativeLum(parts[0], parts[1], parts[2]);
|
|
6480
|
-
onInk({ lum, content: lum });
|
|
6509
|
+
onInk({ lum, content: lum }, "page");
|
|
6481
6510
|
webLog(`ink sample <- page surface ${text} lum=${lum.toFixed(3)}`);
|
|
6482
6511
|
};
|
|
6483
6512
|
const onFrameMessage = (event) => {
|
|
@@ -6583,6 +6612,13 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6583
6612
|
} catch (error) {}
|
|
6584
6613
|
}, [webActive, wallpaperPropKey, value.wpProps]);
|
|
6585
6614
|
|
|
6615
|
+
// adoptSurface runs from a message handler created once, so it reads this
|
|
6616
|
+
// ref instead of a possibly stale render value.
|
|
6617
|
+
useEffect(() => {
|
|
6618
|
+
webPreviewRef.current = String(value.webPreview || "");
|
|
6619
|
+
webBackdropRef.current = Boolean(value.enabled && value.wallpaper && value.source === "web");
|
|
6620
|
+
}, [value.webPreview, value.enabled, value.wallpaper, value.source]);
|
|
6621
|
+
|
|
6586
6622
|
// A web wallpaper renders in an opaque-origin frame, so neither the
|
|
6587
6623
|
// shader nor this page can read a single pixel of it. The wallpaper's
|
|
6588
6624
|
// own preview image is the only honest sample available, and it is
|
|
@@ -6604,7 +6640,7 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6604
6640
|
}
|
|
6605
6641
|
const sample = measureInk(bitmap);
|
|
6606
6642
|
bitmap.close?.();
|
|
6607
|
-
if (sample && !isBlackSwap(sample)) onInk(sample);
|
|
6643
|
+
if (sample && !isBlackSwap(sample)) onInk(sample, "preview");
|
|
6608
6644
|
webLog(`ink sample <- preview ${sample ? Math.round(sample.lum * 100) : 0}%`);
|
|
6609
6645
|
} catch (error) {
|
|
6610
6646
|
webLog(`ink preview failed: ${String((error && error.message) || error)}`);
|
package/client/src/07-styles.js
CHANGED
|
@@ -632,6 +632,20 @@ html[data-lg-mode="dark"] div[data-shortcut-modal="settings"] {
|
|
|
632
632
|
outline-offset: 2px;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
|
+
/* A native <select> popup is painted by the platform, not by the sheet: it
|
|
636
|
+
* keeps the select's own text colour and pairs it with a light list, so white
|
|
637
|
+
* theme text landed white-on-white. Pin both ends of the list to the ink we
|
|
638
|
+
* actually chose, and the popup stays readable on any wallpaper. */
|
|
639
|
+
html[data-lg-ink="dark"] select option {
|
|
640
|
+
background-color: #ffffff;
|
|
641
|
+
color: #0c0e14;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
html[data-lg-ink="light"] select option {
|
|
645
|
+
background-color: #1b1e26;
|
|
646
|
+
color: #f6f8fc;
|
|
647
|
+
}
|
|
648
|
+
|
|
635
649
|
.lg-switch {
|
|
636
650
|
position: relative;
|
|
637
651
|
flex: none;
|
package/client/src/12-apply.js
CHANGED
|
@@ -248,8 +248,14 @@
|
|
|
248
248
|
const intelColor = useIntelColor();
|
|
249
249
|
const intelToken = useIntelToken();
|
|
250
250
|
const inkRef = useRef(null);
|
|
251
|
-
|
|
251
|
+
// While a web wallpaper owns the backdrop, the shader canvas is hidden and
|
|
252
|
+
// its texture is the *desktop* capture, not the picture on screen. Letting
|
|
253
|
+
// it vote flipped a bright wallpaper back to white text within a minute of
|
|
254
|
+
// the preview having decided black. Only the preview votes in that mode.
|
|
255
|
+
const webBackdropRef = useRef(false);
|
|
256
|
+
const onInk = useCallback((next, origin) => {
|
|
252
257
|
if (!next || typeof next.lum !== "number") return;
|
|
258
|
+
if (origin !== "preview" && webBackdropRef.current) return;
|
|
253
259
|
const quantise = (value) => Math.round((Number(value) || 0) * 50) / 50;
|
|
254
260
|
const sample = { lum: quantise(next.lum), content: quantise(next.content ?? next.lum), busy: quantise(next.busy) };
|
|
255
261
|
const prev = inkRef.current;
|
|
@@ -388,6 +394,7 @@
|
|
|
388
394
|
// effect can post through.
|
|
389
395
|
const webFrameRef = useRef(null);
|
|
390
396
|
const webPropsRef = useRef({});
|
|
397
|
+
const webPreviewRef = useRef("");
|
|
391
398
|
const liquid = liquidRef.current;
|
|
392
399
|
const wallpaperUrl = value.wallpaper && state.url ? state.url : "";
|
|
393
400
|
const wallpaperKind = state.kind === "video" ? "video" : state.kind === "animation" ? "animation" : "image";
|
|
@@ -525,7 +532,7 @@
|
|
|
525
532
|
// GPU; everything else hints low-power so laptops stay on the iGPU.
|
|
526
533
|
const powerPreference = preferredPower(value.preset, hw.tier);
|
|
527
534
|
let cancelled = false;
|
|
528
|
-
const liquid = mode === "webgpu" ? createWebGpuCanvas({ onFault, onInk, onBeat: audioBeat, powerPreference }) : createLiquidCanvas({ onFault, onInk, onBeat: audioBeat, powerPreference });
|
|
535
|
+
const liquid = mode === "webgpu" ? createWebGpuCanvas({ onFault, onInk: (sample) => onInk(sample, "glass"), onBeat: audioBeat, powerPreference }) : createLiquidCanvas({ onFault, onInk: (sample) => onInk(sample, "glass"), onBeat: audioBeat, powerPreference });
|
|
529
536
|
if (!liquid) {
|
|
530
537
|
reportClientError(`renderMode ${mode}: unavailable`, true);
|
|
531
538
|
if (mode === "webgpu") {
|
|
@@ -1072,13 +1079,21 @@
|
|
|
1072
1079
|
// the desktop capture, which for a web wallpaper is somebody else.
|
|
1073
1080
|
const adoptSurface = (text) => {
|
|
1074
1081
|
if (value.source !== "web") return;
|
|
1082
|
+
// The author's own preview image is a render of the picture; the page's
|
|
1083
|
+
// body colour is not (a canvas wallpaper clears to #000 and paints over
|
|
1084
|
+
// it). When a preview exists it decides the ink, so this report is
|
|
1085
|
+
// ignored instead of flipping the page to white on a light wallpaper.
|
|
1086
|
+
if (webPreviewRef.current) {
|
|
1087
|
+
webLog(`ink sample <- page surface skipped, preview decides: ${text}`);
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1075
1090
|
const match = /rgba?\(([^)]+)\)/.exec(String(text || ""));
|
|
1076
1091
|
if (!match) return;
|
|
1077
1092
|
const parts = match[1].split(",").map((n) => Number(n));
|
|
1078
1093
|
const alpha = parts.length > 3 ? parts[3] : 1;
|
|
1079
1094
|
if (!Number.isFinite(parts[0]) || alpha < 0.5) return;
|
|
1080
1095
|
const lum = relativeLum(parts[0], parts[1], parts[2]);
|
|
1081
|
-
onInk({ lum, content: lum });
|
|
1096
|
+
onInk({ lum, content: lum }, "page");
|
|
1082
1097
|
webLog(`ink sample <- page surface ${text} lum=${lum.toFixed(3)}`);
|
|
1083
1098
|
};
|
|
1084
1099
|
const onFrameMessage = (event) => {
|
|
@@ -1184,6 +1199,13 @@
|
|
|
1184
1199
|
} catch (error) {}
|
|
1185
1200
|
}, [webActive, wallpaperPropKey, value.wpProps]);
|
|
1186
1201
|
|
|
1202
|
+
// adoptSurface runs from a message handler created once, so it reads this
|
|
1203
|
+
// ref instead of a possibly stale render value.
|
|
1204
|
+
useEffect(() => {
|
|
1205
|
+
webPreviewRef.current = String(value.webPreview || "");
|
|
1206
|
+
webBackdropRef.current = Boolean(value.enabled && value.wallpaper && value.source === "web");
|
|
1207
|
+
}, [value.webPreview, value.enabled, value.wallpaper, value.source]);
|
|
1208
|
+
|
|
1187
1209
|
// A web wallpaper renders in an opaque-origin frame, so neither the
|
|
1188
1210
|
// shader nor this page can read a single pixel of it. The wallpaper's
|
|
1189
1211
|
// own preview image is the only honest sample available, and it is
|
|
@@ -1205,7 +1227,7 @@
|
|
|
1205
1227
|
}
|
|
1206
1228
|
const sample = measureInk(bitmap);
|
|
1207
1229
|
bitmap.close?.();
|
|
1208
|
-
if (sample && !isBlackSwap(sample)) onInk(sample);
|
|
1230
|
+
if (sample && !isBlackSwap(sample)) onInk(sample, "preview");
|
|
1209
1231
|
webLog(`ink sample <- preview ${sample ? Math.round(sample.lum * 100) : 0}%`);
|
|
1210
1232
|
} catch (error) {
|
|
1211
1233
|
webLog(`ink preview failed: ${String((error && error.message) || error)}`);
|
package/host/web-frame.js
CHANGED
|
@@ -142,7 +142,9 @@ const SHIM = String.raw`(function () {
|
|
|
142
142
|
// the drawer came back on every reload — on top of the chat. Seed the page's
|
|
143
143
|
// own defaults with the drawer closed instead; ?lgpanel=1 brings it back.
|
|
144
144
|
try {
|
|
145
|
-
|
|
145
|
+
// The host sets this flag for the folders that actually carry a
|
|
146
|
+
// loadJson.json, so wallpapers without one no longer log a 404 here.
|
|
147
|
+
if (window.__lgPanelSeed && !/(?:^|[?&])lgpanel=1(?:&|$)/.test(location.search)) {
|
|
146
148
|
var seed = new XMLHttpRequest();
|
|
147
149
|
seed.open('GET', 'loadJson.json', false);
|
|
148
150
|
seed.send(null);
|
|
@@ -157,7 +159,7 @@ const SHIM = String.raw`(function () {
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
} catch (e) { send('panel', 'seed failed: ' + e); }
|
|
160
|
-
|
|
162
|
+
// ---- Wallpaper Engine runtime API -------------------------------------
|
|
161
163
|
// Audio-reactive wallpapers expect the engine to drive them: they call
|
|
162
164
|
// wallpaperRegisterAudioListener with a callback and the engine feeds it
|
|
163
165
|
// 128 spectrum values about 16 ms apart. In a bare iframe nothing calls it,
|
|
@@ -258,12 +260,31 @@ const SHIM = String.raw`(function () {
|
|
|
258
260
|
});
|
|
259
261
|
// The page knows its own backdrop; the engine cannot read it through an
|
|
260
262
|
// opaque origin. Report it so the ink pairs with what is really painted.
|
|
263
|
+
// A canvas wallpaper clears the page to black and paints over it, so the body
|
|
264
|
+
// colour under a full-bleed canvas is not the picture. Reporting it made the
|
|
265
|
+
// page pick white ink for a bright wallpaper, which is unreadable everywhere.
|
|
266
|
+
function canvasOwnsViewport() {
|
|
267
|
+
var list = document.querySelectorAll("canvas");
|
|
268
|
+
var area = window.innerWidth * window.innerHeight;
|
|
269
|
+
if (!area) return false;
|
|
270
|
+
for (var i = 0; i < list.length; i += 1) {
|
|
271
|
+
var box = list[i].getBoundingClientRect();
|
|
272
|
+
if (box.width * box.height >= area * 0.85) return true;
|
|
273
|
+
}
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
261
276
|
function surfaceColor() {
|
|
262
277
|
var els = [document.body, document.documentElement];
|
|
278
|
+
var canvas = canvasOwnsViewport();
|
|
263
279
|
for (var i = 0; i < els.length; i += 1) {
|
|
264
280
|
if (!els[i]) continue;
|
|
265
281
|
var c = getComputedStyle(els[i]).backgroundColor;
|
|
266
282
|
if (!c || c === "transparent" || c === "rgba(0, 0, 0, 0)") continue;
|
|
283
|
+
var parts = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(c);
|
|
284
|
+
if (canvas && parts) {
|
|
285
|
+
var r = Number(parts[1]), g = Number(parts[2]), b = Number(parts[3]);
|
|
286
|
+
if ((r === 0 && g === 0 && b === 0) || (r === 255 && g === 255 && b === 255)) continue;
|
|
287
|
+
}
|
|
267
288
|
return c;
|
|
268
289
|
}
|
|
269
290
|
return "";
|
|
@@ -371,9 +392,13 @@ function propDefaultsTag(defaults) {
|
|
|
371
392
|
return `<script>window.__lgPropDefaults=${json};</script>`;
|
|
372
393
|
}
|
|
373
394
|
|
|
374
|
-
function
|
|
395
|
+
function panelSeedTag(enabled) {
|
|
396
|
+
return enabled ? '<script>window.__lgPanelSeed=1;</script>' : '';
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function injectShim(html, defaults, panelSeed) {
|
|
375
400
|
const text = html.toString('utf8');
|
|
376
|
-
const tags = propDefaultsTag(defaults) + SHIM_TAG;
|
|
401
|
+
const tags = propDefaultsTag(defaults) + panelSeedTag(panelSeed) + SHIM_TAG;
|
|
377
402
|
const head = text.search(/<head[^>]*>/i);
|
|
378
403
|
if (head >= 0) {
|
|
379
404
|
const end = text.indexOf('>', head) + 1;
|
|
@@ -468,6 +493,13 @@ function webDefaults(props) {
|
|
|
468
493
|
return out;
|
|
469
494
|
}
|
|
470
495
|
|
|
496
|
+
/** Live2D-style uploads keep their saved panel state in loadJson.json. */
|
|
497
|
+
async function hasPanelSettings() {
|
|
498
|
+
if (!current.root) return false;
|
|
499
|
+
const info = await stat(join(current.root, 'loadJson.json')).catch(() => null);
|
|
500
|
+
return Boolean(info && info.isFile());
|
|
501
|
+
}
|
|
502
|
+
|
|
471
503
|
async function pageDefaults() {
|
|
472
504
|
if (!current.root) return {};
|
|
473
505
|
const schema = await webProperties(current.root).catch(() => ({ ok: false }));
|
|
@@ -529,7 +561,7 @@ export async function serveWebFile(relative, query) {
|
|
|
529
561
|
const raw = await readFile(target);
|
|
530
562
|
const body =
|
|
531
563
|
ext === '.html' || ext === '.htm'
|
|
532
|
-
? Buffer.from(injectShim(raw, await pageDefaults()), 'utf8')
|
|
564
|
+
? Buffer.from(injectShim(raw, await pageDefaults(), await hasPanelSettings()), 'utf8')
|
|
533
565
|
: raw;
|
|
534
566
|
return new Response(body, {
|
|
535
567
|
status: 200,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-theme-engine",
|
|
3
|
-
"version": "26.12.5-
|
|
3
|
+
"version": "26.12.5-194800",
|
|
4
4
|
"description": "Live wallpaper + liquid-glass background for DeepSeek Harness: native desktop capture, 0.8-grade water shader, contrast-driven adaptive ink, frost-density and tint controls, hardware-adaptive profiles, occluded-window compositing, WebGL/WebGPU backends, five-layer performance guard.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|