dsh-effort-mosaic 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  按版本倒序。每条按「新增 / 修复 / 质量」归类;没有的分类省略。
4
4
 
5
+ ## 1.2.3 — 2026-11-21
6
+
7
+ ### 修复
8
+
9
+ - **最高档粒子速度前快后慢**:最高档原来靠 `burstPowerRef` 给一次 2.6× 瞬时提速,随后 `tick()` 每帧把 `burstPower` 减 `0.05 × burstSpeed`,约 20 帧后归零,速度从 2.6× 掉回基础 1×。现在最高档的顶部提速是稳定值:`lv` 从 0.82 到 1 平滑抬到 2.6×(点亮强度越高抬得越多),`burstPower` 只保留 0.06× 的入口轻抬速,衰减完仍停在 2.6×,不会在 0.3 秒后突然变慢。`speedBase` 的每帧增量语义和「不做 dt 归一」保持不变。
10
+ - **详情页自定义设置横向超出容器**:强调色 swatches(6 个圆形按钮 + 96px hex 输入)在窄容器里没有换行,240px 宽时 `scrollWidth` 比 `clientWidth` 多 20px,右缘被宿主 `.pageBody` 的 `overflow-x:hidden` 直接裁掉;分段控件、滑杆、预览标题 / 标签 / 底栏 / 底部按钮也有同类单行最小宽度。现在这些行都带 `flex-wrap` 与 `max-width:100%`,swatches 和 hex 允许换行、swatch 不再被压缩;静态探针从 360px 一路压到 160px,`panelScrollW === panelClientW`,没有横溢出的行或子元素。纵向高度没有在面板内加滚动层,继续交给宿主详情页的 `overflow-y:auto`(插槽锚点为 `display:contents`,面板是 `.detailSection` 的直接 flex 子项)。
11
+
12
+ ### 质量
13
+
14
+ - `node --check lib/client.js` 通过。
15
+ - 离线断言:顶部稳定速度 `0.10972 px/帧`(2.6× 基础值),入口轻抬 `1.06×`,模拟 20 帧 burst 衰减后仍回到 `0.10972`;`lv 0.8` 不进入顶部 ramp。
16
+ - 真实 CSS + headless Edge 静态渲染:360 / 320 / 300 / 280 / 260 / 240 / 220 / 200 / 180 / 160px 十个宽度,面板 `scrollWidth === clientWidth`,无横向溢出的行或子元素。
17
+ - 发布包仍只包含运行文件:`lib/`、`cordis.patch.yml`、`icon.svg`、`package.json`、`README.md`、`CHANGELOG.md`、`LICENSE`。
18
+
19
+ ## 1.2.2 — 2026-11-20
20
+
21
+ ### 修复
22
+
23
+ - **切换模型后推理轨道偶尔空白**:`current.reasoningEffort` 可能还留着上一个模型的 id,旧逻辑直接拿它找下标会得到 `-1`,轨道进入未就绪状态。现在会先用当前模型的 `efforts` 校验,失效时回落到 `defaultEffort`;`default` / `auto` / `none` 只有不在当前档位表里时才当作“跟随默认”的占位值,真实声明的 `none` 档不再被误吞。
24
+ - **模型切换后目录桥仍读旧 store**:`createAccess` 现在每次读取、订阅、选择都重新解析 `directoryFor`;目录包装对象换了、内部 store 换了、连接重置都会重新订阅,清空旧快照并主动通知 React。新目录加载不再沿用旧目录的 400ms 节流,避免刚打开菜单就切模型时新目录被跳过。
25
+ - **轨道索引解析失败仍占 30px 空白**:只要当前模型确实声明了 `reasoning.efforts`,轨道就不会因为 `liveIndex` / 行文案暂时解析不出而完全隐藏;最后会先落在第一档,等快照或官方行文本回来再纠正。未就绪轨道高度收为 0,空容器 `display:none`,不再留下空白占位。
26
+ - **官方行文本和档位对象格式兼容性**:行文本支持 `推理等级 Max`、`Effort: Default`、尾部箭头、大小写混用;不会把 `Maximum` 误判成 `Max`。`efforts` 支持 `{ id, name }`、`{ id, label }` 和字符串数组,`current.model` 兼容字符串与 `{ id }` 对象。
27
+ - **模型换代时旧乐观状态串台**:切换模型会清掉上一代留下的 `draft`、待写档位和超时计时器,避免旧档位短暂盖在新模型轨道上,或把旧档位写进新模型;`teardownEntry` 也会摘掉官方行重建后遗留的空容器。
28
+ - **切模型后非最高档字符被误染蓝**:最高档染色现在只作用于当前最高档那一段文字,不再给卡片里所有档位名统一上蓝;乐观染色索引会绑定模型 id,刚把模型 A 拉到最高档就切到模型 B 时,B 的首帧直接按自己的真实档位绘制,不会先沿用 A 的最高档索引。
29
+
30
+ ### 质量
31
+
32
+ - `node --check lib/client.js` 通过;离线检查覆盖 `Default` 回落、旧模型档位失效、真实 `none` 档、字符串档位、provider 重挂、对象模型 id、菜单行标签/箭头解析、目录切换、加载节流和快照身份稳定性。
33
+ - 发布包仍只包含运行文件:`lib/`、`cordis.patch.yml`、`icon.svg`、`package.json`、`README.md`、`CHANGELOG.md`、`LICENSE`。
34
+
5
35
  ## 1.2.1 — 2026-11-20
6
36
 
7
37
  ### 修复
package/README.md CHANGED
@@ -61,7 +61,7 @@ dsh plugin --profile web add "github:xiaobaga281/dsh-effort-mosaic"
61
61
 
62
62
  粒子按离滑块的距离决定散开程度:右侧 2% 是严格贴网格的墙,往左 `amp` 增大、漂移与抖动随之变大,最左端几乎全部脱离。颜色取自同一条渐变色阶 × 明度系数(0.80–1.06),砖缝从浅蓝到纯蓝都看得清。
63
63
 
64
- **四种点亮动画**(最高档触发,两套风格都有):能量波 / 扫描线 / 爆散 / 呼吸。马赛克那组还带一次粒子瞬时提速;霓虹沿用同一套语义,但峰值更低(紫渐变的亮度天花板比浅蓝低,1.55 倍会烧成白块),且不做饱和变化。
64
+ **四种点亮动画**(最高档触发,两套风格都有):能量波 / 扫描线 / 爆散 / 呼吸。马赛克那组的最高档速度由稳定的顶部提速托住,入口只额外叠一次很轻的抬速,不会在 0.3 秒后掉回基础速度;霓虹沿用同一套语义,但峰值更低(紫渐变的亮度天花板比浅蓝低,1.55 倍会烧成白块),且不做饱和变化。
65
65
 
66
66
  **四套越界动画**(仅马赛克,默认仅最高档):飞沫 / 飘散 / 坠落 / 潮汐 —— 右 1/5 是死区,越往左逃逸比例越高、飞得越远。
67
67
 
@@ -69,7 +69,7 @@ dsh plugin --profile web add "github:xiaobaga281/dsh-effort-mosaic"
69
69
 
70
70
  ## 自定义版式
71
71
 
72
- 插件详情页里有一块面板,预览直接使用正式的三档轨道(Off / Medium / Max),可以拖动、点击、键盘切换;改任何一项即时生效,最高档字符按当前染色设置显示,旁边可「播放」重播一次点亮。打开「拖拽动效」开关时会自动演示一次端点 / 纵向形变,不用真的去拖也能看出差别。越界选「全档位」会把预览自动停到 Medium、选「最高档」停回 Max,两种模式当场就能对上画面。点击预览轨道时,档位字符等滑块 `.3s` 过渡收口后再切换,不会在滑块还在走的时候提前跳字。预览的粒子遮罩变量完全由每帧的 `syncTail` 按真实滑块位置写,点击瞬间不会再先跳到目标档位;粒子边缘也按滑块内缘连续裁切,不按 5px 整格淘汰,从 Max 切到 Medium 时右缘不会闪一下或一格一格地空/满跳。详情页面板本身锁定为固定浅色,不跟随宿主深浅主题;选中项白底蓝字,预览卡浅蓝底,宿主没注入 `--dsw-alias-*` 也不会变成黑底黑字。
72
+ 插件详情页里有一块面板,预览直接使用正式的三档轨道(Off / Medium / Max),可以拖动、点击、键盘切换;改任何一项即时生效,最高档字符按当前染色设置显示,旁边可「播放」重播一次点亮。打开「拖拽动效」开关时会自动演示一次端点 / 纵向形变,不用真的去拖也能看出差别。越界选「全档位」会把预览自动停到 Medium、选「最高档」停回 Max,两种模式当场就能对上画面。点击预览轨道时,档位字符等滑块 `.3s` 过渡收口后再切换,不会在滑块还在走的时候提前跳字。预览的粒子遮罩变量完全由每帧的 `syncTail` 按真实滑块位置写,点击瞬间不会再先跳到目标档位;粒子边缘也按滑块内缘连续裁切,不按 5px 整格淘汰,从 Max 切到 Medium 时右缘不会闪一下或一格一格地空/满跳。详情页面板本身锁定为固定浅色,不跟随宿主深浅主题;选中项白底蓝字,预览卡浅蓝底,宿主没注入 `--dsw-alias-*` 也不会变成黑底黑字。面板内的强调色 swatches、hex 输入、分段控件、滑杆、预览标签和底部按钮都带换行 / 最大宽度约束,详情页窗口收窄到 160px 也不会横向溢出;纵向高度交给宿主详情页自己的滚动容器,不在面板里再套一层滚动。
73
73
 
74
74
  | 项 | 取值 | 默认 |
75
75
  |---|---|---|
@@ -99,7 +99,7 @@ dsh plugin --profile web add "github:xiaobaga281/dsh-effort-mosaic"
99
99
  | **马赛克**(默认) | 像素方块墙,越往左越散 | 四套点亮动画任选 | ✅ 飞沫 / 飘散 / 坠落 / 潮汐 |
100
100
  | **霓虹** | 平涂强调色胶囊 | 蓝→紫擦除渐变 + 滑块脚下烟花 + 14 颗右→左漂流白点 | ❌ 不提供 |
101
101
 
102
- 粒子越界是马赛克风格独有的能力:切到霓虹后,面板里的「粒子越界 / 越界动画 / 越界幅度」整组会消失。**其余设置两套通用** —— 强调色、滑块形状/大小/填充、点亮样式与强度/速度都照常生效,只是霓虹的点亮作用在紫渐变上、用更低的峰值:强度决定四套动画的亮度峰值,速度决定动画时长(定时器同步跟随,不会把慢速档拦腰截断)。
102
+ 粒子越界是马赛克风格独有的能力:切到霓虹后,面板里的「粒子越界 / 越界动画 / 越界幅度」整组会消失。**其余设置两套通用** —— 强调色、滑块形状/大小/填充、点亮样式与强度/速度都照常生效,只是霓虹的点亮作用在紫渐变上、用更低的峰值:强度决定四套动画的亮度峰值,速度决定动画时长(定时器同步跟随,不会把慢速档拦腰截断)。马赛克的「点亮速度」只调入口那一下轻抬速的衰减,最高档的稳定速度由顶部提速托住,不会把它拖慢。
103
103
 
104
104
  霓虹最高档的渐变**跟着强调色走**:默认强调色下逐点等于原版采样值(`#2546D0 → #B37DFF → #724CE9`),换成红/绿主题后整条渐变按同一 RGB 偏移平移,得到同结构的红紫/绿紫渐变;滑块脚下的火星与底纹也跟着强调色变。
105
105
 
@@ -148,6 +148,8 @@ README.md / LICENSE 说明与许可
148
148
 
149
149
  完整记录见 [CHANGELOG.md](./CHANGELOG.md)。
150
150
 
151
+ - **1.2.3** — 修复最高档粒子速度前快后慢:`burstPower` 不再把速度从 2.6× 衰减回 1×,最高档改用稳定的顶部提速,只在入口叠加 0.06× 轻抬;修复详情页自定义设置在窄窗口下强调色 swatches / hex、分段控件、滑杆、预览标签与底栏横向溢出,面板在 160–360px 宽度内均无横向溢出。
152
+ - **1.2.2** — 修复切换模型后推理滑轨偶尔空白:旧 `reasoningEffort` 先用新模型的档位表校验,失效时回落 `defaultEffort`;目录换代时重新解析并订阅新 store,新目录不再被旧加载节流跳过;只要模型声明了档位,轨道就有兜底落点,不再留下 30px 空占位。另修复拉到最高档后立即切模型、新模型非最高档字符被旧最高档索引误染蓝的问题。
151
153
  - **1.2.1** — 修复详情页面板在未注入 DSH 令牌的宿主里选中块纯黑、文字看不清、预览黑底;色带与粒子层改用同一条右端收口,拖拽 `scale / skew` 时不会在滑块右缘露出色轨;粒子引擎的逐帧 `clip-path` 不再把右侧重新放开。
152
154
  - **1.2.0** — 详情页预览接入真实三档轨道与「拖拽动效 / 玻璃材质」开关;无感档位引擎将字符切换提前到视觉落位帧;修复玻璃上缘过厚、旋钮浅色环、轨道底缘硬黑线;修复输入胶囊 Max 染色先蓝后灰再蓝;发布包只保留运行文件。
153
155
  - **1.1.9** — 补充 `screenshots.json` 与 `engines.dsh`,修复插件市场介绍页无截图、宿主要求显示未知。
package/lib/client.js CHANGED
@@ -745,6 +745,8 @@ window.__ModuleLoader__.load({
745
745
  插件若在这里自己画白底,深色主题下就会露出一条白块。 */
746
746
  ".dem-inline{box-sizing:border-box;flex-basis:100%;width:100%;min-width:0;background:transparent;"
747
747
  + "clip-path:inset(-12px 0 -12px 0)}",
748
+ /* 组件返回 null / 档位从有到无时,容器里没有子节点;不要让它继续占一行高度。 */
749
+ ".dem-inline:empty{display:none}",
748
750
  ".dem-track{--dem-slot-bg:var(--dsw-alias-border-l1,color-mix(in srgb,var(--dsw-alias-label-primary,#0f1115) 8%,transparent));"
749
751
  + "position:relative;box-sizing:border-box;height:" + TRACK_HEIGHT + "px;margin:2px " + TRACK_INSET + "px 0;"
750
752
  + "border-radius:999px;"
@@ -957,8 +959,10 @@ window.__ModuleLoader__.load({
957
959
  不能被当成换档过渡播出来。等这一帧画完(data-measured 翻 1)才恢复缓动。 */
958
960
  ".dem-track[data-measured='0'] .dem-knob,.dem-track[data-measured='0'] .dem-fill{transition:none}",
959
961
  /* 目录快照还没给出真实档位时,整条轨道先不显示。否则会先画在 0 档,
960
- 等快照回来再滑到正确档位 —— 就是"每次打开浮层从最左端起步"的另一半根因。 */
961
- ".dem-track[data-ready='0']{opacity:0;pointer-events:none}",
962
+ 等快照回来再滑到正确档位 —— 就是"每次打开浮层从最左端起步"的另一半根因。
963
+ 同时把高度收成 0:只设 opacity 会留下一块 30px 的空白占位,
964
+ 模型切换 / 索引未解析时看起来就是"轨道消失但菜单多了一块洞"。 */
965
+ ".dem-track[data-ready='0']{opacity:0;pointer-events:none;height:0;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0}",
962
966
  ".dem-track[data-dragging='1'] .dem-knob,.dem-track[data-dragging='1'] .dem-fill{transition:none}",
963
967
  /* 吸附阶段位置由 `beginSettle` 的 rAF 逐帧写,再叠一层 CSS transition 就是双重缓动,
964
968
  滑块和填充的插值曲线不同会互相追不上 —— 这一段两边都直接跟数值走。 */
@@ -1128,13 +1132,14 @@ window.__ModuleLoader__.load({
1128
1132
  + "--dsw-focus-ring-color:#4a84ff;"
1129
1133
  + "--dsw-focus-ring-width:2px;"
1130
1134
  + "color-scheme:light;box-sizing:border-box;display:flex;flex-direction:column;gap:14px;"
1135
+ + "min-width:0;max-width:100%;"
1131
1136
  + "padding:14px 12px 12px;border:1px solid #e4eaf3;border-radius:14px;"
1132
1137
  + "background:#ffffff;box-shadow:0 1px 2px rgba(16,24,40,.04);"
1133
1138
  + "font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary)}",
1134
1139
  ".dem-cfg-head{display:flex;flex-direction:column;gap:3px}",
1135
1140
  ".dem-cfg-title{font-size:14px;font-weight:600;letter-spacing:.01em}",
1136
1141
  ".dem-cfg-desc{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#6b7280)}",
1137
- ".dem-cfg-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-height:28px}",
1142
+ ".dem-cfg-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0;max-width:100%;min-height:28px}",
1138
1143
  ".dem-cfg-label{flex:0 0 76px;font-size:12px;color:var(--dsw-alias-label-secondary,#6b7280);"
1139
1144
  + "white-space:nowrap}",
1140
1145
  /* 详情页的开关:轨道形变 / 玻璃材质。做成实体拨片而不是“开 / 关”文字,
@@ -1150,19 +1155,19 @@ window.__ModuleLoader__.load({
1150
1155
  ".dem-cfg-switch[data-on='1']::after{transform:translateX(16px)}",
1151
1156
  ".dem-cfg-switch:focus-visible{outline:2px solid var(--dsw-focus-ring-color,#4a84ff);"
1152
1157
  + "outline-offset:2px}",
1153
- ".dem-cfg-swatches{display:flex;align-items:center;gap:8px}",
1154
- ".dem-cfg-swatch{position:relative;width:22px;height:22px;padding:0;border-radius:50%;"
1158
+ ".dem-cfg-swatches{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0;max-width:100%}",
1159
+ ".dem-cfg-swatch{position:relative;flex:0 0 22px;width:22px;height:22px;padding:0;border-radius:50%;"
1155
1160
  + "border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08));cursor:pointer;"
1156
1161
  + "box-shadow:0 1px 2px rgba(15,25,50,.08);transition:transform .16s ease,box-shadow .16s ease}",
1157
1162
  ".dem-cfg-swatch:hover{transform:translateY(-1px);box-shadow:0 3px 8px rgba(15,25,50,.16)}",
1158
1163
  ".dem-cfg-swatch[data-on='1']{box-shadow:0 0 0 2px var(--dsw-alias-bg-base,#0b0d12),0 0 0 4px currentColor}",
1159
- ".dem-cfg-hex{width:96px;height:26px;padding:0 8px;box-sizing:border-box;border-radius:7px;"
1164
+ ".dem-cfg-hex{width:96px;flex:0 1 96px;min-width:0;height:26px;padding:0 8px;box-sizing:border-box;border-radius:7px;"
1160
1165
  + "border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08));"
1161
1166
  + "background:var(--dsw-alias-bg-base,transparent);"
1162
1167
  + "color:var(--dsw-alias-label-primary,#0f1115);font-size:12px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;"
1163
1168
  + "outline:none;text-transform:uppercase}",
1164
1169
  ".dem-cfg-hex:focus{border-color:var(--dem-accent,#4a84ff)}",
1165
- ".dem-cfg-seg{display:inline-flex;padding:2px;border-radius:9px;gap:2px;"
1170
+ ".dem-cfg-seg{display:inline-flex;max-width:100%;flex-wrap:wrap;padding:2px;border-radius:9px;gap:2px;"
1166
1171
  + "background:var(--dsw-alias-interactive-bg-hover,rgba(0,0,0,.06))}",
1167
1172
  ".dem-cfg-opt{appearance:none;border:0;background:transparent;cursor:pointer;"
1168
1173
  + "padding:3px 10px;border-radius:7px;font-size:12px;line-height:18px;"
@@ -1171,7 +1176,7 @@ window.__ModuleLoader__.load({
1171
1176
  ".dem-cfg-opt[data-on='1']{background:#ffffff;"
1172
1177
  + "color:#1d4ed8;font-weight:600;"
1173
1178
  + "box-shadow:0 0 0 1px #c3d7f6,0 1px 2px rgba(15,25,50,.06)}",
1174
- ".dem-cfg-range{appearance:none;width:150px;height:4px;border-radius:2px;outline:none;cursor:pointer;"
1179
+ ".dem-cfg-range{appearance:none;width:150px;max-width:100%;flex-shrink:1;height:4px;border-radius:2px;outline:none;cursor:pointer;"
1175
1180
  + "background:linear-gradient(90deg,var(--dem-accent,#4a84ff) 0%,"
1176
1181
  + "color-mix(in srgb,var(--dem-accent,#4a84ff) 30%,transparent) 100%)}",
1177
1182
  ".dem-cfg-range::-webkit-slider-thumb{appearance:none;width:14px;height:14px;border-radius:50%;"
@@ -1181,7 +1186,7 @@ window.__ModuleLoader__.load({
1181
1186
  + "color:var(--dsw-alias-label-secondary,#6b7280)}",
1182
1187
  /* 预览卡片同时当"取景框":开了越界之后粒子会飞出轨道,这一层把溢出裁在卡片圆角里,
1183
1188
  不然方块会糊到下面的「恢复默认」上。 */
1184
- ".dem-cfg-preview{padding:14px 12px;border-radius:12px;overflow:hidden;"
1189
+ ".dem-cfg-preview{box-sizing:border-box;max-width:100%;padding:14px 12px;border-radius:12px;overflow:hidden;"
1185
1190
  + "background:linear-gradient(180deg,#f8fbff 0%,#edf3fb 100%);"
1186
1191
  + "border:1px solid #d9e4f2;box-shadow:inset 0 1px 0 #ffffff}",
1187
1192
  /* 环心那层乳白玻璃要用 backdrop-filter 虚化底下粒子,否则环里还是能看见方块在动。 */
@@ -1189,26 +1194,26 @@ window.__ModuleLoader__.load({
1189
1194
  + "{backdrop-filter:blur(4px) saturate(1.15);-webkit-backdrop-filter:blur(4px) saturate(1.15)}",
1190
1195
  /* 详情页预览:直接放一条真轨道,不再另画一套静态示意。
1191
1196
  卡片本身当取景框,越界粒子 / 端点形变都被圆角收在这里。 */
1192
- ".dem-cfg-preview-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}",
1197
+ ".dem-cfg-preview-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:8px}",
1193
1198
  ".dem-cfg-preview-kicker{font-size:11px;line-height:16px;letter-spacing:.08em;text-transform:uppercase;"
1194
1199
  + "color:var(--dsw-alias-label-secondary,#6b7280)}",
1195
1200
  ".dem-cfg-preview-hint{font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#6b7280)}",
1196
1201
  ".dem-cfg-preview-stage{position:relative;min-height:38px;padding:4px 0 2px}",
1197
- ".dem-cfg-preview-stage .dem-track{--dem-slot-bg:#c8d7e9;width:100%;margin:0;cursor:grab}",
1202
+ ".dem-cfg-preview-stage .dem-track{--dem-slot-bg:#c8d7e9;width:100%;max-width:100%;margin:0;cursor:grab}",
1198
1203
  ".dem-cfg-preview-stage .dem-track:active{cursor:grabbing}",
1199
- ".dem-cfg-preview-caption{display:flex;align-items:baseline;gap:8px;min-height:20px;margin-top:10px}",
1204
+ ".dem-cfg-preview-caption{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;min-height:20px;margin-top:10px}",
1200
1205
  ".dem-cfg-preview-label{font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#6b7280)}",
1201
1206
  ".dem-cfg-preview-value{font-size:13px;line-height:18px;font-weight:600;"
1202
1207
  + "font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary,#6b7280)}",
1203
1208
  ".dem-cfg-preview-value[data-hot='1']{font-weight:700}",
1204
1209
  ".dem-cfg-preview-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}",
1205
1210
  ".dem-cfg-preview-tag{padding:2px 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08));"
1206
- + "font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#6b7280);white-space:nowrap}",
1211
+ + "max-width:100%;font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary,#6b7280)}",
1207
1212
  ".dem-cfg-preview-tag[data-on='0']{opacity:.55}",
1208
1213
  ".dem-cfg-preview-tag[data-on='1']{color:var(--dsw-alias-label-primary,#0f1115);"
1209
1214
  + "border-color:color-mix(in srgb,var(--dem-accent,#4a84ff) 34%,var(--dsw-alias-border-l1,rgba(0,0,0,.08)));"
1210
1215
  + "background:color-mix(in srgb,var(--dem-accent,#4a84ff) 8%,transparent)}",
1211
- ".dem-cfg-preview-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px}",
1216
+ ".dem-cfg-preview-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:8px}",
1212
1217
  ".dem-cfg-play{appearance:none;border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,.12));"
1213
1218
  + "background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));"
1214
1219
  + "color:var(--dsw-alias-label-primary,#e6e8ee);font-size:12px;line-height:18px;"
@@ -1216,7 +1221,7 @@ window.__ModuleLoader__.load({
1216
1221
  + "transition:background .16s ease,border-color .16s ease}",
1217
1222
  ".dem-cfg-play:hover{border-color:var(--dem-accent,#4a84ff);"
1218
1223
  + "background:color-mix(in srgb,var(--dem-accent,#4a84ff) 16%,transparent)}",
1219
- ".dem-cfg-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;"
1224
+ ".dem-cfg-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;"
1220
1225
  + "padding-top:2px;border-top:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.06))}",
1221
1226
  ".dem-cfg-reset{appearance:none;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));"
1222
1227
  + "background:transparent;cursor:pointer;padding:5px 12px;border-radius:8px;font-size:12px;"
@@ -1237,20 +1242,37 @@ window.__ModuleLoader__.load({
1237
1242
  error: null,
1238
1243
  });
1239
1244
 
1245
+ /** 当前模型 id:目录正常给字符串;兼容少数把 current.model 给成对象的宿主。 */
1246
+ function modelIdOf(value) {
1247
+ if (typeof value === "string") return value.trim();
1248
+ if (value && typeof value === "object") {
1249
+ if (typeof value.id === "string") return value.id.trim();
1250
+ if (typeof value.value === "string") return value.value.trim();
1251
+ }
1252
+ return "";
1253
+ }
1254
+
1240
1255
  /** 在目录快照里找到当前模型条目(groups[].models[])。 */
1241
1256
  function modelOf(state) {
1242
1257
  var current = state && state.current;
1243
- if (!current || typeof current.provider !== "string" || typeof current.model !== "string") return null;
1258
+ var wanted = modelIdOf(current && current.model);
1259
+ if (!current || typeof current.provider !== "string" || wanted.length === 0) return null;
1244
1260
  var groups = state && Array.isArray(state.groups) ? state.groups : [];
1261
+ var fallback = null;
1245
1262
  for (var i = 0; i < groups.length; i += 1) {
1246
1263
  var group = groups[i];
1247
- if (!group || group.id !== current.provider) continue;
1248
- var models = Array.isArray(group.models) ? group.models : [];
1264
+ if (!group || !Array.isArray(group.models)) continue;
1265
+ var models = group.models;
1249
1266
  for (var j = 0; j < models.length; j += 1) {
1250
- if (models[j] && models[j].id === current.model) return models[j];
1267
+ var model = models[j];
1268
+ if (!model || model.id !== wanted) continue;
1269
+ /* provider 目录项正常时优先取同一分组;目录正在重建、
1270
+ 分组 id 暂时对不上时,至少按模型 id 找到唯一候选。 */
1271
+ if (group.id === current.provider) return model;
1272
+ if (fallback === null) fallback = model;
1251
1273
  }
1252
1274
  }
1253
- return null;
1275
+ return fallback;
1254
1276
  }
1255
1277
 
1256
1278
  /**
@@ -1263,29 +1285,68 @@ window.__ModuleLoader__.load({
1263
1285
  var out = [];
1264
1286
  for (var i = 0; i < efforts.length; i += 1) {
1265
1287
  var effort = efforts[i];
1288
+ /* 目录里通常是 { id, name };少数适配器会直接给字符串。
1289
+ 两种都归一成同一种档位对象,避免"有档位但读不出来"。 */
1290
+ if (typeof effort === "string" && effort.trim().length > 0) {
1291
+ out.push({ id: effort.trim(), name: effort.trim() });
1292
+ continue;
1293
+ }
1266
1294
  if (!effort || typeof effort.id !== "string" || effort.id.length === 0) continue;
1267
1295
  out.push({
1268
1296
  id: effort.id,
1269
- name: typeof effort.name === "string" && effort.name.length > 0 ? effort.name : effort.id,
1297
+ name: typeof effort.name === "string" && effort.name.length > 0
1298
+ ? effort.name
1299
+ : (typeof effort.label === "string" && effort.label.length > 0 ? effort.label : effort.id),
1270
1300
  });
1271
1301
  }
1272
1302
  return out;
1273
1303
  }
1274
1304
 
1275
- /** 当前**生效**的档位 id:显式设置优先,否则回落到模型的 defaultEffort。 */
1305
+ function effortValueOf(value) {
1306
+ if (typeof value === "string") return value.trim();
1307
+ if (value && typeof value === "object") {
1308
+ if (typeof value.id === "string") return value.id.trim();
1309
+ if (typeof value.value === "string") return value.value.trim();
1310
+ if (typeof value.name === "string") return value.name.trim();
1311
+ }
1312
+ return "";
1313
+ }
1314
+
1315
+ /** 当前**生效**的档位 id:显式设置优先,否则回落到模型的 defaultEffort。
1316
+ DSH 会把"跟随模型默认"写成 `default` / `auto`,这不是一个真实档位 id;
1317
+ 如果直接拿它去 levels 里找下标,就会得到 -1,轨道进入"未就绪"状态并留下
1318
+ 一块空白占位。这里先把这类占位值当作"未显式设置",再落回 defaultEffort。 */
1276
1319
  function effectiveEffortId(state) {
1277
1320
  var current = state && state.current;
1278
- if (current && typeof current.reasoningEffort === "string" && current.reasoningEffort.length > 0) {
1279
- return current.reasoningEffort;
1280
- }
1321
+ var explicit = effortValueOf(current && current.reasoningEffort);
1281
1322
  var model = modelOf(state);
1282
- var fallback = model && model.reasoning && model.reasoning.defaultEffort;
1283
- return typeof fallback === "string" && fallback.length > 0 ? fallback : null;
1323
+ var levels = levelsOf(state);
1324
+ var explicitIsLevel = indexOfLevel(levels, explicit) >= 0;
1325
+ /* `none` 也可能是模型真实声明的档位;只有它不在当前档位表里时,
1326
+ 才把 default / auto / none 当成"跟随默认"的占位值。 */
1327
+ var placeholder = /^(default|auto|none)$/i.test(explicit) && !explicitIsLevel;
1328
+ var fallback = effortValueOf(model && model.reasoning && model.reasoning.defaultEffort);
1329
+ if (!placeholder && explicit.length > 0) {
1330
+ /* 切模型时 current.reasoningEffort 可能还留着上一个模型的 id。
1331
+ 这个 id 在新模型的 efforts 里不存在时不能直接拿去定位,
1332
+ 否则会得到 -1,轨道再次变成空白;优先回到新模型的默认档。 */
1333
+ if (levels.length === 0 || explicitIsLevel) return explicit;
1334
+ }
1335
+ if (fallback.length > 0) return fallback;
1336
+ return null;
1284
1337
  }
1285
1338
 
1286
1339
  function indexOfLevel(levels, id) {
1287
1340
  if (typeof id !== "string") return -1;
1288
- for (var i = 0; i < levels.length; i += 1) if (levels[i].id === id) return i;
1341
+ var needle = id.trim().toLowerCase();
1342
+ if (!needle) return -1;
1343
+ for (var i = 0; i < levels.length; i += 1) {
1344
+ var level = levels[i];
1345
+ if (!level) continue;
1346
+ var levelId = typeof level.id === "string" ? level.id.trim().toLowerCase() : "";
1347
+ var levelName = typeof level.name === "string" ? level.name.trim().toLowerCase() : "";
1348
+ if (levelId === needle || levelName === needle) return i;
1349
+ }
1289
1350
  return -1;
1290
1351
  }
1291
1352
 
@@ -1296,12 +1357,42 @@ window.__ModuleLoader__.load({
1296
1357
  if (!row || typeof document === "undefined" || typeof document.createTreeWalker !== "function") return -1;
1297
1358
  var walker = document.createTreeWalker(row, NodeFilter.SHOW_TEXT, null);
1298
1359
  var node;
1299
- while ((node = walker.nextNode())) {
1300
- var text = (node.nodeValue || "").trim();
1301
- if (!text) continue;
1302
- for (var i = 0; i < levels.length; i += 1) {
1303
- if (levels[i] && levels[i].name === text) return i;
1360
+ function normalize(value) {
1361
+ return (value || "").replace(/[\s\u00a0\u200b]+/g, " ").trim().toLowerCase();
1362
+ }
1363
+ function matches(value) {
1364
+ var text = normalize(value);
1365
+ if (!text) return -1;
1366
+ var candidates = [text];
1367
+ /* 有些宿主把标题和值渲染在同一个文本节点里:`推理等级 Default`
1368
+ 或 `Effort: Default`。去掉标题前缀后再做一次精确匹配。 */
1369
+ for (var li = 0; li < EFFORT_ROW_LABELS.length; li += 1) {
1370
+ var label = normalize(EFFORT_ROW_LABELS[li]);
1371
+ if (text.indexOf(label) === 0) {
1372
+ candidates.push(normalize(text.slice(label.length).replace(/^[::·\-—\s]+/, "")));
1373
+ }
1374
+ }
1375
+ /* 值后面常跟展开箭头 / 分隔符;把整段拆成独立 token 再匹配,
1376
+ 避免 `Max` 被 `Maximum` 这类更长文案误命中。 */
1377
+ var pieces = text.split(/[^a-z0-9\u4e00-\u9fff]+/i);
1378
+ for (var pi = 0; pi < pieces.length; pi += 1) {
1379
+ if (pieces[pi]) candidates.push(pieces[pi]);
1304
1380
  }
1381
+ for (var ci = 0; ci < candidates.length; ci += 1) {
1382
+ if (!candidates[ci]) continue;
1383
+ for (var i = 0; i < levels.length; i += 1) {
1384
+ var level = levels[i];
1385
+ if (!level) continue;
1386
+ var id = normalize(level.id);
1387
+ var name = normalize(level.name);
1388
+ if ((id && id === candidates[ci]) || (name && name === candidates[ci])) return i;
1389
+ }
1390
+ }
1391
+ return -1;
1392
+ }
1393
+ while ((node = walker.nextNode())) {
1394
+ var found = matches(node.nodeValue);
1395
+ if (found >= 0) return found;
1305
1396
  }
1306
1397
  return -1;
1307
1398
  }
@@ -1364,6 +1455,27 @@ window.__ModuleLoader__.load({
1364
1455
  return v > 255 ? 255 : Math.round(v);
1365
1456
  }
1366
1457
 
1458
+ /**
1459
+ * 粒子每帧推进速度(px/帧)。最高档的顶部提速是**稳定值**:`topBoost` 从 0.82 档位
1460
+ * 平滑抬到最高档 2.6×(点亮强度越高抬得越多),`burstPower` 只额外叠 0.06× 入口轻抬,
1461
+ * 因此它在 0.3 秒内衰减完也不会把最高档打回基础速度。
1462
+ *
1463
+ * @param {number} lv 0–1 的连续档位
1464
+ * @param {number} intensity 点亮强度 0.4–1.8
1465
+ * @param {number} power 入口 burstPower 0–1.9
1466
+ * @returns {number} 每帧速度
1467
+ */
1468
+ function particleSpeedOf(lv, intensity, power) {
1469
+ if (!isFinite(lv)) lv = 0;
1470
+ lv = Math.max(0, Math.min(1, lv));
1471
+ var i = isFinite(intensity) ? intensity : DEFAULT_SETTINGS.burstIntensity;
1472
+ var topRamp = lv > 0.82 ? Math.min(1, (lv - 0.82) / 0.18) : 0;
1473
+ var topBoost = 1 + 1.6 * i;
1474
+ var burstLift = Math.min(Math.max(0, isFinite(power) ? power : 0), Math.max(0, i)) * 0.06;
1475
+ var speed = (SPEED_BASE + SPEED_PER_LEVEL * lv) * (1 + topRamp * (topBoost - 1)) * (1 + burstLift);
1476
+ return isFinite(speed) && speed > 0 ? speed : SPEED_BASE;
1477
+ }
1478
+
1367
1479
  /**
1368
1480
  * 某一格在位移场里的振幅:0 = 严丝合缝钉在网格上、绝对静止。
1369
1481
  *
@@ -1611,17 +1723,19 @@ window.__ModuleLoader__.load({
1611
1723
  ? "inset(-420px var(--dem-knob-tail-inset,15px) -420px 0px)"
1612
1724
  : "inset(0px var(--dem-knob-tail-inset,15px) 0px 0px)";
1613
1725
  waveT += dt / 1000;
1614
- /* 设计稿:speedBase = (0.0022 + lv*0.040) * (1 + burstPower*1.6),每帧固定增量,
1615
- burstPower 每帧衰减 0.05。**不做 dt 归一** —— 设计稿就是按帧走的,144Hz 屏上
1616
- 它比 60Hz 快 2.4 倍;一旦按 dt/16.667 归一,144Hz 只剩 36% 的速度,
1617
- 怎么调档位都还是慢。 */
1726
+ /* 速度底座仍是设计稿的 `(0.0022 + lv*0.040)`,每帧固定增量;**不做 dt 归一** ——
1727
+ 设计稿就是按帧走的,144Hz 屏上它比 60Hz 快 2.4 倍;一旦按 dt/16.667 归一,
1728
+ 144Hz 只剩 36% 的速度,怎么调档位都还是慢。
1729
+ 最高档另加一段**稳定**的顶部提速(0.82→1 平滑抬到 2.6×,强度越高抬得越多),
1730
+ burstPower 只保留入口瞬间的轻抬速(0.06×),不再把最高档的速度逐帧衰减回基础值。
1731
+ 这样拉到最高档后不会出现“前 0.3 秒很快、随后突然变慢”的断崖。 */
1618
1732
  var power = burstPowerRef ? burstPowerRef.current : 0;
1619
1733
  if (power > 0 && burstPowerRef) {
1620
1734
  /* 衰减快慢 = 面板里的"点亮速度":1.0× 是设计稿原值(每帧 −0.05)。 */
1621
1735
  burstPowerRef.current = Math.max(0, power - 0.05 * settings.burstSpeed);
1622
1736
  }
1623
1737
  var lv = isFinite(lvRef.current) ? lvRef.current : 0;
1624
- var speedBase = (SPEED_BASE + SPEED_PER_LEVEL * lv) * (1 + power * 1.6 * settings.burstIntensity);
1738
+ var speedBase = particleSpeedOf(lv, settings.burstIntensity, power);
1625
1739
  if (!isFinite(speedBase) || speedBase <= 0) speedBase = SPEED_BASE;
1626
1740
  for (var i = 0; i < cells.length; i += 1) {
1627
1741
  var c = cells[i];
@@ -1818,8 +1932,9 @@ window.__ModuleLoader__.load({
1818
1932
  /* 最近一次指针采样(位置 + 时间戳):松手时用它算初速,让吸附接着指尖的势头。 */
1819
1933
  var lastMoveRef = React.useRef(null);
1820
1934
 
1821
- /* 拉到最高档时给粒子一次瞬时提速(设计稿 `burstPower`):值是 1,之后
1822
- 每帧衰减 0.05。没有它,最高档就只剩一圈光晕,没有"水龙头全开"的冲劲。 */
1935
+ /* 拉到最高档时给粒子一次轻抬速(设计稿 `burstPower`):值是强度 × 1.9 或强度,
1936
+ 每帧衰减 0.05;但现在它只叠加 0.06× 的小抬速,顶部速度由 `topBoost` 稳定托住,
1937
+ 所以不会在 0.3 秒后掉回基础速度。 */
1823
1938
  var burstPowerRef = React.useRef(0);
1824
1939
 
1825
1940
  var _useState = React.useState(0);
@@ -2992,10 +3107,12 @@ window.__ModuleLoader__.load({
2992
3107
  function createAccess(ctx, sessionId) {
2993
3108
  var listeners = new Set();
2994
3109
  var directory = null;
3110
+ var activeStore = null;
2995
3111
  var unsubscribe = null;
2996
3112
  var last = EMPTY_SNAPSHOT;
2997
3113
  var retryIndex = 0;
2998
3114
  var retryTimer = null;
3115
+ var notifyTimer = null;
2999
3116
  var closed = false;
3000
3117
  var lastLoadAt = 0;
3001
3118
 
@@ -3007,6 +3124,16 @@ window.__ModuleLoader__.load({
3007
3124
  }
3008
3125
  }
3009
3126
 
3127
+ /* 目录换代本身也要通知 React:新 store 可能已经带着完整快照,
3128
+ 如果只依赖它后续的 subscribe 回调,轨道会一直停在旧档位 / 空白占位上。 */
3129
+ function scheduleNotify() {
3130
+ if (closed || notifyTimer !== null) return;
3131
+ notifyTimer = window.setTimeout(function () {
3132
+ notifyTimer = null;
3133
+ notify();
3134
+ }, 0);
3135
+ }
3136
+
3010
3137
  function scheduleRetry() {
3011
3138
  if (closed || retryTimer !== null || retryIndex >= RETRY_DELAYS.length) return;
3012
3139
  var delay = RETRY_DELAYS[retryIndex];
@@ -3027,23 +3154,38 @@ window.__ModuleLoader__.load({
3027
3154
  fresh = null;
3028
3155
  }
3029
3156
  if (!fresh || !fresh.store || typeof fresh.store.getSnapshot !== "function") fresh = null;
3030
- if (fresh === directory) return directory;
3157
+ /* 解析失败时保留旧目录,别把已经挂上的桥拆掉;下次读写会再试。 */
3158
+ if (fresh === null) return directory;
3159
+ if (fresh === directory && activeStore === fresh.store) return directory;
3160
+ /* 有些宿主在换模型代时只换 directory 包装对象、store 还是同一个;
3161
+ 这种情况不要重新订阅、也不要清空快照,否则会白闪一下空白。 */
3162
+ if (directory !== null && fresh.store === activeStore) {
3163
+ directory = fresh;
3164
+ return directory;
3165
+ }
3031
3166
  if (unsubscribe !== null) {
3032
3167
  try { unsubscribe(); } catch (err) { /* 退订失败不影响新订阅 */ }
3033
3168
  unsubscribe = null;
3034
3169
  }
3035
3170
  directory = fresh;
3036
- if (directory !== null) {
3037
- retryIndex = 0;
3038
- try {
3039
- unsubscribe = typeof directory.store.subscribe === "function"
3040
- ? directory.store.subscribe(notify)
3041
- : null;
3042
- } catch (err) {
3043
- unsubscribe = null;
3044
- }
3045
- kickLoad();
3171
+ activeStore = fresh.store;
3172
+ /* 换代后旧快照里的 current / groups 不再可信;先清空,
3173
+ 等新 store 的 load 回调回来再重新判定档位和轨道。 */
3174
+ last = EMPTY_SNAPSHOT;
3175
+ retryIndex = 0;
3176
+ /* 不要沿用旧目录的加载节流时间:刚打开菜单就切模型时,
3177
+ 旧目录的 load 可能还在 400ms 窗口内,新目录会被误跳过,
3178
+ 一直停在空快照上。 */
3179
+ lastLoadAt = 0;
3180
+ try {
3181
+ unsubscribe = typeof directory.store.subscribe === "function"
3182
+ ? directory.store.subscribe(notify)
3183
+ : null;
3184
+ } catch (err) {
3185
+ unsubscribe = null;
3046
3186
  }
3187
+ kickLoad();
3188
+ scheduleNotify();
3047
3189
  return directory;
3048
3190
  }
3049
3191
 
@@ -3062,16 +3204,18 @@ window.__ModuleLoader__.load({
3062
3204
  /** 同一份快照对象身份必须稳定,否则 useSyncExternalStore 会判定"每帧都变"。 */
3063
3205
  function readStable() {
3064
3206
  if (closed) return EMPTY_SNAPSHOT;
3065
- if (directory === null) {
3066
- resolve();
3067
- if (directory === null) scheduleRetry();
3068
- }
3207
+ /* 每次读都重新解析:换模型代 / 连接重置后目录实例会换,
3208
+ 只认第一次拿到的旧目录会把整条轨道留在旧模型上或直接空掉。 */
3209
+ resolve();
3210
+ if (directory === null) scheduleRetry();
3069
3211
  if (directory !== null) {
3070
3212
  try {
3071
3213
  var value = directory.store.getSnapshot();
3072
3214
  if (value && typeof value === "object") {
3073
3215
  if (last === EMPTY_SNAPSHOT
3074
- || value.current !== last.current
3216
+ || (value.current && value.current.provider) !== (last.current && last.current.provider)
3217
+ || modelIdOf(value.current && value.current.model) !== modelIdOf(last.current && last.current.model)
3218
+ || effortValueOf(value.current && value.current.reasoningEffort) !== effortValueOf(last.current && last.current.reasoningEffort)
3075
3219
  || value.groups !== last.groups
3076
3220
  || value.status !== last.status
3077
3221
  || value.error !== last.error) {
@@ -3089,25 +3233,25 @@ window.__ModuleLoader__.load({
3089
3233
  getSnapshot: readStable,
3090
3234
  subscribe: function (listener) {
3091
3235
  if (closed) return function () {};
3236
+ resolve();
3237
+ if (directory === null) scheduleRetry();
3092
3238
  listeners.add(listener);
3093
- if (directory === null) {
3094
- resolve();
3095
- if (directory === null) scheduleRetry();
3096
- }
3097
3239
  return function () { listeners.delete(listener); };
3098
3240
  },
3099
- directory: function () { return directory; },
3241
+ directory: function () { return resolve(); },
3100
3242
  select: function (payload) {
3101
- if (directory === null) resolve();
3243
+ resolve();
3102
3244
  if (directory === null || typeof directory.select !== "function") return null;
3103
3245
  return directory.select(payload);
3104
3246
  },
3105
3247
  destroy: function () {
3106
3248
  closed = true;
3107
3249
  if (retryTimer !== null) { window.clearTimeout(retryTimer); retryTimer = null; }
3250
+ if (notifyTimer !== null) { window.clearTimeout(notifyTimer); notifyTimer = null; }
3108
3251
  if (unsubscribe !== null) { try { unsubscribe(); } catch (err) { /* 忽略 */ } unsubscribe = null; }
3109
3252
  listeners.clear();
3110
3253
  directory = null;
3254
+ activeStore = null;
3111
3255
  },
3112
3256
  };
3113
3257
  }
@@ -3137,12 +3281,22 @@ window.__ModuleLoader__.load({
3137
3281
  }
3138
3282
 
3139
3283
  function teardownEntry(entry) {
3140
- if (entry.row === null) return;
3284
+ if (!entry) return;
3285
+ var removed = false;
3286
+ /* 即使 row 已经在宿主重建时被换掉,也要把旧容器从它原来的父节点摘掉;
3287
+ 否则会留下一个空 .dem-inline,行高仍是被 mountEntry 加高过的 8px 内边距。 */
3141
3288
  try {
3142
3289
  if (entry.container !== null && entry.container.parentNode) {
3143
3290
  entry.container.parentNode.removeChild(entry.container);
3291
+ removed = true;
3144
3292
  }
3145
3293
  } catch (err) { /* 容器可能已被官方一起销毁 */ }
3294
+ if (entry.row === null) {
3295
+ entry.container = null;
3296
+ entry.setContainer(null);
3297
+ if (removed) bumpResize();
3298
+ return;
3299
+ }
3146
3300
  try {
3147
3301
  entry.row.style.height = entry.prevStyle.height;
3148
3302
  entry.row.style.flexWrap = entry.prevStyle.flexWrap;
@@ -3170,6 +3324,7 @@ window.__ModuleLoader__.load({
3170
3324
  ? indexOverride
3171
3325
  : indexOfLevel(levels, effectiveEffortId(snapshot));
3172
3326
  var hot = liveIndex === levels.length - 1;
3327
+ var hotName = hot && levels[levels.length - 1] ? levels[levels.length - 1].name : "";
3173
3328
  /* 档位名来自模型目录,内容不可控;用无原型表,避免名字恰好是
3174
3329
  "__proto__" / "constructor" 时污染原型、把无关文字也染色。 */
3175
3330
  var byName = Object.create(null);
@@ -3184,7 +3339,9 @@ window.__ModuleLoader__.load({
3184
3339
  if (textInsideEditor(node, root)) continue;
3185
3340
  var host = node.parentElement;
3186
3341
  if (!host) continue;
3187
- if (hot) host.style.setProperty("color", tintColorOf(), "important");
3342
+ /* 只给**当前最高档**那一段文字上蓝;不能把卡片里其它档位名
3343
+ (例如刚切到新模型后行里显示的 Medium)也一起染蓝。 */
3344
+ if (hot && hotName && text === hotName) host.style.setProperty("color", tintColorOf(), "important");
3188
3345
  else if (host.style.getPropertyValue("color")) host.style.removeProperty("color");
3189
3346
  }
3190
3347
  }
@@ -3456,6 +3613,7 @@ window.__ModuleLoader__.load({
3456
3613
 
3457
3614
  var levels = levelsOf(state);
3458
3615
  var liveIndex = indexOfLevel(levels, effectiveEffortId(state));
3616
+ var currentModelId = modelIdOf(state && state.current && state.current.model);
3459
3617
 
3460
3618
  /* 容器裁到宿主浮层:形变/粒子只能在菜单面板里出现,不能顶到面板外。 */
3461
3619
  React.useEffect(function () {
@@ -3477,9 +3635,16 @@ window.__ModuleLoader__.load({
3477
3635
  var _draft = React.useState(null);
3478
3636
  var draft = _draft[0];
3479
3637
  var setDraft = _draft[1];
3638
+ /* 模型切换的当帧不能继续使用上一代 draft:否则新模型的首帧会先
3639
+ 按旧模型的 Max 画一遍,等 effect 清掉 draft 才回退,看起来就是
3640
+ 非最高档字符先蓝一下。等 modelIdRef 跟上后再恢复 draft。 */
3641
+ var sameModelAsPrevious = entry.modelIdRef.current === null
3642
+ || entry.modelIdRef.current === currentModelId;
3643
+ var draftForView = sameModelAsPrevious ? draft : null;
3480
3644
  /* 给 SlotComponent 的胶囊观察器读:等待宿主回写的窗口里,
3481
3645
  颜色必须跟 draft 目标走,不能读尚未更新的 snapshot。 */
3482
- entry.displayIndexRef.current = draft !== null ? draft : (liveIndex >= 0 ? liveIndex : null);
3646
+ entry.displayIndexRef.current = draftForView !== null ? draftForView : (liveIndex >= 0 ? liveIndex : null);
3647
+ entry.displayModelIdRef.current = currentModelId;
3483
3648
 
3484
3649
  var _hint = React.useState(null);
3485
3650
  var hint = _hint[0];
@@ -3491,6 +3656,41 @@ window.__ModuleLoader__.load({
3491
3656
  var flushIdleRef = React.useRef(null);
3492
3657
  var labelGuardRef = React.useRef(null);
3493
3658
 
3659
+ /* 模型换代时清掉上一代留下的乐观 draft / 待写档位:
3660
+ 否则旧模型的索引会短暂盖在新模型的轨道上,甚至把旧档位写进新模型。 */
3661
+ React.useEffect(function () {
3662
+ var previous = entry.modelIdRef.current;
3663
+ if (previous === null) {
3664
+ entry.modelIdRef.current = currentModelId;
3665
+ return;
3666
+ }
3667
+ if (previous === currentModelId) return;
3668
+ entry.modelIdRef.current = currentModelId;
3669
+ /* 旧模型的最高档索引立即作废;下一次绘制由快照的 liveIndex 决定。 */
3670
+ entry.displayIndexRef.current = null;
3671
+ entry.displayModelIdRef.current = currentModelId;
3672
+ var pending = pendingRef.current;
3673
+ pending.levelId = null;
3674
+ pending.inFlight = false;
3675
+ pending.seq += 1;
3676
+ pending.landed = false;
3677
+ pending.effortless = false;
3678
+ if (deadlineRef.current !== null) {
3679
+ window.clearTimeout(deadlineRef.current);
3680
+ deadlineRef.current = null;
3681
+ }
3682
+ if (flushTimerRef.current !== null) {
3683
+ window.clearTimeout(flushTimerRef.current);
3684
+ flushTimerRef.current = null;
3685
+ }
3686
+ if (flushIdleRef.current !== null && typeof window.cancelIdleCallback === "function") {
3687
+ window.cancelIdleCallback(flushIdleRef.current);
3688
+ flushIdleRef.current = null;
3689
+ }
3690
+ setDraft(null);
3691
+ setHint(null);
3692
+ }, [currentModelId, entry]);
3693
+
3494
3694
  function cancelPendingPick() {
3495
3695
  if (flushTimerRef.current !== null) {
3496
3696
  window.clearTimeout(flushTimerRef.current);
@@ -3512,17 +3712,17 @@ window.__ModuleLoader__.load({
3512
3712
  这里负责在组件提交后 / 回滚时再校准)。draft 清空 = 宿主已经接上
3513
3713
  真实档位,或写入失败要回滚,都用 liveIndex 重画。 */
3514
3714
  React.useEffect(function () {
3515
- var shown = draft !== null ? draft : liveIndex;
3715
+ var shown = draftForView !== null ? draftForView : liveIndex;
3516
3716
  paintEffortEverywhere(entry, levels, shown);
3517
- }, [draft, liveIndex, levels, entry]);
3717
+ }, [draftForView, liveIndex, levels, entry]);
3518
3718
 
3519
3719
  /* 官方行 / 输入胶囊可能在等待宿主回写的窗口里被 React 重渲染回旧字符;
3520
3720
  在 draft 未落库前守住目标文字,MutationObserver 的回调在 paint 前跑,
3521
3721
  所以画面不会闪回旧档位。paint 是幂等的,不会自激。 */
3522
3722
  React.useEffect(function () {
3523
- if (draft === null) return undefined;
3723
+ if (draftForView === null) return undefined;
3524
3724
  if (typeof MutationObserver !== "function") return undefined;
3525
- var target = draft;
3725
+ var target = draftForView;
3526
3726
  var roots = [];
3527
3727
  if (entry.row) roots.push(entry.row);
3528
3728
  if (entry.card && entry.card !== entry.row) {
@@ -3564,7 +3764,7 @@ window.__ModuleLoader__.load({
3564
3764
  }
3565
3765
  if (labelGuardRef.current === guards) labelGuardRef.current = null;
3566
3766
  };
3567
- }, [draft, levels, entry]);
3767
+ }, [draftForView, levels, entry]);
3568
3768
 
3569
3769
  React.useEffect(function () {
3570
3770
  return function () {
@@ -3611,7 +3811,8 @@ window.__ModuleLoader__.load({
3611
3811
 
3612
3812
  var snapshot = access.getSnapshot();
3613
3813
  var current = snapshot && snapshot.current;
3614
- if (!current || typeof current.provider !== "string" || typeof current.model !== "string") {
3814
+ var currentModel = modelIdOf(current && current.model);
3815
+ if (!current || typeof current.provider !== "string" || currentModel.length === 0) {
3615
3816
  setDraft(null);
3616
3817
  setHint("模型目录尚未就绪");
3617
3818
  return;
@@ -3620,7 +3821,7 @@ window.__ModuleLoader__.load({
3620
3821
 
3621
3822
  var result;
3622
3823
  try {
3623
- result = access.select({ provider: current.provider, model: current.model, reasoningEffort: levelId });
3824
+ result = access.select({ provider: current.provider, model: currentModel, reasoningEffort: levelId });
3624
3825
  } catch (err) {
3625
3826
  result = Promise.reject(err);
3626
3827
  }
@@ -3672,7 +3873,7 @@ window.__ModuleLoader__.load({
3672
3873
  pending.inFlight = true; /* 兜底写也是一笔宿主写,别让新档位插进来抢 */
3673
3874
  var plain = null;
3674
3875
  try {
3675
- plain = access.select({ provider: current.provider, model: current.model });
3876
+ plain = access.select({ provider: current.provider, model: currentModel });
3676
3877
  } catch (err2) {
3677
3878
  plain = Promise.reject(err2);
3678
3879
  }
@@ -3791,11 +3992,18 @@ window.__ModuleLoader__.load({
3791
3992
  if (levels.length === 0) return null;
3792
3993
 
3793
3994
  /* 目录快照未就绪时,先读官方行里的当前档位名;它通常比快照更早可用。
3794
- 两者都没有才隐藏轨道,等快照回来,绝不先画在 0 档。 */
3995
+ 两者都没有时先落在第 1 档,等快照回来再纠正;绝不先画在 0 档后消失。 */
3795
3996
  var rowIndex = rowEffortIndex(entry.row, levels);
3796
3997
  var seedIndex = liveIndex >= 0 ? liveIndex : rowIndex;
3797
- var indexReady = draft !== null || seedIndex >= 0;
3798
- var displayIndex = draft !== null ? draft : (seedIndex >= 0 ? seedIndex : 0);
3998
+ /* 最后一道兜底:只要这个模型确实声明了档位,就不能让轨道因为
3999
+ `current.reasoningEffort` / 行文案暂时解析不出来而完全消失。
4000
+ 正常路径仍优先用 liveIndex 或官方行里的真实档位名;两者都没有时
4001
+ 才先落在第 1 档,等宿主快照回来再由上面的优先级纠正。 */
4002
+ if (seedIndex < 0 && levels.length > 0) seedIndex = 0;
4003
+ var indexReady = levels.length > 0;
4004
+ var displayIndex = draftForView !== null ? draftForView : seedIndex;
4005
+ entry.displayIndexRef.current = draftForView !== null ? draftForView : seedIndex;
4006
+ entry.displayModelIdRef.current = currentModelId;
3799
4007
 
3800
4008
  return React.createElement(EffortTrack, {
3801
4009
  levels: levels,
@@ -3845,6 +4053,11 @@ window.__ModuleLoader__.load({
3845
4053
  setContainer: setContainer,
3846
4054
  /* 当前应染蓝的档位索引;由 ConnectedTrack 在每次渲染 / 落位时更新。 */
3847
4055
  displayIndexRef: { current: null },
4056
+ /* 这个索引属于哪个模型;模型切换后必须作废旧索引,否则会把
4057
+ 新模型的非最高档字符继续按旧模型的最高档染蓝。 */
4058
+ displayModelIdRef: { current: null },
4059
+ /* 上一次渲染时的模型 id,用于换代时清掉旧 draft / 待写档位。 */
4060
+ modelIdRef: { current: null },
3848
4061
  };
3849
4062
  entryRef.current = entry;
3850
4063
  composers.set(card, entry);
@@ -3865,7 +4078,13 @@ window.__ModuleLoader__.load({
3865
4078
  等待宿主回写的窗口里读 displayIndexRef,不能读尚未更新的 snapshot,
3866
4079
  否则会把刚落位的蓝先擦回灰。 */
3867
4080
  var snap = entry.access.getSnapshot();
3868
- var idx = entry.displayIndexRef.current;
4081
+ var snapModelId = modelIdOf(snap && snap.current && snap.current.model);
4082
+ /* 乐观索引必须和当前快照属于同一个模型;否则用户刚把模型 A 拉到
4083
+ 最高档就切换模型 B,这里还会拿 A 的最高档索引去染 B 的档位字符,
4084
+ B 的非最高档就会被误染成蓝色。模型不一致时强制回到快照真实档位。 */
4085
+ var idx = entry.displayModelIdRef.current === snapModelId
4086
+ ? entry.displayIndexRef.current
4087
+ : null;
3869
4088
  tintEffortText(card, snap, typeof idx === "number" ? idx : undefined);
3870
4089
  }
3871
4090
  function queueTint(records) {
@@ -4426,9 +4645,14 @@ window.__ModuleLoader__.load({
4426
4645
  exports.__internals = {
4427
4646
  levelsOf: levelsOf,
4428
4647
  effectiveEffortId: effectiveEffortId,
4648
+ indexOfLevel: indexOfLevel,
4649
+ rowEffortIndex: rowEffortIndex,
4650
+ tintEffortText: tintEffortText,
4651
+ createAccess: createAccess,
4429
4652
  pctOfIndex: pctOfIndex,
4430
4653
  indexOfPct: indexOfPct,
4431
4654
  ampOf: ampOf,
4655
+ particleSpeedOf: particleSpeedOf,
4432
4656
  cellColor: cellColor,
4433
4657
  findEffortRow: findEffortRow,
4434
4658
  shouldKeepMount: shouldKeepMount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-effort-mosaic",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "把 DSH 模型菜单里的推理等级档位换成一条滑轨:马赛克粒子墙(右侧静止、越往左越散)或 霓虹(蓝轨道 + 最高档蓝紫擦除渐变)。两套风格可切换 / A reasoning-effort track for DeepSeek Harness, with a pixel-mosaic style and a 霓虹变体",
5
5
  "icon": "./icon.svg",
6
6
  "license": "MIT",