feat(tokens): M4-B6 收尾 —— 半像素清零 + 插件契约文件级豁免归零(3.26.49)

- style.css 剩余 16 处半像素字号并入闭集,删 2 条归并后重复的规则;守卫收紧为全文件断言
- 裁定 --iwb-control-h 不扩到全局控件(并排表单 vs 成组紧凑控件),新增「全局 input 不得写死 height」守卫
- plugin-theme-contract-test 重写:ALLOW_FILES 6 → 0,改为私有皮肤自声明(skin) + chroma 强调色判据 + 行内内容色标记;私有皮肤必须自洽(不引用宿主颜色 token)
- token-audit 插件段同口径分三类报数;插件侧中性色写死归零
- 插件仓同步 4 个版本:browser 1.7.1 / batch-export 1.2.1 / image-annotate 1.20.7 / image-vectorize 0.6.1
- 视觉基线 8 张更新(含画布场景的字号栅格化变化),A/B 回退确认非环境噪声,复核 12/12
This commit is contained in:
qiqi committed 2026-11-23 17:09:46 +08:00
1 parent 940c92982d
commit c81a107b5f
22 files changed
+336 -89

No files matched your search

+70
View File
@@ -14,6 +14,76 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.26.49(2026-11-23)M4-B6 收尾:插件契约从「赦免文件」改成「声明皮肤」
> **状态:待发布**(`verify:ci` 全绿、视觉基线变了 8 张且逐张核对无错位;未打 tag)
M4 的最后一批。用户能感知的几乎没有 —— 只有浏览器插件里那颗「连接已关闭」的小灰点
从写死的 `#888780` 改成跟随主题(亮色略深、暗色略亮)。真正的改动在**守门规则**上。
**① 16 处半像素字号清零,`style.css` 里一个不剩**
| 位置 | 改前 | 改后 |
|---|---|---|
| 备份列表项 / 确认框正文 | 13.5px ×2 | `--iwb-font-md`(13) |
| 备份文件名 / 右键菜单项 / 操作日志 / 资源浮标 | 12.5px ×4 | `--iwb-font-sm`(12) |
| 继承条 / 插件市场卡标签 ×3 / 已安装徽标 | 10.5px ×5 | `--iwb-font-xs`(11) |
| 插件市场卡副标题 ×4 | 11.5px ×4 | `--iwb-font-sm`(12) |
顺带删掉 2 条**归并后变成重复**的声明:`.iwb-mk-card .iwb-mk-name` 与 `.iwb-mk-sub` 原本用
13.5/11.5 覆盖全局的 13/12,归并后与全局同值、特异性更高却没有新信息 —— 留着就是下一个「改它没反应」的陷阱。
守卫从「设置范围内禁半像素」收紧成「**全文件**禁半像素」。
**② `--iwb-control-h` 不扩到全局控件(B4 留的悬念,这里裁定)**
B4 时把设置页的输入框与按钮统一到 30px,当时留下「B6 再决定全局跟不跟」。结论是**不跟**:
全局 `.iwb-input` 是「内容撑高」(12px 字 + 6px 竖内边距 + 1px 描边 ≈ 28px),服务的是画布、节点卡、停靠栏里的**紧凑控件**;
`control-h` 要解决的是「输入框与按钮并排时高低不齐」,而那种并排只出现在设置页表单里。
强行统一到 30 会让画布与节点里的每个输入框长 2px,节点总高、面板行距、浮条位置全跟着动 ——
零观感的批次不该带这个。判据写进守卫:**有没有并排的另一半**,而不是「哪个更大」。
**③ 插件主题契约:文件级豁免 6 → 0**
旧规则里有一张 `ALLOW_FILES`,把整个插件文件放进去就等于对它放弃颜色检查。B6 时它攒了 6 条,逐条查过去发现根本不是一类问题:
| 文件 | 真实情况 | 处理 |
|---|---|---|
| `style-source` / `blank-canvas` | **过期豁免**:hex 全在 `var(--x,#hex)` fallback 里,规则本来就会放行 | 直接删豁免,测试照样过 |
| `image-annotate` | 整套 Catppuccin 调色板(470 处),深色专业工具 UI | manifest 声明 `skin: 'private'` |
| `image-vectorize` | 自绘深色 UI(`#1b1b22` 系列,58 处) | 同上 |
| `browser` / `batch-export` | **混合**:面板跟主题走,按钮用自家强调色(绿/橙/蓝/红) | 见下 |
新规则按「颜色在这段 UI 里是什么角色」分三类,判据都写在测试里:
- **表面/文字/边框色** → 必须 `var(--iwb-*)`。这台机器上的判据是 **chroma**(`max-min` of RGB)< 24:
近中性的颜色看起来就是「灰」,拿它当面板底或正文色,暗色下必然白板或黑洞。
- **强调/状态色** → 允许写死,但**不用查表**(表会过期、会被人往里加)。chroma ≥ 24 就是有明确色相,
亮暗两端都读得出来。测试会把用到的强调色逐条打印出来供 review。
- **私有皮肤** → 在 manifest 里 `skin: 'private'`,颜色全放行,**代价是不得引用宿主颜色 token**。
混用才是「一半跟主题走、一半写死」在暗色下花屏的真正根源 —— 这才是旧 `ALLOW_FILES` 一直盖住的问题。
内容色(看片台白底、画布填充)用行内 `/*iwb:content*/` 标记放行:同一个 `#fff` 在面板上是 bug、
在画布上是内容,**值分不出来,上下文才分得出来**。所以豁免从「整个文件」降到「这一条声明」。
**插件版本**:`browser` 1.7.1(状态点跟随主题)、`batch-export` 1.2.1(看片台标内容色)、
`image-annotate` 1.20.7 与 `image-vectorize` 0.6.1(声明私有皮肤)。产物同步走
`scripts/sync-plugins-from-repo.js`,内容寻址文件名与 SRI 一并重建。
**验收偏差:视觉基线变了 8 张,不是计划里写的「零观感」。**
变的正好是 ②④⑤⑥ × 亮/暗四个**含画布**的场景,①首页与③设置弹窗 0 diff。
原因是画布节点里的 `.iwb-oplog`(11.5→12)、`.iwb-inherit-bar`(10.5→11)、
`.iwb-resource-float-title`(12.5→12) 与右键菜单 `.iwb-ctx-item`(12.5→12) 都在这些场景里,
半像素归成整数会改变文字栅格化,逐像素比对(threshold 0)必然有差异。
做过 A/B 回退验证:把 `style.css` 换回 B5 版本后 12/12 通过,确认差异来自本批而不是环境噪声;
逐张看过 diff,只有文字与小图标边缘的抗锯齿变化,没有裁切、重叠、面板位移或边框错位。
**结论:0.5px 的字号归整在肉眼上是零变化,在逐像素基线上不是** —— 以后凡是动字号就别再写「预期 0 diff」。
**这一批的方法论收获:豁免不是「欠的债」,是「没讲清的分歧」。**
6 个豁免里 2 个早已可删(没人回来删)、2 个是设计选择(自带皮肤)、2 个是真混合(要修)。
用一张文件名单把三种情况盖在一起,结果是谁也不敢动其中任何一个。
拆开之后:2 个删掉、2 个变成有代价的公开声明、1 个真修(browser 灰点)、1 个标内容色。
**只要豁免里混着不同性质的东西,它就会一直长。**
## v3.26.48(2026-11-23)画布节点:端口不再是黑洞
> **状态:待发布**(`verify:ci` 全绿、12 张视觉基线变了 8 张且逐张核对;未打 tag)
+42 -7
View File
@@ -136,7 +136,7 @@
| **B3 首页/库** ✅ | `.iwb-home-*/.iwb-lib-*/.iwb-res-*` | 间距归并(就近下取)、字号 7 档(新增 `display`) | 0.5d | 首页截图;文案换行逐条看 |
| **B4 设置/外观** ✅ | `.iwb-settings-modal/.iwb-appear-*/.iwb-set*` | 控件统一 `control-h`(输入框与按钮等高);半像素字号清零 | 0.5d | 设置页截图 + 计算样式 diff |
| **B5 节点** ✅ | `.iwb-node*/.iwb-gen-*/.iwb-port` | 节点卡内部表面统一 `field`(修端口黑洞)、字号 12/15 归口、圆角归并 | 1d | 画布截图 + 计算样式 diff |
| **B6 插件** | `plugins/**` + 插件源码仓库 | 硬编码 → `--iwb-*`;`ALLOW_FILES` 逐项清零 | 0.5d | 契约测试白名单 4 → 0 |
| **B6 插件** ✅ | `plugins/**` + 插件源码仓库 | 硬编码 → `--iwb-*`;`ALLOW_FILES` 逐项清零(6 → 0) | 0.5d | 契约测试白名单 4 → **0** |
**B1 执行结果(v3.26.44,2026-11-23)**:
@@ -263,6 +263,41 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
已把 `threshold` 显式压到 **0**,重生成 8 张基线后仍 12/12 通过(同机渲染是确定性的),
「0 diff」从此名副其实。**此前各批写的「逐像素 0 diff」都应按这个口径重读**:真实含义是「没有超过 0.2 的像素」。
### B6 收尾(3.26.49)执行结果
**计划写的是「插件硬编码 → `--iwb-*`,ALLOW_FILES 逐项清零」,实际做下来发现「全部 token 化」是错的**:
被豁免的 6 个文件根本不是一类问题,其中两个插件的颜色是**自带整套调色板的深色专业工具 UI**,
塞进宿主 token 会毁掉设计(标注的 Catppuccin 388 处、矢量化的 77 处)。
| 项 | 计划 | 实际 | 说明 |
|---|---|---|---|
| 白名单 | 4 → 0 | **6 项 → 0** | 计划里的「4」是早期数字,中途加过两项。逐条查过去:`style-source` / `blank-canvas` 是**过期豁免**(hex 全在 `var()` fallback 里,规则本来放行),删掉后测试照样过 |
| 插件改造 | 硬编码 → token | **分三类,只修 1 处真问题** | 2 个删豁免;2 个在 manifest 声明 `skin:'private'`(代价:不得引用宿主颜色 token);`browser` / `batch-export` 属混合态,真正要修的只有 browser 那颗写死 `#888780` 的「连接关闭」状态点 |
| 半像素字号 | 16 处 | **16 处清零 + 删 2 条冗余规则** | `.iwb-mk-card .iwb-mk-name` / `.iwb-mk-sub` 原本用 13.5/11.5 覆盖全局的 13/12,归并后与全局同值 —— 留着就是下一个「改它没反应」 |
| `control-h` | B6 再决定 | **不扩全局** | 判据从「哪个更大」换成「有没有并排的另一半」:并排表单用 `control-h`,成组的紧凑控件(画布/节点/停靠栏)靠内容撑高。强行 30px 会把节点撑高 2px |
| 守卫 | — | **契约测试重写 + 设置范围断言扩到全文件** | 新增「全局 `.iwb-input` 不得写死 height」一条;半像素从「设置范围内」收紧成「全文件」 |
**本批最大的认知修正:豁免不是欠的债,是没讲清的分歧。**
一张 `ALLOW_FILES` 把三种完全不同的情况盖在一起 —— 已经能删的、设计上就是这么干的、真混合的。
盖在一起的结果是谁也不敢动其中任何一个,名单只会越加越长。拆开之后每种都有明确处置,
而且「私有皮肤」从此变成**有代价的公开声明**(必须自洽,不得借宿主的颜色),比「测试别管这个文件」强得多。
**判据设计上的一个取舍**:强调色用 **chroma**(`max-min` of RGB ≥ 24)判断,不维护允许色表。
表会过期(这次 6 条豁免里 2 条就是过期没删),也会被人顺手往里加;chroma 是颜色自身的属性,不需要维护。
内容色相反,用的是**行内标记** `/*iwb:content*/` —— 同一个 `#fff` 在面板上是 bug、在画布上是内容,
值分不出来,只能靠上下文声明。
**验收偏差:12 张基线变了 8 张(②④⑤⑥ × 亮/暗),不是计划里的「零」。** 含画布的四个场景里
都有节点,`.iwb-oplog` / `.iwb-inherit-bar` / `.iwb-resource-float-title` 与右键菜单 `.iwb-ctx-item`
的字号从半像素归到整数,文字栅格化必然改,在 `threshold: 0` 下就是差异。
做过 A/B 回退(换回 B5 的 `style.css` → 12/12 通过)确认不是环境噪声,逐张 diff 只有文字/小图标边缘,
没有裁切、重叠或面板位移。**结论:0.5px 归整肉眼零变化、逐像素不是零** —— 以后凡是动字号,
不要再写「预期 0 diff」。8 张基线已重生成,复核 12/12。
**审计口径同步**:`token-audit.js` 的插件段从「数 hex」改成三类分开报(中性色写死 / 私有皮肤 / 强调色),
与契约测试同口径。B6 后:中性色写死 **0**、私有皮肤 2 个、强调色 18 处。
**每批三条硬验收**:
1. 亮/暗两张截图 `0 diff`(B1 例外:允许 tab 视觉变化,需人工确认)
2. `token-audit.js` 对应计数下降
@@ -300,7 +335,7 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
| 3.26.46 | M4-B3 首页/库 | **有变化** | 首页主标题 26→24、侧栏条目 38→34、卡片脚注更紧;同时删了 30 条死规则。用户能感知的是「首页更紧凑」,附亮/暗前后对比图 |
| 3.26.47 | M4-B4 设置/外观 | **轻微** | 设置页正文 14→13、标题 16→15;同行输入框与按钮由「33 vs 24」变成都在 30。用户能感知的是「设置页更整齐」,不是「字变小」——13 与 15 仍在原层级里 |
| 3.26.48 | M4-B5 节点 | **有变化(暗色改善明显)** | 端口从「黑洞」变成可见小圆点、提示词节点高度 −4px、浮条阴影统一。用户能感知的是「深色画布上端口看得见了」,附放大对比图 |
| 3.26.49–3.26.50 | M4-B6 | 零 | 收尾:清剩余 16 处半像素 + 全局 input 高度是否跟进 |
| 3.26.49 | M4-B6 ✅ | 肉眼零,基线 8 张变化 | 收尾:16 处半像素清零、`control-h` 不扩全局(裁定)、插件契约文件级豁免 **6 → 0**。②④⑤⑥ 含画布场景因字号栅格化变化更新基线,逐张核对无错位 |
| 3.27.7 | M5 | 零 | 闸门上线 |
| 3.28.0 | M6 | 零 | 案例沉淀 |
@@ -312,18 +347,18 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主
| 指标 | 基线(实测) | M4 后目标 | M6 后目标 |
|---|---|---|---|
| 引用但未定义的变量 | 7 | 0 | 0 |
| 字号档数 | 19 | 7(B5 后散值仍 **17**:B5 范围清零,剩余 16 处半像素在备份/右键/插件市场卡;闭集 7 档已建) | 7 |
| 字号档数 | 19 | 7(B6 后散值 **13**:半像素已全部清零,剩 8/10 微缩徽标与画布区的 14/16/18/22/28/30,属 M5 棘轮范围;闭集 7 档已建) | 7 |
| 圆角档数 | 18 | 5 | 5 |
| 间距档数 | 30 | ≤16 | ≤16 |
| 字号写死处 | 268 | ≤60(B5 后 **188**) | ≤20 |
| 圆角写死处 | 164 | ≤40(B5 后 **104**) | ≤10 |
| 间距写死处 | 629 | ≤200(B5 后 **416**) | ≤80 |
| 字号写死处 | 268 | ≤60(B6 后 **170**) | ≤20 |
| 圆角写死处 | 164 | ≤40(B6 后 **103**) | ≤10 |
| 间距写死处 | 629 | ≤200(B6 后 **415**) | ≤80 |
| 阴影写法种类 | 52 | ≤8 | 5 |
| z-index 取值种类 | 42 | ≤10(B2 后 **31**) | 9 |
| `var(--iwb-layer)` 引用 | 59(一词多义) | 0(已拆) | 0 |
| 暗色硬编码色行 | 24 | 0 | 0 |
| text 对表面 <4.5 的格数 | 暗色 4 格 | 0 | 0 |
| 插件契约白名单文件 | 4 | 2 | 0 |
| 插件契约白名单文件 | 6(文件级豁免) | 0(B6 起按角色分类:私有皮肤自声明 + 强调色 chroma 判据 + 内容色行内标记) | 0 |
| 视觉基线 diff | 无基线 | 每批 0 | 每批 0 |
## 7. 风险登记
+36 -4
View File
@@ -57,7 +57,7 @@
| 4 | `1276` / `650` / `528` / `804` / `1317` | **五套 tab**:`.iwb-tab` r7、`.iwb-drawer-tab` r8 + 边框 + active 用 `--iwb-layer` 底、`.iwb-lib-tab` r8 带下边框、`.iwb-rail-tab` r8 + brand 14% 底、`.iwb-res-tab` r8 | 同一产品里「页签选中」有 4 种视觉表达;`.iwb-drawer-tab` 已**违反** §12.4「单框扁平 + 品牌色高亮」 |
| 5 | `288` / `437` / `826` / `2108` | 同为浮层,圆角 12 / 12 / 12 / 10,阴影三种:`0 4px 16px rgba(0,0,0,.12)`、`0 8px 30px rgba(0,0,0,.25)`、`0 18px 60px rgba(0,0,0,.32)` | 浮层「高低」看不出层级逻辑;硬编码黑在暗色下完全失效 |
| 6 | `2011` / `1734` / `1956` / `580` | z-index 9999(确认框)/ 4000(崩溃页)/ 3300(调色板)/ toast 仅 200 | **toast 会被确认框和调色板盖住**;插件可任意插入任意层 |
| 7 | `plugins/**` + `tests/plugin-theme-contract-test.js:18-25` | 契约测试的 `ALLOW_FILES` 把 image-annotate(399 处)、image-vectorize(77)、batch-export(15)、browser(8) **整文件豁免** | 规则对最重要的四个插件失效;白名单成了永久免死金牌 |
| 7 | `plugins/**` + `tests/plugin-theme-contract-test.js` | 契约测试的 `ALLOW_FILES` 把 image-annotate、image-vectorize、batch-export、browser **整文件豁免** | 规则对最重要的四个插件失效;白名单成了永久免死金牌。**B6 已解决**:文件级豁免清零,改为「私有皮肤自声明 + 角色分类」,见 §3.10 |
### 1.4 插件与官网
@@ -623,7 +623,7 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
| token | 值 | 消费者 |
|---|---|---|
| `--iwb-tab-h` | 28px | 全部 5 套 tab(收敛后只剩 1 套) |
| `--iwb-control-h` | 30px | 设置页输入框 + 设置页默认按钮(B4 落地);B6 再扩到全局控件 |
| `--iwb-control-h` | 30px | 设置页输入框 + 设置页默认按钮(B4 落地) |
| `--iwb-radius-panel` | 14px | 面板/弹窗 |
| `--iwb-node-radius` | 用户可调 14px | 画布节点 |
@@ -633,6 +633,38 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
`tests/settings-scope-test.js` 钉死「这两条规则必须写 `height: var(--iwb-control-h)`」,
防止以后有人单独给其中一个加 `padding` 又把高度差拉开。
**B6 裁定:`--iwb-control-h` 不扩到全局控件。** 全局 `.iwb-input` 是「内容撑高」而非固定高度
(12px 字 + 6px 竖内边距 + 1px 描边,实测 28px),它服务的是画布、节点卡、停靠栏里的**紧凑控件**;
`control-h` 要解决的是「输入框与按钮并排时的高低不齐」,而那种并排只发生在设置页表单里。
强行统一到 30px 会让画布与节点里的每个输入框长 2px —— 节点总高、面板行距、浮条位置全跟着动,
与 B6「零观感」的前提冲突,收益却只是两个场景同高。所以分工保留:
**并排表单 → `control-h`;成组紧凑控件 → 内容撑高**。判据不是「哪个更大」,而是「有没有并排的另一半」。
若将来画布里也出现输入框与按钮并排,就地用 `control-h`,不要反过来把全局撑大。
### 3.10 插件子集与私有皮肤(B6 定稿)
插件不能全量使用 L2,只能用一个子集;而「子集」不等于「白名单文件」—— 那是旧机制。
**三类颜色,三种处理**(守门在 `tests/plugin-theme-contract-test.js`):
| 类别 | 判据 | 规则 |
|---|---|---|
| 表面 / 文字 / 边框 | chroma(`max-min` of RGB)**< 24**,即看起来是「灰」 | 必须 `var(--iwb-*)`。写死在暗色下必然白板或黑洞 |
| 强调 / 状态色 | chroma **≥ 24**,有明确色相 | 允许写死。亮暗两端都读得出来,属插件自己的设计语言 |
| 私有皮肤 | manifest 里 `skin: 'private'` | 颜色全部放行,**但不得引用宿主颜色 token** |
| 内容色 | 行内 `/*iwb:content*/` | 每处显式声明。看片台白底、画布填充属于内容,不属于主题 |
**为什么用 chroma 而不是维护一张允许色表**:表会过期(旧 `ALLOW_FILES` 6 条里 2 条早就可删,没人回来删),
也会被人顺手往里加。chroma 是颜色自身的属性,不需要维护。
**为什么私有皮肤要付代价**:`image-annotate`(Catppuccin 470 处)与 `image-vectorize`(58 处)是自带整套调色板的
深色专业工具 UI,硬塞进宿主 token 会毁掉设计。但它们一旦「一半跟主题、一半写死」,暗色下就会花屏 ——
所以声明 private 的同时,必须**完全自洽**:不得引用宿主颜色 token(布局尺寸如 `--iwb-side-w` 例外,需在测试里登记)。
宿主的 `plugin-host.js` 对未知 manifest 字段不做严格校验,`skin` 会被原样保留,不影响加载。
**内容色为什么要行内标记**:同一个 `#fff`,在面板上写死是 bug(暗色白板),在画布/看片台上是内容(必须白)。
值分不出来,上下文才分得出来,所以豁免粒度从「文件」降到「这一条声明」。
---
## 4. 落地路线
@@ -704,7 +736,7 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
| **禁新增** | diff 新增行里出现裸 `#hex` / 裸 `px`(font-size、border-radius、padding、gap)→ 失败 | `padding: 13px` |
| **完整性** | 所有 `var(--iwb-*)` 必须有定义;禁止 `var(--x, var(--x))` | §1.3-②③ |
| **层级** | 禁止裸数字 `z-index`;插件不超过 40 | `z-index: 9999` |
| **插件契约** | `ALLOW_FILES` 只减不增,且每条必须有 `owner` + 到期版本 | 新增白名单 |
| **插件契约** | **没有文件级豁免**。颜色按角色分三类:中性色(chroma < 24)必须用 token;强调色(chroma ≥ 24)允许写死;自带整套皮肤的在 manifest 声明 `skin: 'private'`,代价是不得引用宿主颜色 token。内容色用行内 `/*iwb:content*/` 标记 | §3.10 |
**棘轮是这套方案能不能活下来的关键**:没有它,三个月后又是一次 281 个字号。
@@ -834,7 +866,7 @@ L3 Contract ── 组件整体换肤时才加,能不建就不建
| # | 决定 | 裁定 | 影响与执行口径 |
|---|---|---|---|
| ① | 面板圆角 | **14px**(`radius-panel`) | 浮层(modal/fullmask/菜单/命令面板)统一 14;`popover` 用 12,`control` 用 8,`chip` 用 6,`round` 用 999。节点保持 `--iwb-node-radius`(默认 14)不受影响 |
| ② | 半像素字号 | **并入整数档**(10.5→10、11.5→11、12.5→12、13.5→13)|**已执行**:B3 清首页/库、B4 清设置/外观 | 闭集实际落在 7 档:11 / 12 / 13 / 15 / 17 / 20 / 24。迁移时逐条看换行,只允许「文案变短一行」不允许「挤出容器」。B5 范围外仍剩 16 处(备份页 2、右键菜单 1、操作日志 1、确认框 1、插件市场卡 9、资源浮标/继承条各 1),留给 B6 |
| ② | 半像素字号 | **并入整数档**(10.5→11、11.5→12、12.5→12、13.5→13)|**已执行**:B3 清首页/库、B4 清设置/外观、**B6 清剩余 16 处** | 闭集落在 7 档:11 / 12 / 13 / 15 / 17 / 20 / 24。迁移时逐条看换行,只允许「文案变短一行」不允许「挤出容器」。B6 全部清零:备份页 2、右键菜单 1、操作日志 1、确认框 1、插件市场卡 9、资源浮标/继承条各 1;其中市场卡的 `.iwb-mk-card .iwb-mk-name/.iwb-mk-sub` 两条归并后与全局同档,作为重复声明删除 |
| ③ | 间距迁移 | **先等值替换**,收敛另起一轮 | M4 只换写法不换值(0 diff);30 档 → 16 档的收敛放到 M4 之后单独一批,届时逐屏对照 |
| ④ | 色彩模型修复范围 | **全修 D1–D9**,但**分两版**:3.26.43 只放 D1(零观感),D3/D4/D5/D6/D7/D8/D9 放 3.26.44 | D1 = 单一写入点(消闪变、修系统转暗不生效),观感零风险;其余会改变暗色观感,单独发版并附亮/暗对比图 |
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.48",
"version": "3.26.49",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+12 -12
View File
@@ -1,9 +1,9 @@
[
{
"id": "batch-export",
"file": "plugin-batch-export.b7d13ba66cf9.js",
"version": "1.2.0",
"integrity": "sha256-t9E7pmz5f/ZelDBTKBg6GjtaRbA5Pzpj939re0Z5U4k="
"file": "plugin-batch-export.4beb9bc20c26.js",
"version": "1.2.1",
"integrity": "sha256-S+ubwgwmP+6V2GNX1sWsL/QpV3kx9+qCo5SYl4a1NFA="
},
{
"id": "blank-canvas",
@@ -13,9 +13,9 @@
},
{
"id": "browser",
"file": "plugin-browser.8161a82890d9.js",
"version": "1.7.0",
"integrity": "sha256-gWGoKJDZZyTZCirpyJSdN6+S+UuUTNUlrcB7ZbXqtPQ="
"file": "plugin-browser.8f2a263e02ef.js",
"version": "1.7.1",
"integrity": "sha256-jyomPgLvCIztHM8MJ1/s6472N7q+q5aHsl128vH50rQ="
},
{
"id": "gallery",
@@ -52,15 +52,15 @@
},
{
"id": "image-annotate",
"file": "plugin-image-annotate.7a865c7c353c.js",
"version": "1.20.6",
"integrity": "sha256-eoZcfDU8P7yqxVGorrWs0b9iTKJfEE25b85JPDCEsk8="
"file": "plugin-image-annotate.fc04e57a7603.js",
"version": "1.20.7",
"integrity": "sha256-/ATlenYDu6SgZkSG7CEmN0DdcY1bo1jasNMCAjdzZjQ="
},
{
"id": "image-vectorize",
"file": "plugin-image-vectorize.7014982f60e6.js",
"version": "0.6.0",
"integrity": "sha256-cBSYL2DmBeNJCZhqwMNyGV5hMBKeKakn1tQaFAVXnp8="
"file": "plugin-image-vectorize.0e5a7fa018b2.js",
"version": "0.6.1",
"integrity": "sha256-Dlp/oBiy6d5wX5ESJyrQLc8Ye1NhaW9/wKEqk8TyDU4="
},
{
"id": "style-source",
@@ -467,14 +467,14 @@
'.iwb-bx-empty{padding:24px 12px;text-align:center;color:var(--iwb-text2,#4d5668)}',
// 缩略图:小方图(30px)常驻在行首,跑完换成产物本身,一眼能对上「哪张图、出了什么」
'.iwb-bx-thumb{width:30px;height:30px;flex:0 0 auto;object-fit:contain;border-radius:5px;',
'border:1px solid var(--iwb-border,#d5d9e0);background:#fff;cursor:zoom-in;padding:1px}',
'border:1px solid var(--iwb-border,#d5d9e0);background:#fff/*iwb:content*/;cursor:zoom-in;padding:1px}',
'.iwb-bx-thumb-out{border-color:#1d9e75;cursor:zoom-in}',
'.iwb-bx-thumb-ph{background:var(--iwb-layer,#f0f1f4);cursor:default}',
'.iwb-bx-done{display:none;align-items:center;gap:6px;padding:9px 12px;font-size:11px;',
'color:#1d9e75;background:rgba(29,158,117,.08);border-top:1px solid var(--iwb-border,#d5d9e0)}',
'.iwb-bx-zoom{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;',
'background:rgba(0,0,0,.72);cursor:zoom-out}',
'.iwb-bx-zoom img{max-width:86vw;max-height:86vh;border-radius:8px;background:#fff}',
'.iwb-bx-zoom img{max-width:86vw;max-height:86vh;border-radius:8px;background:#fff/*iwb:content*/}',
// 双类选择器:单靠 .iwb-bx-btn-hot 会被后定义的 .iwb-bx-btn 背景覆盖(同特异性,后者胜)
'.iwb-bx-btn.iwb-bx-btn-hot{background:#1d9e75;border-color:#1d9e75;color:#fff}',
'.iwb-bx-foot{display:flex;align-items:center;gap:8px;padding:10px 12px;',
@@ -500,7 +500,7 @@
global.IWBPluginHost.register({
id: 'batch-export',
name: '批量出图',
version: '1.2.0',
version: '1.2.1',
apiVersion: 1,
capabilities: ['panels', 'canvas'],
settings: {
@@ -41,7 +41,7 @@
'.iwb-browser-ctrl button:disabled{opacity:.4;cursor:default}' +
'.iwb-browser-now{font-size:12px;color:var(--iwb-text-dim,#9aa0a6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:120px}' +
'.iwb-browser-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#1d9e75;margin-right:6px;vertical-align:middle}' +
'.iwb-browser-dot-off{background:#888780}' +
'.iwb-browser-dot-off{background:var(--iwb-text-dim,#888780)}' +
// 面板内嵌浏览器(2026-11-19):书签改成横排 chips,正文全留给网页
'.iwb-browser-strip{display:flex;align-items:center;gap:6px;padding:5px 8px;flex:0 0 auto;overflow-x:auto;background:var(--iwb-layer,#f0f1f4);box-sizing:border-box}' +
'.iwb-browser-chip{cursor:pointer;border:1px solid var(--iwb-border,#d5d9e0);border-radius:999px;background:var(--iwb-layer2,#fff);color:var(--iwb-text,#1c2333);font-size:11.5px;padding:4px 10px;white-space:nowrap}' +
@@ -1133,7 +1133,7 @@
global.IWBPluginHost.register({
id: 'browser',
name: '应用内浏览器',
version: '1.7.0',
version: '1.7.1',
apiVersion: 1,
// canvasWrite:面板里的「↗」用它把当前页变成画布上的网页节点(需要客户端 v3.25.30+)
capabilities: ['panels', 'nodeTypes', 'canvasWrite'],
@@ -6,11 +6,14 @@
// ⚠️ 因此本文件的注释里不要写出那种字面量形态(会抢先匹配),要描述就直接说「id 字面量」。
//
// 版本占位符由构建脚本用 package.json 的 version 替换,保证两处永不漂移。
// skin: 'private' = 本插件自带整套调色板(Catppuccin 深色工具 UI),不跟随宿主主题。
// 代价由宿主契约测试钉死:声明 private 的插件不得引用宿主颜色 var(--iwb-*),只能自洽。
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.20.6',
version: '1.20.7',
apiVersion: 1,
skin: 'private',
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
exportPreset: { type: 'string', default: 'original' },
@@ -6,11 +6,14 @@
// ⚠️ 因此本文件的注释里不要写出那种字面量形态(会抢先匹配),要描述就直接说「id 字面量」。
//
// 版本占位符由构建脚本用 package.json 的 version 替换,保证两处永不漂移。
// skin: 'private' = 自绘深色工具 UI(#1b1b22 系列),不跟随宿主主题。
// 代价由宿主契约测试钉死:声明 private 的插件不得引用宿主颜色 var(--iwb-*),只能自洽。
var __IWB_VECTORIZE_MANIFEST__ = {
id: 'image-vectorize',
name: '位图转矢量',
version: '0.6.0',
version: '0.6.1',
apiVersion: 1,
skin: 'private',
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
preset: { type: 'string', default: 'text' },
+33 -6
View File
@@ -89,20 +89,43 @@ const tokenUse = {
}
/* ---------- 4. 插件侧 ---------- */
// 与 tests/plugin-theme-contract-test.js 同口径,分三类而不是只数 hex:
// 私有皮肤(manifest 声明 skin:'private')—— 已声明的设计选择,不算欠债,但它不得引用宿主颜色 token
// 强调色(chroma ≥ 24)—— 品牌/危险/成功色,亮暗两端都可读,允许写死
// 中性色(chroma < 24)—— 表面/文字/边框,写死在暗色下必然白板或黑洞,这才是要修的
const chromaOf = (hex) => {
let h = hex.replace('#', '')
if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2]
if (h.length !== 6) return 0
const n = parseInt(h, 16)
const c = [(n >> 16) & 255, (n >> 8) & 255, n & 255]
return Math.max(c[0], c[1], c[2]) - Math.min(c[0], c[1], c[2])
}
const pluginBad = []
const pluginPrivate = []
const pluginAccent = []
for (const f of pluginFiles) {
const src = read(f)
// 与 tests/plugin-theme-contract-test.js 同口径:只数 background/color/border 声明里直接写 hex
const re = /(background(?:-color)?|color|border(?:-color)?)\s*:\s*([^;'"]{0,80})/gi
const isPrivate = /skin:\s*'private'/.test(src.slice(0, 4096))
const re = /(background(?:-color)?|color|border(?:-color)?)\s*:\s*([^;'"}]{0,80})/gi
let m
let n = 0
let neutral = 0
let accent = 0
while ((m = re.exec(src))) {
const val = m[2]
if (!/#[0-9a-f]{3,8}/i.test(val)) continue
if (/\/\*iwb:content\*\//.test(val)) continue
if (/var\(--[a-z0-9-]+\s*,\s*#[0-9a-f]{3,8}/i.test(val)) continue
n++
// 纯白文字压在图片/色块上:内容对比,不是主题表面色(契约测试同款例外)
if (/^color$/i.test(m[1]) && /^#(?:fff|ffffff)$/i.test(val.trim().replace(/[}\s]+$/, ''))) continue
for (const h of val.match(/#[0-9a-f]{3,8}/gi) || []) {
if (chromaOf(h) >= 24) accent++
else neutral++
}
}
if (n) pluginBad.push({ file: path.relative(ROOT, f), hex: n })
if (isPrivate) { pluginPrivate.push({ file: path.relative(ROOT, f), hex: neutral + accent }); continue }
if (neutral) pluginBad.push({ file: path.relative(ROOT, f), hex: neutral })
if (accent) pluginAccent.push({ file: path.relative(ROOT, f), hex: accent })
}
const pluginTokenUse = pluginFiles.reduce((a, f) => a + count(/var\(--iwb-/g, read(f)), 0)
@@ -202,7 +225,11 @@ console.log(`| z-index | ${report.zindex.distinct.length} | ${report.zindex.dist
console.log(`| box-shadow 写法 | ${report.shadows.distinct} | — |`)
console.log('\n## 5. 插件侧\n')
console.log(`- 插件文件数:${pluginFiles.length},引用 var(--iwb-*) 共 ${pluginTokenUse} 次`)
console.log('- 含硬编码 hex 的文件:')
console.log(`- 文件级豁免:0(B6 起按角色分类,不再整文件放行)`)
console.log(`- 写死「中性色」的文件(暗色下会白板/黑洞,必须修):${pluginBad.length}`)
for (const p of pluginBad.sort((a, b) => b.hex - a.hex)) console.log(` - ${p.file} → ${p.hex} 处`)
console.log(`- 声明了私有皮肤的插件(已确认不跟随主题,代价是不得引用宿主颜色 token):${pluginPrivate.length}`)
for (const p of pluginPrivate) console.log(` - ${p.file} → ${p.hex} 处(skin: 'private')`)
console.log(`- 强调色写死(品牌/危险/成功,亮暗两端可读,允许):${pluginAccent.reduce((a, p) => a + p.hex, 0)} 处 / ${pluginAccent.length} 个文件`)
console.log('\n## 6. 官网样式\n')
console.log(`- site/assets/style.css 定义变量:${siteVars.join(' ') || '(无)'}`)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.48",
"version": "3.26.49",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+17 -18
View File
@@ -432,7 +432,7 @@ button { font-family: inherit; }
.iwb-backup-modal .iwb-modal-body { font-size: 14px; gap: 14px; }
.iwb-backup-sec { display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; border: 1px solid var(--iwb-border); border-radius: 10px; background: color-mix(in srgb, var(--iwb-layer) 30%, transparent); }
.iwb-backup-sec-title { font-weight: 700; color: var(--iwb-brand-text, var(--iwb-brand)); font-size: 13px; }
.iwb-backup-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; padding: 2px 0; }
.iwb-backup-item { display: flex; align-items: center; gap: 8px; font-size: var(--iwb-font-md); cursor: pointer; padding: 2px 0; }
.iwb-backup-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--iwb-brand); cursor: pointer; }
.iwb-backup-item-name { flex: 0 0 auto; }
.iwb-backup-item-count { margin-left: auto; color: var(--iwb-text2); font-size: 12px; }
@@ -442,7 +442,7 @@ button { font-family: inherit; }
.iwb-warn { color: var(--iwb-err); }
.iwb-backup-actions { display: flex; gap: 8px; margin-top: 4px; }
.iwb-backup-actions .iwb-btn { font-size: 13px; }
.iwb-backup-file { font-size: 12.5px; color: var(--iwb-text2); padding: 2px 0 4px; }
.iwb-backup-file { font-size: var(--iwb-font-sm); color: var(--iwb-text2); padding: 2px 0 4px; }
.iwb-backup-note { font-size: 12px; color: var(--iwb-text2); line-height: 1.6; }
.iwb-settings-modal .iwb-hint { font-size: var(--iwb-font-md); }
.iwb-settings-modal .iwb-btn { height: var(--iwb-control-h); font-size: var(--iwb-font-md); }
@@ -639,7 +639,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* 常驻选中态(画布工具组的「当前工具」):底栏按钮本身是「无边框 + 透明底」,所以这里用淡填充药丸表示
「当前工具」,与 :hover 的瞬时反馈区分开。!important 是必须的——上面 .iwb-btn 的 background/border 就是 !important。 */
.iwb-toolbar-bottom .iwb-btn-on { background: color-mix(in srgb, var(--iwb-tint) 12%, transparent) !important; border-radius: 8px; color: var(--iwb-text) !important; opacity: 1 !important; }
.iwb-btn-sm { padding: 3px 7px; font-size: 11px; }
.iwb-btn-sm { padding: 3px 7px; font-size: var(--iwb-font-xs); }
.iwb-btn-danger { color: var(--iwb-err); }
.iwb-btn-danger:hover { border-color: var(--iwb-err); color: var(--iwb-err); }
.iwb-input, .iwb-textarea {
@@ -650,7 +650,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
border: 1px solid var(--iwb-border);
border-radius: var(--rd);
color: var(--iwb-text);
font-size: 12px;
font-size: var(--iwb-font-sm);
padding: 6px 9px;
transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
@@ -758,7 +758,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* 提示词/节点组的右键「移动到分组」菜单已 portal 到 body:需高于 .iwb-overlay(z-index:100),否则被应用层盖住 */
.iwb-ctxmenu.iwb-lib-group-menu { z-index: var(--iwb-z-sheet-menu); /* 面板内的 portal 菜单:> sheet、< modal,见 tokens 层级表 */ }
.iwb-ctx-title { font-size: 10px; font-weight: 700; color: var(--iwb-text2); letter-spacing: 1px; padding: 6px 10px 2px; text-transform: uppercase; }
.iwb-ctx-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: 12.5px; cursor: pointer; text-align: left; }
.iwb-ctx-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: 8px; background: transparent; color: var(--iwb-text); font-size: var(--iwb-font-sm); cursor: pointer; text-align: left; }
.iwb-ctx-item .iwb-ic { width: 14px; height: 14px; flex: 0 0 auto; color: var(--iwb-text2); }
.iwb-ctx-item:hover:not(:disabled) { background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); color: var(--iwb-text); }
.iwb-ctx-item:hover:not(:disabled) .iwb-ic { color: var(--iwb-brand-text, var(--iwb-brand)); }
@@ -978,7 +978,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
/* 最近操作日志 */
.iwb-oplogs { max-height: 180px; overflow-y: auto; border: 1px solid var(--iwb-border); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; background: var(--iwb-layer); }
.iwb-oplog { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.5; }
.iwb-oplog { display: flex; gap: 8px; font-size: var(--iwb-font-sm); line-height: 1.5; }
.iwb-oplog-time { flex: 0 0 auto; color: var(--iwb-text2); font-variant-numeric: tabular-nums; }
.iwb-oplog-kind { flex: 0 0 44px; color: var(--iwb-brand-text, var(--iwb-brand)); font-weight: 700; }
.iwb-oplog-msg { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1173,7 +1173,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-resource-float { position: fixed; z-index: 46; width: 360px; max-height: 76vh; display: flex; flex-direction: column; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.24), 0 2px 10px rgba(0,0,0,.12); overflow: hidden; }
.iwb-resource-float-head { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--iwb-layer2); border-bottom: 1px solid var(--iwb-border); cursor: move; user-select: none; flex: 0 0 auto; }
.iwb-resource-float-head:hover { background: var(--iwb-hover); }
.iwb-resource-float-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; color: var(--iwb-text); }
.iwb-resource-float-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--iwb-font-sm); color: var(--iwb-text); }
.iwb-resource-float-title .iwb-ic { width: 15px; height: 15px; }
.iwb-resource-float-spacer { flex: 1 1 auto; }
.iwb-resource-float-head .iwb-btn { width: 26px; height: 22px; padding: 0; justify-content: center; }
@@ -1785,7 +1785,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
* 起因:样式节点连进这两个节点后,节点体只显示空的 placeholder,用户以为没接上。
* 现在自己没写字时直接把上游文本显示出来(.is-inherited 只改字色,零布局位移),
* 状态条说明「继承 / 已固定」并给出「恢复跟随」。 */
.iwb-inherit-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 10.5px; line-height: 16px; color: var(--iwb-text2); min-width: 0; }
.iwb-inherit-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: var(--iwb-font-xs); line-height: 16px; color: var(--iwb-text2); min-width: 0; }
.iwb-inherit-tag { flex: 0 0 auto; padding: 0 5px; border-radius: 999px; font-size: 10px; color: var(--iwb-brand-text, var(--iwb-brand)); background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); }
.iwb-inherit-tag.is-taken { color: var(--iwb-text); background: color-mix(in srgb, var(--iwb-tint) 10%, transparent); }
.iwb-inherit-src { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1814,7 +1814,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.38); display: flex; align-items: center; justify-content: center; z-index: var(--iwb-z-alert); }
.iwb-confirm-box { width: min(460px, calc(100vw - 48px)); background: var(--iwb-bg-menu); color: var(--iwb-text); border-radius: var(--iwb-radius-panel); padding: 18px 20px 14px; box-shadow: var(--iwb-elevation-3); }
.iwb-confirm-title { font-weight: 650; font-size: 15px; margin-bottom: 8px; }
.iwb-confirm-text { font-size: 13.5px; line-height: 1.65; color: var(--iwb-text2); white-space: pre-wrap; word-break: break-word; }
.iwb-confirm-text { font-size: var(--iwb-font-md); line-height: 1.65; color: var(--iwb-text2); white-space: pre-wrap; word-break: break-word; }
.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* 插件市场卡片(设置 → 插件 / 与 market.maqiart.eu.org 同一套视觉) */
.iwb-mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 4px 0 6px; }
@@ -1842,7 +1842,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-mk-row-name { font-weight: 600; font-size: 14px; }
.iwb-mk-row-ver { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-author { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: var(--iwb-font-sm); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iwb-mk-row-actions { display: flex; align-items: center; flex: 0 0 auto; }
.iwb-mk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
@@ -1878,11 +1878,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-mk-titles { flex: 1 1 auto; min-width: 0; }
.iwb-mk-head .iwb-mk-actions { flex: 0 0 auto; margin: 0; padding: 0; min-height: 0; }
.iwb-mk-card .iwb-mk-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 17px; border-radius: 9px; }
.iwb-mk-card .iwb-mk-name { font-size: 13.5px; }
.iwb-mk-card .iwb-mk-sub { font-size: 11.5px; margin-top: 1px; }
/* 字号已与下方 .iwb-mk-name/.iwb-mk-sub 同档(13/12),原来这里用 13.5/11.5 覆盖,归并后是重复声明 */
.iwb-mk-card .iwb-mk-desc { font-size: 12px; line-height: 1.45; min-height: 0; margin-top: 2px; }
.iwb-mk-card .iwb-mk-tags { min-height: 0; margin-top: 2px; gap: 5px; }
.iwb-mk-card .iwb-mk-tag { font-size: 10.5px; padding: 0 7px; line-height: 16px; }
.iwb-mk-card .iwb-mk-tag { font-size: var(--iwb-font-xs); padding: 0 7px; line-height: 16px; }
.iwb-mk-card .iwb-btn-sm { padding: 3px 10px; font-size: 12px; }
/* LLM 渠道:去掉外框,改成分区 + 细分隔线;默认渠道用左侧色条标记 */
.iwb-settings-modal .iwb-llm-card { border: 0; border-top: 1px solid var(--iwb-border); border-radius: 0; background: transparent; padding: var(--iwb-space-12) 0 var(--iwb-space-8); margin: 0; }
@@ -2206,8 +2205,8 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); }
.iwb-mk-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }
.iwb-mk-name { font-weight: 600; font-size: 13.5px; }
.iwb-mk-sub { font-size: 11.5px; color: var(--iwb-text2); margin-top: 1px; }
.iwb-mk-name { font-weight: 600; font-size: var(--iwb-font-md); }
.iwb-mk-sub { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin-top: 1px; }
.iwb-mk-desc { font-size: 12px; line-height: 1.55; color: var(--iwb-text2); }
.iwb-mk-dot {
width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; flex: 0 0 auto;
@@ -2215,10 +2214,10 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
}
.iwb-mk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.iwb-mk-tags { gap: 4px; }
.iwb-mk-tag { border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: 10.5px; padding: 1px 7px; }
.iwb-mk-tag { border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: var(--iwb-font-xs); padding: 1px 7px; }
.iwb-mk-actions { gap: 6px; }
.iwb-mk-actions .iwb-btn { border: 0; background: var(--iwb-layer2); box-shadow: none; }
.iwb-mk-subtitle { font-size: 11.5px; color: var(--iwb-text2); margin: 2px 0 10px; }
.iwb-mk-subtitle { font-size: var(--iwb-font-sm); color: var(--iwb-text2); margin: 2px 0 10px; }
.iwb-set-page-title { margin-bottom: var(--iwb-space-2); }
/* ── v3.26.25 插件市场二次优化:自适应全宽 + 淡描边 + 已安装徽标(去绿色底) ── */
@@ -2226,7 +2225,7 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-mk-card.is-installed { background: var(--iwb-panel); }
.iwb-mk-badge {
margin-left: 7px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; line-height: 17px;
margin-left: 7px; padding: 0 7px; border-radius: 999px; font-size: var(--iwb-font-xs); line-height: 17px;
background: color-mix(in srgb, var(--iwb-ok, #1d9e75) 14%, transparent);
color: color-mix(in srgb, var(--iwb-ok, #1d9e75) 82%, var(--iwb-text));
border: 1px solid color-mix(in srgb, var(--iwb-ok, #1d9e75) 32%, transparent);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

+96 -25
View File
@@ -1,26 +1,59 @@
'use strict'
// 插件主题契约守门(v3.25.85,P4)
// 插件主题契约守门(v3.25.85 P4 起;v3.26.49 / M4-B6 重写)
//
// 规则:插件给**面板/弹层**写的样式必须用宿主主题变量(--iwb-* / --iwb-plugin-*),
// 不允许把颜色写死 —— 否则自动配色/暗色主题下插件永远是白底黑字。
// 目标只有一个:**宿主换主题时,插件不能变成白板或黑块**。
//
// 允许的例外(写进 ALLOW 列表并在注释里说明为什么):
// · var(--x, #hex) 形式里的 fallback(浏览器不支持变量时的兜底)
// · 画布内容自身的颜色(画笔色、填充色),属于数据不属于主题
// 旧做法是「文件级豁免」—— 把整个插件文件放进 ALLOW_FILES,等于对它放弃全部检查。
// 结果是豁免越攒越多(B6 时 6 个),而其中一半早已过期:style-source / blank-canvas 的
// hex 全在 var() fallback 里,规则本来就会放行,白名单只是没人回来删。
// 剩下 4 个也不是同一种情况,硬塞一张名单里就再也看不出区别了。
//
// 现在按「这段颜色在 UI 里是什么角色」分三类(判据写死在下面对应的函数里):
//
// ① 表面色 / 文字色 / 边框色 —— 随主题翻转的东西。必须用 var(--iwb-*)。
// 这类颜色接近中性(chroma 小),写死在暗色下必然是一块白板或一个黑洞。
// ② 强调色 / 状态色 —— 品牌绿、危险红、成功态。饱和度足够,亮暗两端都可读,
// 属插件自己的设计语言,允许写死。判据用 chroma 而不是「查表」:
// 表会过期、会被人往里加,chroma 是颜色自身的属性。
// ③ 私有皮肤 —— 自带整套调色板(标注 / 矢量化这类深色专业工具 UI),
// 在 manifest 里声明 skin: 'private'。颜色全部放行。
// 代价必须付:**不得引用宿主颜色 token**。混用才是「一半跟主题走、一半写死」
// 导致暗色下花屏的真正根源 —— 这才是 old ALLOW_FILES 掩盖掉的问题。
//
// 内容色(画布填充、看片台白底)用行内 `/*iwb:content*/` 标记放行:
// 它是**声明级**的,写明「这一条是内容不是主题」,比文件级豁免精确得多。
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const ROOT = path.join(__dirname, '..')
const PLUG_DIR = path.join(ROOT, 'plugins')
const ALLOW_FILES = new Set([
'plugin-image-annotate.7a865c7c353c.js', // 画笔/文字颜色是用户内容色
'plugin-blank-canvas.67763893fa99.js', // 画布填充色(白底画布内容)+ 变量 fallback
'plugin-image-vectorize.7014982f60e6.js', // 位图转矢量的浮层是深色自绘 UI(#1b1b22 等),待插件源码改用 --iwb-*
'plugin-style-source.ee7168565a44.js', // 风格库角标:白字(品牌底)+ 琥珀色提示,属内容色
'plugin-browser.8161a82890d9.js', // 浏览器面板的刷新/危险按钮用自家色(#e05252/#1d9e75/#888780)
'plugin-batch-export.b7d13ba66cf9.js', // 导出面板按钮用自家品牌色(#1d9e75/#d85a30/#2f6fed),待插件源码仓库改用 --iwb-*
])
// 私有皮肤可用的宿主变量(布局尺寸,不属于主题色)。新增需在此登记并说明用途。
const PRIVATE_ALLOWED_VARS = new Set(['--iwb-side-w'])
// chroma 阈值:max(r,g,b) - min(r,g,b) 的差。
// 24/255 ≈ 0.094 —— 低于它的颜色看起来就是「灰」,靠它承载面板/文字必然要跟主题走;
// 高于它的有明确色相,作为强调色在亮暗两端都能读。
const CHROMA_MIN = 24
// 内容色的行内标记:`background:#fff/*iwb:content*/`(看片台、画布填充等)。
// 用标记而不是值来判断,是因为同一个 #fff 在面板上是 bug、在画布上是内容 —— 值分不出来,上下文才分得出来。
const CONTENT_MARK = /\/\*iwb:content\*\//
function toRgb (hex) {
let h = hex.replace('#', '')
if (h.length === 3) h = h[0] + h[0] + h[1] + h[1] + h[2] + h[2]
if (h.length !== 6) return null
const n = parseInt(h, 16)
return [(n >> 16) & 255, (n >> 8) & 255, n & 255]
}
function chromaOf (hex) {
const c = toRgb(hex)
if (!c) return 0
return Math.max(c[0], c[1], c[2]) - Math.min(c[0], c[1], c[2])
}
function walk (dir, out) {
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
@@ -37,25 +70,63 @@ if (!fs.existsSync(PLUG_DIR)) {
}
const files = walk(PLUG_DIR, [])
let checked = 0
const bad = []
const accents = new Map()
let checked = 0
let privateCount = 0
for (const f of files) {
const base = path.basename(f)
if (ALLOW_FILES.has(base)) continue
// 已知 plugin-batch-export 的导出按钮色写死(#1d9e75 等),留给插件源码仓库修。
const src = fs.readFileSync(f, 'utf8')
checked++
// 找 background/color/border 声明里直接写 hex(排除 var(--x,#hex) 的 fallback)
const re = /(background(?:-color)?|color|border(?:-color)?)\s*:\s*([^;'"]{0,80})/gi
// 私有皮肤:声明在产物 manifest 里(build-plugin.mjs 把 banner 原样放在文件最前面)
const isPrivate = /skin:\s*'private'/.test(src.slice(0, 4096))
if (isPrivate) {
privateCount++
// 自洽性:不跟随主题,就不能借宿主的颜色
const used = new Set([...src.matchAll(/var\(\s*(--iwb-[a-z0-9-]+)/gi)].map((m) => m[1]))
const borrowed = [...used].filter((v) => !PRIVATE_ALLOWED_VARS.has(v))
assert.deepStrictEqual(
borrowed, [],
base + ' 声明了 skin: \'private\',却又引用宿主变量 ' + borrowed.join(', ') +
' —— 私有皮肤必须自洽(要么全跟主题、要么全自己来,混用会在暗色下花屏)'
)
continue
}
// 普通插件:逐条检查 CSS 颜色声明(`}` 也算值结束 —— 否则 `color:#fff}` 的尾巴会混进值里)
const re = /(background(?:-color)?|color|border(?:-color)?)\s*:\s*([^;'"}]{0,120})/gi
let m
while ((m = re.exec(src))) {
const prop = m[1].toLowerCase()
const val = m[2]
if (!/#[0-9a-f]{3,8}/i.test(val)) continue
if (/var\(--[a-z0-9-]+\s*,\s*#[0-9a-f]{3,8}/i.test(val)) continue // fallback
// 白字(压在图片/渐变上的标题)属于内容对比,不算主题表面色
if (/^color$/i.test(m[1]) && /^#(?:fff|ffffff)$/i.test(val)) continue
bad.push(base + ' → ' + m[1] + ': ' + val.trim().slice(0, 60))
if (CONTENT_MARK.test(val)) continue // 显式标记的内容色
if (/var\(--[a-z0-9-]+\s*,\s*#[0-9a-f]{3,8}/i.test(val)) continue // 变量 fallback
// 纯白文字压在图片/色块上:属于内容对比,不是主题表面色
if (prop === 'color' && /^#(?:fff|ffffff)$/i.test(val.trim())) continue
for (const h of val.match(/#[0-9a-f]{3,8}/gi) || []) {
const c = chromaOf(h)
if (c >= CHROMA_MIN) {
// 强调色:允许,但要能被看见(打印出来供 review)
accents.set(base + ' ' + h.toLowerCase(), (prop + ': ' + val.trim()).slice(0, 60))
continue
}
bad.push(base + ' → ' + prop + ': ' + val.trim().slice(0, 60))
}
}
}
assert.strictEqual(bad.length, 0, '插件样式不得写死颜色(改用 --iwb-plugin-*):\n' + bad.slice(0, 10).join('\n'))
console.log('plugin theme contract checks passed(检查 ' + checked + ' 个插件文件)')
assert.strictEqual(
bad.length, 0,
'插件把「中性色」(表面/文字/边框)写死了 —— 暗色下会变白板或黑块,改用 var(--iwb-*):\n' +
bad.slice(0, 10).join('\n')
)
console.log('plugin theme contract checks passed(' + checked + ' 个文件 / ' + privateCount +
' 个私有皮肤插件 / ' + accents.size + ' 个强调色 / 0 个文件级豁免)')
if (accents.size) {
for (const [k, v] of accents) console.log(' · 强调色 ' + k + ' ' + v)
}
+15 -8
View File
@@ -34,18 +34,25 @@ const llm = css.indexOf('.iwb-settings-modal .iwb-llm-card .iwb-input {')
assert.ok(llm > 0, '找不到渠道卡片输入框规则')
assert.ok(css.slice(llm, css.indexOf('}', llm)).includes('height: auto'), '渠道卡片输入框应显式 height: auto')
// ── 2. 半像素字号在设置/外观范围内必须清零 ──
// 13.5px / 12.5px 这类值来自「凭手感调半像素」,闭集里没有它们;B4 范围内已全部并到 13/12。
// 范围外的(备份、右键菜单、插件市场卡)留给 B5/B6,这里不越界。
const SCOPE = /\.iwb-(settings-modal|appear|set|setcell|set-num|set-nav|set-page|set-row|set-main|setlabel|sethd|setalign|setx|sethint|seterr|setrow|setgrid|setopen)/
// ── 1b. 全局 .iwb-input 保持「内容撑高」,不得写死 height ──
// B6 裁定 control-h 不扩到全局:画布/节点/停靠栏里的输入框是紧凑控件,强制 30px 会连带
// 拉高节点与面板行距。判据是「有没有并排的另一半」——并排的表单用 control-h,成组的紧凑控件靠内容撑高。
const gInput = css.indexOf('.iwb-input, .iwb-textarea {')
assert.ok(gInput > 0, '找不到全局 .iwb-input 规则')
assert.ok(
!/\bheight\s*:/.test(css.slice(gInput, css.indexOf('}', gInput))),
'全局 .iwb-input 不该写死 height —— 它服务的是画布里的紧凑控件,写死就会把节点撑高(并排场景请就地用 control-h)'
)
// ── 2. 半像素字号必须清零(B6 后是全文件) ──
// 13.5px / 12.5px 这类值来自「凭手感调半像素」,闭集里没有它们。
// B4 清了设置/外观范围内的 12 处;B6 把备份页、右键菜单、操作日志、确认框、插件市场卡
// 剩下的 16 处一并清完,所以断言从「范围内」收紧成「全文件」—— 以后新增的一律拦下。
const halfPixel = []
css.split('\n').forEach((line, i) => {
const brace = line.indexOf('{')
if (brace < 0) return
if (!SCOPE.test(line.slice(0, brace))) return
if (/font-size:\s*[\d]+\.5px/.test(line)) halfPixel.push((i + 1) + ':' + line.trim().slice(0, 70))
})
assert.deepStrictEqual(halfPixel, [], '设置/外观范围内还有半像素字号')
assert.deepStrictEqual(halfPixel, [], 'style.css 里还有半像素字号(闭集只有 11/12/13/15/17/20/24)')
// ── 3. 已删除的死规则不许回来 ──
// 判据:DOM 不渲染 + 插件不复用。删除前查过 dist/app.js 与 plugins/**(B3 的教训:只查产物会把插件契约误删)。