@lokiyou/pi-nano-footer 0.14.0 → 0.15.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 +1 -53
  2. package/package.json +2 -2
package/index.ts CHANGED
@@ -1,18 +1,12 @@
1
1
  /**
2
- * pi-nano-footer — 超轻量 powerline 风格 footer + 输入框呼吸发光
2
+ * pi-nano-footer — 超轻量 powerline 风格 footer
3
3
  *
4
4
  * 精确复刻 pi-powerline-footer default 预设的样式 +
5
5
  * 用户自定义霓虹色配色方案。
6
- *
7
- * 当模型工作时:
8
- * - 输入框边框基于当前颜色做呼吸发光(明暗渐变)
9
- * - "Working..." 保持原样
10
- * - Footer 不变
11
6
  */
12
7
 
13
8
  import type { AssistantMessage } from "@earendil-works/pi-ai";
14
9
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
15
- import { Editor } from "@earendil-works/pi-tui";
16
10
  import { truncateToWidth } from "@earendil-works/pi-tui";
17
11
 
18
12
  // ── Nerd Font 图标(与 pi-powerline-footer 完全一致) ──
@@ -55,52 +49,6 @@ const RAINBOW = [
55
49
  "#89d281", "#00afaf", "#178fb9", "#b281d6",
56
50
  ];
57
51
 
58
- // ═══════════════════════════════════════════════════════════════════════════
59
- // 输入框呼吸发光(基于当前边框颜色做明暗呼吸)
60
- // ═══════════════════════════════════════════════════════════════════════════
61
-
62
- let working = false;
63
- let animInterval: ReturnType<typeof setInterval> | undefined;
64
-
65
- /**
66
- * 从 borderColor 函数采样字符,提取当前 RGB 色值
67
- */
68
- function extractRGB(fn: (str: string) => string): [number, number, number] | null {
69
- const sample = fn("─");
70
- const m = sample.match(ANSI_RE);
71
- if (!m) return null;
72
- return [parseInt(m[1]), parseInt(m[2]), parseInt(m[3])];
73
- }
74
-
75
- /** 保存原始 render */
76
- const origRender = Editor.prototype.render;
77
-
78
- Editor.prototype.render = function (width: number): string[] {
79
- if (working) {
80
- const saved = this.borderColor;
81
- const rgb = extractRGB(saved);
82
- if (rgb) {
83
- const [r, g, b] = rgb;
84
- // 纯前景呼吸:当前色 + 峰值白色辉光,0.8s 周期
85
- // 无背景阴影,避免生硬灯管感
86
- const t = 0.5 + 0.5 * Math.sin(performance.now() / 191);
87
- const bright = 0.35 + 0.65 * t; // 35%~100%
88
- const glow = t * t * 0.45; // 0~0.45 白色 blend
89
- const nr = Math.round(Math.min(255, r * bright + (255 - r) * glow));
90
- const ng = Math.round(Math.min(255, g * bright + (255 - g) * glow));
91
- const nb = Math.round(Math.min(255, b * bright + (255 - b) * glow));
92
- this.borderColor = (str: string) =>
93
- `[38;2;${nr};${ng};${nb}m${str}`;
94
- }
95
- try {
96
- return origRender.call(this, width);
97
- } finally {
98
- this.borderColor = saved;
99
- }
100
- }
101
- return origRender.call(this, width);
102
- };
103
-
104
52
  // ═══════════════════════════════════════════════════════════════════════════
105
53
  // Extension
106
54
  // ═══════════════════════════════════════════════════════════════════════════
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lokiyou/pi-nano-footer",
3
- "version": "0.14.0",
4
- "description": "超轻量 powerline 风格 footer for Pi Coding Agent 输入框脉冲发光,霓虹配色,实时显示模型、目录、上下文、token 和费用",
3
+ "version": "0.15.0",
4
+ "description": "超轻量 powerline 风格 footer for Pi Coding Agent,保留内置 Working... 指示器,霓虹配色,实时显示模型、目录、上下文、token 和费用",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "pi-package",