dsh-theme-engine 26.12.5-193000 → 26.12.5-193700
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 +30 -1
- package/client/src/07-styles.js +14 -0
- package/client/src/12-apply.js +15 -0
- 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.193700** · 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.193700** · 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.193832";
|
|
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;
|
|
@@ -5787,6 +5801,7 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
5787
5801
|
// effect can post through.
|
|
5788
5802
|
const webFrameRef = useRef(null);
|
|
5789
5803
|
const webPropsRef = useRef({});
|
|
5804
|
+
const webPreviewRef = useRef("");
|
|
5790
5805
|
const liquid = liquidRef.current;
|
|
5791
5806
|
const wallpaperUrl = value.wallpaper && state.url ? state.url : "";
|
|
5792
5807
|
const wallpaperKind = state.kind === "video" ? "video" : state.kind === "animation" ? "animation" : "image";
|
|
@@ -6471,6 +6486,14 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6471
6486
|
// the desktop capture, which for a web wallpaper is somebody else.
|
|
6472
6487
|
const adoptSurface = (text) => {
|
|
6473
6488
|
if (value.source !== "web") return;
|
|
6489
|
+
// The author's own preview image is a render of the picture; the page's
|
|
6490
|
+
// body colour is not (a canvas wallpaper clears to #000 and paints over
|
|
6491
|
+
// it). When a preview exists it decides the ink, so this report is
|
|
6492
|
+
// ignored instead of flipping the page to white on a light wallpaper.
|
|
6493
|
+
if (webPreviewRef.current) {
|
|
6494
|
+
webLog(`ink sample <- page surface skipped, preview decides: ${text}`);
|
|
6495
|
+
return;
|
|
6496
|
+
}
|
|
6474
6497
|
const match = /rgba?\(([^)]+)\)/.exec(String(text || ""));
|
|
6475
6498
|
if (!match) return;
|
|
6476
6499
|
const parts = match[1].split(",").map((n) => Number(n));
|
|
@@ -6583,6 +6606,12 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6583
6606
|
} catch (error) {}
|
|
6584
6607
|
}, [webActive, wallpaperPropKey, value.wpProps]);
|
|
6585
6608
|
|
|
6609
|
+
// adoptSurface runs from a message handler created once, so it reads this
|
|
6610
|
+
// ref instead of a possibly stale render value.
|
|
6611
|
+
useEffect(() => {
|
|
6612
|
+
webPreviewRef.current = String(value.webPreview || "");
|
|
6613
|
+
}, [value.webPreview]);
|
|
6614
|
+
|
|
6586
6615
|
// A web wallpaper renders in an opaque-origin frame, so neither the
|
|
6587
6616
|
// shader nor this page can read a single pixel of it. The wallpaper's
|
|
6588
6617
|
// own preview image is the only honest sample available, and it is
|
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
|
@@ -388,6 +388,7 @@
|
|
|
388
388
|
// effect can post through.
|
|
389
389
|
const webFrameRef = useRef(null);
|
|
390
390
|
const webPropsRef = useRef({});
|
|
391
|
+
const webPreviewRef = useRef("");
|
|
391
392
|
const liquid = liquidRef.current;
|
|
392
393
|
const wallpaperUrl = value.wallpaper && state.url ? state.url : "";
|
|
393
394
|
const wallpaperKind = state.kind === "video" ? "video" : state.kind === "animation" ? "animation" : "image";
|
|
@@ -1072,6 +1073,14 @@
|
|
|
1072
1073
|
// the desktop capture, which for a web wallpaper is somebody else.
|
|
1073
1074
|
const adoptSurface = (text) => {
|
|
1074
1075
|
if (value.source !== "web") return;
|
|
1076
|
+
// The author's own preview image is a render of the picture; the page's
|
|
1077
|
+
// body colour is not (a canvas wallpaper clears to #000 and paints over
|
|
1078
|
+
// it). When a preview exists it decides the ink, so this report is
|
|
1079
|
+
// ignored instead of flipping the page to white on a light wallpaper.
|
|
1080
|
+
if (webPreviewRef.current) {
|
|
1081
|
+
webLog(`ink sample <- page surface skipped, preview decides: ${text}`);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1075
1084
|
const match = /rgba?\(([^)]+)\)/.exec(String(text || ""));
|
|
1076
1085
|
if (!match) return;
|
|
1077
1086
|
const parts = match[1].split(",").map((n) => Number(n));
|
|
@@ -1184,6 +1193,12 @@
|
|
|
1184
1193
|
} catch (error) {}
|
|
1185
1194
|
}, [webActive, wallpaperPropKey, value.wpProps]);
|
|
1186
1195
|
|
|
1196
|
+
// adoptSurface runs from a message handler created once, so it reads this
|
|
1197
|
+
// ref instead of a possibly stale render value.
|
|
1198
|
+
useEffect(() => {
|
|
1199
|
+
webPreviewRef.current = String(value.webPreview || "");
|
|
1200
|
+
}, [value.webPreview]);
|
|
1201
|
+
|
|
1187
1202
|
// A web wallpaper renders in an opaque-origin frame, so neither the
|
|
1188
1203
|
// shader nor this page can read a single pixel of it. The wallpaper's
|
|
1189
1204
|
// own preview image is the only honest sample available, and it is
|
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-193700",
|
|
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": {
|