feat(web): drive every status dot from one shared blink clock

Each dot used its own CSS animation ("pulse" in app.css, "tree-dot-blink" in
chat.css), so dots drifted out of phase and the tree looked noisy. One
ref-counted 500ms clock in lib/blink.ts now writes data-pi-blink-fast and
data-pi-blink-slow on <html>, and CSS derives the dim phase from those
attributes: one timer for the whole app, no React re-renders, and
prefers-reduced-motion pins every dot solid.
This commit is contained in:
yuez committed 2026-10-27 18:42:54 +08:00
1 parent 48411dccd2
commit 81e7f96a64
4 files changed
+97 -36

No files matched your search

+4 -32
View File
@@ -445,38 +445,10 @@
background: color-mix(in oklch, var(--destructive) 12%, transparent);
}
/* 状态圆点:pi2.nvim 是离散二值闪烁(busy/error 500ms、compacting 1000ms),
不是 app.css 里那种平滑 ease 的 pulse;attention / idle / ok / exited 常亮。
只作用于会话树,其他页面的圆点保持不变。 */
@keyframes tree-dot-blink {
0%,
49% {
opacity: 1;
}
50%,
100% {
opacity: 0.35;
}
}
.tree-row .dot--busy,
.tree-row .dot--err {
animation: tree-dot-blink 1s steps(1, end) infinite;
}
.tree-row .dot--compacting {
animation: tree-dot-blink 2s steps(1, end) infinite;
}
.tree-row .dot--attention,
.tree-row .dot--idle,
.tree-row .dot--ok,
.tree-row .dot--exited {
animation: none;
}
@media (prefers-reduced-motion: reduce) {
.tree-row .dot--busy,
.tree-row .dot--err,
.tree-row .dot--compacting {
animation: none;
}
/* 状态圆点:由 <html> 根节点上的单一全局时钟驱动(data-pi-blink-* 属性,见 app.css 与 blink.ts),
不再使用每个圆点独立的 CSS animation,避免相位漂移。当前聚焦会话叠加高亮背景。 */
.tree-row .dot--current {
background: var(--info);
}
/* 子会话 / 子代理行:更矮、更小、灰一档;状态只由圆点表达。 */