dsh-config-manager 0.3.0 → 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.
Files changed (78) hide show
  1. package/lib/client.d.ts +33 -1
  2. package/lib/client.js +1063 -838
  3. package/lib/core/env-lock-lifecycle.d.ts +45 -0
  4. package/lib/core/env-lock-lifecycle.js +43 -0
  5. package/lib/core/history-prune.d.ts +34 -0
  6. package/lib/core/history-prune.js +43 -0
  7. package/lib/core/index.d.ts +1 -1
  8. package/lib/core/index.js +1 -1
  9. package/lib/core/migration-history.d.ts +28 -2
  10. package/lib/core/migration-history.js +41 -4
  11. package/lib/index.d.ts +2 -2
  12. package/lib/index.js +24 -6
  13. package/lib/routes/history.js +70 -5
  14. package/lib/routes/index.d.ts +1 -1
  15. package/lib/routes/kit.d.ts +2 -2
  16. package/lib/routes/messages.d.ts +1 -0
  17. package/lib/routes/messages.js +3 -0
  18. package/lib/sync/autosync-scheduler.js +6 -0
  19. package/lib/sync/backup-scheduler.js +6 -0
  20. package/lib/sync/s3/oss4-verify.js +21 -6
  21. package/lib/sync/s3/s3-providers.d.ts +13 -0
  22. package/lib/sync/s3/s3-providers.js +6 -0
  23. package/lib/sync/s3/s3-transport.d.ts +22 -0
  24. package/lib/sync/s3/s3-transport.js +89 -18
  25. package/lib/sync/ui-prefs.d.ts +8 -0
  26. package/lib/sync/ui-prefs.js +8 -0
  27. package/lib/utils/env-lock.d.ts +55 -1
  28. package/lib/utils/env-lock.js +131 -2
  29. package/lib/utils/messages-utils.d.ts +3 -0
  30. package/lib/utils/messages-utils.js +6 -0
  31. package/package.json +1 -1
  32. package/src/client/common/InfoHint.tsx +12 -3
  33. package/src/client/common/Skeleton.tsx +45 -8
  34. package/src/client/common/info-hint-guard.test.ts +196 -0
  35. package/src/client/common/routes.ts +3 -1
  36. package/src/client/common/skeleton-guard.test.ts +58 -0
  37. package/src/client/common/ui.tsx +17 -4
  38. package/src/client/config-manager.module.css +256 -27
  39. package/src/client/css-motion-guard.test.ts +230 -0
  40. package/src/client/environment/EnvironmentPanel.tsx +41 -29
  41. package/src/client/environment/maintenance/DiskUsageCard.tsx +28 -33
  42. package/src/client/environment/profiles-incomplete-ui.test.ts +9 -5
  43. package/src/client/export/ExportView.tsx +6 -6
  44. package/src/client/history/HistoryPanel.tsx +87 -2
  45. package/src/client/history/history-api.ts +49 -3
  46. package/src/client/history/history-locales.ts +30 -0
  47. package/src/client/home/HomePanel.tsx +55 -23
  48. package/src/client/market/MyConfigsWizard.tsx +12 -3
  49. package/src/client/recovery/RecoveryPanel.tsx +93 -92
  50. package/src/client/recovery/RollbackCard.tsx +25 -16
  51. package/src/client/sync/AutosyncCard.tsx +12 -6
  52. package/src/client/sync/ChannelConfigDialog.tsx +45 -45
  53. package/src/client/sync/DecryptPasswordCard.tsx +3 -3
  54. package/src/client/sync/SecurityOptionsCard.tsx +3 -3
  55. package/src/client/sync/SyncSectionPickerDialog.tsx +3 -3
  56. package/src/core/env-lock-lifecycle.ts +73 -0
  57. package/src/core/history-prune.test.ts +115 -0
  58. package/src/core/history-prune.ts +61 -0
  59. package/src/core/index.ts +2 -0
  60. package/src/core/migration-history.test.ts +78 -0
  61. package/src/core/migration-history.ts +46 -4
  62. package/src/index.ts +25 -6
  63. package/src/routes/history.ts +81 -4
  64. package/src/routes/index.ts +1 -1
  65. package/src/routes/kit.ts +2 -2
  66. package/src/routes/messages.ts +3 -0
  67. package/src/sync/autosync-scheduler.ts +3 -0
  68. package/src/sync/backup-scheduler.ts +3 -0
  69. package/src/sync/s3/oss4-verify.ts +22 -6
  70. package/src/sync/s3/s3-conditional-write.test.ts +153 -3
  71. package/src/sync/s3/s3-providers.ts +20 -0
  72. package/src/sync/s3/s3-transport.oss4-server.test.ts +48 -0
  73. package/src/sync/s3/s3-transport.ts +98 -17
  74. package/src/sync/ui-prefs.test.ts +32 -0
  75. package/src/sync/ui-prefs.ts +16 -0
  76. package/src/utils/env-lock.test.ts +107 -0
  77. package/src/utils/env-lock.ts +124 -2
  78. package/src/utils/messages-utils.ts +6 -0
@@ -171,8 +171,22 @@ body {
171
171
  --cm-motion-fast: 120ms;
172
172
  --cm-motion-base: 180ms;
173
173
  --cm-motion-slow: 300ms;
174
+ /* 勾形描边的专用时长(2026-11-04 用户实测「没有动画、或者太快」):
175
+ 180ms 的 base 放在 16px 方框上只是一闪,读不出「一路画过去」的行程;340ms 才看得见笔尖移动。
176
+ **只给 checkStroke 用**,别扩散到其它过渡(其它动效的克制靠 fast/base/slow 三档)。 */
177
+ --cm-motion-draw: 340ms;
178
+ /* 描边的缓动也单独一支,**只给 checkStroke 用**(2026-11-04 实测三组进度):
179
+ `ease-out` 前 60ms 就画完 82%,看上去仍像"啪"地出现;`ease-in-out` 前 60ms 只画 6%,
180
+ 像先卡住再猛跳。这一支在 60/85/170/255ms 分别是 13%/23%/64%/91% —— 起笔立刻动、
181
+ 中段匀速、收笔收敛,才读得出是"画"出来的。 */
182
+ --cm-motion-ease-draw: cubic-bezier(0.3, 0.05, 0.5, 1);
174
183
  --cm-motion-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
175
184
  --cm-motion-ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);
185
+ /* 按压回弹的弹簧曲线(2026-11-04):**只有按压回弹用它**,别扩散到其它过渡。
186
+ linear() 允许进度超过 1 —— 这是 CSS 里唯一能表达「过冲到目标之外再回来」的缓动形态
187
+ (三次贝塞尔的过冲量只有行程的 ~10%,在 28px 按钮上不到 0.2px,肉眼无感)。
188
+ 峰值 1.58 = 落回时先到 102% 再回 100%。见 §3「按压回弹」。 */
189
+ --cm-press-spring: linear(0, 0.26 22%, 0.62 42%, 0.88 58%, 1.12 70%, 1.58 82%, 1.24 90%, 1.06 96%, 1 100%);
176
190
  }
177
191
 
178
192
  /* 交互过渡统一参数(hover/focus 颜色过渡;仅颜色属性,克制) */
@@ -182,6 +196,28 @@ body {
182
196
  transition-timing-function: ease;
183
197
  }
184
198
 
199
+ /* —— 按压回弹(2026-11-04 用户要求:按下缩到 96%,松手过冲一点再落回 100%)——
200
+ 为什么用 transition 的**逐属性列表**而不是再写一条 transition 简写:简写会整体顶掉上面那条
201
+ 三色过渡的 property/duration/timing(同一元素上后写的简写覆盖整个列表),hover 变色就没了。
202
+ 这里只把 transform 那一条换成更长的弹簧曲线,三色仍是 120ms ease;按下态再把本条的
203
+ timing 换回 ease-out(跟手、不飘)—— 时长仍是 --cm-motion-fast,松手时自动回到弹簧那条。
204
+ 弹簧曲线用 linear():它允许进度**超过 1**,过冲量才读得出来;三次贝塞尔 curve 的过冲只有
205
+ 行程的 ~10%(4% 行程 ⇒ 0.4% 尺寸,28px 按钮上不到 0.2px,等于看不见)。峰值 1.58 ⇒ 落回
206
+ 102% 左右,正是「略超过原尺寸」。
207
+ 触发面 = 原生 <button> + 带 data-pressable 的外链按钮(common/ui.tsx 的 Button href 分支):
208
+ 正文里的行内 <a> 不参与 —— 否则聊天/报告里点个链接整行都会抖一下。
209
+ prefers-reduced-motion 下整条关掉(见 §15)。 */
210
+ .section :is(button, [data-pressable]) {
211
+ transition-property: background-color, border-color, color, transform;
212
+ transition-duration: var(--cm-motion-fast), var(--cm-motion-fast), var(--cm-motion-fast), var(--cm-motion-base);
213
+ transition-timing-function: ease, ease, ease, var(--cm-press-spring);
214
+ }
215
+
216
+ .section :is(button, [data-pressable]):not(:disabled):active {
217
+ transform: scale(0.96);
218
+ transition-timing-function: ease, ease, ease, ease-out;
219
+ }
220
+
185
221
  /* 键盘焦点环:仅键盘导航(:focus-visible)触发 */
186
222
  .section :is(button, a, input, select, textarea, [role='tab']):focus-visible {
187
223
  outline: var(--cm-focus-width) solid var(--cm-focus-color);
@@ -1382,6 +1418,76 @@ body {
1382
1418
  outline-offset: 2px;
1383
1419
  }
1384
1420
 
1421
+ /* —— 勾选框自绘 + 勾形描边(2026-11-04 用户要求)——
1422
+ 为什么要自绘:原生 checkbox 的勾选过程由 UA 决定(Chrome/Edge 只有一次淡入),
1423
+ ::before/::after 也画不进去 —— 「勾从左下角一路画到右上角」在原生控件里落不了地。
1424
+
1425
+ 柱子怎么搭:appearance:none 接管盒子 → 勾形是一张 SVG 笔画的 **mask**(stroke 圆头),
1426
+ 再对 ::after 做 clip-path 从左往右揭开。视觉上笔尖正好从勾最左下的起笔点开始,
1427
+ 扫到最右上的收笔点,与真实手写的方向一致。
1428
+
1429
+ · 16×16 + **显式 border-box**:本仓库没有全局 `*{box-sizing}` 复位(见黑块溢出那条注释),
1430
+ 漏写就吃 UA 的 content-box ⇒ 18×18,行高被顶起来。
1431
+ · 居中用 `inset: 2px` 而不是 `margin: auto`:scale 守卫只放行
1432
+ padding/margin/gap ∈ {0,1,2,4,6,8,10,12,14,16,24},`auto` 会被拦(css-scale-guard scale-05)。
1433
+ · 不用 `opacity` 表达「未勾选」:clip-path 收到 0 宽即可,这样勾形始终在树里,
1434
+ 动画每次都从同一个基点起跑(勾选 → 取消 → 再勾选,动画能重放)。
1435
+ · 单选(radio)保持原生:圆点的「描边」与打勾不是同一件事,硬套会像图钉。 */
1436
+ .section input[type='checkbox'] {
1437
+ appearance: none;
1438
+ box-sizing: border-box;
1439
+ position: relative;
1440
+ display: inline-block;
1441
+ width: 16px;
1442
+ height: 16px;
1443
+ flex: none;
1444
+ vertical-align: middle;
1445
+ border: 1px solid var(--cm-line-2);
1446
+ border-radius: var(--cm-r-1);
1447
+ background-color: var(--cm-input-bg);
1448
+ cursor: pointer;
1449
+ transition: background-color var(--cm-motion-fast) ease, border-color var(--cm-motion-fast) ease;
1450
+ }
1451
+
1452
+ .section input[type='checkbox']:hover:not(:disabled) {
1453
+ border-color: var(--cm-brand);
1454
+ }
1455
+
1456
+ .section input[type='checkbox']:disabled {
1457
+ cursor: default;
1458
+ opacity: 0.5;
1459
+ }
1460
+
1461
+ .section input[type='checkbox']:checked {
1462
+ border-color: var(--cm-brand);
1463
+ background-color: var(--cm-brand);
1464
+ }
1465
+
1466
+ .section input[type='checkbox']::after {
1467
+ content: '';
1468
+ position: absolute;
1469
+ inset: 2px;
1470
+ background-color: var(--cm-text-on-accent);
1471
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13.2 9.4 18.6 20 6.4'/%3E%3C/svg%3E");
1472
+ mask-repeat: no-repeat;
1473
+ mask-position: center;
1474
+ mask-size: 100% 100%;
1475
+ clip-path: inset(0 100% 0 0);
1476
+ }
1477
+
1478
+ .section input[type='checkbox']:checked::after {
1479
+ animation: checkStroke var(--cm-motion-draw) var(--cm-motion-ease-draw) forwards;
1480
+ }
1481
+
1482
+ @keyframes checkStroke {
1483
+ from {
1484
+ clip-path: inset(0 100% 0 0);
1485
+ }
1486
+ to {
1487
+ clip-path: inset(0 0 0 0);
1488
+ }
1489
+ }
1490
+
1385
1491
  /* 「左标题 · 右开关」行(2026-11-01)。设置类开关的标题就是这一行的名字,
1386
1492
  开关是这一行的值 —— 控件跟在标题后面读起来是「启用 ☑」,用户得先读半句再找方框,
1387
1493
  而 564px 画布里每行右侧本来就空着。开关统一贴右:勾选框仍在标签内(点标题也能切),
@@ -1720,12 +1826,6 @@ body {
1720
1826
  border-radius: var(--cm-r-1);
1721
1827
  }
1722
1828
 
1723
- /* 骨架下方的可见文案(与 Spinner 的 label 同义):加载反馈必须能被读到,不只靠色块 */
1724
- .skeletonCaption {
1725
- font-size: var(--cm-fs-meta);
1726
- color: var(--dsw-alias-label-tertiary);
1727
- }
1728
-
1729
1829
  /* ================================================================ §4 Surfaces */
1730
1830
 
1731
1831
  .card {
@@ -1951,6 +2051,19 @@ body {
1951
2051
  }
1952
2052
 
1953
2053
  /* 空态 */
2054
+ /* —— 一行式状态行(2026-11-04)——
2055
+ * 「暂无恢复事项」这类**已知为空**的结论只需要一行字 + 一个状态点,不需要虚线空框:
2056
+ * 空框有 24px 上下内边距 + 边框,视觉上读作「这里本该有内容却没加载出来」,
2057
+ * 而且它会把下面的磁盘占用 / 会话体检 / 回滚点整块推到首屏之外。
2058
+ * 用 .empty 的空态(如列表没数据、需要引导)继续用 .empty;只表达状态时用本类。 */
2059
+ .statusLine {
2060
+ display: flex;
2061
+ align-items: center;
2062
+ gap: 6px;
2063
+ font-size: var(--cm-fs-meta);
2064
+ color: var(--dsw-alias-label-tertiary);
2065
+ }
2066
+
1954
2067
  .empty {
1955
2068
  animation: itemEnter var(--cm-motion-base) var(--cm-motion-ease-out);
1956
2069
  display: flex;
@@ -3232,28 +3345,68 @@ body {
3232
3345
  min-height: 0;
3233
3346
  }
3234
3347
 
3235
- /* 列宽显式给定(2026-11-01):table-layout: fixed 下不给宽度时浏览器按首行内容分配,
3236
- Cleanup policy 只剩 ~118px —— "Auto-removed after 7 days"、"Your data / safety net
3237
- (never auto-removed)" 全被省略号截掉,而这一列恰好是「这块数据能不能删」的唯一答案。 */
3238
- .diskUsageScroll th:nth-child(2) { width: 78px; }
3239
- .diskUsageScroll th:nth-child(3) { width: 86px; }
3240
- .diskUsageScroll th:nth-child(4) { width: 160px; }
3348
+ /* —— 磁盘明细:两行式行卡(2026-11-04,替换原四列表格)——
3349
+ *
3350
+ * 为什么换:564px 画布下四列把「回收策略」压到 160px,"Your data / safety net
3351
+ * (never auto-removed)" 折成三行;表头再固定吃掉 24px。而这张卡的唯一决定是
3352
+ * 「哪几块能删、删了多大」—— 靠的是**比大小**,不是三列对齐。
3353
+ *
3354
+ * 行内层级:
3355
+ * ① 首行 = 区域名(左)+ 占用(右,整卡唯一的右边缘 ⇒ 量级一眼可比);
3356
+ * ② meta 行 = 文件数 + 回收策略徽章 + 过期量 —— 策略拿到整行宽度,不再折行。
3357
+ * 表头由行内语义承担:占用自带单位(4.8 KB),文件数自带「个文件」。
3358
+ * 区域名**允许换行**而不是省略号:它是「这是哪块数据」的唯一线索,
3359
+ * 长名字截成「Sync config & work…」等于没写;行高增长交给滚动区吸收。 */
3360
+ .duList {
3361
+ display: flex;
3362
+ flex-direction: column;
3363
+ }
3241
3364
 
3242
- /* 数值两列不需要省略号:内容永远是「4.8 KB」「235 file(s)」这种短串,
3243
- 一旦被 .tableFixed 的 ellipsis 截成 "265.0 …" 就完全读不出量级。 */
3244
- .diskUsageScroll td:nth-child(2),
3245
- .diskUsageScroll td:nth-child(3) {
3246
- overflow: visible;
3247
- text-overflow: clip;
3365
+ .duRow {
3366
+ display: flex;
3367
+ flex-direction: column;
3368
+ gap: 2px;
3369
+ padding: 8px 0;
3370
+ border-bottom: 1px solid var(--dsw-alias-border-l1);
3248
3371
  }
3249
3372
 
3250
- /* 策略列允许换行(其余列是短标签,保持单行省略) */
3251
- .diskUsageScroll td:nth-child(4) { white-space: normal; }
3373
+ .duRow:last-child {
3374
+ border-bottom: none;
3375
+ }
3252
3376
 
3253
- /* 第一列也允许换行(2026-11-01):内容列剩 186px,"Sync config & workbook copies" 这类
3254
- 长名字一律被截成「Sync config & work…」—— 而这一列就是「这是哪块数据」的唯一线索。
3255
- 表格行高由 .tableFixed 的 min-height 兜住,换行后仍是两行可读,不会塌成 4px。 */
3256
- .diskUsageScroll td:nth-child(1) { white-space: normal; }
3377
+ .duRowTop {
3378
+ display: flex;
3379
+ align-items: baseline;
3380
+ gap: 12px;
3381
+ }
3382
+
3383
+ .duRowName {
3384
+ flex: 1 1 auto;
3385
+ min-width: 0;
3386
+ font-size: var(--cm-fs-table);
3387
+ color: var(--dsw-alias-label-primary);
3388
+ }
3389
+
3390
+ .duRowSize {
3391
+ flex: none;
3392
+ font-size: var(--cm-fs-table);
3393
+ font-variant-numeric: tabular-nums;
3394
+ color: var(--dsw-alias-label-primary);
3395
+ }
3396
+
3397
+ .duRowMeta {
3398
+ display: flex;
3399
+ align-items: center;
3400
+ gap: 8px;
3401
+ min-width: 0;
3402
+ font-size: var(--cm-fs-meta);
3403
+ color: var(--dsw-alias-label-tertiary);
3404
+ }
3405
+
3406
+ .duRowFiles {
3407
+ flex: none;
3408
+ font-variant-numeric: tabular-nums;
3409
+ }
3257
3410
 
3258
3411
  /* 卡内小节之间留出间隔(2026-11-01):表格滚动区下方紧贴的「Legacy data」分组标签
3259
3412
  原本与最后一行数据只差 2px,读起来像表格的又一行数据。 */
@@ -3385,6 +3538,59 @@ body {
3385
3538
  white-space: nowrap;
3386
3539
  }
3387
3540
 
3541
+ /* —— 最近活动骨架:与真实表同一几何(2026-11-04 用户要求「占位条宽高与真实内容一致、
3542
+ 原位替换、布局不跳」)——
3543
+ 旧骨架是通用「图标 + 两行 + 动作位」行(52px),真实态却是一张 4 列日志表(行高 38.5px、
3544
+ 带静态列头)⇒ 数据一到整块的高度、列位、滚动条都会跳一下。这里把真实行的
3545
+ grid / gap / padding / 行高 / 分隔线整套照抄,只把 4 列内容换成占位条:
3546
+ · 时间列 44px(真实 mono 时间 "20:31:04" 的宽度档,右对齐与 .activityTime 一致)
3547
+ · 事件列 72px(≤ 定宽 96px 列,留出 ellipsis 的余量)
3548
+ · 详情列 62%(弹性列按比例给,右边空出来正好是 CopyButton 的落点)
3549
+ · 结果列 44px(徽章宽度档,右对齐)
3550
+ 骨架行装在 .activityRows 里(同一个滚动容器 ⇒ 滚动条槽占位也一致),
3551
+ 配色与 shimmer 复用 .skeletonBar(§15 已覆盖 reduced-motion 下的静默)。 */
3552
+ .activitySkeletonRow {
3553
+ box-sizing: border-box;
3554
+ display: grid;
3555
+ grid-template-columns: 72px 96px minmax(0, 1fr) auto;
3556
+ align-items: center;
3557
+ gap: 10px;
3558
+ padding: 10px 10px;
3559
+ /* 真实行 = 上下 10px + 一行 18px(12px × 1.5)+ 0.5px 分隔线 = 38.5px。
3560
+ 占位条只有 12px 高,行高必须钉死,否则骨架行会比真实行矮 6px。 */
3561
+ height: 38.5px;
3562
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2);
3563
+ }
3564
+
3565
+ .activitySkeletonRow:last-child {
3566
+ border-bottom: none;
3567
+ }
3568
+
3569
+ .activitySkeletonTime,
3570
+ .activitySkeletonKind,
3571
+ .activitySkeletonSummary,
3572
+ .activitySkeletonResult {
3573
+ height: 12px;
3574
+ }
3575
+
3576
+ .activitySkeletonTime {
3577
+ justify-self: end;
3578
+ width: 44px;
3579
+ }
3580
+
3581
+ .activitySkeletonKind {
3582
+ width: 72px;
3583
+ }
3584
+
3585
+ .activitySkeletonSummary {
3586
+ width: 62%;
3587
+ }
3588
+
3589
+ .activitySkeletonResult {
3590
+ justify-self: end;
3591
+ width: 44px;
3592
+ }
3593
+
3388
3594
  /* —— 备份位置卡:四列事实网格(标签上、值下,tabular-nums 对齐) —— */
3389
3595
  /* 卡内小节分隔(2026-11-01):同一张卡里的第二块内容不再套 Card,改用顶线 + 上下 10px。
3390
3596
  0.5px + border-l2 与 css 里既有的 4 处卡内分节一致(DESIGN.md:行分隔 0.5px、外框 1px)。 */
@@ -5470,6 +5676,16 @@ button.profileRowMain:hover {
5470
5676
  animation: none;
5471
5677
  background-image: none;
5472
5678
  }
5679
+ /* 按压回弹:缩小 + 过冲都是纯装饰,关掉后点击仍有瞬时背景反馈(§3 的弹簧曲线不动其它过渡) */
5680
+ .section :is(button, [data-pressable]):not(:disabled):active {
5681
+ transform: none;
5682
+ }
5683
+ /* 勾形描边:关掉动画,但**必须**把揭开的终态一起写上 ——
5684
+ 基础态是 clip-path: inset(0 100% 0 0)(等于完全裁掉),只关 animation 会让勾形永远看不见。 */
5685
+ .section input[type='checkbox']:checked::after {
5686
+ animation: none;
5687
+ clip-path: inset(0 0 0 0);
5688
+ }
5473
5689
  }
5474
5690
  /* ================================================================ §16 Page: Foreign agent import
5475
5691
 
@@ -6471,11 +6687,14 @@ button.profileRowMain:hover {
6471
6687
  }
6472
6688
 
6473
6689
  /* 数据口径块(未深度校验 / 被隐藏的正常会话 / 超上限 / 读不出条目 / 截断):
6474
- 与上面的数字用一条分隔线分开 —— 它们是「这次统计覆盖了多少」,不是待办。 */
6690
+ 与上面的数字用一条分隔线分开 —— 它们是「这次统计覆盖了多少」,不是待办。
6691
+ 2026-11-04:四条口径原先**竖排**(≈92px),把列表头挤出 620px 弹窗首屏;
6692
+ 改成横向 wrap 后同样四条事实只占 1~2 行。 */
6475
6693
  .shNotes {
6476
6694
  display: flex;
6477
- flex-direction: column;
6478
- gap: 4px;
6695
+ flex-wrap: wrap;
6696
+ align-items: center;
6697
+ gap: 4px 6px;
6479
6698
  padding-top: 8px;
6480
6699
  border-top: 1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 60%, transparent);
6481
6700
  }
@@ -6506,6 +6725,9 @@ button.profileRowMain:hover {
6506
6725
  .snapshotList.shScroll {
6507
6726
  padding: 8px;
6508
6727
  background: var(--dsw-alias-bg-base);
6728
+ /* 弹窗只有 620px 高:列表再高就要靠整页外滚动去找「修复计划 / 结果」,
6729
+ 限到 300px 让列表自己内滚、面板留在首屏内。 */
6730
+ max-height: 300px;
6509
6731
  }
6510
6732
 
6511
6733
  .shRow {
@@ -6617,6 +6839,13 @@ button.profileRowMain:hover {
6617
6839
  margin-bottom: 6px;
6618
6840
  }
6619
6841
 
6842
+ /* 面板内的动作行(2026-11-04 反馈「按钮上下边距」):旧 .actionRow 是 0 / 10px ——
6843
+ 按钮上边贴着上一行字、下边叠上面板自身 padding 变成 20px,上下不对称。
6844
+ 面板内改成上 8、下 0(底部留白交给 .shPanel 的 padding)。 */
6845
+ .shPanel > .actionRow {
6846
+ margin: 8px 0 0;
6847
+ }
6848
+
6620
6849
  .shPanelTitle {
6621
6850
  flex: 1 1 auto;
6622
6851
  min-width: 0;
@@ -0,0 +1,230 @@
1
+ /**
2
+ * 动效守卫(源码级、零依赖、只读):2026-11-04 用户提的「按压回弹」与「勾形描边」两条。
3
+ *
4
+ * 钉住三件事(每条都带负向自检,删掉即红):
5
+ * 1. **按压回弹的两侧必须同时成立**:CSS 端 `\:active` 缩到 96%、松手用 `linear()` 弹簧曲线过冲
6
+ * 再落回;JSX 端**外链按钮**(Button 的 href 分支渲染 `<a>`)必须打 `data-pressable` ——
7
+ * 选择器是 `:is(button, [data-pressable])`,属性没人写就等于外链按钮永远没有按压反馈。
8
+ * 这条是实测发现的漂移(CSS 写了、JSX 漏了),所以两侧一起钉。
9
+ * 2. **勾形描边的落点**:勾不是原生 UA 画的(原生 checkbox 只有一次淡入,::before/::after
10
+ * 画不进去),而是 `appearance:none` + SVG mask 当笔画 + `clip-path` 从左往右揭开;
11
+ * 柱子必须有显式 `box-sizing: border-box`(本仓库没有全局 `*{box-sizing}` 复位)。
12
+ * 3. **reduced-motion 的终态**:关掉动画后**必须补上揭开的终态** clip-path,否则勾形永远是
13
+ * 裁掉的样子(勾选框看起来全空)。这是「减法动画」最容易踩的坑,单列一条钉住。
14
+ *
15
+ * 复现:`node --test src/client/css-motion-guard.test.ts`
16
+ */
17
+ import test from 'node:test';
18
+ import assert from 'node:assert/strict';
19
+ import fs from 'node:fs';
20
+ import path from 'node:path';
21
+
22
+ import { stripJsComments } from '../utils/bundle-scan.ts';
23
+
24
+ /** 仓库根(本文件位于 <root>/src/client/)。 */
25
+ const ROOT = path.resolve(import.meta.dirname, '../..');
26
+ const STYLE_FILE = 'src/client/config-manager.module.css';
27
+ const UI_FILE = 'src/client/common/ui.tsx';
28
+
29
+ /** 读取即折 LF(issue #70 同口径:锚点全是含 \n 的源码字面量)。 */
30
+ const read = (rel: string): string => fs.readFileSync(path.join(ROOT, rel), 'utf8').replace(/\r\n?/g, '\n');
31
+
32
+ /** 负向自检的改写:锚点必须命中(源码改了要同步守卫,而不是静默绿灯)。 */
33
+ function mutate(text: string, from: string, to: string): string {
34
+ assert.ok(text.includes(from), '负向自检锚点未命中(源码改写后需同步守卫):' + from);
35
+ return text.replace(from, to);
36
+ }
37
+
38
+ /** 取一条选择器规则的声明块(含嵌套花括号也要正确闭合)。 */
39
+ function ruleBody(css: string, selector: string): string | null {
40
+ const at = css.indexOf(selector);
41
+ if (at === -1) return null;
42
+ const open = css.indexOf('{', at);
43
+ if (open === -1) return null;
44
+ let depth = 0;
45
+ for (let i = open; i < css.length; i++) {
46
+ if (css[i] === '{') depth++;
47
+ else if (css[i] === '}') {
48
+ depth--;
49
+ if (depth === 0) return css.slice(open + 1, i);
50
+ }
51
+ }
52
+ return null;
53
+ }
54
+
55
+ /**
56
+ * 所有 reduced-motion 媒体块的正文。
57
+ * 为什么是复数:样式表里有多个 `@media (prefers-reduced-motion: reduce)` 块(历史遗留 + 本次追加),
58
+ * 只取第一处会让守卫看漏(第一处恰是 `.taskPanel`,与本次改动无关)。
59
+ */
60
+ function reducedMotionBodies(css: string): string[] {
61
+ const out: string[] = [];
62
+ const needle = '@media (prefers-reduced-motion: reduce)';
63
+ let from = 0;
64
+ for (;;) {
65
+ const at = css.indexOf(needle, from);
66
+ if (at === -1) break;
67
+ const body = ruleBody(css.slice(at), needle);
68
+ if (body !== null) out.push(body);
69
+ from = at + needle.length;
70
+ }
71
+ return out;
72
+ }
73
+
74
+ /** reduced-motion 违规扫描:关动画的同时必须补终态。 */
75
+ function findReducedMotionViolations(css: string): string[] {
76
+ const bodies = reducedMotionBodies(css).join('\n');
77
+ if (bodies === '') return ['缺少 @media (prefers-reduced-motion: reduce) 块'];
78
+ const violations: string[] = [];
79
+ if (!/:is\(button, \[data-pressable\]\):not\(:disabled\):active\s*\{[^}]*transform:\s*none/.test(bodies)) {
80
+ violations.push('reduced-motion 下必须关掉按压缩放(transform: none)');
81
+ }
82
+ const checked = ruleBody(bodies, ".section input[type='checkbox']:checked::after {");
83
+ if (checked === null) {
84
+ violations.push('reduced-motion 下必须单独处理勾选态');
85
+ return violations;
86
+ }
87
+ if (!/animation:\s*none/.test(checked)) violations.push('reduced-motion 下必须关掉描边动画');
88
+ if (!/clip-path:\s*inset\(0 0 0 0\)/.test(checked)) {
89
+ violations.push('reduced-motion 下必须补上「全部露出」的终态(只关 animation 会让勾形永远被裁掉)');
90
+ }
91
+ return violations;
92
+ }
93
+
94
+ /** 按压回弹违规扫描(CSS 侧)。 */
95
+ function findPressCssViolations(css: string): string[] {
96
+ const violations: string[] = [];
97
+ if (!/--cm-press-spring:\s*linear\(/.test(css)) {
98
+ violations.push('缺少 --cm-press-spring: linear(…) —— 三次贝塞尔的过冲在按钮尺寸上肉眼无感,只能用 linear() 的 >1 进度');
99
+ }
100
+ const base = ruleBody(css, '.section :is(button, [data-pressable]) {');
101
+ if (base === null) {
102
+ violations.push('缺少按压回弹的基础规则 .section :is(button, [data-pressable])');
103
+ } else {
104
+ if (!/transition-property:[^;]*transform/.test(base)) violations.push('基础规则必须把 transform 放进 transition-property(否则缩放是瞬跳)');
105
+ if (!/transition-timing-function:[^;]*--cm-press-spring/.test(base)) violations.push('松手必须用 --cm-press-spring(弹簧过冲的来源)');
106
+ // 三色过渡不能被顶掉:简写会整体覆盖列表,这里要求列表里同时有颜色与 transform
107
+ if (!/transition-property:[^;]*background-color/.test(base) || !/transition-property:[^;]*color/.test(base)) {
108
+ violations.push('transform 必须并进三色过渡的列表,不得用 transition 简写顶掉 hover 变色');
109
+ }
110
+ }
111
+ const active = ruleBody(css, '.section :is(button, [data-pressable]):not(:disabled):active {');
112
+ if (active === null) {
113
+ violations.push('缺少 :active 规则(按下时的缩小态)');
114
+ } else {
115
+ if (!/transform:\s*scale\(0\.96\)/.test(active)) violations.push(':active 必须缩到 scale(0.96)(用户要求 96%)');
116
+ if (!/transition-timing-function:[^;]*ease-out/.test(active)) violations.push(':active 的 transform 必须回到 ease-out(跟手、不飘)');
117
+ }
118
+ return violations;
119
+ }
120
+
121
+ test('t13-1 按压回弹:按到 96%、松手弹簧过冲(CSS 侧的曲线与档位)', () => {
122
+ const css = read(STYLE_FILE);
123
+ const violations = findPressCssViolations(css);
124
+ assert.deepEqual(violations, [], '按压回弹的样式不完整:\n' + violations.join('\n'));
125
+
126
+ const noScale = mutate(css, ' transform: scale(0.96);', ' transform: none;');
127
+ assert.ok(findPressCssViolations(noScale).length >= 1, '去掉 96% 缩放必须报红');
128
+ const noSpring = mutate(css, 'transition-timing-function: ease, ease, ease, var(--cm-press-spring);', 'transition-timing-function: ease;');
129
+ assert.ok(findPressCssViolations(noSpring).length >= 1, '松手不用弹簧曲线必须报红');
130
+ const shorthand = mutate(
131
+ css,
132
+ ' transition-property: background-color, border-color, color, transform;\n transition-duration: var(--cm-motion-fast), var(--cm-motion-fast), var(--cm-motion-fast), var(--cm-motion-base);\n transition-timing-function: ease, ease, ease, var(--cm-press-spring);',
133
+ ' transition: transform var(--cm-motion-base) var(--cm-press-spring);',
134
+ );
135
+ assert.ok(findPressCssViolations(shorthand).length >= 1, '退回 transition 简写(会顶掉 hover 变色)必须报红');
136
+ });
137
+
138
+ /** Button 的 href 分支渲染出的 `<a>` 开标签原文(找不到返回 null)。 */
139
+ function anchorTagOf(ui: string): string | null {
140
+ const branch = ui.indexOf('if (href !== undefined) {');
141
+ if (branch === -1) return null;
142
+ const start = ui.indexOf('<a', branch);
143
+ if (start === -1) return null;
144
+ const end = ui.indexOf('>', start);
145
+ if (end === -1) return null;
146
+ return ui.slice(start, end + 1);
147
+ }
148
+
149
+ test('t13-2 外链按钮必须打 data-pressable(选择器靠属性入队,漏写就没有按压反馈)', () => {
150
+ const ui = stripJsComments(read(UI_FILE), true, false);
151
+ const tag = anchorTagOf(ui);
152
+ assert.ok(tag !== null, UI_FILE + ' 里找不到 Button 的 href 分支渲染的 <a>(守卫需同步)');
153
+ assert.ok(
154
+ tag.includes('data-pressable'),
155
+ '外链按钮必须带 data-pressable=""(CSS 的按压选择器只认 button 与该属性):' + tag.replace(/\s+/g, ' '),
156
+ );
157
+ // 负向自检:删掉属性后同一条判据必须红
158
+ const stripped = mutate(ui, ' data-pressable=""\n', '');
159
+ const strippedTag = anchorTagOf(stripped);
160
+ assert.ok(strippedTag !== null && !strippedTag.includes('data-pressable'), '负向自检:删掉属性后必须判定为缺属性');
161
+ });
162
+
163
+ /** 勾形描边违规扫描(自绘 + 笔画方向 + 播放时机)。 */
164
+ function findCheckStrokeViolations(css: string): string[] {
165
+ const violations: string[] = [];
166
+ const base = ruleBody(css, ".section input[type='checkbox'] {");
167
+ if (base === null) {
168
+ violations.push('缺少勾选框自绘的基础规则 input[type=checkbox]');
169
+ } else {
170
+ if (!/appearance:\s*none/.test(base)) violations.push('必须 appearance:none 接管原生勾选框(原生只有一次淡入,画不出描边)');
171
+ if (!/box-sizing:\s*border-box/.test(base)) violations.push('必须显式 box-sizing:border-box(仓库没有全局 *{box-sizing} 复位)');
172
+ }
173
+ const mark = ruleBody(css, ".section input[type='checkbox']::after {");
174
+ if (mark === null) {
175
+ violations.push('缺少 ::after 的勾形');
176
+ } else {
177
+ if (!/mask-image:\s*url\("data:image\/svg\+xml/.test(mark)) violations.push('勾形必须是 SVG 笔画 mask(不是字符、不是第二张图)');
178
+ if (!/clip-path:\s*inset\(0 100% 0 0\)/.test(mark)) violations.push('未勾选时必须整条裁掉(起点 = 左下起笔)');
179
+ }
180
+ if (!/@keyframes checkStroke\s*\{[\s\S]*?from\s*\{[^}]*clip-path:\s*inset\(0 100% 0 0\)[\s\S]*?to\s*\{[^}]*clip-path:\s*inset\(0 0 0 0\)/.test(css)) {
181
+ violations.push('checkStroke 必须从「整条裁掉」到「全部露出」——即从左往右一路画过去');
182
+ }
183
+ const checked = ruleBody(css, ".section input[type='checkbox']:checked::after {");
184
+ if (checked === null || !/animation:\s*checkStroke/.test(checked)) violations.push('勾选态必须播放 checkStroke');
185
+ else if (!/animation:\s*checkStroke\s+var\(--cm-motion-draw\)/.test(checked)) {
186
+ // 用户实测(2026-11-04 第二条):「没有动画或者太快」—— 180ms 的 base 在 16px 方框上只是一闪。
187
+ violations.push('勾选态必须用 --cm-motion-draw 播描边(base 的 180ms 太快,读不出笔画移动)');
188
+ } else if (!/var\(--cm-motion-draw\)\s+var\(--cm-motion-ease-draw\)/.test(checked)) {
189
+ // 缓动也是观感的一部分:ease-out 前 60ms 就画完 82%(仍像瞬间出现),ease-in-out 前 60ms 只有 6%(像先卡住)。
190
+ violations.push('勾选态必须用 --cm-motion-ease-draw(通用缓动的前段进度不适合「画」,实测要么一闪要么先卡住)');
191
+ }
192
+ const draw = /--cm-motion-draw:\s*(\d+)ms;/.exec(css);
193
+ if (draw === null) {
194
+ violations.push('--cm-motion-draw 必须定义在 body 上(缺定义 ⇒ 时长在 computed-value 阶段失效,动画静默不播)');
195
+ } else if (Number(draw[1]) < 300) {
196
+ violations.push('--cm-motion-draw 至少 300ms(用户实测 180ms 太快)');
197
+ }
198
+ if (!/--cm-motion-ease-draw:\s*cubic-bezier\(/.test(css)) {
199
+ violations.push('--cm-motion-ease-draw 必须以 cubic-bezier(…) 定义在 body 上');
200
+ }
201
+ return violations;
202
+ }
203
+
204
+ test('t13-3 勾选框自绘 + 勾形从左下画到右上(mask 笔画 + 左→右揭开)', () => {
205
+ const css = read(STYLE_FILE);
206
+ const violations = findCheckStrokeViolations(css);
207
+ assert.deepEqual(violations, [], '勾形描边不完整:\n' + violations.join('\n'));
208
+
209
+ const noAppearance = mutate(css, ' appearance: none;\n box-sizing: border-box;', ' box-sizing: border-box;');
210
+ assert.ok(findCheckStrokeViolations(noAppearance).length >= 1, '负向自检:退回原生勾选框必须报红');
211
+ const noReveal = mutate(css, ' clip-path: inset(0 100% 0 0);\n }\n to {', ' }\n to {');
212
+ assert.ok(findCheckStrokeViolations(noReveal).length >= 1, '负向自检:描边起点不裁掉必须报红');
213
+ const tooFast = mutate(css, ' animation: checkStroke var(--cm-motion-draw)', ' animation: checkStroke var(--cm-motion-base)');
214
+ assert.ok(findCheckStrokeViolations(tooFast).length >= 1, '负向自检:退回 180ms 的 base 必须报红');
215
+ const genericEase = mutate(css, 'var(--cm-motion-draw) var(--cm-motion-ease-draw)', 'var(--cm-motion-draw) var(--cm-motion-ease-out)');
216
+ assert.ok(findCheckStrokeViolations(genericEase).length >= 1, '负向自检:改用通用 ease-out 必须报红');
217
+ const noToken = mutate(css, ' --cm-motion-draw: 340ms;', ' --cm-motion-draw: 150ms;');
218
+ assert.ok(findCheckStrokeViolations(noToken).length >= 1, '负向自检:描边时长低于 300ms 必须报红');
219
+ });
220
+
221
+ test('t13-4 reduced-motion:关动画必须补终态(否则勾形永远看不见)', () => {
222
+ const css = read(STYLE_FILE);
223
+ const violations = findReducedMotionViolations(css);
224
+ assert.deepEqual(violations, [], 'reduced-motion 的终态不完整:\n' + violations.join('\n'));
225
+
226
+ const broken = mutate(css, ' animation: none;\n clip-path: inset(0 0 0 0);\n }', ' animation: none;\n }');
227
+ assert.ok(findReducedMotionViolations(broken).length >= 1, '负向自检:去掉勾形终态必须报红');
228
+ const noPress = mutate(css, ' transform: none;\n }', ' }');
229
+ assert.ok(findReducedMotionViolations(noPress).length >= 1, '负向自检:reduced-motion 下留着按压缩放必须报红');
230
+ });