dsh-background-by-model 0.7.5 → 0.7.6

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 CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- > The full release history lives here; the two most recent releases (v0.7.5 / v0.7.4) are also listed in [README.md](./README.md#recent-optimizations).
3
+ > The full release history lives here; the two most recent releases (v0.7.6 / v0.7.5) are also listed in [README.md](./README.md#recent-optimizations).
4
+
5
+ ## v0.7.6
6
+
7
+ - **The rules page turns from a stack of self-growing cards into one tab strip and one editor** — the report was "如果规则多且不收起的话会拉的很长". Every rule used to be a card that expanded itself, so the page was as tall as the sum of the cards and only got shorter once the user collapsed them by hand. Now **every rule is a tab and exactly one editor is mounted**: `ModelBgPage` holds the selection (`selId`), `RuleCard` no longer owns an open/collapsed state and is always rendered — it is the tab panel. The page height is therefore a function of one card plus the strip, whatever the rule count. The tabs carry what only the card head used to show: the number, a thumbnail of the rule's first image, the match string, and the two states worth knowing without opening the rule — whether it is the one in use, and whether it rotates or is switched off. The strip scrolls sideways rather than wrapping, for the same reason as above (a wrapped strip hands the page height straight back to the rule count), and the tabs are a fixed 34px with an elided match label, so switching rules cannot reflow the row. **The `+` and the "which rule" menu sit OUTSIDE the scroller**, as icon tiles at its right edge: inside, the only control that can ADD a rule scrolled away from the end of a long list. The strip's scrollbar now declares the host's own `--dsw-scrollbar-*` block (5px, rounded, layer-2 tint, no stepper arrows) instead of the platform's thick arrowed default sitting next to the panel's slim vertical one; every selector is scoped to a `dab-` class because this stylesheet is injected into the host page and a bare webkit-scrollbar selector would restyle the whole harness. **The match tester moved to the profile page** — it answers a question about the configuration as a whole ("which rule does this model land on?"), is read once rather than consulted while editing a rule, and on the rules page it pushed the strip a whole card down; the host-stale notice went with it, since that is also about config writes as a whole. The two decisions behind the strip are pure and now live in `src/client/rules-view.ts` (which rule the editor shows, and where a deletion lands — its neighbour, never rule 1), pinned by the new `check:rules`, which also pins the page structure the layout rests on: one editor drawn, no old stacked container, no per-card open state, a strip that can neither wrap nor grow, and its scrollbar block staying scoped. Also, the page description loses its `max-width:56ch`, which left it wrapping early with dead space beside it while the cards below ran the full width.
8
+
9
+ - **The rotation card's controls were reshuffled, at your request** — four changes, all explicit asks ("'一小时'删掉,'切换模型时也换一张'放到'随机'旁边,'下一张、正在显示...'放到外面'轮换这组图'旁边,常驻" and "把多图轮换板块放到主题色板块之下,把图二元素删掉"). **The manual step is always there**: the Next button and the "On screen 2 / 3" readout beside it used to be gated behind `rotatable && enabled`, so they vanished together with the rotation switch — and that readout is the only place on the card that says which picture is showing. The button now sits in the switch row, outside both the rotation panel and that test, so it is present for every rule state, enabled whenever the ACTIVE rule has two or more pictures (which is exactly `rotateNow`'s own test — it gates on the active rule and on `nextIndex`, never on `rotate.enabled`); below two pictures it is disabled and the readout is omitted rather than printing "0 / 0". **"Also step on a model switch" joined the order row**, beside In order / Shuffle: all three answer "when does a picture change", and the row without it read as the whole story of when the rotation steps. **"1 hour" is gone** from the dwell-time presets — five chips now (10 s / 30 s / 1 min / 5 min / 30 min) plus the custom field, which still takes 3600 s like any other value in the 5 s – 24 h clamp. **"图二元素" — the row of eight fixed preset swatches — is deleted**: the wheel, the numeric inputs, Extract from this image, the eyedropper and Follow system theme all stay; the row was a shortcut into the same setter the wheel drives. It was the only reader of three things, which went with it: the `PALETTE` table in `state.ts`, the `.dab-swatches` / `.dab-swatch` rules in `ui.css.ts`, and the `.dab-swatch:focus-visible` entry in the shared outline group; `.dab-swatch-title` and `.dab-swatch-lg` merely share the prefix and are untouched. **The whole rotation block moved into the second column**, below the theme colour and the wallpaper sliders: it used to sit between the image strip and the layout mode, which is the same place in the wide two-column card but the worst place in the collapsed one (below ~760px, `.dab-rule-cols`), where the tallest block of the card — a titled switch, a bordered panel with three rows inside it — landed between the pictures and the colour controls that edit them. Nothing inside the block changed; it is the same JSX, moved. Both READMEs lose the swatch row ("an inspiration palette" / 「灵感色板」), "1 h" from the dwell-time list, and now say where the manual step lives.
10
+
11
+ - **The festival art stops shipping in the package: it is fetched on the day, and cached by asset** — the two holiday wallpapers (228 KB + 500 KB) were two thirds of the entire tarball, for a picture that is looked at one day a year, and they were the one thing in the package that is a picture rather than code — with their binary history kept in `.git` forever besides. They now live in the project's own [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets) repository (beside the README screenshots, in a directory that is marked separately), and the node half downloads, validates and caches one on the first read of the day, under `~/.dsh/.dsh-background-by-model-data/holiday-cache/`. **The reference is pinned to a commit, never a branch**: runtime art has to be immutable — a branch reference would let a later reshuffle of the documentation screenshots silently kill a shipped feature on a day nobody is watching, with nothing in the log — and jsDelivr caches a commit reference forever, which is exactly what a file that never changes wants. **Two mirrors**: `cdn.jsdelivr.net` first (reachable from networks where `raw.githubusercontent.com` is not), raw as the fallback, both pointing at the same revision so a fallback cannot mix versions. **A failed download is a normal state, not an error path**: with both mirrors down the holiday simply does not take over and the model rules keep painting — the "does this slot actually have bytes" gate in `pickHoliday` was written for exactly this. **A cache entry is validated, not trusted**: a cached file that is not an image is treated as a miss and overwritten by the next download, because a process killed mid-write would otherwise break that holiday permanently with no way back short of deleting a file the user does not know exists; the write goes through a temp name and a rename, so a half-written file can never be read. **Neither invariant moved an inch**: the cache is keyed by ASSET name (`mid-autumn.webp`), deliberately outside the slot namespace, so `writeImage` still refuses a holiday slot and the store still never holds a `modelbg-h-*` file. `globalThis.fetch` is replaced by a stub throughout `check:node`, so the suite neither needs a CDN to be up nor asserts today's byte count of a file it does not own; the new assertions cover: loading the plugin and reading the config fetch nothing, one cold read is enough, the second read comes off disk with no transfer, two simultaneous cold reads share one transfer, a dead first mirror falls through, a failed fetch caches nothing, a mirror answering 200 with HTML is rejected, a corrupt cache entry is re-downloaded, and both mirrors serve the same commit.
12
+
13
+ - **A recommended profile, installed in one click** — the Config page gained a third card that downloads the author's own configuration from the same [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets) repository and writes it in place of yours. **It is hosted in the store's own shape**: `preset/preset.json` (the shape gate), `preset/theme-config.json` (6.5 KB of readable JSON) and `preset/modelbg-<slot>` (one raw file per slot). It was first written as a single theme file with every wallpaper inlined as base64 — 2.9 MB where 99.8% of the bytes were a picture, which is not a document anyone can hand-edit, since changing one rule's `match` string means finding it inside one line of several hundred thousand characters. That is why the format was changed: editing the config is now editing 6.5 KB of JSON on GitHub, replacing a wallpaper is replacing a file, and publishing the whole thing is a `cp` out of `~/.dsh/.dsh-background-by-model-data/`. On the node side a new `fetchPresetConfig` (fetch the manifest and the config, run the SHARED sanitizer on this side, then derive which files to ask for) and `fetchPresetImage` (one file by slot, magic-byte checked, returned as a data URL) replace the old single-document `fetchPreset`, both reusing the general `fetchAsset` the previous release split out of the festival-art downloader. **The request set is derived from the config rather than from a second manifest**, so adding a wallpaper is adding a rule entry and a file with nothing to keep in sync — which also means an untrusted config decides how many times this process goes to the network, so every slot name is checked against `SLOT_RE` (in `normalizeImage`) and the count is capped besides. **The two holiday slots a config legally names are dropped rather than requested**: `holidays.items` always carries `h-midautumn` / `h-nationalday`, no `modelbg-h-*` file can ever exist (a hard assertion added by the previous release), and asking for one would fail the whole feature on a file the plugin itself guarantees is not there. The client fetches **one file per request**, four of them in flight at a time — measured at 8.3 s sequential against 4.8 s concurrent for the real profile, since what is being paid is per-request latency over HTTP/2 — showing `3/7` on the button; each file therefore gets its own mirror fallback and its own validation. **One missing wallpaper fails the whole attempt and names the slot** — a profile that quietly arrived short a picture is precisely the silent failure that pinning the festival art to a commit exists to prevent, and naming it is what keeps a branch reference acceptable here. It still lands through the same `applyThemeFile` a hand-picked file goes through (assembled on the client into the shape `exportTheme` writes), so the version gate, the sanitizer and the wipe are one path; `preset.json` is what lets the version gate fire before a single wallpaper is requested. It remains the only destructive action in the panel: the download happens before the question (so the confirmation can state what is actually in hand), the wipe happens only after the download succeeds (an unreachable CDN must not cost the user their configuration on the way to a profile that never arrived), a host too old to write this shape is refused before anything is deleted, `holiday-cache/` is untouched, and nothing is cached to disk. `check:node`'s stub grew a "serve a whole directory by file name, a name it does not hold is a 404" mode, covering: the manifest and config fetched in order and sanitized on arrival, the request set derived from the rules with the holiday slot dropped, one request per wallpaper with its type sniffed rather than trusted from a header, a fallback to raw for a single file, a named wallpaper the host does not have being an error rather than a short profile, the two refusals that happen before any request at all (a holiday slot, a malformed slot name), a manifest version that is not a number, a profile written for a newer shape refused before anything is fetched, a config that is not JSON, one that is a JSON array, one naming more images than the cap, and a mirror announcing an oversized body.
14
+
15
+ - **The published package drops from 1.1 MB to about 220 kB** — besides the two festival pictures above, two other things were taking up room that the people downloading this plugin should not be paying for. **The documentation screenshots moved out**: `example_img/` (three webp files, 220 KB) now lives in the same assets repository under `dsh-background-by-model/`, and both READMEs reference it by absolute jsDelivr URL — the screenshots were put into `files` in the first place so the images on the npm page would not break, and an absolute URL does that too without putting binaries in the tarball or their history in `.git`. `screenshots.json` is deleted: nothing in the whole DSH installation or `~/.dsh` consumes it. **`lib/client.js.map` is no longer published**: it is a source map for the browser bundle, 624 KB, useless to anyone installing the package, and it stays in the repository (anyone debugging should be debugging a local build anyway). Ten files, about 220 kB packed / 690 kB unpacked, against thirteen files and 1.1 MB / 2.0 MB before. (Both figures are deliberately approximate — this entry and the two READMEs are themselves part of the number, so they nudge it every time they are edited. What the number says is the point: after the pictures left, the tarball is code and documentation and very little else.)
4
16
 
5
17
  ## v0.7.5
6
18
 
package/CHANGELOG.zh.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # 更新日志
2
2
 
3
- > 这里保留完整的历史记录;最近两个版本(v0.7.5 / v0.7.4)同时列在 [README.zh.md](./README.zh.md#近期优化) 里。
3
+ > 这里保留完整的历史记录;最近两个版本(v0.7.6 / v0.7.5)同时列在 [README.zh.md](./README.zh.md#近期优化) 里。
4
+
5
+ ## v0.7.6
6
+
7
+ - **规则页从一摞会自己长大的卡片变成一条选项卡 + 一个编辑器** —— 报告是「这个界面如果规则多且不收起的话会拉的很长」。此前每条规则是一张自展开的卡片,页面的高度等于所有卡片之和,只有用户手动一张张收起才会缩短。现在**每条规则是一个选项卡,页面上只挂载一个编辑器**:`ModelBgPage` 持有选中项(`selId`),`RuleCard` 不再拥有开合状态、永远渲染,它就是那个面板。于是页面高度只跟「一张卡片 + 一条选项卡」有关,与规则条数无关。选项卡把原本只在卡头上才看得到的东西搬了上来 —— 序号、首图缩略图、匹配串,以及两条不用展开就该知道的状态(它是不是当前生效的那条、它在轮换还是被关掉了);条子横向滚动而不是换行,理由和上面一样:一换行就把高度还给了规则条数,而且选项卡固定 34px、匹配串省略号截断,所以切换规则不会让整行抖动。**「+」和「切换哪条规则」这两个动作挪到了滚动区之外**,作为图标贴在条子右端:放在里面时,一个长列表里**唯一能新增规则**的控件会被滚走。条子的滚动条现在也用宿主自己那套 `--dsw-scrollbar-*`(5px、圆角、layer-2 染色、无步进箭头),此前它在面板那条细竖向滚动条旁边显示的是平台默认的粗浅色带箭头版本;选择器全部限定在 `dab-` 类上,因为这个样式表是注入宿主页面的,一个裸的 webkit-scrollbar 选择器会把整个 harness 一起改掉。**匹配测试器搬到了「资料」页** —— 它回答的是「这个模型落在哪条规则上」这个关于整份配置的问题,读一次就够,不是编辑某条规则时要反复看的东西,而在规则页上它把选项卡整整推下去一张卡片的高度;宿主过期的提示一起走了,因为那同样关乎整份配置的写入。选项卡背后那两个判定是纯的,现在住在 `src/client/rules-view.ts`(编辑器显示哪条规则、删除之后落在哪条 —— 落在邻居上,永远不是规则 1),由新的 `check:rules` 钉住,它同时还钉住布局所依赖的页面结构:只画一个编辑器、没有旧的堆叠容器、没有逐卡片的开合状态、条子既不换行也不长高、滚动条样式块仍然被限定住。另外页面描述去掉了 `max-width:56ch` —— 它让那段话提前换行、在旁边留出一块死空间,而下面的卡片是跑满宽度的。
8
+
9
+ - **轮换卡片的控件按你的要求重新排了一遍** —— 四处改动,都是明确的请求(「'一小时'删掉,'切换模型时也换一张'放到'随机'旁边,'下一张、正在显示...'放到外面'轮换这组图'旁边,常驻」「把多图轮换板块放到主题色板块之下,把图二元素删掉」)。**常驻的手动换图**:此前「下一张」按钮和它旁边那句「正在显示第 2 / 3 张」被关在 `rotatable && enabled` 的判定里,于是它们会跟着轮换开关一起消失 —— 而那句读数正是这张卡片上**唯一**说明当前是哪张图的地方。现在按钮住在「轮换这组图」那一行的外侧,对所有规则状态都在,判据只有一条:当前生效的规则有两张以上图就可用(这正是 `rotateNow` 自己的判据,它只问生效规则和 `nextIndex`,从来不问 `rotate.enabled`);不足两张时按钮禁用、读数整句省略而不是印一个「0 / 0」。**「切换模型时也换一张」挪到顺序那一行**,和「顺序」「随机」并排:三者都在回答「什么时候换」,缺了它的那一行读起来像是把话说完了。**「1 小时」从停留时长预设里删掉**,剩五个(10 秒 / 30 秒 / 1 分 / 5 分 / 30 分)加自定义输入 —— 自定义输入照旧接受 3600 秒,5 秒到 24 小时的夹紧范围没变。**「图二元素」—— 那排八个固定预设色板 —— 删掉了**:滚轮、数值输入、从本图提取、吸管、跟随系统主题都还在,那一排只是通往同一个 setter 的快捷方式。它是 `state.ts` 里的 `PALETTE` 表、`ui.css.ts` 里的 `.dab-swatches` / `.dab-swatch` 规则(以及共享描边分组里的 `.dab-swatch:focus-visible`)唯一的读者,这些跟着它一起走了;`.dab-swatch-title` 和 `.dab-swatch-lg` 只是名字前缀相同,未受影响。**整个轮换块移到了第二列**,在主题色和壁纸滑块之下:它此前夹在胶片条和布局模式之间,在宽版两列卡片里是同一个位置,但在折叠成单列的窄版(`~760px` 以下,`.dab-rule-cols`)里,它是卡片里最高的一块 —— 一个带标题的开关、一个内部三行的带框面板 —— 正好落在图片和编辑图片的颜色控件中间。块内部一个字段都没动,就是同一段 JSX 挪了位置。两份 README 里描述那排色板的地方(「灵感色板」/ "an inspiration palette")、停留时长列表里的「1 小时」、以及手动换图的位置都相应改了。
10
+
11
+ - **节日画不再随包发布:当天按需下载、按素材名缓存** —— 两张节日壁纸(228 KB + 500 KB)此前打进包里,占了整个 tarball 的三分之二 —— 为了一张一年只被看一天的画,而且是包里唯一属于「图片」而不是「代码」的东西,还要把它的二进制历史永久留在 `.git` 里。现在它们托管在项目自己的 [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets) 仓库(和 README 截图放在一起,但目录分开标注),节点半边在节日当天第一次读取时下载、校验、写进 `~/.dsh/.dsh-background-by-model-data/holiday-cache/`。**引用钉死在 commit 上,不是分支**:运行时素材必须是不可变的 —— 分支引用意味着以后整理一次文档截图,就能让一个已经发布的功能在某个没人盯着的那天静默失效、日志里什么都不说;而 jsDelivr 对 commit 引用永久缓存,正是一个永不改变的文件想要的。**两个镜像**:`cdn.jsdelivr.net` 主用(在 `raw.githubusercontent.com` 不通的网络里也能到),raw 兜底,两个都指向同一个 revision,所以回退不可能混版本。**下载失败不是一个异常路径,而是一个正常状态**:两个镜像都不通,这个节日今天就不接管,模型规则继续画 —— `pickHoliday` 那道「槽位里到底有没有字节」的闸门本来就是为这个写的。**缓存条目会被校验而不是被信任**:不是图片的缓存文件按未命中处理并在下次下载时覆盖,否则一个写到一半被杀掉的进程会让这个节日永久报废,而用户根本不知道有那个文件存在;写入走临时名 + rename,读到一半的文件不可能被看见。**两条不变量一个字都没改**:缓存按**素材名**(`mid-autumn.webp`)命名,刻意放在槽位命名空间之外,所以 `writeImage` 照旧拒绝节日槽位、数据目录里照旧永远不会出现 `modelbg-h-*`。`globalThis.fetch` 在 `check:node` 里被整体替换成桩,测试因此不依赖任何 CDN 是活的,也不去断言一个不属于自己的文件今天有多少字节;新增的断言覆盖:加载插件和读配置不发起任何下载、冷读一次就够、第二次读盘不再传输、两次并发冷读共用一次传输、第一个镜像死了会回退、失败的抓取什么都不缓存、镜像返回 200 但内容是 HTML 会被拒绝、损坏的缓存会被重新下载、两个镜像指向同一个 commit。
12
+
13
+ - **一键装上「推荐配置」** —— 「配置」页多了第三张卡,从同一个 [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets) 仓库下载作者本人正在用的那套配置并就地覆盖你的。**它托管在数据目录自己的形状里**:`preset/preset.json`(形状闸门)、`preset/theme-config.json`(6.5 KB 可读 JSON)和 `preset/modelbg-<slot>`(每个槽位一个原始文件)。第一版是单个主题文件、所有壁纸内联成 base64,2.9 MB 里 99.8% 是图片 —— 在几十万字符的一行里找一个 `match` 字符串不是任何人能做的手改,格式就是为这个改的;换过来之后,改配置是在 GitHub 上编辑 6.5 KB 的 JSON,换壁纸是替换一个文件,发布是从 `~/.dsh/.dsh-background-by-model-data/` 里 `cp` 一下。node 半边新增 `fetchPresetConfig`(取 manifest 与 config、在**这一侧**跑共享 sanitizer、再从这个配置推导出要请求哪些文件)与 `fetchPresetImage`(按槽位取一个文件,魔数校验后返回 data URL),旧的单文档 `fetchPreset` 删掉;`fetchHolidayAsset` 上一版拆出的通用 `fetchAsset` 被两者复用。**请求清单从配置推导,而不是来自第二份清单**:加一张壁纸就是在 config 里加一条并放进同名文件;反过来说,一份不受信任的配置决定了这个进程会去网络几次,所以每个槽位名都要过 `SLOT_RE`(在 `normalizeImage` 里),数量另有上限。**config 里合法存在的两个节日槽位会被剔掉而不是去请求** —— `holidays.items` 里必然有 `h-midautumn` / `h-nationalday`,而数据目录里永远不可能有 `modelbg-h-*` 文件(上一版刚加的硬断言),照单去请求会让整个功能在一份插件自己保证不存在的文件上失败。客户端**一个文件一个请求**地取、同时最多四路 —— 实测同一份配置顺序取 8.3 秒、并发取 4.8 秒,因为付的是 HTTP/2 上的每请求延迟 —— 按钮上显示 `3/7`;每个文件因此有自己的镜像回退与自己的校验。**少一张就整体失败并报出是哪个槽位**:一份悄悄少了图的配置恰恰是「节日素材钉死 commit」那条契约要防的静默失效,把它报出来才让分支引用在这里站得住。落地仍然走本地文件那条 `applyThemeFile`(在客户端组装成 `exportTheme` 写出的形状),所以版本闸门、sanitizer、清空都还是同一条路;`preset.json` 让版本闸门在请求第一张壁纸之前就能生效。它仍然是这个面板里唯一会销毁东西的操作:下载在**提问之前**(确认框因此能如实说出手里有什么),清空在**下载成功之后**(CDN 不通不该让你在等一份永远没来的配置的路上先弄丢自己的配置),一个旧到写不了这套形状的宿主在删除任何东西之前就被拒绝,`holiday-cache/` 不碰,配置也从不落盘缓存。`check:node` 的桩新增了「按文件名供应一整个目录、缺名就是 404」这一档,覆盖:manifest 与 config 按序取且当场 sanitize、请求清单由规则推导且节日槽位被剔掉、一张壁纸一个请求且类型是嗅出来的、对单个文件回落到 raw、config 点名而托管处没有的文件是一个错误、节日槽位与畸形槽位名在任何请求之前就被拒绝、manifest 版本不是数字、写给更新形状的配置在请求第一张壁纸之前被拒绝、config 不是 JSON / 是数组 / 图片数超限、以及镜像谎报超长。
14
+
15
+ - **发布包从 1.1 MB 瘦到约 220 kB** —— 除了上面那两张节日画,另外两样东西也在占地方,而且都不该由下载这个插件的人来付。**文档截图搬走了**:`example_img/`(三个 webp,220 KB)移到同一个 assets 仓库的 `dsh-background-by-model/` 目录下,两份 README 改用 jsDelivr 绝对地址引用 —— 这个插件此前专门把截图放进 `files` 是为了让 npm 页面上的图不裂,而绝对地址同样做得到,还不用把二进制塞进包里、更不用写进 `.git` 的历史。`screenshots.json` 删掉了:翻遍整个 DSH 安装目录和 `~/.dsh` 都没有任何消费方。**`lib/client.js.map` 不再发布**:它是给浏览器 bundle 用的源码映射,624 KB,对装包的人没有用处,仓库里仍然保留(要调试本地构建的人本来就该对着本地构建调)。10 个文件、约 220 kB packed / 690 kB unpacked,此前是 13 个文件、1.1 MB / 2.0 MB。(这两组数字刻意写成约数 —— 这条记录和两份 README 本身就是这个数字的一部分,每改一次就把它推高一点。这个数字想说的是:图片搬走之后,包里剩下的确实只有代码和文档。)
4
16
 
5
17
  ## v0.7.5
6
18
 
package/README.md CHANGED
@@ -49,19 +49,19 @@ Notes:
49
49
  One interface, one config — only the current model differs:
50
50
 
51
51
  <p align="center">
52
- <img src="example_img/wallpaper-deepseek.webp" alt="Appearance under DeepSeek" width="880">
52
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/wallpaper-deepseek.webp" alt="Appearance under DeepSeek" width="880">
53
53
  <br/>
54
54
  <em>DeepSeek V4.1 Flash · matched the rule whose match string contains <code>deepseek</code>: a light wallpaper with a matching theme color</em>
55
55
  </p>
56
56
 
57
57
  <p align="center">
58
- <img src="example_img/wallpaper-kimi.webp" alt="Appearance under Kimi" width="880">
58
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/wallpaper-kimi.webp" alt="Appearance under Kimi" width="880">
59
59
  <br/>
60
60
  <em>Kimi K2.7 Code · matched the rule containing <code>kimi</code>: a dark wallpaper, a dark theme, and the whole interface reskinned with it</em>
61
61
  </p>
62
62
 
63
63
  <p align="center">
64
- <img src="example_img/rule-editor.webp" alt="One rule's editor" width="660">
64
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/rule-editor.webp" alt="One rule's editor" width="660">
65
65
  <br/>
66
66
  <em>One rule on the Model Background tab · the wallpaper, its opacity and its blur belong to the rule; the layout mode, the framing and the theme color (wheel / HSL / RGB / extract from this image / pick from image) belong to the image it is editing</em>
67
67
  </p>
@@ -78,7 +78,7 @@ One interface, one config — only the current model differs:
78
78
  - **Live Match Readout** — The top of the Model Background tab shows the current state, e.g. `Current model deepseek-flash → matched · Rule 1`, so you can verify a rule on the spot. If the current model can't be detected, a hint is shown instead.
79
79
  - **Per-rule Appearance** — Every rule owns its wallpapers, opacity and blur, and **every image owns its layout mode, its framing and its theme color**. Nothing is shared globally except the Interface tab.
80
80
  - **Several Images per Rule** — A rule holds an ordered set of images, shown as a filmstrip: add several at once (file picker, drag & drop, or a list of URLs, one per line), reorder them, promote one to first, **replace one in place** (which keeps its position in the rotation), or remove them one by one. The image a rule paints when nothing rotates is its **first**. Removing the last image simply leaves the rule empty — and empty is not the same as off: while the rule keeps a theme color of its own it still matches, still serves as the fallback, and paints the interface instead of a wallpaper; only a rule with neither (a freshly added one) is skipped by matching. So an emptied rule is a visible, reversible state rather than one you get stuck in. While it holds no picture the filmstrip is hidden and the big preview tile **is** the upload button, so there is exactly one obvious place to add one.
81
- - **Import / Export** — Export every rule **including all of its images** to a `dsh-background-by-model-theme.json` (format version 6, images inlined as base64) and restore it anywhere. Files written by earlier releases still import: each rule's single image is lifted into its image list, a color written before per-image colors is lifted onto every image that has none, a layout mode written when it was the rule's is lifted onto each of its images, and a file written before the [switch effect](#switch-effect-global) gets that setting's shipped default — so an older theme file restores its look unchanged.
81
+ - **Import / Export** — Export every rule **including all of its images** to a `dsh-background-by-model-theme.json` (format version 6, images inlined as base64) and restore it anywhere. Files written by earlier releases still import: each rule's single image is lifted into its image list, a color written before per-image colors is lifted onto every image that has none, a layout mode written when it was the rule's is lifted onto each of its images, and a file written before the [switch effect](#switch-effect-global) gets that setting's shipped default — so an older theme file restores its look unchanged. The same document can also be **downloaded from the project's asset host** instead of picked from disk — see [Recommended profile](#recommended-profile) — with one difference, which is that it empties the store before it writes.
82
82
  - **File-based Persistence** — All settings and images are stored on the filesystem under `~/.dsh/.dsh-background-by-model-data/`, not `localStorage`.
83
83
  - **Automatic Migration** — Old single-wallpaper configs are upgraded in place on first read, and so is a layout mode that used to live on the rule. See the [v0.3.0 entry in CHANGELOG.md](./CHANGELOG.md#v030).
84
84
  - **Bilingual** — Full Chinese / English UI with automatic locale detection.
@@ -89,11 +89,11 @@ One interface, one config — only the current model differs:
89
89
  Per rule, and **off by default** — cycling spends real bandwidth, memory and battery, so nothing turns it on for you.
90
90
 
91
91
  - **Enable it per rule** — the switch appears in the rule card and only becomes usable once the rule holds two or more images.
92
- - **Dwell time** — 10 s / 30 s / 1 min / 5 min / 30 min / 1 h, or any custom value in seconds (clamped to 5 s – 24 h).
92
+ - **Dwell time** — 10 s / 30 s / 1 min / 5 min / 30 min, or any custom value in seconds (clamped to 5 s – 24 h).
93
93
  - **Order** — **In order** walks the list top-down and wraps around; **Shuffle** picks uniformly among every image *except* the one on screen, so a tick never looks like it was missed.
94
94
  - **Also step on a model switch** — an optional second trigger: every time the model changes and lands on that rule, it steps once. That is the whole feature for a rule meant to show "a different picture every time" without any timer running.
95
95
  - **Only the active rule rotates** — one timer for the whole plugin, aimed at whichever rule the current model resolved to. It stops while the tab is hidden and resumes on a fresh interval; a single-image rule (and every [holiday](#holiday-backgrounds)) never schedules anything.
96
- - **Next image** — steps the wallpaper immediately, for when you want to check the set.
96
+ - **Next image** — steps the wallpaper immediately, for when you want to check the set. It sits with the rotation switch (beside *which image is on screen*) and works whether or not the timer is running.
97
97
  - **What follows a switch is the rule — except everything that belongs to the picture** — opacity and blur belong to the rule and stay put. The **layout mode**, the **framing** and the **theme color** belong to the image, so a rotation can letterbox a tall screenshot and fill the landscape photo next to it, and can move through a green picture, a red one and a system-themed one with the interface palette following the wallpaper. The cross-fade between two images is the same one a model switch already used.
98
98
  - **Layout mode, framing and color are per image** — 适应/填充 decides how *this* picture meets the viewport, a crop and an accent belong to it too, so each image keeps its own while sharing the rule's opacity and blur. The filmstrip marks the images that carry a color of their own, and the color controls always say which image they are editing.
99
99
  - **Only the images it needs are loaded** — boot reads each rule's first image; the rest stream in when a card is expanded or when the rotation is about to need one. Ten images per rule therefore do not mean ten wallpapers transferred before the first frame.
@@ -120,14 +120,14 @@ A small one, not a settings block: **one switch on the Config page and nothing e
120
120
  - **National Day** — October 1–7.
121
121
  - **Mid-Autumn wins the overlap** — the two do collide (2025-10-06 was both); the single precise day is the better answer.
122
122
  - **A holiday with no image falls through** to the model rules rather than blanking the wallpaper.
123
- - **Built-in wallpapers** — Both holidays ship with a compressed wallpaper (228 KB and 500 KB at native resolution, against 8.37 MB of source art). Only the holiday that can paint *today* is ever fetched, so a profile that is not on a holiday transfers none of it.
124
- - **Neither the art nor the palette is swappable, by design** — an easter egg that asks to be configured is not an easter egg. A holiday slot is read-only: a file dropped into `modelbg-h-midautumn` / `modelbg-h-nationalday` is ignored by every read, and the plugin refuses to write, fetch into or delete those slots. The theme colors are constants in the holiday definition and are forced on every read — on the holiday **and on its image**, since a theme color lives on the image now — so a hand-edited `color` in `theme-config.json` cannot repaint a festival either. Its layout mode is the definition's **Fill** for the same reason (the art is full-bleed, and a stale `fit` would letterbox it), while the **framing** next to it stays yours. Theme exports therefore carry your rules only.
123
+ - **The art is downloaded, not shipped** — a compressed wallpaper per holiday (228 KB and 500 KB at native resolution, against 8.37 MB of source art), hosted in the project's [assets repository](https://github.com/HarmlessFunny/assets) rather than in the package: they were two thirds of the tarball for a picture that is looked at one day a year. The download is gated on the **calendar**, so a profile that is not on a holiday fetches nothing at all, and the first read on the day caches the file under `holiday-cache/` — every boot after that, and every year after that, is answered from disk and needs no network. The reference is pinned to a **commit**, never a branch, so reshuffling the repository's screenshots cannot break a shipped festival; a `jsDelivr` mirror is tried first and `raw.githubusercontent.com` second, and if both are unreachable the holiday simply does not take over — the model rules keep painting.
124
+ - **Neither the art nor the palette is swappable, by design** — an easter egg that asks to be configured is not an easter egg. A holiday slot is read-only: a file dropped into `modelbg-h-midautumn` / `modelbg-h-nationalday` is ignored by every read, and the plugin refuses to write, fetch into or delete those slots. The download lands in `holiday-cache/`, keyed by asset name and never by slot, so the store still never holds a `modelbg-h-*` file. The theme colors are constants in the holiday definition and are forced on every read — on the holiday **and on its image**, since a theme color lives on the image now — so a hand-edited `color` in `theme-config.json` cannot repaint a festival either. Its layout mode is the definition's **Fill** for the same reason (the art is full-bleed, and a stale `fit` would letterbox it), while the **framing** next to it stays yours. Theme exports therefore carry your rules only.
125
125
  - **Turning it off** — the switch on the Config page, or `"holidays": { "enabled": false }` in the same file.
126
126
 
127
127
  ### Per-rule and per-image settings
128
128
 
129
129
  - **Wallpaper** — Give a rule one or more images; each image is its own file. The filmstrip picks which one you are editing, and the "first" one is what the rule paints when no rotation is running. A rule may also hold **no** image: it then paints no wallpaper, but as long as it has a theme color of its own it still matches and still serves as the fallback (painting the interface alone), and only with neither is it skipped by matching until you give it something.
130
- - **Theme Color** — HSL wheel plus numeric input and an inspiration palette, with **Extract from this image** and an **eyedropper**. **The color belongs to the image**: those controls edit the one selected in the filmstrip, the strip shows which images already carry a color of their own, and an image that has none follows the system theme rather than inheriting its rule's. A rule with **no image at all** has only its own color left to edit — and that is exactly what such a rule paints. Generates the full CSS design-token set in real time. Following the system theme hands the palette back to the host while the wallpaper and the Interface-tab opacity/blur sliders keep working — the surface colors are read back from the host's own tokens and re-emitted with your alpha, so the wallpaper is never buried under an opaque plate.
130
+ - **Theme Color** — HSL wheel plus numeric input, with **Extract from this image** and an **eyedropper**. **The color belongs to the image**: those controls edit the one selected in the filmstrip, the strip shows which images already carry a color of their own, and an image that has none follows the system theme rather than inheriting its rule's. A rule with **no image at all** has only its own color left to edit — and that is exactly what such a rule paints. Generates the full CSS design-token set in real time. Following the system theme hands the palette back to the host while the wallpaper and the Interface-tab opacity/blur sliders keep working — the surface colors are read back from the host's own tokens and re-emitted with your alpha, so the wallpaper is never buried under an opaque plate.
131
131
  - **Layout Mode** — Fit / Fill / Stretch / Tile / Center, and it is stored **per image**: a rotation can letterbox one picture and fill the next. On a rule that holds no picture the row is disabled (there is nothing to lay out) rather than hidden, so the card shows what becomes editable once you add one.
132
132
  - **Framing** — Drag to pan and scroll to zoom inside a viewport-proportional editor; **only editable in Fit mode**, and the committed framing stays consistent across window resizes and cross-monitor moves. Stored per image.
133
133
  - **Background Opacity** — `0–100%` for the rule's wallpaper layer.
@@ -140,6 +140,30 @@ A small one, not a settings block: **one switch on the Config page and nothing e
140
140
  - **Conversation & Trajectory** — The message list is wrapped in a translucent card automatically, and the trajectory page gets whole-page opacity & blur controls, letting the wallpaper shine through the content.
141
141
  - **Right Panel** — The column that slides in from the right when you open a file now has a card of its own: its opacity follows **Main background** until you drag it (then this card owns it), and its blur stacks on top of the main-background blur. While closed it takes no space and costs nothing.
142
142
 
143
+ ### Recommended profile
144
+
145
+ The Config tab's first card downloads the author's own configuration — rules, wallpapers and interface settings — from the project's [assets repository](https://github.com/HarmlessFunny/assets) and installs it in one click.
146
+
147
+ **It is hosted in the store's own shape**, not as one bundled document:
148
+
149
+ ```
150
+ preset/
151
+ ├── preset.json the shape gate — {"version": 6}
152
+ ├── theme-config.json the rules and the interface settings (6.5 KB)
153
+ └── modelbg-m1 … modelbg-m7 each wallpaper as its raw bytes
154
+ ```
155
+
156
+ So it is editable where it lives: the config is a few kilobytes of readable JSON that can be edited on GitHub directly, and replacing one wallpaper is replacing one file. It also makes publishing it a `cp` out of `~/.dsh/.dsh-background-by-model-data/`. The plugin fetches the manifest and the config, derives the file list from `rules[].images[].slot` — there is no manifest of images to keep in sync — and then fetches the wallpapers **one request each, up to four in flight**, showing the count on the button while it runs.
157
+
158
+ It is the only action in the panel that **destroys** something, and it is built around that:
159
+
160
+ - **You are asked second, not first.** The download happens before the confirmation, so the question can say what is actually in hand — *7 rules · 7 wallpapers · 2.9 MB* — instead of asking about a file that may never arrive. If the download fails, nothing has happened yet.
161
+ - **One missing wallpaper fails the whole thing**, and says which. A profile that quietly arrived without a picture — because a file was renamed where it is hosted — would be exactly the silent failure that pinning the festival art to a commit exists to prevent; naming the file keeps that failure loud, which is what makes a branch reference acceptable here.
162
+ - **The store is emptied before the profile is written.** `nextSlot` allocates slots as `m1`, `m2`, … — a counter, not a random token — so a downloaded profile and the store it lands in collide on those names as a matter of course. "Replace everything with this" is only true if the everything is genuinely gone, and this is also why there is no undo.
163
+ - **The wipe runs after the download, never before it.** An unreachable CDN must not cost you your configuration on the way to a profile that never arrived — which matters more now that the download is several transfers rather than one.
164
+ - **The festival art is not touched.** `holiday-cache/` is downloaded art that belongs to no slot; it is not part of anybody's configuration, and re-fetching it would be a network round trip for nothing. The config *does* name the two holiday slots (they are part of any config), and they are dropped from the request set rather than asked for: no `modelbg-h-*` file can exist.
165
+ - **It is referenced by branch, unlike the festival art's commit** — and for the opposite reason. A profile fails *loudly* (you are looking at the button when it happens) where a holiday fails silently, so pinning would buy nothing and would cost a plugin release for every correction to one JSON file. The risk that is real — a profile written for a config shape this build cannot read — is what `preset.json` is for: it is refused before a single wallpaper is requested, and long before anything is deleted.
166
+
143
167
  ## Settings
144
168
 
145
169
  Settings → **Theme** now has three tabs:
@@ -148,7 +172,7 @@ Settings → **Theme** now has three tabs:
148
172
  | --- | --- | --- |
149
173
  | **Interface** | Global, shared by every model | Opacity & blur for the main background, left panel, right panel, cards & panels, input & controls, settings panel, conversation text box and trajectory page |
150
174
  | **Model Background** | Per rule, per image | The ordered rule list, the live match readout, and each rule's images (filmstrip), **per-image layout mode, framing and theme color**, plus the rule's opacity, blur and [rotation](#image-rotation) |
151
- | **Config** | — | The global [switch effect](#switch-effect-global), import / export of the whole rule set (`dsh-background-by-model-theme.json`), plus the single [holiday background](#holiday-backgrounds) switch |
175
+ | **Config** | — | The global [switch effect](#switch-effect-global), the whole rule set as a file — [recommended profile](#recommended-profile), import and export (`dsh-background-by-model-theme.json`) — plus the single [holiday background](#holiday-backgrounds) switch |
152
176
 
153
177
  The old **Color** tab is gone — the theme color is now a property of each rule. The old **Background** tab became **Model Background**.
154
178
 
@@ -160,7 +184,7 @@ Data directory: `~/.dsh/.dsh-background-by-model-data/` (Windows: `C:\Users\<you
160
184
  | --- | --- |
161
185
  | `theme-config.json` | The rule list (each rule with its image list and rotation) plus the global Interface settings, the global switch effect and the holiday overrides |
162
186
  | `modelbg-<slot>` | One image, stored as raw bytes without a file extension — one file per image, so a rule with three images owns three slots |
163
- | `modelbg-h-midautumn` / `modelbg-h-nationalday` | Not used: both holiday wallpapers ship inside the package and are served straight out of it |
187
+ | `holiday-cache/<asset>` | Festival art downloaded from the CDN, one file per holiday (`mid-autumn.webp`, `national-day.webp`). Keyed by **asset name**, deliberately outside the slot namespace — a holiday slot still never holds a file, which is what keeps it read-only. Delete a file here and it is simply re-downloaded the next time that holiday is in force |
164
188
 
165
189
  ## Installation
166
190
 
@@ -212,14 +236,17 @@ To mount a working copy into a profile instead, add it to the profile's `package
212
236
 
213
237
  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.
214
238
 
215
- `pnpm test` builds, typechecks and runs six checks (`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/ui-strings-check.ts && node scripts/node-half-check.mjs`). None of them needs a dependency, a transformer or a browser, and each can be run alone with `pnpm check:holiday` / `pnpm check:rotation` / `pnpm check:transition` / `pnpm check:repaint` / `pnpm check:ui` / `pnpm check:node`:
239
+ `pnpm test` builds, typechecks and runs nine checks (`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/ui-strings-check.ts && node scripts/node-half-check.mjs`). None of them needs a dependency, a transformer or a browser, and each can be run alone 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:ui` / `pnpm check:node`:
216
240
 
217
241
  - **`check:holiday`** — the two holiday windows against known dates, the Beijing day boundary (23:59 vs 00:01), leap eighth months across 1900–2100, and the four gates `pickHoliday` applies before a holiday is allowed to take over the background.
218
242
  - **`check:rotation`** — the rotation's decisions (`nextIndex` / `isRotating`): no walking off the end of a list, shuffle never repeating the image already on screen (across the whole support of the roll), and "rotating" never claimed for a rule with nothing to rotate.
219
243
  - **`check:transition`** — the switch effect's decisions (`resolveFadeMs` / `transitionPlan`), which live in `src/client/transition.ts` and are the ones that fail without a sound: that the shipped default still produces **exactly** the transition string earlier releases wrote (`opacity 320ms ease`, opacity only — an unchanged property must not be put on the transition list), that `Instant`, a `0` duration, a `0` unified duration and a non-numeric duration each mean a hard cut, that reduced motion vetoes rather than shortens, that every effect starts somewhere other than where it ends (the "I picked the new effect and nothing happened" failure), and that every effect lands fully visible and **unscaled** — a zoom that never resets would crop every later wallpaper.
220
244
  - **`check:repaint`** — the decision that says whether an edit has to repaint the interface (`shouldRepaint`), including the case that kept failing in the field: an edit that **creates** the winner (a rule's first picture, its first or auto-extracted color) must repaint even though the edited rule was not the active one yet. It also fails if any of the write paths in `src/client/index.tsx` stops asking — so re-introducing the old `id === activeRuleId` test breaks the build's checks instead of the user's next upload — and if a rotation step stops re-emitting the interface palette (a theme color belongs to the image, so a step changes it).
245
+ - **`check:code-plate`** — the code block's plate: that the surface tokens it reads are declared on **both** `:root` and `body` (a `var()` is substituted where it is *declared*, so a root-level consumer otherwise reads the host's colour and not the palette's), that the light branch emits the banner instead of borrowing the host's near-white, and that each of the two surfaces reads its **own** plugin variable — one shared variable would let the banner's write paint the plate too.
246
+ - **`check:image-mode`** — the 0.7.5 lift of the layout mode onto the image and, more to the point, the **wiring**: which image a control edits and which image the render layer reads. A mis-wired read does not throw, it just makes every picture in a rotation look the same.
247
+ - **`check:rules`** — the two decisions behind the tab strip, which are pure and live in `src/client/rules-view.ts` (which rule the editor shows, and where a deletion lands — its neighbour, never rule 1), plus the page structure the layout rests on: one editor drawn, no stacked per-card container, no per-card open state, a strip that can neither wrap nor grow, and its scrollbar block staying scoped to the plugin's own classes.
221
248
  - **`check:ui`** — every `t('…')` key exists in both dictionaries, both dictionaries carry the same key set, every `dab-…` class has a rule in the stylesheet, and no dictionary entry has gone unreferenced.
222
- - **`check:node`** — the built node half driven through its real RPC handler with `DSH_HOME` redirected to a throwaway directory: the holiday block through the shared sanitizer, the packaged wallpapers served from an empty slot (without being copied into the data directory), a holiday slot refusing writes, deletes and URL fetches while a file dropped into it is ignored, an ordinary rule slot still writing, listing and deleting, a hand-edited config unable to redirect a holiday at another rule's image, the per-image color shape: the read-time lift in both directions (an absent key inherits the rule's color, an explicit `null` does not), independent colors through the file, and a `null` written as a key rather than omitted, and the global switch effect: the shipped default for a config that predates it, a chosen effect/easing/unified duration surviving the round trip, hostile values falling back while an absurd duration clamps, a `0` duration kept rather than defaulted, and drift inside `transition` reported instead of silently dropped.
249
+ - **`check:node`** — the built node half driven through its real RPC handler with `DSH_HOME` redirected to a throwaway directory, and `globalThis.fetch` replaced by a stub — the festival art lives on a CDN now, and this suite must not depend on one being up, nor assert today's bytes of a file it does not own. It covers: the holiday block through the shared sanitizer; nothing fetched merely for loading the plugin or reading the config; the art fetched on demand and cached under `holiday-cache/` keyed by **asset** rather than slot; a second read answered from disk with no second transfer; two simultaneous cold reads sharing one transfer; a dead first mirror falling through to the second with both mirrors pinned to the same commit; every mirror down yielding "no bytes" rather than a throw, with nothing cached from a failed fetch; a mirror answering 200 with a non-image rejected rather than cached; a corrupt cache entry discarded and re-downloaded; a holiday slot refusing writes, deletes and URL fetches while a file dropped into it is ignored and no `modelbg-h-*` file is ever written; an ordinary rule slot still writing, listing and deleting; a hand-edited config unable to redirect a holiday at another rule's image; the per-image color shape — the read-time lift in both directions (an absent key inherits the rule's color, an explicit `null` does not), independent colors through the file, and a `null` written as a key rather than omitted; and the global switch effect — the shipped default for a config that predates it, a chosen effect/easing/unified duration surviving the round trip, hostile values falling back while an absurd duration clamps, a `0` duration kept rather than defaulted, and drift inside `transition` reported instead of silently dropped. The recommended profile is covered end to end from the node half's side: the manifest and the config fetched in that order and sanitized on arrival, the request set DERIVED from the rules with the holiday slots dropped from it, one request per wallpaper with the bytes sniffed rather than trusted from a header, a dead jsDelivr falling through to raw for a single file, and every way it can fail reported as a value rather than a throw — every mirror down, a mirror answering 500, a 200 carrying HTML, a manifest whose version is not a number, a profile written for a newer shape refused before a single wallpaper is asked for, a config that is not JSON, a config that is a JSON array, a config naming more images than the cap, and a mirror announcing an oversized body; plus the strict half (a named wallpaper the host does not have is an error, not a short profile), the two naming refusals that happen before any request at all (a holiday slot, and a slot name that is not a slot), and the reset: the config and every rule image gone, `holiday-cache/` untouched, a read afterwards yielding a fresh config rather than an error, and the profile then writing into the emptied store.
223
250
 
224
251
  ## FAQ
225
252
 
@@ -270,7 +297,15 @@ Two things can hold it, and both are on the card: the effect is **Instant**, or
270
297
 
271
298
  ## Recent Optimizations
272
299
 
273
- > Only the two most recent releases are listed here; older ones (v0.7.3 and earlier) live in [CHANGELOG.md](./CHANGELOG.md).
300
+ > Only the two most recent releases are listed here; older ones (v0.7.4 and earlier) live in [CHANGELOG.md](./CHANGELOG.md).
301
+
302
+ ### v0.7.6
303
+
304
+ - **The rules page turns from a stack of self-growing cards into one tab strip and one editor** — every rule used to be a card that expanded itself, so the page was as tall as the sum of the cards and only got shorter once the user collapsed them by hand. Now every rule is a tab and exactly one editor is mounted, so the height is a function of one card plus the strip, whatever the rule count. The tabs carry what only the card head used to show (the number, a thumbnail of the first image, the match string, and whether the rule is the one in use and whether it rotates); the strip scrolls sideways rather than wrapping, at a fixed 34px with an elided match label, so switching rules cannot reflow the row. **The `+` and the "which rule" menu sit outside the scroller** — inside it, the only control that can add a rule scrolled away from the end of a long list. The match tester moved to the profile page: it answers a question about the configuration as a whole, and on the rules page it pushed the strip a whole card down. The two decisions behind the strip are pure functions now (`src/client/rules-view.ts`), pinned by the new `check:rules`, which also pins the page structure the layout rests on.
305
+ - **The rotation card's controls were reshuffled, at your request** — the Next button and the "On screen 2 / 3" readout moved outside the rotation panel and are **always there**: that readout is the only place on the card that says which picture is showing, and it used to vanish together with the rotation switch. The only test left is `rotateNow`'s own — the active rule has two or more pictures — and below that the button is disabled and the readout is omitted rather than printing "0 / 0". **"Also step on a model switch" joined the order row** (all three answer "when does a picture change"); **"1 hour" is gone** from the dwell-time presets (the custom field still takes 3600 s); **the row of eight fixed preset swatches is deleted** (the wheel, the numeric inputs, Extract from this image, the eyedropper and Follow system theme all stay — the row was a shortcut into the same setter); and **the whole rotation block moved into the second column**, below the theme colour, where in the collapsed single-column card it used to be the tallest block on the card, sitting between the pictures and the colour controls that edit them.
306
+ - **The festival art stops shipping in the package: fetched on the day, cached by asset** — the two holiday wallpapers (228 KB + 500 KB) were two thirds of the entire tarball, for a picture looked at one day a year, with their binary history kept in `.git` forever on top of that. They now live in the project's own [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets): the download is gated on the **calendar**, so a profile that is not on a holiday fetches nothing at all, and the first read on the day caches the file under `holiday-cache/` — every boot after that, and every year after that, comes off disk. The reference is **pinned to a commit, never a branch** — runtime art has to be immutable, or a later reshuffle of the documentation screenshots could silently kill a shipped feature on a day nobody is watching — with jsDelivr first and raw second, and with both mirrors unreachable the holiday simply does not take over and the model rules keep painting (the "does this slot actually have bytes" gate was written for exactly that). The cache is keyed by **asset** name and sits deliberately outside the slot namespace, so neither "a holiday slot is read-only" nor "the store never holds a `modelbg-h-*` file" moved an inch; a cache entry is **validated**, and one that is not an image is treated as a miss and re-downloaded. `globalThis.fetch` is replaced by a stub throughout `check:node`, so the suite does not need a CDN to be up.
307
+ - **A recommended profile you can install in one click** — the Config tab gained a third card that downloads the author's own configuration from the same assets repository and writes it in place of yours (see [Recommended profile](#recommended-profile)). **It is hosted in the store's own shape** — a `preset.json` shape gate, a readable `theme-config.json`, and one raw file per slot — which is what makes it editable where it lives: the config is 6.5 KB of JSON you can edit on GitHub, replacing a wallpaper is replacing a file, and publishing it is a `cp` out of the data directory. It was first written as a single theme file with every wallpaper inlined as base64, at 2.9 MB where 99.8% of the bytes were a picture; that is not a thing anyone can hand-edit, and the format was changed for exactly that reason. The plugin fetches the manifest and the config, derives the file list from `rules[].images[].slot` (no second place to keep in sync), and fetches the wallpapers one request each, four at a time — showing `3/7` on the button while it runs — so each file gets its own mirror fallback and its own validation. Applied through the same `applyThemeFile` a hand-picked file goes through, assembled on the client into the shape `exportTheme` writes; it is the only action in the panel that destroys anything, so it is the only one that asks, and the download happens **before** the question so the confirmation can state what is actually in hand (7 rules · 7 wallpapers · 2.9 MB). **The store is emptied first, deliberately:** `nextSlot` hands slots out as `m1`, `m2`, … — a counter, not a random token — so a downloaded profile and the store it lands in collide on those names as a matter of course, and "replace everything with this" is only true if the everything is actually gone; that is also why there is no undo. The wipe runs **after** the download and never before it, because an unreachable CDN must not cost the user their configuration on the way to a profile that never arrived, and a host too old to write this build's config shape is refused before anything is deleted. **One missing wallpaper fails the whole attempt and names the file** — a profile that quietly arrived short a picture is precisely the silent failure that pinning the festival art to a commit exists to prevent, so the loud failure is what makes a branch reference acceptable here; the two holiday slots a config legally names are dropped from the request set rather than asked for, since the store can never hold a `modelbg-h-*` file. `holiday-cache/` is left alone, and nothing about the profile is written to the store or cached to disk — the whole point of the button is to fetch what is there *now*.
308
+ - **The published package drops from 1.1 MB to about 220 kB** — the documentation screenshots (`example_img/`, three webp files, 220 KB) moved into the same assets repository and both READMEs reference them by absolute jsDelivr URL (an absolute URL keeps the images on the npm page unbroken just as well, without putting binaries in the tarball or their history in `.git`); `screenshots.json`, which nothing consumes, is deleted; and `lib/client.js.map` (a 624 KB source map, useless to anyone installing the package) is no longer published, though it stays in the repository. Thirteen files became ten.
274
309
 
275
310
  ### v0.7.5
276
311
 
@@ -280,11 +315,6 @@ Two things can hold it, and both are on the card: the effect is **Instant**, or
280
315
  - **Four small ones** — the rotation switch no longer stays "on" when deleting images leaves fewer than two (the panel disables the switch there, so it could not be turned off either; `normalizeRule` enforces the same invariant for imports), "切换时长" is printed once instead of twice, and the profile footer's package name and the brand tile link to the repository, with `check:ui` comparing that one address against `package.json`.
281
316
  - **Gates** — `pnpm test` is now **eight** checks: `check:code-plate` and `check:image-mode` join the suite, `check:rotation` gained the switch-and-count invariant, `check:ui` the repository-link agreement, `check:transition` the fade-ownership rule and `check:repaint` the two lines that arm the fade.
282
317
 
283
- ### v0.7.4
284
-
285
- - **The controls inside the dialog change colour on the wallpaper's clock instead of jumping when it finishes (a fix)** — on a theme-colour change the holiday switch's fill and the active **Slide in** / **Standard** chips held the **previous** colour for the whole switch and took the new one only once the background had finished: a three-second change that reads as "the interface ignores it, then hard-cuts at the end". The cause was this plugin's own doing: the fade armed the **full token list** on three elements, two of which (the settings dialog and the trajectory root) only **re-declare** the three layer tokens and inherit the rest. A transition on an *inherited* token targets the value that element saw when the fade was armed — still the old one, because the ancestor is itself interpolating — so it becomes a damped copy of the animation and drags its whole subtree behind it (measured: 113/255 of the way at t = 1500 ms on a 1200 ms transition, against frame-for-frame for a consumer with no transition of its own). The transition list is now per scope, and a scope only ever gets the tokens it declares.
286
- - **The surfaces painted from a colour of the plugin's own fade too now (a fix)** — the settings dialog's plate, the file-preview panel and the Cordis panel are not painted from a registered alias token but from a variable the plugin owns and writes inline on `<html>`, and an unregistered variable cannot interpolate at all: they snapped in one frame while every surface around them faded. A fade scope can now name a **standard property** (`background-color`), and each paint rule and its fade now share one selector constant so the two halves cannot drift apart. Measured over the real emitted CSS, one 3000 ms `ease` change: the plate, the right panel and the Cordis surface already read their **final** colour at the first sample and never moved, while all five surfaces now sit at exactly the same fraction of the way — 80.2% at t = 1500 ms, which is `ease(0.5)`.
287
-
288
318
  ## Star History
289
319
 
290
320
  [![Star History Chart](https://api.star-history.com/chart?repos=HarmlessFunny/dsh-background-by-model&type=timeline&legend=bottom-right)](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)
package/README.zh.md CHANGED
@@ -49,19 +49,19 @@
49
49
  同一套界面、同一份配置,只因为当前模型不同:
50
50
 
51
51
  <p align="center">
52
- <img src="example_img/wallpaper-deepseek.webp" alt="DeepSeek 下的外观" width="880">
52
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/wallpaper-deepseek.webp" alt="DeepSeek 下的外观" width="880">
53
53
  <br/>
54
54
  <em>DeepSeek V4.1 Flash · 命中匹配串含 <code>deepseek</code> 的规则:浅色壁纸 + 与图相配的主题色</em>
55
55
  </p>
56
56
 
57
57
  <p align="center">
58
- <img src="example_img/wallpaper-kimi.webp" alt="Kimi 下的外观" width="880">
58
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/wallpaper-kimi.webp" alt="Kimi 下的外观" width="880">
59
59
  <br/>
60
60
  <em>Kimi K2.7 Code · 命中匹配串含 <code>kimi</code> 的规则:深色壁纸 + 深色主题,整个界面跟着换肤</em>
61
61
  </p>
62
62
 
63
63
  <p align="center">
64
- <img src="example_img/rule-editor.webp" alt="单条规则的编辑器" width="660">
64
+ <img src="https://cdn.jsdelivr.net/gh/HarmlessFunny/assets@main/dsh-background-by-model/rule-editor.webp" alt="单条规则的编辑器" width="660">
65
65
  <br/>
66
66
  <em>「模型背景」页的单条规则 · 壁纸、透明度与模糊度属于这条规则;布局模式、取景与主题色(色轮 / HSL / RGB / 从本图提取 / 从图片取色)属于它正在编辑的那张图</em>
67
67
  </p>
@@ -78,7 +78,7 @@
78
78
  - **实时状态提示** — 「模型背景」页顶部会显示当前状态,例如「当前模型 deepseek-flash → 命中 · 规则 1」,方便当场验证规则写对没有;检测不到当前模型时会给出提示。
79
79
  - **外观随规则走,逐图的三项随图走** — 壁纸(多张)、透明度与模糊度是每条规则自己的属性;**布局模式、取景和主题色则是每张图片自己的**。除「界面」页外没有任何全局外观项。
80
80
  - **一条规则多张图** — 每条规则持有一组有序图片,用胶片条展示:可一次加多张(多选文件、拖放,或一行一个网址批量粘贴)、排序、把某张设为第一张、**原地替换某一张**(替换会保住它在轮换里的位置)、逐张删除。不轮换时规则画的就是**第一张**。删掉最后一张只是让这条规则变空,而空不等于失效:只要它还留着自己的主题色,它就照旧参与匹配与兜底、只给界面配色而不铺壁纸;连主题色也没有(比如刚新增的规则)才会被匹配跳过。空规则是一个看得见、退得回的状态,而不是卡住出不来的死胡同。一张图都没有时胶片条会隐藏、上方那块大预览**就是**上传按钮,所以添加图片的地方只有一个、也很显眼。
81
- - **导入 / 导出** — 一键把**每一条规则连同它的全部图片**导出为 `dsh-background-by-model-theme.json`(版本 6,图片以 base64 内联),可随时导入还原。更早版本导出的文件同样能导入:规则唯一的那张图会被还原成它的图片列表,在「主题色属于图片」之前写下的颜色会被抬升到每一张还没有自己颜色的图上,在布局模式下放到规则上时写下的值会被抬升到它的每一张图上,而在[切换效果](#切换效果全局)之前写下的文件会拿到这项设置的出厂默认——所以旧主题文件还原出来的观感与当初一模一样。
81
+ - **导入 / 导出** — 一键把**每一条规则连同它的全部图片**导出为 `dsh-background-by-model-theme.json`(版本 6,图片以 base64 内联),可随时导入还原。更早版本导出的文件同样能导入:规则唯一的那张图会被还原成它的图片列表,在「主题色属于图片」之前写下的颜色会被抬升到每一张还没有自己颜色的图上,在布局模式下放到规则上时写下的值会被抬升到它的每一张图上,而在[切换效果](#切换效果全局)之前写下的文件会拿到这项设置的出厂默认——所以旧主题文件还原出来的观感与当初一模一样。同一个文件也可以不从本地选、而是**从项目的素材库下载**,见[推荐配置](#推荐配置)——只有一处不同:它会先把数据目录清空再写入。
82
82
  - **文件持久化** — 所有设置与图片保存到文件系统 `~/.dsh/.dsh-background-by-model-data/`,不依赖 `localStorage`。
83
83
  - **自动迁移** — 旧版单壁纸配置在首次读取时自动升级,曾经放在规则上的布局模式也会被抬升到它的每一张图上。详见 [CHANGELOG.zh.md 的 v0.3.0 条目](./CHANGELOG.zh.md#v030)。
84
84
  - **中英双语** — 完整的中英文界面,自动跟随语言设置。
@@ -89,11 +89,11 @@
89
89
  按规则开关,且**默认关闭** —— 轮换是真要花流量、内存和电的,不该由默认值替你决定。
90
90
 
91
91
  - **按规则开启** — 开关就在规则卡片里,规则至少有两张图之后才能打开。
92
- - **每张停留** — 10 秒 / 30 秒 / 1 分钟 / 5 分钟 / 30 分钟 / 1 小时,也可以自己填秒数(限制在 5 秒 – 24 小时)。
92
+ - **每张停留** — 10 秒 / 30 秒 / 1 分钟 / 5 分钟 / 30 分钟,也可以自己填秒数(限制在 5 秒 – 24 小时)。
93
93
  - **换图顺序** — 「按顺序」自上而下走完一圈再回到第一张;「随机」会在**除当前这张之外**的所有图里等概率挑一张,因为抽到同一张看起来就跟这一次没生效一模一样。
94
94
  - **切换模型时也换一张** — 可选的第二种触发方式:每次切换模型落到这条规则上就往前走一张。对「每次都想看到不一样」的规则来说,这就是全部功能,而且不用挂任何定时器。
95
95
  - **只有正在生效的规则会轮换** — 全插件只有一个定时器,始终对准当前模型解析出的那条规则。标签页不可见时它会停下、回来时重新计时;只有一张图的规则(以及所有[节日](#节日特殊背景))从不排期。
96
- - **下一张** — 立刻换一张,方便当场检查这组图。
96
+ - **下一张** — 立刻换一张,方便当场检查这组图。它就在「轮换这组图」开关旁边(挨着「正在显示 N / M」),轮换开着还是关着都能用。
97
97
  - **跟着规则走的是外观,跟着图片走的是布局、取景与颜色** — 透明度、模糊度留在规则上、原地不动;**布局模式、取景、主题色属于图片**,所以一组图可以一张高截图用适应、旁边那张横图用填充,也可以依次是绿的、红的、以及跟随系统主题的,界面配色跟着壁纸一起换。过渡用的就是切换模型时那套交叉淡入。
98
98
  - **布局模式、取景、颜色都是逐图的** — 适应/填充决定的是**这一张**图怎么铺进这块区域,构图和配色也都属于某一张图:每张图各自保留自己的三项,同时共享规则的透明度与模糊度。胶片条会标出哪些图已经各自有颜色,调色区上方也会写明当前编辑的是哪一张。
99
99
  - **只加载用得到的图** — 启动时只读每条规则的**第一张**,其余的在展开卡片时、或者在轮换即将用到它时再读。所以「五条规则各十张图」不等于首帧之前先传五十张壁纸。
@@ -120,14 +120,14 @@
120
120
  - **国庆节** — 公历 10 月 1–7 日。
121
121
  - **两者重叠时中秋优先** — 它们确实会撞(2025-10-06 就是同一天),一个精确的单日比七天窗口里的某一天更值得采信。
122
122
  - **没有图的节日会回落到模型规则**,而不是把背景刷空。
123
- - **内置壁纸** — 两个节日都自带一张压缩过的壁纸(原生分辨率下 228 KB 与 500 KB,原图共 8.37 MB)。只会去取**今天真能生效**的那一张,所以不在节日的配置一点都不会传。
124
- - **图片和配色都不可替换,这是刻意的** — 一个要求用户去配置的彩蛋就不是彩蛋了。节日槽位是只读的:往 `modelbg-h-midautumn` / `modelbg-h-nationalday` 里放文件不会被任何一次读取采用,插件也拒绝写入、抓取和删除这两个槽位。主题色是节日定义里的常量、每次读取都强制覆盖——**节日条目和它的图片两处都覆盖**,所以手改 `theme-config.json` 里的 `color` 也换不掉节日配色。布局模式同理固定为定义里的**填充**(这些画本来就是满幅的,一个残留的 `fit` 会给它加黑边),而旁边的**取景**仍然是你自己的。导出的主题文件只包含你自己的规则。
123
+ - **画是下载来的,不是随包发的** — 每个节日一张压缩过的壁纸(原生分辨率下 228 KB 与 500 KB,原图共 8.37 MB),放在项目自己的 [assets 仓库](https://github.com/HarmlessFunny/assets)里,而不是打进包里 —— 它们占了整个 tarball 的三分之二,而这张画一年只被看一天。下载由**日历**把关:不在节日的配置一点流量都不会有;当天第一次读取会把它缓存到 `holiday-cache/`,此后每一次启动、往后每一年,都直接读磁盘、不再联网。引用钉死在一个 **commit** 上而不是分支,所以你以后整理仓库里的截图不可能弄坏一个已经发出去的节日;先走 `jsDelivr`、失败再走 `raw.githubusercontent.com`,两个都不通时这个节日就是不接管 —— 模型规则继续画,不会白屏。
124
+ - **图片和配色都不可替换,这是刻意的** — 一个要求用户去配置的彩蛋就不是彩蛋了。节日槽位是只读的:往 `modelbg-h-midautumn` / `modelbg-h-nationalday` 里放文件不会被任何一次读取采用,插件也拒绝写入、抓取和删除这两个槽位。下载落进 `holiday-cache/`,按**素材名**而不是槽位命名,所以数据目录里依然永远不会出现 `modelbg-h-*` 文件。主题色是节日定义里的常量、每次读取都强制覆盖——**节日条目和它的图片两处都覆盖**,所以手改 `theme-config.json` 里的 `color` 也换不掉节日配色。布局模式同理固定为定义里的**填充**(这些画本来就是满幅的,一个残留的 `fit` 会给它加黑边),而旁边的**取景**仍然是你自己的。导出的主题文件只包含你自己的规则。
125
125
  - **不想要它** — 关掉「配置」页那个开关,或者在同一个文件里写 `"holidays": { "enabled": false }`。
126
126
 
127
127
  ### 规则与图片各自的设置
128
128
 
129
129
  - **背景图片** — 一条规则可以放一张或多张图,每张图是独立文件。胶片条决定你正在编辑哪一张;不轮换时规则画的是**第一张**。规则也可以是**一张图都没有**的:这时它不再铺壁纸,但只要它有自己的主题色就照旧参与匹配与兜底(只是把界面按那个颜色配色),连主题色也没有才会被匹配跳过,直到你给它一点内容。
130
- - **主题色** — HSL 色轮 + 数值输入 + 灵感色板,外加「从本图提取」和吸管「从图片取色」。**颜色属于图片**:这些控件编辑的是胶片条里选中的那张,胶片条上会标出哪些图已经各自有颜色,而没有自己颜色的图**跟随系统主题**、不会去继承规则的颜色。**一张图都没有**的规则只剩它自己的主题色可编辑——那正是这种规则唯一能画的东西。实时生成整套 CSS 设计令牌。跟随系统主题时,界面配色交还宿主,而壁纸与「界面」页的透明度、模糊照旧生效——表面颜色是从宿主自己的令牌读出来后套上你的透明度的,所以壁纸不会被一块不透明底板盖住。
130
+ - **主题色** — HSL 色轮 + 数值输入,外加「从本图提取」和吸管「从图片取色」。**颜色属于图片**:这些控件编辑的是胶片条里选中的那张,胶片条上会标出哪些图已经各自有颜色,而没有自己颜色的图**跟随系统主题**、不会去继承规则的颜色。**一张图都没有**的规则只剩它自己的主题色可编辑——那正是这种规则唯一能画的东西。实时生成整套 CSS 设计令牌。跟随系统主题时,界面配色交还宿主,而壁纸与「界面」页的透明度、模糊照旧生效——表面颜色是从宿主自己的令牌读出来后套上你的透明度的,所以壁纸不会被一块不透明底板盖住。
131
131
  - **布局模式** — 适应 / 填充 / 拉伸 / 平铺 / 居中,并且**按图分别保存**:同一组轮换里可以一张适应、一张填充。规则还没有图片时这一行是**禁用**而不是隐藏(没有图可布局),这样卡片本身就说明了加上图片后会多出什么可调项。
132
132
  - **取景** — 在视口比例的编辑器中拖动平移、滚轮缩放;**仅「适应」模式下可编辑**,提交的构图在窗口缩放、跨屏移动后保持一致。按图分别保存。
133
133
  - **背景透明度** — `0–100%`,作用于该规则的壁纸层。
@@ -140,6 +140,30 @@
140
140
  - **对话与轨迹页** — 消息列表自动包裹为半透明卡片,轨迹页可整页调节透明度与模糊,让壁纸从内容后方透出来。
141
141
  - **右侧栏** — 点开文件后从右侧滑出的那一栏有了自己的卡片:透明度默认跟随「主背景」(拖动后本卡片接管),模糊则在主背景模糊之上再叠加;关闭时不占位置、无副作用。
142
142
 
143
+ ### 推荐配置
144
+
145
+ 「配置」页的第一张卡会从项目自己的 [assets 仓库](https://github.com/HarmlessFunny/assets)下载作者本人正在用的那套配置 —— 规则、壁纸与接口设置 —— 一键装好。
146
+
147
+ **它托管在数据目录自己的形状里**,而不是打包成一个文档:
148
+
149
+ ```
150
+ preset/
151
+ ├── preset.json 形状闸门 —— {"version": 6}
152
+ ├── theme-config.json 规则与接口设置(6.5 KB)
153
+ └── modelbg-m1 … modelbg-m7 每张壁纸的原始字节
154
+ ```
155
+
156
+ 所以它在**所在的地方就是可编辑的**:配置是几 KB 的可读 JSON,可以直接在 GitHub 上改;换一张壁纸就是替换一个文件。发布它也因此变成从 `~/.dsh/.dsh-background-by-model-data/` 里 `cp` 一下。插件先取 manifest 与 config,从 `rules[].images[].slot` 推出文件清单 —— 没有第二处清单需要同步 —— 然后**一个文件一个请求**地取壁纸(最多四路并发),过程中按钮上显示进度。
157
+
158
+ 它同时也是这个面板里**唯一会销毁东西**的操作,整个设计都在围着这一点转:
159
+
160
+ - **先下载,后询问。** 确认框出现在下载成功之后,所以它能如实说出手里到底有什么 —— *7 条规则 · 7 张壁纸 · 2.9 MB* —— 而不是让你先对「一个可能根本下不来的文件」做决定。下载失败时,什么都还没有发生。
161
+ - **少一张壁纸就整体失败,并且会说是哪一张。** 一份悄悄少了图的配置 —— 因为托管处的某个文件被改了名 —— 正是「节日素材钉死 commit」那条契约要防的静默失效;把文件名报出来,这个失败就仍然是响亮的,而这正是分支引用在这里可以被接受的原因。
162
+ - **写入之前先清空。** `nextSlot` 分配槽位用的是 `m1`、`m2`…… 一个计数器而不是随机串,所以下载来的配置和它落进去的那个数据目录**必然**在这些名字上撞车。「用它替换一切」只有在那个「一切」真的没了的时候才成立 —— 这也是它没有撤销的原因。
163
+ - **清空发生在下载之后,绝不会在之前。** CDN 不通不该让你在等一个永远没来的推荐配置的路上,先把自己的配置弄丢 —— 现在下载是多次传输而不是一次,这一点更重要。
164
+ - **不碰节日素材。** `holiday-cache/` 是下载来的、不属于任何槽位的画,不是任何人配置的一部分;重下一遍只是白白一次网络往返。而 config **确实**会列出那两个节日槽位(任何一份 config 都有),它们会被从请求清单里剔掉而不是去请求:数据目录里永远不可能存在 `modelbg-h-*` 文件。
165
+ - **它引用的是分支,而不是节日素材那样的 commit** —— 理由正好相反。推荐配置的失败是**响亮的**(文件下不来时你正盯着那个按钮),节日的失败却是静默的;所以钉 commit 在这里什么都买不到,反而会让「改一个 JSON 里的错别字」变成一次插件发版。真正存在的风险 —— 这份配置是写给一个本版本读不懂的配置形状的 —— 正是 `preset.json` 存在的理由:它在请求第一张壁纸之前、更在删除任何东西之前就被拒绝。
166
+
143
167
  ## 设置界面
144
168
 
145
169
  设置的 **「主题」** 分类下现在有三个选项卡:
@@ -148,7 +172,7 @@
148
172
  | --- | --- | --- |
149
173
  | **界面** | 全局,所有模型共用 | 主背景、左侧栏、右侧栏、卡片面板、输入框与控件、设置面板、对话文本框、轨迹页的透明度与模糊度 |
150
174
  | **模型背景** | 每条规则、每张图片 | 有序规则列表、顶部实时状态,以及每条规则的图片(胶片条)、**逐图布局模式 / 取景 / 主题色**,加上规则自己的透明度、模糊度与[多图轮换](#多图轮换) |
151
- | **配置** | — | 全局[切换效果](#切换效果全局)、导入 / 导出整套规则(`dsh-background-by-model-theme.json`),外加[节日特殊背景](#节日特殊背景)那一个开关 |
175
+ | **配置** | — | 全局[切换效果](#切换效果全局)、整套规则的进出 —— [推荐配置](#推荐配置)与导入 / 导出(`dsh-background-by-model-theme.json`)—— 外加[节日特殊背景](#节日特殊背景)那一个开关 |
152
176
 
153
177
  原先的 **「色彩」** 选项卡已删除——主题色改为每条规则自己的属性;原 **「背景」** 选项卡已改造成 **「模型背景」**。
154
178
 
@@ -160,7 +184,7 @@
160
184
  | --- | --- |
161
185
  | `theme-config.json` | 规则列表(每条规则含图片列表与轮换设置)+ 全局「界面」设置 + 全局切换效果 + 节日覆盖配置 |
162
186
  | `modelbg-<slot>` | 一张图片,保存为原始字节,无扩展名 —— 一张图一个文件,所以一条有三张图的规则占三个槽位 |
163
- | `modelbg-h-midautumn` / `modelbg-h-nationalday` | 不使用:两张节日壁纸都随包发布,直接从包内送出 |
187
+ | `holiday-cache/<asset>` | 从 CDN 下载的节日画,一个节日一个文件(`mid-autumn.webp`、`national-day.webp`)。按**素材名**命名,刻意放在槽位命名空间之外 —— 节日槽位里依然永远不会有文件,这正是它只读的原因。删掉这里的文件也没关系,下次那个节日生效时会重新下载 |
164
188
 
165
189
  ## 安装
166
190
 
@@ -212,14 +236,17 @@ pnpm run typecheck
212
236
 
213
237
  改完 `src/` 必须重新执行 `pnpm run bundle` 才会生效——挂载的 profile 加载的是 `lib/`。
214
238
 
215
- `pnpm 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/ui-strings-check.ts && node scripts/node-half-check.mjs`)。六道都不需要依赖、不需要转译器、也不需要浏览器,也可以单独跑:`pnpm check:holiday` / `pnpm check:rotation` / `pnpm check:transition` / `pnpm check:repaint` / `pnpm check:ui` / `pnpm check:node`。
239
+ `pnpm 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/ui-strings-check.ts && node scripts/node-half-check.mjs`)。九道都不需要依赖、不需要转译器、也不需要浏览器,也可以单独跑:`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:ui` / `pnpm check:node`。
216
240
 
217
241
  - **`check:holiday`** — 两个节日窗口对照已知日期、北京时间的跨日边界(23:59 与 00:01)、1900–2100 年间的闰八月,以及 `pickHoliday` 允许节日接管背景之前必须通过的四道闸门。
218
242
  - **`check:rotation`** — 轮换的判定(`nextIndex` / `isRotating`):不会走越界、随机不会重复当前这张(在整个随机取值范围内穷举)、也不会把只有一张图的规则报成「正在轮换」。
219
243
  - **`check:transition`** — 切换效果的判定(`resolveFadeMs` / `transitionPlan`),代码在 `src/client/transition.ts`,正是那些不报错、只是「看起来没生效」的部分:出厂默认仍然必须产出**与旧版本逐字符相同**的过渡串(`opacity 320ms ease`,且只动 opacity——没有变化的属性不能被写进过渡列表);`直接切换`、时长为 `0`、统一时长为 `0`、以及时长不是数字,四者都必须等于硬切;「减少动态效果」是否决而不是缩短;每个效果的起点都必须与终点不同(也就是「换了新效果却什么都没发生」);每个效果结束时都必须完全可见且**没有残留缩放**——一次没有复位的 zoom 会让之后每一张壁纸都被放大裁掉一圈。
220
244
  - **`check:repaint`** — 「这次编辑要不要重画界面」的判定(`shouldRepaint`),其中就包含实际踩过的那个坑:**这次编辑本身**制造出了生效规则(某条规则的第一张图、第一个颜色或自动提取出的颜色)时,即使被编辑的规则此刻还不是生效规则,也必须立刻重画。它同时还会在 `src/client/index.tsx` 里任何一条写入路径不再询问这个判定时报错——也就是说,把老的 `id === activeRuleId` 判断写回去,会是构建校验失败,而不是你下一次上传时界面不动;轮换步骤不再重发调色板(主题色属于图片,换图就是换配色)同样会被它拦下。
245
+ - **`check:code-plate`** — 代码块底板:它读的那几个表面 token 必须在 `:root` **和** `body` 上都有声明(`var()` 是在**声明它的地方**就被替换的,只声明在 body 上的 token 被根元素消费时读到的是宿主的颜色而不是调色板的)、浅色分支也要发出 banner 而不是偷借宿主的近白色、以及两块表面各读**自己**的插件变量 —— 共用一个变量会让 banner 的写入把底板也一起画了。
246
+ - **`check:image-mode`** — 0.7.5 把布局模式下放到图片上的那次抬升,以及更要紧的**接线**:某个控件编辑的是哪张图、渲染层读的又是哪张图。接错了不会报错,只会让一轮轮换里的每张图长得一样。
247
+ - **`check:rules`** — 选项卡背后那两个纯判定(在 `src/client/rules-view.ts`:编辑器显示哪条规则、删除之后落在哪——落在邻居上,永远不是规则 1),以及布局所依赖的页面结构:只画一个编辑器、没有旧的堆叠容器、没有逐卡片的展开状态、胶片条既不换行也不长高,以及它的滚动条样式块仍然被限定在插件自己的类上。
221
248
  - **`check:ui`** — 每个 `t('…')` 键在中英两本字典里都存在、两本字典键集完全一致、每个 `dab-…` 类在样式表里都有规则,且没有字典条目变成没人引用的死键。
222
- - **`check:node`** — 把构建好的 node 半边通过它真实的 RPC 处理器跑一遍,`DSH_HOME` 指向临时目录:节日配置块穿过共享的 sanitizer、内置壁纸从空槽位被送出(且不会因此写进数据目录)、节日槽位拒绝写入 / 删除 / 抓取而丢进去的文件被忽略、普通规则槽位照常写入和删除,以及手改过的配置无法把节日指向别的规则的图片。它还覆盖逐图主题色这套形状:读取时抬升的两个方向(缺键继承规则色、显式 `null` 不继承)、颜色经过文件往返后各自独立,以及 `null` 是写出键而不是省略。切换效果同样在覆盖范围内:旧配置拿到的出厂默认、选定的效果 / 缓动 / 统一时长能原样穿过文件往返、非法值回退而夸张时长被夹紧、时长为 `0` 被保留而不是回退成默认,以及 `transition` 内部的字段漂移会被上报而不是悄悄丢掉。
249
+ - **`check:node`** — 把构建好的 node 半边通过它真实的 RPC 处理器跑一遍,`DSH_HOME` 指向临时目录,并把 `globalThis.fetch` 换成桩 —— 节日画现在住在 CDN 上,这套校验不能依赖某个 CDN 是活的,也不该去断言一个不属于自己的文件今天有多少字节。它覆盖:节日配置块穿过共享的 sanitizer;仅仅加载插件或读取配置不会发起任何下载;画是按需下载并缓存到 `holiday-cache/`、按**素材名**而不是槽位命名;第二次读取直接读盘、不再传输;两次并发的冷读取共用一次传输;第一个镜像不通时回落到第二个,且两个镜像钉在同一个 commit 上;所有镜像都不通时答案是「没有字节」而不是抛异常,失败的抓取什么都不缓存;镜像返回 200 但内容不是图片时被拒绝而不是被缓存;损坏的缓存条目被丢弃并重新下载;节日槽位拒绝写入 / 删除 / 抓取而丢进去的文件被忽略、且数据目录里永远不会出现 `modelbg-h-*` 文件;普通规则槽位照常写入和删除;手改过的配置无法把节日指向别的规则的图片。它还覆盖逐图主题色这套形状:读取时抬升的两个方向(缺键继承规则色、显式 `null` 不继承)、颜色经过文件往返后各自独立,以及 `null` 是写出键而不是省略。切换效果同样在覆盖范围内:旧配置拿到的出厂默认、选定的效果 / 缓动 / 统一时长能原样穿过文件往返、非法值回退而夸张时长被夹紧、时长为 `0` 被保留而不是回退成默认,以及 `transition` 内部的字段漂移会被上报而不是悄悄丢掉。推荐配置从 node 半边这一侧被整条覆盖:manifest 与 config 按序下载并当场穿过 sanitizer、请求清单由规则推导且把节日槽位剔掉、一张壁纸一个请求且类型是嗅出来的而不是信 header、jsDelivr 对单个文件死了会回落到 raw,以及它每一种失败都是返回值而不是抛异常 —— 所有镜像都不通、镜像回 500、回 200 但内容是 HTML、manifest 的版本不是数字、写给更新形状的配置在请求第一张壁纸之前就被拒绝、config 不是 JSON、config 是 JSON 数组、config 列出的图片数超限、镜像谎报一个超大的长度;再加上严格的那一半(config 点名而托管处没有的壁纸是一个错误,而不是一份短了的配置)、两次在任何请求之前就发生的拒绝(节日槽位、以及一个根本不是槽位的名字),以及清空那一步:配置和每一张规则图片都没了、`holiday-cache/` 原封不动、清空后再读拿到的是全新配置而不是报错,以及随后能往空目录里写入这份配置。
223
250
 
224
251
  ## 常见问题
225
252
 
@@ -270,7 +297,15 @@ pnpm run typecheck
270
297
 
271
298
  ## 近期优化
272
299
 
273
- > 这里只列最近两个版本;更早的版本(v0.7.3 及以前)见 [CHANGELOG.zh.md](./CHANGELOG.zh.md)。
300
+ > 这里只列最近两个版本;更早的版本(v0.7.4 及以前)见 [CHANGELOG.zh.md](./CHANGELOG.zh.md)。
301
+
302
+ ### v0.7.6
303
+
304
+ - **规则页从一摞会自己长大的卡片变成一条选项卡 + 一个编辑器** —— 此前每条规则是一张自展开的卡片,页面高度等于所有卡片之和,只有手动一张张收起才会变短。现在每条规则是一个选项卡、页面上只挂载一个编辑器,所以高度只跟「一张卡片 + 一条选项卡」有关,与规则条数无关。选项卡带上原本只在卡头才有的东西(序号、首图缩略图、匹配串,以及它是不是当前生效的那条、是否在轮换);条子横向滚动不换行、固定 34px、匹配串省略号截断,所以切换规则不会让整行抖动。**「+」和「切换哪条规则」挪到滚动区之外** —— 放在里面时,长列表里唯一能新增规则的控件会被滚走。匹配测试器搬到「资料」页:它回答的是关于整份配置的问题,而在规则页上它把选项卡整整推下去一张卡片的高度。背后两个判定抽成了纯函数(`src/client/rules-view.ts`),由新的 `check:rules` 钉住,同时钉住布局所依赖的页面结构。
305
+ - **轮换卡片的控件按你的要求重排了一遍** —— 「下一张」和「正在显示第 2 / 3 张」搬到了「轮换这组图」那一行的外侧、**常驻**:那句读数是这张卡片上唯一说明当前是哪张图的地方,此前它会跟着轮换开关一起消失。判据只剩一条 —— 当前生效的规则有两张以上图就可用(`rotateNow` 自己的判据),不足两张时按钮禁用、读数整句省略。**「切换模型时也换一张」挪到顺序那一行**(三者都在回答「什么时候换」);**「1 小时」从停留时长预设里删掉**(自定义输入照旧接受 3600 秒);**八个固定预设色板删掉**(滚轮、数值输入、从本图提取、吸管、跟随系统主题都还在,那一排只是同一个 setter 的快捷方式);**整个轮换块移到第二列、主题色之下** —— 折叠成单列的窄版里它此前是卡片最高的一块,正好夹在图片和编辑图片的颜色控件中间。
306
+ - **节日画不再随包发布:当天按需下载、按素材名缓存** —— 两张节日壁纸(228 KB + 500 KB)此前占了整个 tarball 的三分之二,为的是一张一年只被看一天的画,还要把二进制历史永久留在 `.git` 里。现在它们托管在项目自己的 [`HarmlessFunny/assets`](https://github.com/HarmlessFunny/assets):下载由**日历**把关,不在节日的配置一点流量都没有;当天第一次读取会把它缓存到 `holiday-cache/`,此后每次启动、往后每一年都直接读磁盘。引用**钉死在 commit 上而不是分支** —— 运行时素材必须不可变,否则以后整理一次文档截图就能让已发布的功能在某个没人盯着的那天静默失效;jsDelivr 主用、raw 兜底,两个都不通时这个节日就是不接管、模型规则继续画(那道「槽位里到底有没有字节」的闸门本来就是为这个写的)。缓存按**素材名**命名、刻意放在槽位命名空间之外,所以「节日槽位只读」「数据目录里永远没有 `modelbg-h-*`」两条不变量一个字没改;缓存条目会被**校验**,不是图片的按未命中处理并重下。`check:node` 里 `globalThis.fetch` 被整体换成桩,测试因此不依赖任何 CDN 是活的。
307
+ - **一键装上「推荐配置」** —— 「配置」页多了第三张卡,从同一个 assets 仓库下载作者本人正在用的那套配置并就地覆盖你的(见[推荐配置](#推荐配置))。**它托管在数据目录自己的形状里** —— 一个 `preset.json` 形状闸门、一份可读的 `theme-config.json`、加上每个槽位一个原始文件 —— 这正是它「在所在的地方就可编辑」的原因:配置是 6.5 KB 的 JSON,可以直接在 GitHub 上改;换一张壁纸就是替换一个文件;发布它就是从数据目录里 `cp` 一下。它一开始被写成单个主题文件、所有壁纸内联成 base64,2.9 MB 里 99.8% 是图片 —— 那不是任何人能手改的东西,格式就是为这个改的。插件先取 manifest 与 config,从 `rules[].images[].slot` 推出文件清单(没有第二处要同步),再一个文件一个请求地取壁纸(四路并发) —— 过程中按钮上显示 `3/7` —— 于是每个文件都有自己的镜像回退和校验。落地时走的还是本地文件那条 `applyThemeFile`,在客户端组装成 `exportTheme` 写出的形状;它是这个面板里唯一会销毁东西的操作,所以也是唯一会先问一句的,而下载发生在**提问之前**,确认框因此能如实说出手里到底有什么(7 条规则 · 7 张壁纸 · 2.9 MB)。**先清空再写入是刻意的**:`nextSlot` 分配槽位用的是 `m1`、`m2`…… 一个计数器而不是随机串,所以下载来的配置和它落进去的那个数据目录必然在这些名字上撞车,「用它替换一切」只有在那个「一切」真的没了的时候才成立 —— 这也是它没有撤销的原因。清空跑在下载**之后**、绝不在之前,因为 CDN 不通不该让你在等一个永远没来的推荐配置的路上先弄丢自己的配置;而一个旧到写不了这套配置形状的宿主,会在删除任何东西之前就被拒绝。**少一张壁纸就整体失败并报出是哪个文件** —— 一份悄悄少了图的配置,恰恰是「节日素材钉死 commit」那条契约要防的静默失效,所以这个响亮的失败正是分支引用在这里可以被接受的原因;config 合法列出的那两个节日槽位会被从请求清单里剔掉而不是去请求,因为数据目录里永远不可能有 `modelbg-h-*` 文件。`holiday-cache/` 不碰,配置也从不写进数据目录、从不落盘缓存 —— 那个按钮的全部意义就是拿到**此刻**的那一份。
308
+ - **发布包从 1.1 MB 瘦到约 220 kB** —— 文档截图(`example_img/`,三个 webp 共 220 KB)搬去同一个 assets 仓库、两份 README 改用 jsDelivr 绝对地址(绝对地址同样能让 npm 页面上的图不裂,还不用把二进制塞进包和 `.git` 历史);没有消费方的 `screenshots.json` 删掉;`lib/client.js.map`(624 KB 的源码映射,对装包的人没用)不再发布,仓库里仍然保留。13 个文件 → 10 个。
274
309
 
275
310
  ### v0.7.5
276
311
 
@@ -280,11 +315,6 @@ pnpm run typecheck
280
315
  - **四个小修** —— 删图删到不足两张时轮换开关不再卡在「开」(面板在那里本来就把它禁用了,于是也关不掉;`normalizeRule` 对导入的配置强制同一条不变量);「切换时长」只印一次;资料页页脚的包名与品牌磁贴现在是指向仓库的链接,`check:ui` 拿那一个地址和 `package.json` 对比。
281
316
  - **门禁** —— `pnpm test` 现在是**八道**:`check:code-plate` 与 `check:image-mode` 加入,`check:rotation` 增加开关不变量,`check:ui` 增加链接一致性,`check:transition` 增加渐变归属规则,`check:repaint` 钉住武装渐变的那两行。
282
317
 
283
- ### v0.7.4
284
-
285
- - **弹窗里的控件现在和壁纸走同一个时钟,而不是等它切完再跳(修复)** —— 换主题色那一下,「节日特殊背景」的开关填充和「平移推入」「标准」这些胶囊按钮会**整整一套切换时长**停在上一套颜色上,直到背景切完才瞬间换成新的:一次 3 秒的换图看起来就是"界面先不管它、末尾来一下硬切"。成因是插件自己造成的:淡入把**整张 token 表**挂到了三个元素上,而其中两个(设置弹窗与轨迹页根节点)**只重新声明**三个 layer token、其余全靠继承。给一个*继承来的* token 挂过渡,该元素的过渡目标就是武装那一刻它看到的值 —— 祖先正在插值,那个值还是旧的 —— 于是它变成一条被阻尼的过渡、整棵子树跟着走(实测:1200ms 过渡在 t=1500ms 只走到 113/255,而只继承、自己没有过渡的消费者是逐帧跟随)。现在过渡表按作用域给,每个作用域只拿自己声明的 token。
286
- - **用插件自有颜色画的那几块表面,现在也淡入了(修复)** —— 设置弹窗底板、文件预览面板、Cordis 面板都不是用注册过的 alias token 画的,而是用插件自有、内联写在 `<html>` 上的变量;未注册的变量根本不能插值,所以它们在一帧之内硬切,而周围每一块都在渐变。现在淡入作用域可以点一个**标准属性**(`background-color`),并且每条上色规则与它的淡入共用同一个选择器常量,两半不可能再走岔。拿真实产出的 CSS 实测、跑一次 3000ms `ease`:底板、右侧面板、Cordis 面板在第一次采样时就已经是**终色**并且再没动过,而现在五块表面每一次采样都处在同一进度 —— t=1500ms 时 80.2%,恰好是 `ease(0.5)`。
287
-
288
318
  ## Star History
289
319
 
290
320
  [![Star History Chart](https://api.star-history.com/chart?repos=HarmlessFunny/dsh-background-by-model&type=timeline&legend=bottom-right)](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)