dsh-background-by-model 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,10 +94,10 @@ One interface, one config — only the current model differs:
94
94
 
95
95
  ### Global settings (Interface tab)
96
96
 
97
- - **Per-part Interface Opacity** — Independent sliders for the main background, sidebar, file preview panel, cards & panels (including the dropdowns and menus around the dialog), the input & controls (composer box, Cordis panel), plus the settings panel and the conversation text box.
97
+ - **Per-part Interface Opacity** — Independent sliders for the main background, left panel, right panel, cards & panels (including the dropdowns and menus around the dialog), the input & controls (composer box, Cordis panel), plus the settings panel and the conversation text box.
98
98
  - **Per-part Interface Blur** — Frosted-glass `backdrop-filter` blur (`0–60 px`) for each interface part, including a real backdrop on the composer and Cordis panel via stable host selectors.
99
99
  - **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.
100
- - **File Preview 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.
100
+ - **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.
101
101
 
102
102
  ## Settings
103
103
 
@@ -105,7 +105,7 @@ Settings → **Theme** now has three tabs:
105
105
 
106
106
  | Tab | Scope | Contents |
107
107
  | --- | --- | --- |
108
- | **Interface** | Global, shared by every model | Opacity & blur for the main background, sidebar, file preview panel, cards & panels, input & controls, settings panel, conversation text box and trajectory page |
108
+ | **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 |
109
109
  | **Model Background** | Per rule | The ordered rule list, the live match readout, and each rule's wallpaper, theme color, layout mode, framing, opacity and blur |
110
110
  | **Config** | — | Import / export the whole rule set (`dsh-background-by-model-theme.json`) |
111
111
 
@@ -204,6 +204,19 @@ No. Both were removed in 0.3.0; each rule uses a static image.
204
204
 
205
205
  ## Recent Optimizations
206
206
 
207
+ ### v0.4.0
208
+
209
+ - **Color extraction now measures brightness the way a display does** — The auto light/dark band was decided from the average HSV *value* (the max channel), which reads every saturated pixel as bright: pure blue is `v = 1.0` while its Rec.709 luma is `0.072`. A dark, saturated wallpaper was therefore pushed into the light band and got a light palette built on top of a dark picture. The extractor now averages Rec.709 luma — the same measure the wallpaper verdict always used.
210
+ - **Choosing an image now themes the rule** — Picking or replacing a rule's image extracts its theme color automatically (global toggle, on by default). It only ever fills a rule that has *no* color, so a color you picked — or deliberately cleared — is never overwritten; because the decode is asynchronous the rule is re-checked on arrival, so a color chosen while it ran wins.
211
+ - **Match test card replaces the "Active now" readout** — The status card answered "what is active" and went stale between switches; the tester answers the better question one step earlier. Type any model name (the field follows the detected model until you type) and it reports which rule would match, or that the fallback would. The diagnostics it could not express — the value being *host default* rather than this session's model, and a sessions service that is not up yet — moved into the card as hints, so a broken lookup still cannot masquerade as a correct read.
212
+ - **Config** — The one new persisted field (`autoExtract`) landed in the shared schema, so both halves sanitize it identically.
213
+
214
+ ### v0.3.3
215
+
216
+ - **The config shape is declared once, for both halves** — The node half (which sanitizes every write to disk) and the browser half (the UI's own view of the same file) used to spell the shape out separately: the key lists appeared 6 times across the two halves plus two sets of defaults, so a field added to one side only was silently dropped by the other side's sanitizer — the slider stayed live in memory, `writeConfig` wrote a config without it, and the next load fell back to the default. That is exactly how `blurs.rightbar` / `rightbarOpacity` were lost in 0.3.2. The types, the key lists, the defaults and the pure normalizers now live in one shared module (`src/schema.ts`) that both halves import, and both run the *same* sanitizer, so the UI and the disk copy can no longer disagree.
217
+ - **Unknown config fields are now reported** — While sanitizing a write, the node half logs one warning per key the shared shape does not declare (`ignoring unknown config field "blurs.produced" (declared in one half only?)`), so this class of drift shows up in the host log instead of quietly discarding a setting. Legacy pre-0.3 top-level keys are exempt (the migration consumes them).
218
+ - **No behaviour change** — Defaults, clamps, migration and the persisted file stay byte-for-byte what they were; this release only removes the duplication.
219
+
207
220
  ### v0.3.2
208
221
 
209
222
  - **New "File preview panel" card** — The column that slides in from the right when you open a file now has opacity and blur sliders of its own. Its only surface was `--dsw-alias-bg-base` — the very token the Main background slider rewrites — so it used to be an unnamed second copy of the main background with no control of its own. The new card's opacity **follows Main background by default** and only takes over on the first drag, so nothing changes on upgrade; its blur stacks on top of the main-background blur. While the panel is closed it is merely slid off-screen, so the card costs nothing.
package/README.zh.md CHANGED
@@ -94,10 +94,10 @@
94
94
 
95
95
  ### 全局设置(「界面」页)
96
96
 
97
- - **分部位界面透明度** — 主背景、侧边栏、文件预览侧栏、卡片面板(含对话框周围的选项框/菜单)、输入框与控件(发送框、Cordis 插件面板)、设置面板与对话文本框各自独立滑块。
97
+ - **分部位界面透明度** — 主背景、左侧栏、右侧栏、卡片面板(含对话框周围的选项框/菜单)、输入框与控件(发送框、Cordis 插件面板)、设置面板与对话文本框各自独立滑块。
98
98
  - **分部位界面模糊度** — 每个界面部位可独立调整毛玻璃 `backdrop-filter` 模糊(`0–60 px`),并通过宿主的稳定选择器为发送框与 Cordis 面板提供真实背景模糊。
99
99
  - **对话与轨迹页** — 消息列表自动包裹为半透明卡片,轨迹页可整页调节透明度与模糊,让壁纸从内容后方透出来。
100
- - **文件预览侧栏** — 点开文件后从右侧滑出的那一栏有了自己的卡片:透明度默认跟随「主背景」(拖动后本卡片接管),模糊则在主背景模糊之上再叠加;关闭时不占位置、无副作用。
100
+ - **右侧栏** — 点开文件后从右侧滑出的那一栏有了自己的卡片:透明度默认跟随「主背景」(拖动后本卡片接管),模糊则在主背景模糊之上再叠加;关闭时不占位置、无副作用。
101
101
 
102
102
  ## 设置界面
103
103
 
@@ -105,7 +105,7 @@
105
105
 
106
106
  | 选项卡 | 作用范围 | 内容 |
107
107
  | --- | --- | --- |
108
- | **界面** | 全局,所有模型共用 | 主背景、侧边栏、文件预览侧栏、卡片面板、输入框与控件、设置面板、对话文本框、轨迹页的透明度与模糊度 |
108
+ | **界面** | 全局,所有模型共用 | 主背景、左侧栏、右侧栏、卡片面板、输入框与控件、设置面板、对话文本框、轨迹页的透明度与模糊度 |
109
109
  | **模型背景** | 每条规则 | 有序规则列表、顶部实时状态,以及每条规则的壁纸、主题色、布局模式、取景、透明度与模糊度 |
110
110
  | **配置** | — | 导入 / 导出整套规则(`dsh-background-by-model-theme.json`) |
111
111
 
@@ -204,6 +204,19 @@ pnpm run typecheck
204
204
 
205
205
  ## 近期优化
206
206
 
207
+ ### v0.4.0
208
+
209
+ - **取色改用「显示器看到的亮度」** — 亮暗带此前按 HSV 明度(max 通道)取平均,它把每个饱和像素都算成亮:纯蓝 `v = 1.0`,而 Rec.709 luma 只有 `0.072`。于是深色但饱和的壁纸被判进亮色带,在暗画面上配出一套浅色界面。现在改为平均 Rec.709 luma——与壁纸判定的同一套度量。
210
+ - **选图即上色** — 选图或换图后自动为规则取主题色(全局开关,默认开)。它**只补空**:你手动选过的颜色(或刻意清空的)绝不会被覆盖;由于解码是异步的,回来时会再确认一次,期间你手选的色优先。
211
+ - **匹配试跑卡取代「当前生效」卡片** — 原状态卡回答的是「现在生效什么」,且会在切换之间留旧值;试跑卡把同一个问题提前一步回答。输入任意模型名(未输入时自动跟随检测到的模型),即时显示会命中哪条规则,或提示走兜底。状态卡里那几句它表达不了的诊断——比如读到的只是**宿主默认**而非本会话模型、会话服务还没就绪——作为提示保留在卡片里,所以坏掉的链路依旧不会伪装成一次正常读取。
212
+ - **配置** — 新增的持久化字段只有一个(`autoExtract`),落在共享 schema 一处,两半边的净化行为因此完全一致。
213
+
214
+ ### v0.3.3
215
+
216
+ - **配置结构只声明一份,两半边共用** — node 半边(落盘前净化)与浏览器半边(UI 自己读同一份文件)此前各写一遍结构:键表在两侧合计 6 处、默认值两套,于是只在一边声明的字段会被另一边的净化静默丢掉——滑块当次有效、`writeConfig` 写下的配置里没有它、刷新即回默认。0.3.2 的 `blurs.rightbar` / `rightbarOpacity` 正是这么丢的。现在类型、键表、默认值与纯净化函数都收在 `src/schema.ts` 一处、两半边共同 import,两侧跑的是**同一份**净化代码,界面与磁盘的取值不可能再不一致。
217
+ - **未知字段会被点名** — node 半边净化写入时,对任何「共用结构里未声明」的字段打一次警告(`ignoring unknown config field "blurs.produced" (declared in one half only?)`),这类不同步会出现在宿主日志里,而不是安静地吞掉一个设置项。0.3 之前的旧顶层字段除外(迁移会消费它们)。
218
+ - **行为不变** — 默认值、夹取范围、迁移结果与落盘文件与此前逐字节一致,本次只消除重复声明。
219
+
207
220
  ### v0.3.2
208
221
 
209
222
  - **「文件预览侧栏」卡片** — 点开文件后从右侧滑出的那一栏现在有自己的透明度与模糊度滑块。它此前的唯一表面就是 `--dsw-alias-bg-base`,也就是「主背景」滑块改写的那个令牌,所以它一直是主背景的第二份拷贝、无法单独调节。新卡片的透明度**默认跟随「主背景」**(首次拖动后才由自己接管),因此升级后外观零变化;模糊则叠加在主背景模糊之上。面板关闭时只是滑出屏幕,这张卡片不会带来任何副作用。