@leo-alvarenga/pi-zen-frame 0.18.0 → 0.19.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.
|
@@ -4,7 +4,7 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
|
4
4
|
import { MAX_VISIBLE } from "./items";
|
|
5
5
|
import type { PaletteState } from "./types";
|
|
6
6
|
|
|
7
|
-
const ACTIVE_PREFIX = "
|
|
7
|
+
const ACTIVE_PREFIX = " → ";
|
|
8
8
|
const INACTIVE_PREFIX = " ";
|
|
9
9
|
|
|
10
10
|
export function renderPalette(
|
|
@@ -27,10 +27,11 @@ export function renderPalette(
|
|
|
27
27
|
const padTo = (text: string, w: number) =>
|
|
28
28
|
text + " ".repeat(Math.max(0, w - visibleWidth(text)));
|
|
29
29
|
|
|
30
|
-
const title = "
|
|
30
|
+
const title = " Command Palette ";
|
|
31
31
|
|
|
32
32
|
const rows: string[] = [
|
|
33
|
-
lPad +
|
|
33
|
+
lPad +
|
|
34
|
+
b("╭─" + title + "─".repeat(Math.max(0, inner - title.length - 1)) + "╮"),
|
|
34
35
|
bRow(padTo(" /" + state.query, inner)),
|
|
35
36
|
lPad + b("├" + "─".repeat(inner) + "┤"),
|
|
36
37
|
];
|
|
@@ -41,32 +42,38 @@ export function renderPalette(
|
|
|
41
42
|
const nm = " no matches";
|
|
42
43
|
rows.push(bRow(d(nm) + " ".repeat(Math.max(0, inner - nm.length))));
|
|
43
44
|
} else {
|
|
44
|
-
const kindW = 5;
|
|
45
|
-
const labelW = inner - 3 - 2 - kindW;
|
|
46
|
-
|
|
47
45
|
for (let i = 0; i < visible.length; i++) {
|
|
48
46
|
const item = visible[i]!;
|
|
49
47
|
const sel = i === state.selected - state.viewTop;
|
|
50
48
|
|
|
51
|
-
const
|
|
49
|
+
const kind = item.name.startsWith("/skill:") ? "skill" : "cmd";
|
|
50
|
+
const kindFg = () => (sel ? b(kind) : d(kind));
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
let source = "";
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
if (sel && item.sourceInfo) {
|
|
55
|
+
source = d(`(${item.sourceInfo.source}) `);
|
|
56
|
+
}
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
-
|
|
58
|
+
const kindW = visibleWidth(kind);
|
|
59
|
+
const labelW = inner - 3 - 2 - kindW - visibleWidth(source);
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
const label = truncateToWidth(item.name, labelW);
|
|
62
|
+
const lPadStr = getLPadStr(labelW, label);
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
const content = truncateToWidth(
|
|
64
|
-
`${INACTIVE_PREFIX} ${item.description}`,
|
|
65
|
-
labelW,
|
|
66
|
-
);
|
|
64
|
+
const plain = `${sel ? ACTIVE_PREFIX : INACTIVE_PREFIX}${label}${lPadStr} ${source}${kindFg()}`;
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
rows.push(bRow(sel ? b(plain) : plain));
|
|
67
|
+
|
|
68
|
+
if (sel) {
|
|
69
|
+
const content = [
|
|
70
|
+
truncateToWidth(`${INACTIVE_PREFIX} ${item.description}`, labelW),
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
content.forEach((c) => {
|
|
74
|
+
const lPadStr = getLPadStr(inner, c);
|
|
75
|
+
rows.push(bRow(d(c) + lPadStr));
|
|
76
|
+
});
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@leo-alvarenga/pi-zen-frame",
|
|
3
3
|
"description": "A pi-coding-agent extension that gives the TUI editor a simple yet polished look and feel",
|
|
4
4
|
"author": "Leonardo A. Alvarenga",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.19.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github.com/leo-alvarenga/pi-mono",
|
|
8
8
|
"publishConfig": {
|