dsh-background-by-model 0.12.1 → 0.12.3
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/CHANGELOG.md +17 -1
- package/CHANGELOG.zh.md +17 -1
- package/README.md +9 -11
- package/README.zh.md +9 -11
- package/icon.svg +21 -0
- package/lib/client.js +59 -57
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
> The full release history lives here; the **Recent optimizations** section of [README.md](./README.md#recent-optimizations) lists only the two most recent releases (v0.12.
|
|
3
|
+
> The full release history lives here; the **Recent optimizations** section of [README.md](./README.md#recent-optimizations) lists only the two most recent releases (v0.12.3 / v0.12.2).
|
|
4
|
+
|
|
5
|
+
## v0.12.3
|
|
6
|
+
|
|
7
|
+
- **The settings nav shows this plugin's mark, not the harness's default gear** — the glyph was patched into the mounted DOM cell, and the patch looked for the nav button whose first `<span>` read as the section label. The host's markup puts the icon span first, so that span's text was empty, the label never matched and the patch returned having found nothing. It is now a `settings.section.icon` registration, which is the supported route.
|
|
8
|
+
- **The nav icon and the section share one id** — the icon's registration id must equal the section's (`only: row.id` filters everything else out), so both read it from a single constant instead of two literals that can drift.
|
|
9
|
+
- **A new mark: a sun over hills, the 16px counterpart of the store icon** — drawn on the 16-unit grid rather than scaled down from 36, because at nav size the larger drawing's rounding and its echo cards collapse. `currentColor` throughout, so the sidebar tints it like any other row and the brand tile supplies its own foreground. The plain sun stays, since its other caller is the "follow the system theme" button.
|
|
10
|
+
- **The published icon is 20% larger** — its ink covered 70%×78% of the 36 viewBox, so it sat noticeably smaller in the plugin manager than the other plugins' artwork. Measured against the sidebar strip, ours read 37% of the container width against 51% for a neighbouring plugin; 1.20 brings it to the same weight while staying inside the viewBox (1.277 is the vertical limit).
|
|
11
|
+
- **`check:mark`** — the slot registration, the shared id, the absence of the DOM patch, the mark's `currentColor` and grid, and the artwork's scale staying under its clipping limit. Verified to fail when the id is wrong, when the observer comes back, and when the section names a literal.
|
|
12
|
+
|
|
13
|
+
## v0.12.2
|
|
14
|
+
|
|
15
|
+
- **The plugin manager no longer shows a package name and a generic icon** — `locale/en.json` and `locale/zh.json` supply the title and description the manager displays, and `icon.svg` replaces the default artwork.
|
|
16
|
+
- **Both files are EXPORTED, and that is what makes them readable** — the reader resolves them through Node's ESM resolver, so `exports` must name `./locale/*.json`; a file on disk without that entry resolves to nothing and is treated as absent, with no error anywhere.
|
|
17
|
+
- **And they are in `files`** — everything above can be right in the repository and still be missing from the tarball, which looks exactly the same in the UI.
|
|
18
|
+
- **`check:meta`** — asserts all of it, then asks `readPluginMeta` itself for the answer the card would show. Verified to fail when the `exports` entry, the `files` entry or the `icon` key is removed.
|
|
19
|
+
- **The publish gate accepts globs in `files`** — it compared every `files` entry with `packed.includes()`, so `locale/*.json` looked like a missing literal filename and the pack step refused a perfectly good tarball. A literal path is still matched by name; a glob now has to match at least one packed file.
|
|
4
20
|
|
|
5
21
|
## v0.12.1
|
|
6
22
|
|
package/CHANGELOG.zh.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
-
> 这里保留完整的历史记录;[README.zh.md](./README.zh.md#近期优化) 的「近期优化」一节只列最近两个版本(v0.12.
|
|
3
|
+
> 这里保留完整的历史记录;[README.zh.md](./README.zh.md#近期优化) 的「近期优化」一节只列最近两个版本(v0.12.3 / v0.12.2)。
|
|
4
|
+
|
|
5
|
+
## v0.12.3
|
|
6
|
+
|
|
7
|
+
- **设置导航里显示的是这个插件自己的标记,不再是宿主的默认齿轮** —— 那个字形是补丁式地塞进已挂载的 DOM 单元里的,它去找"第一个 `<span>` 文字等于分组名"的按钮。而宿主的结构里第一个 span 就是图标那个,文字为空,于是标签永远匹配不上,补丁什么也没找到就返回了。现在改成注册 `settings.section.icon` 插槽,这才是官方支持的方式。
|
|
8
|
+
- **导航图标与分组共用一个 id** —— 图标注册的 id 必须等于分组的 id(`only: row.id` 会把其它的都过滤掉),所以两处都从同一个常量读,而不是两个可能漂移的字面量。
|
|
9
|
+
- **新标记:太阳与山,即商店图标在 16px 网格上的对应画法** —— 直接在 16 单位网格上画,而不是把 36 的缩小,因为导航那个尺寸下大图的圆角和两片残影会糊成一团。整体 `currentColor`,侧栏按文字色着色、品牌方块自带前景色。原来的纯太阳留着,它的另一个调用方是「跟随系统主题」按钮。
|
|
10
|
+
- **发布的图标放大了 20%** —— 原来的墨迹只占 36 视框的 70%×78%,在插件管理器里明显比别的插件小一圈。对着侧栏截图实测,我们只占容器宽度 37%,旁边那个插件是 51%;1.20 让它回到同样的分量,同时仍在视框内(垂直上限是 1.277)。
|
|
11
|
+
- **`check:mark`** —— 插槽注册、共用 id、DOM 补丁不得回归、标记的 `currentColor` 与网格、以及图标的缩放不得超过裁切上限。验证过:id 写错、观察器回归、分组用字面量,三种都会红。
|
|
12
|
+
|
|
13
|
+
## v0.12.2
|
|
14
|
+
|
|
15
|
+
- **插件管理器里不再是包名加通用图标** —— `locale/en.json` 与 `locale/zh.json` 提供管理器显示的标题与描述,`icon.svg` 顶掉默认图标。
|
|
16
|
+
- **两份文件必须写进 `exports`,否则读不到** —— 读取方走 Node 的 ESM 解析器,`exports` 要声明 `./locale/*.json`;磁盘上有但这里没写就解析不到,会被当成不存在,且不报任何错。
|
|
17
|
+
- **还要写进 `files`** —— 上面全对、包里却没有,界面上看起来一模一样。
|
|
18
|
+
- **`check:meta`** —— 把这些都断言一遍,最后直接问 `readPluginMeta` 卡片上会显示什么。撤掉 `exports`、`files` 或 `icon` 任意一项都验证过会红。
|
|
19
|
+
- **发布闸门支持 `files` 里的通配符** —— 它原来用 `packed.includes()` 比对每一项,于是 `locale/*.json` 被当成一个不存在的字面文件名,一个完全正常的包被打包步骤拒绝。现在字面路径仍按名比对,通配符则要求至少匹配到包里的一个文件。
|
|
4
20
|
|
|
5
21
|
## v0.12.1
|
|
6
22
|
|
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ To mount a working copy into a profile instead, add it to the profile's `package
|
|
|
237
237
|
|
|
238
238
|
After changing anything under `src/`, run `pnpm run bundle` again — the mounted profile loads `lib/`, so edits do not take effect until the bundle is rebuilt.
|
|
239
239
|
|
|
240
|
-
`pnpm test` builds, typechecks and runs
|
|
240
|
+
`pnpm test` builds, typechecks and runs seventeen checks, none of which needs a dependency, a transformer or a browser. Each can also be run on its own with `pnpm check:holiday` / `pnpm check:rotation` / `pnpm check:transition` / `pnpm check:repaint` / `pnpm check:code-plate` / `pnpm check:image-mode` / `pnpm check:rules` / `pnpm check:preset` / `pnpm check:ui` / `pnpm check:watchdogs` / `pnpm check:scheme` / `pnpm check:store` / `pnpm check:agent` / `pnpm check:rev` / `pnpm check:meta` / `pnpm check:mark` / `pnpm check:node`:
|
|
241
241
|
|
|
242
242
|
- **`check:holiday`** — the two holiday windows, the Beijing day boundary, leap eighth months across 1900–2100, and the four gates `pickHoliday` applies.
|
|
243
243
|
- **`check:rotation`** — `nextIndex` / `isRotating`: no walking off the end, shuffle never repeating the image on screen, and nothing called "rotating" with nothing to rotate.
|
|
@@ -253,6 +253,8 @@ After changing anything under `src/`, run `pnpm run bundle` again — the mounte
|
|
|
253
253
|
- **`check:store`** — the two decisions behind the storage cleanup, `referencedSlots` and `orphanSlots`: a picture in use is never an orphan, a stray holiday-slot file always is, and the browser half sends RULE slots rather than the whole config.
|
|
254
254
|
- **`check:agent`** — agent access and the config revision: off by default, only an explicit `true` granting it (`'yes'` / `1` / `null` do not), the recommended profile not turning it on, an export not carrying it, the revision only ever moving forward, and a config written before either field reading as revision 0.
|
|
255
255
|
- **`check:rev`** — the panel's revision chain: a write carries `expectedRev`, a successful one records the host's answer, `setRev` mutates the live object, an import neither zeroes the revision nor reads it after the wipe, installing the recommended profile goes through one `adoptRecommended` call rather than a `resetStore` plus a write, config writes are chained while picture bytes are released only after the config lands (imports included), a tool-added picture derives a slot name from the clock, and two callers cannot adopt at once. Miss any link and the next save refuses itself, so an edit visibly undoes itself ("click + once, the card flashes and disappears").
|
|
256
|
+
- **`check:meta`** — how the plugin describes ITSELF in the plugin manager and the settings pages: `locale/<language>.json` carrying a title and a description per language, both files EXPORTED (the reader resolves them through Node's ESM resolver, so a file on disk that `exports` does not name resolves to nothing and is silently treated as absent), both listed in `files` (or the published tarball is missing them and looks identical), and an icon that is a relative path, inside the package, SVG/PNG/JPEG/WebP under 256 KiB, with a 36×36 viewBox and nothing referenced externally. When the harness is installed next door it ends by asking `readPluginMeta` itself, because the fallback it otherwise answers with — the bare package name — is exactly what a reader sees on the card.
|
|
257
|
+
- **`check:mark`** — how the plugin's own mark reaches the settings navigation: a `settings.section.icon` registration rather than a DOM patch over the host's markup, its id read from the same constant the section registers under (`only: row.id` silently drops any other id), no `MutationObserver` or `<svg>` surgery coming back, a glyph on the 16-unit grid drawn in `currentColor` (so one drawing suits the sidebar's text tint and the brand tile's foreground), and the published artwork's scale staying under the factor at which the viewBox starts clipping it. The DOM patch this replaced never matched, so the gear stayed and nothing reported anything.
|
|
256
258
|
- **`check:node`** — the built node half through its real RPC handler with `DSH_HOME` redirected and `fetch` stubbed: the holiday block, the festival art's content-hash cache and its pruning, fallback across the three edges, the per-image color AND effect lifts, the global switch effect, the atomic config write with its backup and its recovery, the store's usage report and cleanup, and the recommended profile's seven pictures end to end (including the old manifest method being gone, the slot whitelist, and the retry budget).
|
|
257
259
|
|
|
258
260
|
## FAQ
|
|
@@ -309,19 +311,15 @@ The effect is **Instant**, or the duration is `0` — an effect and a duration a
|
|
|
309
311
|
|
|
310
312
|
> Only the two most recent releases are listed here; older ones live in [CHANGELOG.md](./CHANGELOG.md).
|
|
311
313
|
|
|
312
|
-
### v0.12.
|
|
314
|
+
### v0.12.3
|
|
313
315
|
|
|
314
|
-
- **
|
|
316
|
+
- **The settings nav draws this plugin's own mark** — it was a DOM patch looking for the nav button whose first `<span>` read as the section label, and the host puts the icon span first, so the text was empty and the patch silently found nothing; what showed was the harness's default gear. It is a `settings.section.icon` registration now, sharing one id constant with the section so the two cannot drift.
|
|
317
|
+
- **A new mark, drawn for 16px** — a sun over hills, the small counterpart of the store icon, on the 16-unit grid rather than scaled down from 36 (at nav size the larger drawing collapses). `currentColor`, so the sidebar tints it like any other row. The plain sun stays for the "follow the system theme" button.
|
|
318
|
+
- **The published icon is 20% larger** — its ink sat at 70%×78% of the 36 viewBox and read 37% of the sidebar container's width against 51% for a neighbouring plugin; 1.20 puts it at the same weight and still inside the viewBox. `check:mark` pins the registration, the shared id, the absent patch and that scale.
|
|
315
319
|
|
|
316
|
-
### v0.12.
|
|
320
|
+
### v0.12.2
|
|
317
321
|
|
|
318
|
-
- **The
|
|
319
|
-
- **Their descriptions say what the theme decides for them** — a picture is not picked to suit the current light/dark interface (the scheme follows the wallpaper, so either works), no colour is passed unless the user named one, URLs come from hosts reachable in mainland China, and a picture the agent adds lands in `fill`.
|
|
320
|
-
- **The switch ships off** — a new `agentAccess` in the config. While it is off the tools are **absent from the model's tool table**, costing no context and impossible to call; the recommended profile does not turn it on — and installing it does not turn one OFF either.
|
|
321
|
-
- **An export never carries the grant** — a theme file describes an appearance; `agentAccess` and `rev` are stripped on the way out and the importing machine's own value wins on the way in.
|
|
322
|
-
- **The config carries a revision, and a stale write is refused** — the panel and the tools cannot silently overwrite each other; the loser is handed the config that won and adopts it. A successful write must record the new revision, or the next save refuses itself and the edit visibly undoes itself ("click + once, the card flashes and disappears"). Installing the recommended profile is one round trip, not "wipe then write".
|
|
323
|
-
- **The panel checks the revision every 3 s**, so an agent's edit repaints without a reload — a no-op while access is off.
|
|
324
|
-
- **`SCHEMA_VERSION` is 11**, with a new `check:agent` and the stale-write and access round trips added to `check:node`.
|
|
322
|
+
- **The plugin manager and the settings pages describe this plugin properly** — `locale/en.json` and `locale/zh.json` carry its title and description in each language, and `icon.svg` (36×36, the same viewBox the built-in artwork uses) replaces the generic package glyph. Both are listed in `exports` and in `files`: the reader resolves them through Node's ESM resolver, so a locale file on disk that `exports` does not name resolves to nothing, and a file outside `files` is missing from the published tarball — both look exactly like "no locale at all" in the UI, with no error anywhere. `check:meta` pins the lot and ends by asking `readPluginMeta` itself what the card would show. The publish gate now accepts globs in `files`, so a `locale/*.json` entry no longer reads as a missing literal filename.
|
|
325
323
|
|
|
326
324
|
## Star History
|
|
327
325
|
[](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)
|
package/README.zh.md
CHANGED
|
@@ -237,7 +237,7 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
237
237
|
|
|
238
238
|
改完 `src/` 必须重新执行 `pnpm run bundle` 才会生效 —— 挂载的 profile 加载的是 `lib/`。
|
|
239
239
|
|
|
240
|
-
`pnpm test`
|
|
240
|
+
`pnpm test` 会构建、类型检查并跑十七道校验,十七道都不需要依赖、不需要转译器、也不需要浏览器。也可以单独跑:`pnpm check:holiday` / `pnpm check:rotation` / `pnpm check:transition` / `pnpm check:repaint` / `pnpm check:code-plate` / `pnpm check:image-mode` / `pnpm check:rules` / `pnpm check:preset` / `pnpm check:ui` / `pnpm check:watchdogs` / `pnpm check:scheme` / `pnpm check:store` / `pnpm check:agent` / `pnpm check:rev` / `pnpm check:meta` / `pnpm check:mark` / `pnpm check:node`:
|
|
241
241
|
|
|
242
242
|
- **`check:holiday`** —— 两个节日窗口、北京时间的跨日边界、1900–2100 年间的闰八月,以及 `pickHoliday` 的四道闸门。
|
|
243
243
|
- **`check:rotation`** —— `nextIndex` / `isRotating`:不走越界、随机不重复当前这张、没有可轮换的东西时绝不报「正在轮换」。
|
|
@@ -253,6 +253,8 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
253
253
|
- **`check:store`** —— 存储清理的两个判定:`referencedSlots` 与 `orphanSlots`。钉住「正在用的图不会被当成孤儿」与「节日槽位的文件必须可清」,外加浏览器半边传的是**规则槽位**而不是整份配置。
|
|
254
254
|
- **`check:agent`** —— AI 授权与配置版本号:默认关闭、只有显式 `true` 才授予(`'yes'` / `1` / `null` 都不行)、推荐配置不替你打开、导出不带授权、版本号只增不减、以及旧配置读成 0。
|
|
255
255
|
- **`check:rev`** —— 面板的版本号链:写入必须带 `expectedRev`、成功后必须记下宿主的回答、`setRev` 改写活对象、导入不得把版本号清零且要在清空之前读,推荐配置必须走一次 `adoptRecommended` 而不是自己 `resetStore` 再写,且配置写入必须串成一条链、图片字节要等配置落盘之后再删(导入主题也一样)、AI 加的图片用时钟派生的槽位名、两条路径不能同时采用推荐配置。少了任何一环,下一次保存就会判自己陈旧,改动在画面上自己撤销("点一次 + 卡片闪一下后消失")。
|
|
256
|
+
- **`check:meta`** —— 插件在插件管理器和设置页里如何描述**它自己**:`locale/<语言>.json` 每种语言各带标题与描述、两份文件都在 `exports` 里(读取方走 Node 的 ESM 解析器,磁盘上有但 `exports` 没写等于解析不到,而且会被**静默当成不存在**)、都在 `files` 里(否则发布的包里根本没有,症状和上一句一模一样),以及一个相对路径、留在包内、SVG/PNG/JPEG/WebP、256 KiB 以内、带 36×36 viewBox 且不引用外部资源的图标。dsh 就装在旁边时,最后会直接问 `readPluginMeta` 本人——因为它给出的兜底答案正是包名,而那恰是卡片上原来显示的东西。
|
|
257
|
+
- **`check:mark`** —— 插件自己的标记如何抵达设置导航:用 `settings.section.icon` 插槽注册,而不是在宿主 DOM 上打补丁;它的 id 与分组注册共用同一个常量(`only: row.id` 会静默丢掉任何别的 id);`MutationObserver` 和替换 `<svg>` 那些做法不得回归;字形画在 16 单位网格上、整体 `currentColor`(所以一份画法既适配侧栏的文字色,也适配品牌方块的前景色);以及发布图标的缩放不得超过视框开始裁切它的那个系数。它替换掉的那个 DOM 补丁从来没匹配上过,所以齿轮一直在,而且什么都不报错。
|
|
256
258
|
- **`check:node`** —— 把构建好的 node 半边通过真实的 RPC 处理器跑一遍(`DSH_HOME` 指向临时目录、`fetch` 换成桩):节日配置块、节日画按内容哈希的缓存与清理、三个边缘的回落、逐图颜色与逐图效果的抬升、全局切换效果、配置的原子写与备份/恢复、图片存储的用量报告与清理,以及推荐配置的七张图(含旧清单方法的消失、槽位白名单、超时与重试预算)。
|
|
257
259
|
|
|
258
260
|
## 常见问题
|
|
@@ -309,19 +311,15 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
309
311
|
|
|
310
312
|
> 这里只列最近两个版本;更早的版本见 [CHANGELOG.zh.md](./CHANGELOG.zh.md)。
|
|
311
313
|
|
|
312
|
-
### v0.12.
|
|
314
|
+
### v0.12.3
|
|
313
315
|
|
|
314
|
-
-
|
|
316
|
+
- **侧栏现在画的是插件自己的标记** —— 原来是一个 DOM 补丁,去找"第一个 `<span>` 文字等于分组名"的导航按钮,而宿主把图标那个 span 放在最前面,文字为空,补丁什么也没找到就静默返回,显示出来的其实是宿主的默认齿轮。现在改成注册 `settings.section.icon`,并与分组共用同一个 id 常量,两边不会漂移。
|
|
317
|
+
- **新标记,按 16px 画的** —— 太阳与山,商店图标的小尺寸对应画法,直接画在 16 单位网格上而不是把 36 的缩小(导航那个尺寸下大图会糊成一团)。整体 `currentColor`,侧栏按文字色着色。原来的纯太阳留给「跟随系统主题」按钮。
|
|
318
|
+
- **发布的图标放大了 20%** —— 墨迹原来只占 36 视框的 70%×78%,在侧栏里只占容器宽度 37%,而旁边的插件是 51%;1.20 让它回到同样分量,且仍在视框内。`check:mark` 钉住注册、共用 id、补丁不得回归,以及缩放上限。
|
|
315
319
|
|
|
316
|
-
### v0.12.
|
|
320
|
+
### v0.12.2
|
|
317
321
|
|
|
318
|
-
-
|
|
319
|
-
- **工具描述写清了主题替它决定的事** —— 不必为适配当前深浅模式挑图(深浅跟着壁纸走,深色浅色都能用)、用户没点名就不传颜色、找图优先选中国大陆能访问的站点、AI 加的图片落在「填充」。
|
|
320
|
-
- **授权开关默认关** —— 配置里新增 `agentAccess`。关着时工具**根本不在模型的工具表里**,不占上下文也不会被误调;推荐配置也不替你打开。
|
|
321
|
-
- **导出不带授权** —— 主题文件只描述外观,`agentAccess` 与 `rev` 在导出时被剥掉,导入时以本机的值为准。
|
|
322
|
-
- **配置带版本号,落后写入被拒绝** —— 面板与工具不能互相静默覆盖;被拒的一方拿到赢家的配置并接盘重绘。写入成功后必须记下新版本号,否则下一次保存会判自己陈旧、改动在画面上自己撤销("点一次 + 卡片闪一下后消失")。推荐配置是一个操作的往返,不是"清空再写"两步。
|
|
323
|
-
- **面板 3 秒核对一次版本号**,AI 改完不用刷新;授权关闭时是空操作。
|
|
324
|
-
- **`SCHEMA_VERSION` 升到 11**,新增 `check:agent`,`check:node` 补上陈旧写入与授权往返。
|
|
322
|
+
- **插件管理器和设置页里能正确描述这个插件了** —— `locale/en.json` 与 `locale/zh.json` 分语言给出标题与描述,`icon.svg`(36×36,和内置图标同一个 viewBox)顶掉那个通用方块。两样都写进了 `exports` 和 `files`:读取方走 Node 的 ESM 解析器,磁盘上有但 `exports` 没声明的 locale 文件解析不到,没写进 `files` 的文件发布的包里根本没有——这两种情况在界面上都长得像"根本没有 locale",且不报任何错。`check:meta` 把这些全钉住,最后直接问 `readPluginMeta` 卡片上会显示什么。发布闸门也改成支持 `files` 里的通配符了,`locale/*.json` 不会再被当成一个不存在的字面文件名。
|
|
325
323
|
|
|
326
324
|
## Star History
|
|
327
325
|
|
package/icon.svg
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" fill="none">
|
|
2
|
+
<!-- Drawn 1.2x about the artwork's own centre, so the mark fills the container
|
|
3
|
+
the way the other plugin icons do. The bbox before scaling is
|
|
4
|
+
x 5.50..30.70, y 3.75..31.95; 1.277 is the largest factor the viewBox
|
|
5
|
+
allows vertically, so this keeps headroom instead of touching the edge. -->
|
|
6
|
+
<g transform="translate(-3.720 -3.420) scale(1.2)">
|
|
7
|
+
<defs>
|
|
8
|
+
<linearGradient id="j1" x1="8" y1="12" x2="28.5" y2="32" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop stop-color="#69B9FF"/><stop offset="1" stop-color="#324DE2"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<clipPath id="jclip"><rect x="8.5" y="12" width="20" height="20" rx="5"/></clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
<rect x="11" y="4.5" width="19" height="19" rx="4.5" transform="rotate(9 20.5 14)" fill="#4561EE" opacity=".3"/>
|
|
14
|
+
<rect x="6" y="9" width="19" height="19" rx="4.5" transform="rotate(-6 15.5 18.5)" fill="#4561EE" opacity=".55"/>
|
|
15
|
+
<rect x="8.5" y="12" width="20" height="20" rx="5" fill="url(#j1)"/>
|
|
16
|
+
<g clip-path="url(#jclip)">
|
|
17
|
+
<circle cx="15.4" cy="17.8" r="2.1" fill="#fff" opacity=".95"/>
|
|
18
|
+
<path d="M11.6 27.6l4.7-4.7 3.1 3.3 2.1-1.9 4.3 4.2" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" opacity=".92"/>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</svg>
|
package/lib/client.js
CHANGED
|
@@ -4,8 +4,8 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let react_dom = require("react-dom");
|
|
10
10
|
//#region src/client/runtime.ts
|
|
11
11
|
function resolveStore() {
|
|
@@ -4566,6 +4566,32 @@ window.__ModuleLoader__.load({
|
|
|
4566
4566
|
dangerouslySetInnerHTML: { __html: SUN_PATHS }
|
|
4567
4567
|
});
|
|
4568
4568
|
}
|
|
4569
|
+
/**
|
|
4570
|
+
* The plugin's own mark: a sun over hills, the 16px counterpart of `icon.svg`.
|
|
4571
|
+
*
|
|
4572
|
+
* NOT `SunIcon`, which stays the plain sun because its other caller
|
|
4573
|
+
* (`ModelBgPage`'s "follow the system theme" button) means a light/dark switch.
|
|
4574
|
+
* This one identifies the PLUGIN, so it carries the picture motif of the store
|
|
4575
|
+
* artwork: the rounded card becomes the sun, the mountain range stays.
|
|
4576
|
+
*
|
|
4577
|
+
* Drawn on the 16px grid rather than scaled down from the 36px icon — at this
|
|
4578
|
+
* size a 36px drawing's rounding and its two echo cards collapse into mush.
|
|
4579
|
+
* `currentColor` throughout: the sidebar tints it with the text colour, the
|
|
4580
|
+
* brand tile behind the section header tints it with its own foreground.
|
|
4581
|
+
*/
|
|
4582
|
+
const MARK_PATHS = "<circle cx=\"5.15\" cy=\"4.55\" r=\"1.5\" fill=\"currentColor\"/><path d=\"M1.75 12.1l4.35-4.8 2.15 2.45 1.6-1.75 4.4 4.1\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>";
|
|
4583
|
+
function MarkIcon({ size = 16, className }) {
|
|
4584
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
4585
|
+
width: size,
|
|
4586
|
+
height: size,
|
|
4587
|
+
className,
|
|
4588
|
+
viewBox: "0 0 16 16",
|
|
4589
|
+
fill: "none",
|
|
4590
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4591
|
+
"aria-hidden": "true",
|
|
4592
|
+
dangerouslySetInnerHTML: { __html: MARK_PATHS }
|
|
4593
|
+
});
|
|
4594
|
+
}
|
|
4569
4595
|
function Glyph({ children, size = 16, className }) {
|
|
4570
4596
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
4571
4597
|
width: size,
|
|
@@ -4820,63 +4846,39 @@ window.__ModuleLoader__.load({
|
|
|
4820
4846
|
/**
|
|
4821
4847
|
* The settings-nav glyph.
|
|
4822
4848
|
*
|
|
4823
|
-
* The harness
|
|
4824
|
-
*
|
|
4825
|
-
*
|
|
4826
|
-
*
|
|
4827
|
-
*
|
|
4828
|
-
*
|
|
4829
|
-
*
|
|
4849
|
+
* The harness renders each settings section's nav icon from a slot,
|
|
4850
|
+
* `settings.section.icon`, whose registration id must EQUAL the section's id
|
|
4851
|
+
* (`dsh-client-ui-settings-general`, `renderSlot('settings.section.icon', …,
|
|
4852
|
+
* { only: row.id, fallback: navIcon(row.id) })`). The fallback is
|
|
4853
|
+
* `IconSettingsOutlineMedium` — a gear — which is why a section with no icon
|
|
4854
|
+
* registered shows a gear.
|
|
4855
|
+
*
|
|
4856
|
+
* THIS USED TO BE A DOM PATCH, and it never worked. It looked for the nav
|
|
4857
|
+
* button whose first `<span>` read as the section label, but the host's markup is
|
|
4858
|
+
* `<button><span class="navIcon"><svg/></span><span class="navLabel">…</span>`,
|
|
4859
|
+
* so `querySelector('span')` returned the ICON span — text content `''` — the
|
|
4860
|
+
* label never matched, and the gear stayed. Nothing reported it: the patch simply
|
|
4861
|
+
* found no cell and returned. A slot is both the supported route and the honest
|
|
4862
|
+
* one, so the observer, the markup scan and the DOM surgery are all gone.
|
|
4830
4863
|
*/
|
|
4831
|
-
/** The
|
|
4832
|
-
const
|
|
4833
|
-
const MARK = "dabNavIcon";
|
|
4864
|
+
/** The id the section is registered under; the icon's id has to match it. */
|
|
4865
|
+
const SECTION_ID = "dsh-background-by-model";
|
|
4834
4866
|
/**
|
|
4835
|
-
*
|
|
4867
|
+
* Register the section's nav icon.
|
|
4836
4868
|
*
|
|
4837
|
-
*
|
|
4838
|
-
*
|
|
4869
|
+
* `active` arrives from the host on every render, so the mark can react to the
|
|
4870
|
+
* section being selected without re-registering.
|
|
4839
4871
|
*/
|
|
4840
|
-
function
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
sun.setAttribute("height", "16");
|
|
4851
|
-
sun.setAttribute("viewBox", "0 0 16 16");
|
|
4852
|
-
sun.setAttribute("fill", "none");
|
|
4853
|
-
sun.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
4854
|
-
sun.dataset[MARK] = "1";
|
|
4855
|
-
sun.innerHTML = SUN_PATHS;
|
|
4856
|
-
svg?.replaceWith(sun);
|
|
4857
|
-
if (svg === null) cell.prepend(sun);
|
|
4858
|
-
return;
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
|
-
/** Watch for the settings dialog (re)appearing; returns the disposer. */
|
|
4862
|
-
function watchNavIcon(navLabel) {
|
|
4863
|
-
if (typeof MutationObserver === "undefined") return () => void 0;
|
|
4864
|
-
const observer = new MutationObserver((records) => {
|
|
4865
|
-
if (records.some((r) => {
|
|
4866
|
-
for (const n of r.addedNodes) {
|
|
4867
|
-
if (n.nodeType !== 1) continue;
|
|
4868
|
-
const el = n;
|
|
4869
|
-
if (el.matches?.(DIALOG_SEL) || el.querySelector?.(DIALOG_SEL)) return true;
|
|
4870
|
-
}
|
|
4871
|
-
return false;
|
|
4872
|
-
})) applyNavIcon(navLabel());
|
|
4873
|
-
});
|
|
4874
|
-
observer.observe(document.body, {
|
|
4875
|
-
childList: true,
|
|
4876
|
-
subtree: true
|
|
4877
|
-
});
|
|
4878
|
-
applyNavIcon(navLabel());
|
|
4879
|
-
return () => observer.disconnect();
|
|
4872
|
+
function registerNavIcon(ctx) {
|
|
4873
|
+
ctx.slots.inject("settings.section.icon", () => ctx.slots.register({
|
|
4874
|
+
name: "settings.section.icon",
|
|
4875
|
+
id: SECTION_ID,
|
|
4876
|
+
order: 35,
|
|
4877
|
+
label: () => ""
|
|
4878
|
+
}, (props) => (0, react.createElement)(MarkIcon, {
|
|
4879
|
+
size: props.size ?? 16,
|
|
4880
|
+
className: props.active ? "dab-nav-mark is-active" : "dab-nav-mark"
|
|
4881
|
+
})));
|
|
4880
4882
|
}
|
|
4881
4883
|
//#endregion
|
|
4882
4884
|
//#region src/client/theme-file.ts
|
|
@@ -8706,7 +8708,7 @@ window.__ModuleLoader__.load({
|
|
|
8706
8708
|
title: t("repoLink"),
|
|
8707
8709
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
8708
8710
|
className: "dab-brand-tile",
|
|
8709
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
8711
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkIcon, { size: 17 })
|
|
8710
8712
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
8711
8713
|
className: "dab-brand-name",
|
|
8712
8714
|
children: t("nav")
|
|
@@ -9583,14 +9585,14 @@ window.__ModuleLoader__.load({
|
|
|
9583
9585
|
};
|
|
9584
9586
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
9585
9587
|
name: "settings.section",
|
|
9586
|
-
id:
|
|
9588
|
+
id: SECTION_ID,
|
|
9587
9589
|
order: 35,
|
|
9588
9590
|
label: () => ctx.locale.bind(NS)("nav"),
|
|
9589
9591
|
locale: NS,
|
|
9590
9592
|
store,
|
|
9591
9593
|
inject: sectionInject
|
|
9592
9594
|
}, ThemeSection));
|
|
9593
|
-
|
|
9595
|
+
registerNavIcon(ctx);
|
|
9594
9596
|
const disposeThemeResets = watchThemeResets();
|
|
9595
9597
|
ctx.effect(() => () => {
|
|
9596
9598
|
disposeThemeResets();
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-background-by-model",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Appearance plugin for DeepSeek Harness: an ordered list of model rules, each carrying its own wallpapers — every image with its own framing and theme color — plus layout mode, opacity, brightness and blur; the background follows the model you switch to, a rule can rotate through several images on its own rhythm, and an off-by-default switch lets the agent change any of it through two tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"author": "Tkingxiao",
|
|
24
|
+
"icon": "./icon.svg",
|
|
24
25
|
"type": "module",
|
|
25
26
|
"engines": {
|
|
26
27
|
"dsh": ">=0.2.1-alpha.2"
|
|
@@ -35,13 +36,16 @@
|
|
|
35
36
|
"./client": {
|
|
36
37
|
"default": "./lib/client.js"
|
|
37
38
|
},
|
|
38
|
-
"./package.json": "./package.json"
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
"./locale/*.json": "./locale/*.json"
|
|
39
41
|
},
|
|
40
42
|
"main": "lib/index.js",
|
|
41
43
|
"directories": {
|
|
42
44
|
"lib": "lib"
|
|
43
45
|
},
|
|
44
46
|
"files": [
|
|
47
|
+
"icon.svg",
|
|
48
|
+
"locale/*.json",
|
|
45
49
|
"lib/index.js",
|
|
46
50
|
"lib/invariant.js",
|
|
47
51
|
"lib/client.js",
|
|
@@ -67,8 +71,10 @@
|
|
|
67
71
|
"check:scheme": "node scripts/scheme-check.ts",
|
|
68
72
|
"check:store": "node scripts/store-check.ts",
|
|
69
73
|
"check:node": "node scripts/node-half-check.mjs",
|
|
70
|
-
"test": "tsdown && tsc -p tsconfig.json && node scripts/holiday-check.ts && node scripts/rotation-check.ts && node scripts/transition-check.ts && node scripts/repaint-check.ts && node scripts/code-plate-check.ts && node scripts/image-mode-check.ts && node scripts/rules-view-check.ts && node scripts/preset-check.ts && node scripts/ui-strings-check.ts && node scripts/watchdogs-check.ts && node scripts/scheme-check.ts && node scripts/store-check.ts && node scripts/agent-access-check.ts && node scripts/rev-check.ts && node scripts/node-half-check.mjs",
|
|
74
|
+
"test": "tsdown && tsc -p tsconfig.json && node scripts/holiday-check.ts && node scripts/rotation-check.ts && node scripts/transition-check.ts && node scripts/repaint-check.ts && node scripts/code-plate-check.ts && node scripts/image-mode-check.ts && node scripts/rules-view-check.ts && node scripts/preset-check.ts && node scripts/ui-strings-check.ts && node scripts/watchdogs-check.ts && node scripts/scheme-check.ts && node scripts/store-check.ts && node scripts/agent-access-check.ts && node scripts/rev-check.ts && node scripts/plugin-meta-check.ts && node scripts/section-mark-check.ts && node scripts/node-half-check.mjs",
|
|
71
75
|
"check:agent": "node scripts/agent-access-check.ts",
|
|
76
|
+
"check:meta": "node scripts/plugin-meta-check.ts",
|
|
77
|
+
"check:mark": "node scripts/section-mark-check.ts",
|
|
72
78
|
"check:rev": "node scripts/rev-check.ts"
|
|
73
79
|
},
|
|
74
80
|
"devDependencies": {
|