@lokiyou/pi-nano-footer 0.8.0 → 0.10.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 (2) hide show
  1. package/index.ts +6 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -63,11 +63,10 @@ let working = false;
63
63
  let animInterval: ReturnType<typeof setInterval> | undefined;
64
64
 
65
65
  /**
66
- * 从 borderColor 函数采样一个字符,提取其中使用的 RGB 色值
66
+ * 从 borderColor 函数采样字符,提取当前 RGB 色值
67
67
  */
68
68
  function extractRGB(fn: (str: string) => string): [number, number, number] | null {
69
69
  const sample = fn("─");
70
- // borderColor 输出格式:\x1b[38;2;R;G;Bm─\x1b[0m
71
70
  const m = sample.match(ANSI_RE);
72
71
  if (!m) return null;
73
72
  return [parseInt(m[1]), parseInt(m[2]), parseInt(m[3])];
@@ -82,12 +81,11 @@ Editor.prototype.render = function (width: number): string[] {
82
81
  const rgb = extractRGB(saved);
83
82
  if (rgb) {
84
83
  const [r, g, b] = rgb;
85
- // 呼吸发光:纯 sin + 60fps 主动刷新
86
- // - 暗处 ~25%,亮处 100% + 柔和白色辉光
87
- // 周期 ~1.2s(从容的呼吸节奏)
88
- const t = 0.5 + 0.5 * Math.sin(performance.now() / 600);
89
- const bright = 0.25 + 0.75 * t; // 25%~100%
90
- const glow = t * t * 0.35; // 0~0.35 白色 blend,t² 让辉光集中在峰值
84
+ // 基于当前边框颜色做呼吸,颜色不变只是明暗+辉光变化
85
+ // 周期 ~800ms,60fps 驱动,非工作→工作无突兀跳变
86
+ const t = 0.5 + 0.5 * Math.sin(performance.now() / 400);
87
+ const bright = 0.25 + 0.75 * t;
88
+ const glow = t * t * 0.35;
91
89
  const nr = Math.round(Math.min(255, r * bright + (255 - r) * glow));
92
90
  const ng = Math.round(Math.min(255, g * bright + (255 - g) * glow));
93
91
  const nb = Math.round(Math.min(255, b * bright + (255 - b) * glow));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokiyou/pi-nano-footer",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "超轻量 powerline 风格 footer for Pi Coding Agent — 输入框脉冲发光,霓虹配色,实时显示模型、目录、上下文、token 和费用",
5
5
  "type": "module",
6
6
  "keywords": [