@muzi3/pi-ui 0.1.1 → 0.1.2
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.
- package/README.md +10 -2
- package/extensions/border-editor.ts +8 -3
- package/extensions/footer.ts +3 -3
- package/package.json +1 -1
- package/themes/pi-ui-catppuccin.json +2 -2
package/README.md
CHANGED
|
@@ -22,11 +22,12 @@ Context ██░░░░░░░░░░░░ 1.7% / 272k ↑74.7k ↓3.8
|
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
色:标签 `muted`|进度条 按占用率 绿/黄/红|占比 跟条同色|`/ 窗口`、`/ ¥` 与未知占位 `dim`|
|
|
25
|
-
`↑` `mdLink` 蓝、`↓` `syntaxNumber` 桃、`$` `syntaxOperator` 青|分支 `accent
|
|
25
|
+
`↑` `mdLink` 蓝、`↓` `syntaxNumber` 桃、`$` `syntaxOperator` 青|分支 `accent`(图标与分支名同色)
|
|
26
26
|
|
|
27
27
|
- 第 1 行:其他扩展通过 `setStatus` 设置的文本(如 `@muzi3/comate-quota` 的额度条)+ git 分支。
|
|
28
28
|
分支前是 Nerd Font 的 git 图标 `U+E0A0`(nf-pl-branch,与 starship 默认提示符同一字形,
|
|
29
|
-
`accent` 色),**需要 Nerd Font
|
|
29
|
+
`accent` 色),**需要 Nerd Font 字体**,否则显示为豆腐块;分支名同色 `accent`(图标与名字
|
|
30
|
+
合成一整块,在行尾立成一个锚点)
|
|
30
31
|
- 第 2 行:上下文进度条(14 格)+ `百分比 / 窗口` + 累计用量(`↑in ↓out $cost`)。
|
|
31
32
|
进度条配色按占用率分级:`<70%` 绿(`success`)、`70~90%` 黄(`warning`)、`>90%` 红(`error`);
|
|
32
33
|
刚压缩完占用未知时显示为暗色 `?`
|
|
@@ -62,6 +63,11 @@ Context ██░░░░░░░░░░░░ 1.7% / 272k ↑74.7k ↓3.8
|
|
|
62
63
|
- 呼吸灯:流式为 `· • ● ● • ·` @120ms(颜色按主题 token 递进)。不闪的时候完全不显示——空闲、
|
|
63
64
|
或关掉 `indicator` 时都不留静止的点(静止的点反而更难看出在不在生成);代价是模型名会左右
|
|
64
65
|
移 2 列,在以 `─` 为主的边框上几乎看不出来
|
|
66
|
+
- 配色:模型名直接取编辑器**当前**的 `borderColor`(`this.borderColor`),边框是什么色它就是
|
|
67
|
+
什么色。pi 会按 thinking level 换这个函数(`getThinkingBorderColor`:off `overlay0`、low `blue`、
|
|
68
|
+
medium `sapphire`、high `mauve`……),bash 模式另有 `getBashModeBorderColor`,所以写死任何 token
|
|
69
|
+
都会在切换后与边框脱色(例如 medium 下边框是青色而模型名还是灰的);
|
|
70
|
+
`⏱ 耗时` 为 `dim`
|
|
65
71
|
- 耗时口径与旧版 footer 一致,只是位置变了:流式为已进行秒数(随呼吸灯帧重绘跳秒),
|
|
66
72
|
空闲为上一轮总耗时;宽度不足时先丢掉 `⏱ 耗时`,再逐字截断模型名
|
|
67
73
|
- 退出/关闭 `working` 会换回内置编辑器,还原 pi 默认:仅流式期间在边框显示模型名
|
|
@@ -116,6 +122,8 @@ pi.events.emit("pi-ui:model-override", undefined); // 恢复会话模型
|
|
|
116
122
|
| `mdQuoteBorder` | `surface2` | `surface1` | 同上,引用属于次要结构 |
|
|
117
123
|
| `mdHeading` | `mauve` | `lavender` | `mauve` 同时是 `accent`/`mdListBullet`/`syntaxKeyword`/`thinkingHigh`,标题再占用就分不出主次 |
|
|
118
124
|
| `mdListBullet` | `mauve` | `overlay2` | 列表符号属于次要装饰,降为灰色 |
|
|
125
|
+
| `thinkingOff` | `surface1` | `overlay0` | 1.80:1 时编辑框边框(thinking off 档)几乎看不见,模型名也一致地暗;换成 `overlay0` 后 3.36:1 |
|
|
126
|
+
| `thinkingMinimal` | `surface2` | `overlay1` | 随 `thinkingOff` 上移,否则 off(3.36)会比 minimal(2.46)还亮,暗端递进反转 |
|
|
119
127
|
| `thinkingXhigh` | `red` | `maroon` | 给 `thinkingMax` 让出 `red`,形成 `mauve → maroon → red` 的递进 |
|
|
120
128
|
| `thinkingMax` | 未定义 | `red` | 补上最高档,取代回落的默认色 |
|
|
121
129
|
|
|
@@ -39,13 +39,15 @@ type BorderTitle = {
|
|
|
39
39
|
class PiUiBorderTitle implements BorderTitle {
|
|
40
40
|
private readonly tui: TUI;
|
|
41
41
|
private readonly inputs: EditorTitleInputs;
|
|
42
|
+
private readonly getBorderColor: (text: string) => string;
|
|
42
43
|
private ticker: ReturnType<typeof setInterval> | undefined;
|
|
43
44
|
private framesKey: string | undefined;
|
|
44
45
|
private frames: string[] = [];
|
|
45
46
|
|
|
46
|
-
constructor(tui: TUI, inputs: EditorTitleInputs) {
|
|
47
|
+
constructor(tui: TUI, inputs: EditorTitleInputs, getBorderColor: (text: string) => string) {
|
|
47
48
|
this.tui = tui;
|
|
48
49
|
this.inputs = inputs;
|
|
50
|
+
this.getBorderColor = getBorderColor;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/** 状态或模型变化后调用:立即重绘,并按是否流式启停呼吸灯。 */
|
|
@@ -73,7 +75,9 @@ class PiUiBorderTitle implements BorderTitle {
|
|
|
73
75
|
// 不闪的时候不占位:留一个静止的点比没有更难看出在不在生成。
|
|
74
76
|
const parts: string[] = [];
|
|
75
77
|
if (pulse !== undefined) parts.push(pulse);
|
|
76
|
-
|
|
78
|
+
// 与编辑框边框同色:直接用编辑器当前的 borderColor,边框换成什么色(thinking
|
|
79
|
+
// level、bash 模式、换主题)标题就跟着变,不需要自己维护 token 映射。
|
|
80
|
+
if (model !== undefined) parts.push(this.getBorderColor(model));
|
|
77
81
|
const head = parts.join(" ");
|
|
78
82
|
|
|
79
83
|
const seconds = this.inputs.getTimerSeconds();
|
|
@@ -132,7 +136,8 @@ export class PiUiBorderEditor extends CustomEditor {
|
|
|
132
136
|
|
|
133
137
|
constructor(tui: EditorArgs[0], theme: EditorArgs[1], keybindings: EditorArgs[2], inputs: EditorTitleInputs) {
|
|
134
138
|
super(tui, theme, keybindings, { embedWorkingStatus: true });
|
|
135
|
-
|
|
139
|
+
// 延迟取:pi 会用 getThinkingBorderColor / getBashModeBorderColor 整体替换 borderColor。
|
|
140
|
+
this.title = new PiUiBorderTitle(tui, inputs, (text) => this.borderColor(text));
|
|
136
141
|
this.attachTitle();
|
|
137
142
|
}
|
|
138
143
|
|
package/extensions/footer.ts
CHANGED
|
@@ -110,9 +110,9 @@ export class PiUiFooter implements Component {
|
|
|
110
110
|
private renderBranch(): string {
|
|
111
111
|
const branch = this.data.getGitBranch();
|
|
112
112
|
if (!branch) return "";
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
return
|
|
113
|
+
// 图标与分支名同色:整块 accent 让分支在行尾立成一个锚点。名字单独压成灰色会
|
|
114
|
+
// 读成"图标是装饰、名字是正文",两种颜色反而把这一块拆散。
|
|
115
|
+
return this.theme.fg("accent", `${GIT_ICON} ${branch}`);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/** 第 2 行:上下文进度条 + 累计用量,标签补齐到 LABEL_COLUMN 与上一行左对齐。 */
|
package/package.json
CHANGED
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"syntaxType": "yellow",
|
|
80
80
|
"syntaxOperator": "sky",
|
|
81
81
|
"syntaxPunctuation": "overlay2",
|
|
82
|
-
"thinkingOff": "
|
|
83
|
-
"thinkingMinimal": "
|
|
82
|
+
"thinkingOff": "overlay0",
|
|
83
|
+
"thinkingMinimal": "overlay1",
|
|
84
84
|
"thinkingLow": "blue",
|
|
85
85
|
"thinkingMedium": "sapphire",
|
|
86
86
|
"thinkingHigh": "mauve",
|