dsh-theme-engine 26.12.5-150734 → 26.12.5-154000

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/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.150753";
12
+ const CLIENT_BUILD = "v.26.12.05.153749";
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
@@ -312,6 +312,15 @@
312
312
  updateGroup: "更新与下载",
313
313
  updateHint: "从 npm、GitHub 和 git 三个渠道查询最新版本;「下载」会打开对应页面。",
314
314
  checkUpdate: "检查更新",
315
+ diagGroup: "诊断日志",
316
+ diagHint: "在别的电脑上测试时,点一下导出,生成一份包含版本、硬件、壁纸状态和页面快照的日志文件,发回来即可。",
317
+ exportLog: "导出日志",
318
+ exporting: "正在导出…",
319
+ copyLog: "复制日志",
320
+ logSaved: "已保存到",
321
+ logCopied: "已复制到剪贴板。",
322
+ logHostOnly: "页面快照未能随请求上传,日志只含宿主信息。",
323
+ logHostMissing: "导出接口尚未加载(重启桌面端后可用),已改为下载页面快照:",
315
324
  checking: "检查中…",
316
325
  updateCurrent: "当前版本",
317
326
  updateUpToDate: "已是最新",
@@ -573,6 +582,15 @@
573
582
  updateGroup: "Updates & downloads",
574
583
  updateHint: "Queries npm, GitHub and git for the newest version; Download opens that channel's page.",
575
584
  checkUpdate: "Check for updates",
585
+ diagGroup: "Diagnostic log",
586
+ diagHint: "Testing on another computer? Export a log with the versions, the hardware, the wallpaper state and a page snapshot, then send the file back.",
587
+ exportLog: "Export log",
588
+ exporting: "Exporting…",
589
+ copyLog: "Copy log",
590
+ logSaved: "Saved to",
591
+ logCopied: "Copied to the clipboard.",
592
+ logHostOnly: "The page snapshot did not ride along; the log carries the host half only.",
593
+ logHostMissing: "The export route is not loaded yet (restart the desktop app), so the page snapshot was downloaded instead:",
576
594
  checking: "Checking…",
577
595
  updateCurrent: "Current version",
578
596
  updateUpToDate: "Up to date",
@@ -1971,11 +1989,31 @@ html[data-lg-enabled="on"] [class*="_sidebarCol"] {
1971
1989
  /* The pane carries the milky floor itself. The shell token stays at
1972
1990
  bare-glass level because the frame and titlebar strip share it. */
1973
1991
  background-color: var(--lg-sidebar-fill, rgba(255, 255, 255, 0.14)) !important;
1974
- -webkit-backdrop-filter: blur(24px) saturate(1.32);
1975
- backdrop-filter: blur(24px) saturate(1.32);
1976
1992
  box-shadow:
1977
1993
  inset 0 1px 0 rgba(255, 255, 255, 0.3),
1978
1994
  inset -0.5px 0 0 rgba(255, 255, 255, 0.12);
1995
+ /* Anchor for the frost pseudo below; a plain static pane cannot hold an
1996
+ absolutely positioned child. */
1997
+ position: relative;
1998
+ }
1999
+
2000
+ /*
2001
+ * The frost must NOT be a backdrop-filter on the pane itself. On Windows DSH
2002
+ * renders the window frameless ([data-windows-titlebar]) and pins the sidebar
2003
+ * toggle with position: fixed at left:12px, top: 6px, i.e. in the titlebar
2004
+ * strip. A backdrop-filter (like filter/transform) makes the element a
2005
+ * containing block for fixed descendants, so the toggle lost the viewport as
2006
+ * its anchor, dropped by the sidebar's 40px offset into the logo row and sat
2007
+ * right on top of the brand mark. A pseudo element blurs the same backdrop
2008
+ * without becoming the containing block of the pane's children.
2009
+ */
2010
+ html[data-lg-enabled="on"] [class*="_sidebarCol"]::before {
2011
+ content: "";
2012
+ position: absolute;
2013
+ inset: 0;
2014
+ pointer-events: none;
2015
+ -webkit-backdrop-filter: blur(24px) saturate(1.32);
2016
+ backdrop-filter: blur(24px) saturate(1.32);
1979
2017
  }
1980
2018
 
1981
2019
  html[data-lg-enabled="on"][data-lg-mode="dark"] [class*="_sidebarCol"] {
@@ -6795,6 +6833,65 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
6795
6833
  return () => clearTimeout(timer);
6796
6834
  }, []);
6797
6835
 
6836
+ useEffect(() => {
6837
+ // Header audit. The brand row at the top of the sidebar is laid out by
6838
+ // the app, so when a logo and a version pill collide the only useful
6839
+ // evidence is the real geometry: report the boxes once on hw:.
6840
+ const timer = setTimeout(() => {
6841
+ try {
6842
+ const side = document.querySelector('[class*="_sidebarCol"]');
6843
+ if (!side) {
6844
+ reportClientError("hw: hdr missing", true);
6845
+ return;
6846
+ }
6847
+ const rows = [];
6848
+ const walk = (node, depth) => {
6849
+ if (!node || depth > 5 || rows.length >= 18) return;
6850
+ const rect = node.getBoundingClientRect();
6851
+ if (rect.bottom < 0 || rect.top > 150) return;
6852
+ const cs = getComputedStyle(node);
6853
+ const cls = String(node.className || "")
6854
+ .split(" ")
6855
+ .filter(Boolean)
6856
+ .map((name) => name.replace(/^.*_/, ""))
6857
+ .join(".")
6858
+ .slice(0, 24);
6859
+ rows.push(
6860
+ [
6861
+ node.tagName.toLowerCase().slice(0, 4) + (cls ? "." + cls : ""),
6862
+ Math.round(rect.left) + "," + Math.round(rect.top),
6863
+ Math.round(rect.width) + "x" + Math.round(rect.height),
6864
+ cs.position,
6865
+ cs.display,
6866
+ cs.overflow,
6867
+ cs.marginLeft + "/" + cs.marginRight,
6868
+ cs.paddingLeft
6869
+ ].join("|")
6870
+ );
6871
+ for (const child of node.children) walk(child, depth + 1);
6872
+ };
6873
+ walk(side, 0);
6874
+ const sr = side.getBoundingClientRect();
6875
+ const own = getComputedStyle(side);
6876
+ const frost = getComputedStyle(side, "::before");
6877
+ reportClientError(
6878
+ "hw: hdr " +
6879
+ JSON.stringify({
6880
+ side: Math.round(sr.left) + "," + Math.round(sr.width),
6881
+ ownBf: own.backdropFilter || "none",
6882
+ frostBf: frost.backdropFilter || "none",
6883
+ frostPos: frost.position + "|" + frost.inset,
6884
+ rows
6885
+ }),
6886
+ true
6887
+ );
6888
+ } catch (error) {
6889
+ reportClientError("hw: hdr failed " + String(error?.message ?? error), true);
6890
+ }
6891
+ }, 3000);
6892
+ return () => clearTimeout(timer);
6893
+ }, []);
6894
+
6798
6895
  useEffect(() => {
6799
6896
  // One small, local-only snapshot so the host can report whether the
6800
6897
  // glass actually mounted (and why not) without a DevTools session.
@@ -6915,6 +7012,84 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
6915
7012
  );
6916
7013
  }
6917
7014
 
7015
+ // Everything a remote tester's log should carry about the page. Kept
7016
+ // small enough to ride the export URL as a query parameter.
7017
+ const clientSnapshot = (settings, perf) => {
7018
+ const root = document.documentElement;
7019
+ const style = getComputedStyle(document.body);
7020
+ const token = (name) => style.getPropertyValue(name).trim();
7021
+ const canvas = document.querySelector("canvas[data-liquid-glass]");
7022
+ const canvasStyle = canvas ? getComputedStyle(canvas) : null;
7023
+ let stored = "";
7024
+ try {
7025
+ stored = localStorage.getItem(STORAGE_KEY) ?? "";
7026
+ } catch {
7027
+ stored = "";
7028
+ }
7029
+ return {
7030
+ build: CLIENT_BUILD,
7031
+ load: LOAD_TAG,
7032
+ ua: navigator.userAgent,
7033
+ lang: navigator.language,
7034
+ vp: [innerWidth, innerHeight],
7035
+ dpr: devicePixelRatio,
7036
+ screen: [screen.width, screen.height],
7037
+ vis: document.visibilityState,
7038
+ flags: { ...root.dataset },
7039
+ canvas: canvas
7040
+ ? { w: canvas.width, h: canvas.height, op: canvasStyle.opacity, disp: canvasStyle.display, z: canvasStyle.zIndex }
7041
+ : null,
7042
+ frame: Boolean(document.querySelector("[data-lg-web='frame']")),
7043
+ token: {
7044
+ base: token("--dsw-alias-bg-base"),
7045
+ label: token("--dsw-alias-label-primary"),
7046
+ sidebar: token("--dsw-specific-sidebar-fill"),
7047
+ lgSidebar: token("--lg-sidebar-fill"),
7048
+ surface: token("--lg-surface"),
7049
+ caret: token("--lg-caret")
7050
+ },
7051
+ perf,
7052
+ settings,
7053
+ stored
7054
+ };
7055
+ };
7056
+ const copyText = (text) => {
7057
+ try {
7058
+ if (navigator.clipboard && navigator.clipboard.writeText) return navigator.clipboard.writeText(text);
7059
+ } catch {
7060
+ // Fall through to the selection trick.
7061
+ }
7062
+ try {
7063
+ const area = document.createElement("textarea");
7064
+ area.value = text;
7065
+ area.style.position = "fixed";
7066
+ area.style.opacity = "0";
7067
+ document.body.appendChild(area);
7068
+ area.select();
7069
+ document.execCommand("copy");
7070
+ area.remove();
7071
+ } catch {
7072
+ // Nothing else to try.
7073
+ }
7074
+ return Promise.resolve();
7075
+ };
7076
+ const saveText = (text, name) => {
7077
+ try {
7078
+ const url = URL.createObjectURL(new Blob([text], { type: "text/plain;charset=utf-8" }));
7079
+ const link = document.createElement("a");
7080
+ link.href = url;
7081
+ link.download = name;
7082
+ link.style.display = "none";
7083
+ document.body.appendChild(link);
7084
+ link.click();
7085
+ link.remove();
7086
+ setTimeout(() => URL.revokeObjectURL(url), 4000);
7087
+ return true;
7088
+ } catch {
7089
+ return false;
7090
+ }
7091
+ };
7092
+
6918
7093
  function SettingsPanel() {
6919
7094
  const value = useSettings();
6920
7095
  const state = useWallpaper();
@@ -6924,6 +7099,7 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
6924
7099
  const [perf, setPerf] = useState(null);
6925
7100
  const [update, setUpdate] = useState(null);
6926
7101
  const [tab, setTab] = useState(null);
7102
+ const [log, setLog] = useState(null);
6927
7103
  const checkUpdates = useCallback((force) => {
6928
7104
  setUpdate((prev) => ({ ...(prev ?? {}), loading: true, error: "" }));
6929
7105
  fetch(`${API}/update${force ? "?force=1" : ""}`)
@@ -6936,6 +7112,47 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
6936
7112
  useEffect(() => {
6937
7113
  checkUpdates(false);
6938
7114
  }, [checkUpdates]);
7115
+ // One press, one file: the panel collects the page, the host adds
7116
+ // everything it knows and writes the result to disk. A host that
7117
+ // predates the route still yields a client-only file.
7118
+ const exportLog = useCallback(() => {
7119
+ setLog({ loading: true });
7120
+ const snapshot = clientSnapshot(value, perf);
7121
+ const query = (() => {
7122
+ try {
7123
+ let encoded = "?snap=" + encodeURIComponent(JSON.stringify(snapshot));
7124
+ if (encoded.length > 6000) {
7125
+ delete snapshot.stored;
7126
+ delete snapshot.perf;
7127
+ encoded = "?snap=" + encodeURIComponent(JSON.stringify(snapshot));
7128
+ }
7129
+ return encoded.length > 6000 ? "" : encoded;
7130
+ } catch {
7131
+ return "";
7132
+ }
7133
+ })();
7134
+ fetch(`${API}/log/export${query}`)
7135
+ .then((response) => response.json())
7136
+ .then((data) => {
7137
+ if (!data || data.ok === false) throw new Error(String((data && data.error) || "export failed"));
7138
+ setLog({ loading: false, path: String(data.path ?? ""), text: String(data.text ?? ""), hostOnly: !query });
7139
+ })
7140
+ .catch((error) => {
7141
+ const text = "DSH Theme Engine — client-only snapshot\n\n" + JSON.stringify(snapshot, null, 2);
7142
+ saveText(text, "dsh-theme-engine-client.txt");
7143
+ setLog({
7144
+ loading: false,
7145
+ path: "",
7146
+ text,
7147
+ error: String((error && error.message) || error),
7148
+ hostOnly: true
7149
+ });
7150
+ });
7151
+ }, [value, perf]);
7152
+ const copyLog = useCallback(() => {
7153
+ const text = String((log && log.text) || "");
7154
+ copyText(text).then(() => setLog((prev) => ({ ...(prev ?? {}), copied: true })));
7155
+ }, [log]);
6939
7156
  useEffect(() => {
6940
7157
  let timer = null;
6941
7158
  const stop = () => {
@@ -7345,6 +7562,37 @@ renderAppearance(),
7345
7562
  )
7346
7563
  )
7347
7564
  ),
7565
+ h(
7566
+ "section",
7567
+ { className: "lg-group" },
7568
+ h("h2", { className: "lg-group-title" }, t("diagGroup")),
7569
+ h("p", { className: "lg-group-hint" }, t("diagHint")),
7570
+ h(
7571
+ "div",
7572
+ { className: "lg-actions" },
7573
+ h(
7574
+ "button",
7575
+ {
7576
+ type: "button",
7577
+ className: "lg-button",
7578
+ disabled: Boolean(log && log.loading),
7579
+ onClick: exportLog
7580
+ },
7581
+ log && log.loading ? t("exporting") : t("exportLog")
7582
+ ),
7583
+ log && log.text
7584
+ ? h("button", { type: "button", className: "lg-button", onClick: copyLog }, t("copyLog"))
7585
+ : null
7586
+ ),
7587
+ log && log.path ? h("p", { className: "lg-group-hint" }, `${t("logSaved")} ${log.path}`) : null,
7588
+ log && log.error && !log.path
7589
+ ? h("p", { className: "lg-group-hint" }, `${t("logHostMissing")} ${log.error}`)
7590
+ : null,
7591
+ log && log.hostOnly && log.path
7592
+ ? h("p", { className: "lg-group-hint" }, t("logHostOnly"))
7593
+ : null,
7594
+ log && log.copied ? h("p", { className: "lg-group-hint" }, t("logCopied")) : null
7595
+ ),
7348
7596
  h(
7349
7597
  "section",
7350
7598
  { className: "lg-group" },
@@ -144,6 +144,15 @@
144
144
  updateGroup: "更新与下载",
145
145
  updateHint: "从 npm、GitHub 和 git 三个渠道查询最新版本;「下载」会打开对应页面。",
146
146
  checkUpdate: "检查更新",
147
+ diagGroup: "诊断日志",
148
+ diagHint: "在别的电脑上测试时,点一下导出,生成一份包含版本、硬件、壁纸状态和页面快照的日志文件,发回来即可。",
149
+ exportLog: "导出日志",
150
+ exporting: "正在导出…",
151
+ copyLog: "复制日志",
152
+ logSaved: "已保存到",
153
+ logCopied: "已复制到剪贴板。",
154
+ logHostOnly: "页面快照未能随请求上传,日志只含宿主信息。",
155
+ logHostMissing: "导出接口尚未加载(重启桌面端后可用),已改为下载页面快照:",
147
156
  checking: "检查中…",
148
157
  updateCurrent: "当前版本",
149
158
  updateUpToDate: "已是最新",
@@ -405,6 +414,15 @@
405
414
  updateGroup: "Updates & downloads",
406
415
  updateHint: "Queries npm, GitHub and git for the newest version; Download opens that channel's page.",
407
416
  checkUpdate: "Check for updates",
417
+ diagGroup: "Diagnostic log",
418
+ diagHint: "Testing on another computer? Export a log with the versions, the hardware, the wallpaper state and a page snapshot, then send the file back.",
419
+ exportLog: "Export log",
420
+ exporting: "Exporting…",
421
+ copyLog: "Copy log",
422
+ logSaved: "Saved to",
423
+ logCopied: "Copied to the clipboard.",
424
+ logHostOnly: "The page snapshot did not ride along; the log carries the host half only.",
425
+ logHostMissing: "The export route is not loaded yet (restart the desktop app), so the page snapshot was downloaded instead:",
408
426
  checking: "Checking…",
409
427
  updateCurrent: "Current version",
410
428
  updateUpToDate: "Up to date",
@@ -282,11 +282,31 @@ html[data-lg-enabled="on"] [class*="_sidebarCol"] {
282
282
  /* The pane carries the milky floor itself. The shell token stays at
283
283
  bare-glass level because the frame and titlebar strip share it. */
284
284
  background-color: var(--lg-sidebar-fill, rgba(255, 255, 255, 0.14)) !important;
285
- -webkit-backdrop-filter: blur(24px) saturate(1.32);
286
- backdrop-filter: blur(24px) saturate(1.32);
287
285
  box-shadow:
288
286
  inset 0 1px 0 rgba(255, 255, 255, 0.3),
289
287
  inset -0.5px 0 0 rgba(255, 255, 255, 0.12);
288
+ /* Anchor for the frost pseudo below; a plain static pane cannot hold an
289
+ absolutely positioned child. */
290
+ position: relative;
291
+ }
292
+
293
+ /*
294
+ * The frost must NOT be a backdrop-filter on the pane itself. On Windows DSH
295
+ * renders the window frameless ([data-windows-titlebar]) and pins the sidebar
296
+ * toggle with position: fixed at left:12px, top: 6px, i.e. in the titlebar
297
+ * strip. A backdrop-filter (like filter/transform) makes the element a
298
+ * containing block for fixed descendants, so the toggle lost the viewport as
299
+ * its anchor, dropped by the sidebar's 40px offset into the logo row and sat
300
+ * right on top of the brand mark. A pseudo element blurs the same backdrop
301
+ * without becoming the containing block of the pane's children.
302
+ */
303
+ html[data-lg-enabled="on"] [class*="_sidebarCol"]::before {
304
+ content: "";
305
+ position: absolute;
306
+ inset: 0;
307
+ pointer-events: none;
308
+ -webkit-backdrop-filter: blur(24px) saturate(1.32);
309
+ backdrop-filter: blur(24px) saturate(1.32);
290
310
  }
291
311
 
292
312
  html[data-lg-enabled="on"][data-lg-mode="dark"] [class*="_sidebarCol"] {
@@ -1448,6 +1448,65 @@
1448
1448
  return () => clearTimeout(timer);
1449
1449
  }, []);
1450
1450
 
1451
+ useEffect(() => {
1452
+ // Header audit. The brand row at the top of the sidebar is laid out by
1453
+ // the app, so when a logo and a version pill collide the only useful
1454
+ // evidence is the real geometry: report the boxes once on hw:.
1455
+ const timer = setTimeout(() => {
1456
+ try {
1457
+ const side = document.querySelector('[class*="_sidebarCol"]');
1458
+ if (!side) {
1459
+ reportClientError("hw: hdr missing", true);
1460
+ return;
1461
+ }
1462
+ const rows = [];
1463
+ const walk = (node, depth) => {
1464
+ if (!node || depth > 5 || rows.length >= 18) return;
1465
+ const rect = node.getBoundingClientRect();
1466
+ if (rect.bottom < 0 || rect.top > 150) return;
1467
+ const cs = getComputedStyle(node);
1468
+ const cls = String(node.className || "")
1469
+ .split(" ")
1470
+ .filter(Boolean)
1471
+ .map((name) => name.replace(/^.*_/, ""))
1472
+ .join(".")
1473
+ .slice(0, 24);
1474
+ rows.push(
1475
+ [
1476
+ node.tagName.toLowerCase().slice(0, 4) + (cls ? "." + cls : ""),
1477
+ Math.round(rect.left) + "," + Math.round(rect.top),
1478
+ Math.round(rect.width) + "x" + Math.round(rect.height),
1479
+ cs.position,
1480
+ cs.display,
1481
+ cs.overflow,
1482
+ cs.marginLeft + "/" + cs.marginRight,
1483
+ cs.paddingLeft
1484
+ ].join("|")
1485
+ );
1486
+ for (const child of node.children) walk(child, depth + 1);
1487
+ };
1488
+ walk(side, 0);
1489
+ const sr = side.getBoundingClientRect();
1490
+ const own = getComputedStyle(side);
1491
+ const frost = getComputedStyle(side, "::before");
1492
+ reportClientError(
1493
+ "hw: hdr " +
1494
+ JSON.stringify({
1495
+ side: Math.round(sr.left) + "," + Math.round(sr.width),
1496
+ ownBf: own.backdropFilter || "none",
1497
+ frostBf: frost.backdropFilter || "none",
1498
+ frostPos: frost.position + "|" + frost.inset,
1499
+ rows
1500
+ }),
1501
+ true
1502
+ );
1503
+ } catch (error) {
1504
+ reportClientError("hw: hdr failed " + String(error?.message ?? error), true);
1505
+ }
1506
+ }, 3000);
1507
+ return () => clearTimeout(timer);
1508
+ }, []);
1509
+
1451
1510
  useEffect(() => {
1452
1511
  // One small, local-only snapshot so the host can report whether the
1453
1512
  // glass actually mounted (and why not) without a DevTools session.
@@ -1568,6 +1627,84 @@
1568
1627
  );
1569
1628
  }
1570
1629
 
1630
+ // Everything a remote tester's log should carry about the page. Kept
1631
+ // small enough to ride the export URL as a query parameter.
1632
+ const clientSnapshot = (settings, perf) => {
1633
+ const root = document.documentElement;
1634
+ const style = getComputedStyle(document.body);
1635
+ const token = (name) => style.getPropertyValue(name).trim();
1636
+ const canvas = document.querySelector("canvas[data-liquid-glass]");
1637
+ const canvasStyle = canvas ? getComputedStyle(canvas) : null;
1638
+ let stored = "";
1639
+ try {
1640
+ stored = localStorage.getItem(STORAGE_KEY) ?? "";
1641
+ } catch {
1642
+ stored = "";
1643
+ }
1644
+ return {
1645
+ build: CLIENT_BUILD,
1646
+ load: LOAD_TAG,
1647
+ ua: navigator.userAgent,
1648
+ lang: navigator.language,
1649
+ vp: [innerWidth, innerHeight],
1650
+ dpr: devicePixelRatio,
1651
+ screen: [screen.width, screen.height],
1652
+ vis: document.visibilityState,
1653
+ flags: { ...root.dataset },
1654
+ canvas: canvas
1655
+ ? { w: canvas.width, h: canvas.height, op: canvasStyle.opacity, disp: canvasStyle.display, z: canvasStyle.zIndex }
1656
+ : null,
1657
+ frame: Boolean(document.querySelector("[data-lg-web='frame']")),
1658
+ token: {
1659
+ base: token("--dsw-alias-bg-base"),
1660
+ label: token("--dsw-alias-label-primary"),
1661
+ sidebar: token("--dsw-specific-sidebar-fill"),
1662
+ lgSidebar: token("--lg-sidebar-fill"),
1663
+ surface: token("--lg-surface"),
1664
+ caret: token("--lg-caret")
1665
+ },
1666
+ perf,
1667
+ settings,
1668
+ stored
1669
+ };
1670
+ };
1671
+ const copyText = (text) => {
1672
+ try {
1673
+ if (navigator.clipboard && navigator.clipboard.writeText) return navigator.clipboard.writeText(text);
1674
+ } catch {
1675
+ // Fall through to the selection trick.
1676
+ }
1677
+ try {
1678
+ const area = document.createElement("textarea");
1679
+ area.value = text;
1680
+ area.style.position = "fixed";
1681
+ area.style.opacity = "0";
1682
+ document.body.appendChild(area);
1683
+ area.select();
1684
+ document.execCommand("copy");
1685
+ area.remove();
1686
+ } catch {
1687
+ // Nothing else to try.
1688
+ }
1689
+ return Promise.resolve();
1690
+ };
1691
+ const saveText = (text, name) => {
1692
+ try {
1693
+ const url = URL.createObjectURL(new Blob([text], { type: "text/plain;charset=utf-8" }));
1694
+ const link = document.createElement("a");
1695
+ link.href = url;
1696
+ link.download = name;
1697
+ link.style.display = "none";
1698
+ document.body.appendChild(link);
1699
+ link.click();
1700
+ link.remove();
1701
+ setTimeout(() => URL.revokeObjectURL(url), 4000);
1702
+ return true;
1703
+ } catch {
1704
+ return false;
1705
+ }
1706
+ };
1707
+
1571
1708
  function SettingsPanel() {
1572
1709
  const value = useSettings();
1573
1710
  const state = useWallpaper();
@@ -1577,6 +1714,7 @@
1577
1714
  const [perf, setPerf] = useState(null);
1578
1715
  const [update, setUpdate] = useState(null);
1579
1716
  const [tab, setTab] = useState(null);
1717
+ const [log, setLog] = useState(null);
1580
1718
  const checkUpdates = useCallback((force) => {
1581
1719
  setUpdate((prev) => ({ ...(prev ?? {}), loading: true, error: "" }));
1582
1720
  fetch(`${API}/update${force ? "?force=1" : ""}`)
@@ -1589,6 +1727,47 @@
1589
1727
  useEffect(() => {
1590
1728
  checkUpdates(false);
1591
1729
  }, [checkUpdates]);
1730
+ // One press, one file: the panel collects the page, the host adds
1731
+ // everything it knows and writes the result to disk. A host that
1732
+ // predates the route still yields a client-only file.
1733
+ const exportLog = useCallback(() => {
1734
+ setLog({ loading: true });
1735
+ const snapshot = clientSnapshot(value, perf);
1736
+ const query = (() => {
1737
+ try {
1738
+ let encoded = "?snap=" + encodeURIComponent(JSON.stringify(snapshot));
1739
+ if (encoded.length > 6000) {
1740
+ delete snapshot.stored;
1741
+ delete snapshot.perf;
1742
+ encoded = "?snap=" + encodeURIComponent(JSON.stringify(snapshot));
1743
+ }
1744
+ return encoded.length > 6000 ? "" : encoded;
1745
+ } catch {
1746
+ return "";
1747
+ }
1748
+ })();
1749
+ fetch(`${API}/log/export${query}`)
1750
+ .then((response) => response.json())
1751
+ .then((data) => {
1752
+ if (!data || data.ok === false) throw new Error(String((data && data.error) || "export failed"));
1753
+ setLog({ loading: false, path: String(data.path ?? ""), text: String(data.text ?? ""), hostOnly: !query });
1754
+ })
1755
+ .catch((error) => {
1756
+ const text = "DSH Theme Engine — client-only snapshot\n\n" + JSON.stringify(snapshot, null, 2);
1757
+ saveText(text, "dsh-theme-engine-client.txt");
1758
+ setLog({
1759
+ loading: false,
1760
+ path: "",
1761
+ text,
1762
+ error: String((error && error.message) || error),
1763
+ hostOnly: true
1764
+ });
1765
+ });
1766
+ }, [value, perf]);
1767
+ const copyLog = useCallback(() => {
1768
+ const text = String((log && log.text) || "");
1769
+ copyText(text).then(() => setLog((prev) => ({ ...(prev ?? {}), copied: true })));
1770
+ }, [log]);
1592
1771
  useEffect(() => {
1593
1772
  let timer = null;
1594
1773
  const stop = () => {
@@ -1998,6 +2177,37 @@ renderAppearance(),
1998
2177
  )
1999
2178
  )
2000
2179
  ),
2180
+ h(
2181
+ "section",
2182
+ { className: "lg-group" },
2183
+ h("h2", { className: "lg-group-title" }, t("diagGroup")),
2184
+ h("p", { className: "lg-group-hint" }, t("diagHint")),
2185
+ h(
2186
+ "div",
2187
+ { className: "lg-actions" },
2188
+ h(
2189
+ "button",
2190
+ {
2191
+ type: "button",
2192
+ className: "lg-button",
2193
+ disabled: Boolean(log && log.loading),
2194
+ onClick: exportLog
2195
+ },
2196
+ log && log.loading ? t("exporting") : t("exportLog")
2197
+ ),
2198
+ log && log.text
2199
+ ? h("button", { type: "button", className: "lg-button", onClick: copyLog }, t("copyLog"))
2200
+ : null
2201
+ ),
2202
+ log && log.path ? h("p", { className: "lg-group-hint" }, `${t("logSaved")} ${log.path}`) : null,
2203
+ log && log.error && !log.path
2204
+ ? h("p", { className: "lg-group-hint" }, `${t("logHostMissing")} ${log.error}`)
2205
+ : null,
2206
+ log && log.hostOnly && log.path
2207
+ ? h("p", { className: "lg-group-hint" }, t("logHostOnly"))
2208
+ : null,
2209
+ log && log.copied ? h("p", { className: "lg-group-hint" }, t("logCopied")) : null
2210
+ ),
2001
2211
  h(
2002
2212
  "section",
2003
2213
  { className: "lg-group" },
package/host/audio.js CHANGED
@@ -184,6 +184,11 @@ export function startSpectrum() {
184
184
  const text = String(chunk).trim();
185
185
  if (text) spectrum.error = text.slice(0, 240);
186
186
  });
187
+ // A helper that dies mid-write can raise EPIPE on either pipe; unhandled that
188
+ // 'error' event is fatal for the whole host, so absorb both and let the exit
189
+ // handler clear the child.
190
+ spectrumChild.stdout.on('error', () => {});
191
+ spectrumChild.stderr.on('error', () => {});
187
192
  spectrumChild.on('error', (error) => {
188
193
  spectrum.error = 'child: ' + ((error && error.message) || error);
189
194
  spectrumChild = null;
@@ -0,0 +1,260 @@
1
+ /**
2
+ * One-file diagnostic export.
3
+ *
4
+ * A user testing the engine on another machine cannot open DevTools and cannot
5
+ * read the host's memory, so the plugin writes everything that matters about
6
+ * one run into a single plain-text file: versions, platform, the live capture
7
+ * engine, both halves of the client report (the ready line, the `hw:` probes
8
+ * and the last perf frame), the audio/loopback status and the client snapshot
9
+ * the panel just collected. The same payload is returned as JSON so the panel
10
+ * can offer "copy".
11
+ */
12
+ import { readFile, stat, writeFile } from 'node:fs/promises';
13
+ import { cpus, homedir, release, tmpdir, totalmem } from 'node:os';
14
+ import { join } from 'node:path';
15
+
16
+ import { BUNDLE_ROOT } from './paths.js';
17
+
18
+ /** Local time with an explicit offset, so two machines' logs line up. */
19
+ function stamp(date = new Date()) {
20
+ const pad = (value, width = 2) => String(value).padStart(width, '0');
21
+ const offset = -date.getTimezoneOffset();
22
+ const sign = offset >= 0 ? '+' : '-';
23
+ return (
24
+ date.getFullYear() +
25
+ '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) +
26
+ ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds()) +
27
+ ' ' + sign + pad(Math.floor(Math.abs(offset) / 60)) + pad(Math.abs(offset) % 60)
28
+ );
29
+ }
30
+
31
+ /** `26.12.5-152100` — the number npm publishes. */
32
+ async function engineVersion() {
33
+ try {
34
+ const raw = await readFile(join(BUNDLE_ROOT, 'package.json'), 'utf8');
35
+ return String(JSON.parse(raw).version ?? '');
36
+ } catch {
37
+ return '';
38
+ }
39
+ }
40
+
41
+ /** Environment variables that describe where this run lives. */
42
+ function environment() {
43
+ const keep = [
44
+ 'DSH_PROFILE',
45
+ 'DSH_PROFILE_DIR',
46
+ 'DSH_HOME',
47
+ 'DSH_INSTALL_DIR',
48
+ 'DSH_WEB_URL',
49
+ 'DSH_SESSION_ID',
50
+ 'DSH_SHELL',
51
+ 'DSH_SERVICE',
52
+ 'DSH_LOG_LEVEL',
53
+ 'APPDATA',
54
+ 'LOCALAPPDATA',
55
+ 'USERPROFILE',
56
+ 'USERNAME'
57
+ ];
58
+ const out = {};
59
+ for (const key of keep) {
60
+ const value = process.env[key];
61
+ if (value) out[key] = value;
62
+ }
63
+ return out;
64
+ }
65
+
66
+ function platformText() {
67
+ const cpu = cpus()[0];
68
+ return {
69
+ os: process.platform + ' ' + release(),
70
+ arch: process.arch,
71
+ cpu: cpu ? cpu.model : '',
72
+ threads: cpus().length,
73
+ ramGB: Math.round((totalmem() / 1024 ** 3) * 10) / 10,
74
+ electron: process.versions.electron || null,
75
+ node: process.versions.node,
76
+ chrome: process.versions.chrome || null
77
+ };
78
+ }
79
+
80
+ /** Where a tester will actually look: Downloads first, then home, then temp. */
81
+ async function outputDirectory() {
82
+ const candidates = [join(homedir(), 'Downloads'), homedir(), tmpdir()];
83
+ for (const candidate of candidates) {
84
+ try {
85
+ const info = await stat(candidate);
86
+ if (info.isDirectory()) return candidate;
87
+ } catch {
88
+ // Try the next one.
89
+ }
90
+ }
91
+ return tmpdir();
92
+ }
93
+
94
+ function line(label, value) {
95
+ if (value === null || value === undefined || value === '') return '';
96
+ return label + ': ' + value + '\n';
97
+ }
98
+
99
+ /**
100
+ * Keep the report finite: a live capture object holds typed arrays and a
101
+ * library can hold thousands of entries. Deep-copy, dropping functions and
102
+ * capping depth, arrays and strings.
103
+ */
104
+ function shrink(value, depth = 0, seen = new WeakSet()) {
105
+ if (value === null || value === undefined) return value ?? null;
106
+ const type = typeof value;
107
+ if (type === 'number' || type === 'boolean') return value;
108
+ if (type === 'string') return value.length > 2000 ? value.slice(0, 2000) + '…' : value;
109
+ if (type === 'function' || type === 'symbol') return undefined;
110
+ if (type !== 'object') return String(value);
111
+ if (seen.has(value)) return '[circular]';
112
+ seen.add(value);
113
+ if (depth > 5) return '[deep]';
114
+ if (Array.isArray(value) || ArrayBuffer.isView(value)) {
115
+ const list = Array.from(value);
116
+ const capped = list.length > 64 ? list.slice(0, 64).concat('[+' + (list.length - 64) + ' more]') : list;
117
+ return capped.map((entry) => shrink(entry, depth + 1, seen));
118
+ }
119
+ const out = {};
120
+ for (const [key, entry] of Object.entries(value)) {
121
+ const next = shrink(entry, depth + 1, seen);
122
+ if (next !== undefined) out[key] = next;
123
+ }
124
+ return out;
125
+ }
126
+
127
+ /** The human half: sections a person and a search engine can both read. */
128
+ function formatReport(payload) {
129
+ const { version, clientBuild, server, client, saved } = payload;
130
+ const we = server.wallpaperEngine;
131
+ const audio = server.audio || {};
132
+ const spectrum = audio.status || {};
133
+ const loopback = audio.loopback || {};
134
+ const capture = server.capture || {};
135
+ const clients = server.clients || {};
136
+ const facts = server.facts || {};
137
+
138
+ let text = '';
139
+ text += 'DSH Theme Engine — diagnostic log\n';
140
+ text += 'format: 2\n';
141
+ text += line('generated', saved);
142
+ text += '\n';
143
+
144
+ text += '== versions ==\n';
145
+ text += line('plugin', version);
146
+ text += line('client build', clientBuild || '(unknown)');
147
+ text += line('node', process.versions.node);
148
+ text += line('electron', process.versions.electron || '(not electron)');
149
+ text += line('process type', facts.type || '(none)');
150
+ text += '\n';
151
+
152
+ text += '== machine ==\n';
153
+ for (const [key, value] of Object.entries(platformText())) text += line(key, value);
154
+ text += '\n';
155
+
156
+ text += '== paths ==\n';
157
+ text += line('bundle', BUNDLE_ROOT);
158
+ text += line('execPath', process.execPath);
159
+ text += line('argv0', process.argv0);
160
+ text += line('cwd', process.cwd());
161
+ for (const [key, value] of Object.entries(environment())) text += line(key, value);
162
+ text += '\n';
163
+
164
+ text += '== capture ==\n';
165
+ text += line('engine', capture.engine);
166
+ text += line('streaming', capture.streaming);
167
+ text += line('fps', capture.fps);
168
+ text += line('frames', capture.frames);
169
+ text += line('ms', capture.ms);
170
+ text += line('error', capture.error);
171
+ text += line('borderless', capture.borderless);
172
+ text += line('appsBehind', capture.info && capture.info.appsBehind);
173
+ text += line('apps', capture.info && capture.info.apps ? capture.info.apps.join(', ') : '');
174
+ text += line('size', capture.info ? capture.info.width + 'x' + capture.info.height : '');
175
+ text += line('live', server.stream && server.stream.live);
176
+ text += line('dropped', server.stream && server.stream.dropped);
177
+ text += line('helper alive', server.helperAlive);
178
+ text += '\n';
179
+
180
+ text += '== wallpaper engine ==\n';
181
+ text += line('installed', we && we.installed);
182
+ text += line('install root', we && we.installRoot);
183
+ text += line('running', we && we.running);
184
+ text += line('steam running', we && we.steamRunning);
185
+ text += line('library items', we && typeof we.items === 'number' ? we.items : Array.isArray(we.items) ? we.items.length : '');
186
+ text += line('active id', we && we.current && we.current.id);
187
+ text += line('active name', we && we.current && we.current.name);
188
+ text += line('active kind', we && we.current && we.current.kind);
189
+ text += line('note', we && we.note);
190
+ text += '\n';
191
+
192
+ text += '== elysia ==\n';
193
+ const elysia = server.elysia;
194
+ if (elysia) {
195
+ for (const key of ['installed', 'via', 'name', 'profile', 'version', 'error']) text += line(key, elysia[key]);
196
+ }
197
+ text += '\n';
198
+
199
+ text += '== audio ==\n';
200
+ text += line('loopback installed', loopback.installed);
201
+ text += line('loopback error', loopback.error);
202
+ text += line('spectrum running', spectrum.running);
203
+ text += line('spectrum ageMs', spectrum.ageMs);
204
+ text += line('spectrum frames', spectrum.frames);
205
+ text += line('spectrum error', spectrum.error);
206
+ text += line('spectrum bins', spectrum.bins);
207
+ text += '\n';
208
+
209
+ text += '== client report ==\n';
210
+ text += line('ready', clients.ready);
211
+ text += line('hw', clients.hardware);
212
+ text += line('perf', clients.error);
213
+ text += line('overlay', clients.overlay);
214
+ text += line('bench', clients.bench);
215
+ text += '\n';
216
+
217
+ text += '== client snapshot ==\n';
218
+ text += JSON.stringify(client, null, 2) + '\n\n';
219
+
220
+ text += '== raw json ==\n';
221
+ text += JSON.stringify(payload.raw, null, 2) + '\n';
222
+ return text;
223
+ }
224
+
225
+ /**
226
+ * Write one report and hand back both the path and the bytes, so the panel can
227
+ * say where the file went and offer the text for copying.
228
+ */
229
+ export async function exportDiagnostics(server, client) {
230
+ const version = await engineVersion();
231
+ const build = String(client && client.build ? client.build : '');
232
+ const saved = stamp();
233
+ const safeClient = shrink(client && typeof client === 'object' ? client : {});
234
+ const safeServer = shrink(server);
235
+ const payload = {
236
+ version,
237
+ clientBuild: build,
238
+ saved,
239
+ server: safeServer,
240
+ client: safeClient
241
+ };
242
+ payload.raw = {
243
+ version,
244
+ clientBuild: build,
245
+ saved,
246
+ server: safeServer,
247
+ client: safeClient
248
+ };
249
+ const text = formatReport(payload);
250
+ const dir = await outputDirectory();
251
+ const name =
252
+ 'dsh-theme-engine-log-' +
253
+ saved.slice(0, 10).replace(/-/g, '') +
254
+ '-' +
255
+ saved.slice(11, 19).replace(/:/g, '') +
256
+ '.txt';
257
+ const path = join(dir, name);
258
+ await writeFile(path, text, 'utf8');
259
+ return { path, name, bytes: Buffer.byteLength(text, 'utf8'), text };
260
+ }
package/host/helper.js CHANGED
@@ -238,6 +238,7 @@ export function helperCommand(payload, timeoutMs = 6000) {
238
238
  try {
239
239
  stdin.write(payload);
240
240
  } catch {
241
+ clearTimeout(timer);
241
242
  resetHelper('write failed');
242
243
  resolve(null);
243
244
  }
package/index.js CHANGED
@@ -58,6 +58,7 @@ import {
58
58
  streamSpectrum
59
59
  } from "./host/audio.js";
60
60
  import { openWebRoot, serveWebFile, webProperties, webLogs } from './host/web-frame.js';
61
+ import { exportDiagnostics } from './host/diagnostics.js';
61
62
  import { runPowerShellFile } from './host/run.js';
62
63
  import { GATE_SCRIPT } from './host/scripts.js';
63
64
  import { CACHE_DIR, GATE_SCRIPT_PATH } from './host/paths.js';
@@ -449,6 +450,86 @@ export function apply(ctx, config) {
449
450
  },
450
451
  }));
451
452
 
453
+ // One-file diagnostic export for machines we cannot inspect: the panel
454
+ // collects the client snapshot, the host adds everything it knows, and the
455
+ // file lands in Downloads so the tester only has to attach it.
456
+ disposers.push(ctx.webServer.register({
457
+ kind: 'exact',
458
+ path: '/liquid-glass/log/export',
459
+ resource: async (request) => {
460
+ try {
461
+ let client = {};
462
+ let raw = '';
463
+ try {
464
+ raw = new URL(request.url, 'http://127.0.0.1').searchParams.get('snap') ?? '';
465
+ } catch {
466
+ // No query string: fall through to the body.
467
+ }
468
+ if (!raw && typeof request.text === 'function') {
469
+ try {
470
+ raw = (await request.text()) || '';
471
+ } catch {
472
+ // An unreadable body only costs the client snapshot.
473
+ }
474
+ }
475
+ if (raw) {
476
+ try {
477
+ client = JSON.parse(raw);
478
+ } catch {
479
+ client = { snapshotParseError: String(raw).slice(0, 200) };
480
+ }
481
+ }
482
+ const full = await Promise.race([
483
+ weState().catch(() => null),
484
+ new Promise((resolve) => setTimeout(() => resolve(null), 8000)),
485
+ ]);
486
+ // Counts, not the whole library: the log has to stay readable.
487
+ const engine = full
488
+ ? {
489
+ installed: full.installed,
490
+ installRoot: full.installRoot,
491
+ running: full.running,
492
+ steamRunning: full.steamRunning,
493
+ current: full.current,
494
+ roots: Array.isArray(full.roots) ? full.roots.length : 0,
495
+ items: Array.isArray(full.items) ? full.items.length : 0,
496
+ monitors: Array.isArray(full.monitors) ? full.monitors.length : 0,
497
+ note: full.note,
498
+ }
499
+ : null;
500
+ const result = await exportDiagnostics(
501
+ {
502
+ capture: captureStats,
503
+ stream: { live: streamIsLive(), dropped: streamDropCount() },
504
+ helperAlive: helperAlive(),
505
+ audio: { status: spectrumStatus(), loopback: loopbackStatus(), facts: hostFacts() },
506
+ clients: {
507
+ ready: lastClientReady,
508
+ hardware: lastHardware,
509
+ error: lastClientError,
510
+ overlay: lastClientOverlay,
511
+ bench: lastClientBench,
512
+ },
513
+ wallpaperEngine: engine,
514
+ elysia: await elysiaEngineStatus().catch(() => null),
515
+ facts: hostFacts(),
516
+ config: options,
517
+ },
518
+ client
519
+ );
520
+ return jsonResponse({
521
+ ok: true,
522
+ path: result.path,
523
+ name: result.name,
524
+ bytes: result.bytes,
525
+ text: result.text,
526
+ });
527
+ } catch (error) {
528
+ return jsonResponse({ ok: false, error: String(error instanceof Error ? error.message : error) }, 500);
529
+ }
530
+ },
531
+ }));
532
+
452
533
  disposers.push(ctx.webServer.register({
453
534
  kind: 'exact',
454
535
  path: '/liquid-glass/gate',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-theme-engine",
3
- "version": "26.12.5-150734",
3
+ "version": "26.12.5-154000",
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": {