wallpaper-engine-dsh 2.1.3 → 2.1.4
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.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +50 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ git clone https://github.com/Weilv-D/wallpaper-engine-dsh.git
|
|
|
35
35
|
dsh plugin --profile web add link:<absolute path to the cloned folder>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Restart `dsh web`,
|
|
38
|
+
Restart `dsh web`, open **Settings** from the sidebar, and pick **Wallpaper**.
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
package/README.zh.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -37,6 +37,7 @@ window.__ModuleLoader__.load({
|
|
|
37
37
|
const STRINGS = {
|
|
38
38
|
zh: {
|
|
39
39
|
settingsLabel: "壁纸背景 (Wallpaper Engine)",
|
|
40
|
+
navLabel: "壁纸背景",
|
|
40
41
|
scanning: "正在扫描 Wallpaper Engine…",
|
|
41
42
|
connError: "未能连接 Wallpaper Engine:",
|
|
42
43
|
retry: "重试",
|
|
@@ -122,6 +123,7 @@ window.__ModuleLoader__.load({
|
|
|
122
123
|
},
|
|
123
124
|
en: {
|
|
124
125
|
settingsLabel: "Wallpaper Engine",
|
|
126
|
+
navLabel: "Wallpaper",
|
|
125
127
|
scanning: "Scanning Wallpaper Engine…",
|
|
126
128
|
connError: "Could not reach Wallpaper Engine: ",
|
|
127
129
|
retry: "Retry",
|
|
@@ -1869,6 +1871,7 @@ window.__ModuleLoader__.load({
|
|
|
1869
1871
|
const editing = sel.editing;
|
|
1870
1872
|
|
|
1871
1873
|
return React.createElement("div", { className: "webg-picker" },
|
|
1874
|
+
React.createElement("h2", { className: "webg-heading" }, t.settingsLabel),
|
|
1872
1875
|
SearchRow(t, sel, query, setQuery, filteredList.length, usableList.length),
|
|
1873
1876
|
WallpaperGrid(t, sel, usableList, filteredList, q),
|
|
1874
1877
|
ActionRow(t, sel),
|
|
@@ -2109,6 +2112,10 @@ window.__ModuleLoader__.load({
|
|
|
2109
2112
|
search/language row breathes; gap keeps every row evenly spaced.
|
|
2110
2113
|
Type scale follows the shell: 14px body → 13px controls → 12px hints. */
|
|
2111
2114
|
.webg-picker { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; max-width: 900px; }
|
|
2115
|
+
/* Page heading mirrors the shell's own section headings (18px/600, no
|
|
2116
|
+
margins) — the sidebar label is the short nav name, this carries the
|
|
2117
|
+
full product name. */
|
|
2118
|
+
.webg-heading { margin: 0; font-size: 18px; font-weight: 600; color: var(--dsw-alias-label-primary, inherit); }
|
|
2112
2119
|
.webg-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
|
2113
2120
|
.webg-hint { font-size: 12px; opacity: 0.7; color: var(--dsw-alias-label-tertiary, inherit); }
|
|
2114
2121
|
.webg-error {
|
|
@@ -2535,6 +2542,35 @@ window.__ModuleLoader__.load({
|
|
|
2535
2542
|
});
|
|
2536
2543
|
}
|
|
2537
2544
|
|
|
2545
|
+
// Nav icon: the settings sidebar hardcodes icons by section id
|
|
2546
|
+
// (account/models/plugins/...) and falls back to a gear for every
|
|
2547
|
+
// plugin-registered section; nav rows expose no per-row hook (no
|
|
2548
|
+
// data-id, class names are module-suffixed), so the icon is swapped
|
|
2549
|
+
// in place: watch for nav rows whose label text is ours and replace
|
|
2550
|
+
// the default gear SVG with the plugin wallpaper glyph. The gear's
|
|
2551
|
+
// class attribute is copied so the shell's sizing styles still apply,
|
|
2552
|
+
// and a dataset guard keeps the swap idempotent across re-renders.
|
|
2553
|
+
const NAV_ICON_SVG =
|
|
2554
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">' +
|
|
2555
|
+
'<rect x="2" y="2" width="12" height="12" rx="2"/>' +
|
|
2556
|
+
'<circle cx="5.8" cy="5.8" r="1.1"/>' +
|
|
2557
|
+
'<path d="M14 10l-3.33-3.33L3.33 14"/></svg>';
|
|
2558
|
+
const styleNavIcon = () => {
|
|
2559
|
+
if (typeof document.querySelectorAll !== "function") return;
|
|
2560
|
+
for (const row of document.querySelectorAll('button[class*="navCell"]')) {
|
|
2561
|
+
if (row.dataset && row.dataset.webgNavIcon) continue;
|
|
2562
|
+
if (row.textContent !== S().navLabel) continue;
|
|
2563
|
+
const gear = row.querySelector("svg");
|
|
2564
|
+
if (!gear) continue;
|
|
2565
|
+
row.dataset.webgNavIcon = "1";
|
|
2566
|
+
const tpl = document.createElement("span");
|
|
2567
|
+
tpl.innerHTML = NAV_ICON_SVG;
|
|
2568
|
+
const svg = tpl.firstChild;
|
|
2569
|
+
const cls = gear.getAttribute && gear.getAttribute("class");
|
|
2570
|
+
if (cls) svg.setAttribute("class", cls);
|
|
2571
|
+
gear.replaceWith(svg);
|
|
2572
|
+
}
|
|
2573
|
+
};
|
|
2538
2574
|
// 4. Own settings section — NOT a row inside General. The settings dialog
|
|
2539
2575
|
// enumerates every registered settings.section slot for its nav
|
|
2540
2576
|
// (settings-general and settings-plugins register theirs the same way),
|
|
@@ -2543,12 +2579,25 @@ window.__ModuleLoader__.load({
|
|
|
2543
2579
|
if (ctx.slots) {
|
|
2544
2580
|
ctx.slots.inject("settings.section", () =>
|
|
2545
2581
|
ctx.slots.register(
|
|
2546
|
-
{ name: "settings.section", id: "we-background", order: 20, label: () => S().
|
|
2582
|
+
{ name: "settings.section", id: "we-background", order: 20, label: () => S().navLabel },
|
|
2547
2583
|
() => React.createElement(WallpaperPicker),
|
|
2548
2584
|
),
|
|
2549
2585
|
);
|
|
2550
2586
|
}
|
|
2551
2587
|
|
|
2588
|
+
// 4b. Drive the nav icon swap (defined above): the settings dialog mounts
|
|
2589
|
+
// its nav only while open, so the observer just sweeps on mutation
|
|
2590
|
+
// batches and early-exits when no nav rows exist. Disposed with the
|
|
2591
|
+
// plugin fiber.
|
|
2592
|
+
if (ctx.effect && typeof MutationObserver === "function" && typeof document !== "undefined") {
|
|
2593
|
+
ctx.effect(() => {
|
|
2594
|
+
const mo = new MutationObserver(styleNavIcon);
|
|
2595
|
+
mo.observe(document.body, { childList: true, subtree: true });
|
|
2596
|
+
styleNavIcon();
|
|
2597
|
+
return () => mo.disconnect();
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2552
2601
|
loadInventory(false);
|
|
2553
2602
|
}
|
|
2554
2603
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallpaper-engine-dsh",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Wallpaper Engine library as the DSH web GUI background — video/web/still wallpapers, rotation lists, search, resource monitor, bilingual UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|