@lokiyou/pi-nano-footer 0.4.0 → 0.6.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 +15 -5
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -81,12 +81,19 @@ Editor.prototype.render = function (width: number): string[] {
81
81
  const rgb = extractRGB(saved);
82
82
  if (rgb) {
83
83
  const [r, g, b] = rgb;
84
- // 呼吸亮度:sin 周期 ~800ms,亮度范围 40%~100%
85
- // performance.now() 保证时间连续的呼吸曲线
86
- const t = 0.5 + 0.5 * Math.sin(performance.now() / 400);
87
- const bright = 0.4 + 0.6 * t;
84
+ // 荧光呼吸:
85
+ // - 暗处降到 12% 亮度(像灯熄了)
86
+ // - 亮处叠加白色辉光(像荧光灯通电)
87
+ // - 曲线让过渡更锐利,停留暗/亮两端更久
88
+ // 周期 ~1s 一次完整呼吸
89
+ const t = 0.5 + 0.5 * Math.sin(performance.now() / 350);
90
+ const base = 0.12 + 0.88 * t; // 12%~100% 明暗
91
+ const glow = Math.min(1, t * 1.4); // 0~1 白色 blending,峰值更亮
92
+ const nr = Math.round(Math.min(255, r * base + (255 - r) * glow * 0.35));
93
+ const ng = Math.round(Math.min(255, g * base + (255 - g) * glow * 0.35));
94
+ const nb = Math.round(Math.min(255, b * base + (255 - b) * glow * 0.35));
88
95
  this.borderColor = (str: string) =>
89
- `\x1b[38;2;${Math.round(r * bright)};${Math.round(g * bright)};${Math.round(b * bright)}m${str}\x1b[0m`;
96
+ `\x1b[38;2;${nr};${ng};${nb}m${str}\x1b[0m`;
90
97
  }
91
98
  try {
92
99
  return origRender.call(this, width);
@@ -109,6 +116,9 @@ export default function (pi: ExtensionAPI) {
109
116
  pi.on("session_start", async (_event, ctx) => {
110
117
  thinkingLevel = pi.getThinkingLevel();
111
118
 
119
+ // 隐藏内置的 "Working..." 指示器,用输入框呼吸代替
120
+ ctx.ui.setWorkingVisible(false);
121
+
112
122
  ctx.ui.setFooter((tui, theme, footerData) => {
113
123
  requestRender = () => tui.requestRender();
114
124
  const unsubBranch = footerData.onBranchChange(() => tui.requestRender());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokiyou/pi-nano-footer",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "超轻量 powerline 风格 footer for Pi Coding Agent — 输入框脉冲发光,霓虹配色,实时显示模型、目录、上下文、token 和费用",
5
5
  "type": "module",
6
6
  "keywords": [