@xynogen/pix-9router 0.3.21 → 0.3.22
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/package.json +1 -1
- package/src/render.test.ts +5 -6
- package/src/render.ts +4 -4
package/package.json
CHANGED
package/src/render.test.ts
CHANGED
|
@@ -36,13 +36,12 @@ const config = {
|
|
|
36
36
|
meta: (details: { _type: "fetchResult"; chars: number }) => `${details.chars} chars`,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
test("renderCall shows title +
|
|
39
|
+
test("renderCall shows title + dim arg", () => {
|
|
40
40
|
const stub = stubComponent();
|
|
41
41
|
const rc = makeRenderCall<{ url: string }>("fetch", (a) => a.url);
|
|
42
42
|
rc({ url: "https://x.com" }, theme, context(stub));
|
|
43
|
-
// Only the tool name is accent/toolTitle-colored; the arg is
|
|
44
|
-
|
|
45
|
-
expect(stub.get()).toBe("[toolTitle]*fetch* [muted]https://x.com");
|
|
43
|
+
// Only the tool name is accent/toolTitle-colored; the arg is secondary.
|
|
44
|
+
expect(stub.get()).toBe("[toolTitle]*fetch* [dim]https://x.com");
|
|
46
45
|
});
|
|
47
46
|
|
|
48
47
|
test("renderCall hides only an effectively collapsed call row", () => {
|
|
@@ -56,7 +55,7 @@ test("renderCall hides only an effectively collapsed call row", () => {
|
|
|
56
55
|
theme,
|
|
57
56
|
context(stub, { state: { collapsed: true }, expanded: true }),
|
|
58
57
|
);
|
|
59
|
-
expect(stub.get()).toBe("[toolTitle]*fetch* [
|
|
58
|
+
expect(stub.get()).toBe("[toolTitle]*fetch* [dim]https://x.com");
|
|
60
59
|
});
|
|
61
60
|
|
|
62
61
|
test("renderResult renders structured compact details after collapse", () => {
|
|
@@ -157,7 +156,7 @@ test("renderResult renders empty and errors without compacting", () => {
|
|
|
157
156
|
theme,
|
|
158
157
|
context(empty),
|
|
159
158
|
);
|
|
160
|
-
expect(empty.get()).toBe(" [
|
|
159
|
+
expect(empty.get()).toBe(" [muted](empty)");
|
|
161
160
|
|
|
162
161
|
const failed = stubComponent();
|
|
163
162
|
rr(
|
package/src/render.ts
CHANGED
|
@@ -81,12 +81,12 @@ function dimBody(body: string, theme: Theme, expanded: boolean): string {
|
|
|
81
81
|
const out = shown.map((line) => ` ${theme.fg("dim", line)}`);
|
|
82
82
|
const remaining = lines.length - maxShow;
|
|
83
83
|
if (remaining > 0) {
|
|
84
|
-
out.push(` ${theme.fg("
|
|
84
|
+
out.push(` ${theme.fg("muted", `… ${remaining} more lines`)}`);
|
|
85
85
|
}
|
|
86
86
|
return out.join("\n");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/** Build a `renderCall` that shows `<title> <
|
|
89
|
+
/** Build a `renderCall` that shows `<title> <secondary arg>`. */
|
|
90
90
|
export function makeRenderCall<TArgs>(title: string, pickArg: (args: TArgs) => string) {
|
|
91
91
|
return (args: TArgs, theme: Theme, ctx: RenderCtx): Component => {
|
|
92
92
|
const text = getText(ctx.lastComponent);
|
|
@@ -97,7 +97,7 @@ export function makeRenderCall<TArgs>(title: string, pickArg: (args: TArgs) => s
|
|
|
97
97
|
)
|
|
98
98
|
return text;
|
|
99
99
|
const arg = pickArg(args);
|
|
100
|
-
text.setText(`${theme.fg("toolTitle", theme.bold(title))} ${theme.fg("
|
|
100
|
+
text.setText(`${theme.fg("toolTitle", theme.bold(title))} ${theme.fg("dim", arg)}`);
|
|
101
101
|
return text;
|
|
102
102
|
};
|
|
103
103
|
}
|
|
@@ -118,7 +118,7 @@ export function makeRenderResult<TDetails>(config?: CompactRendererConfig<TDetai
|
|
|
118
118
|
return text;
|
|
119
119
|
}
|
|
120
120
|
if (!body.trim()) {
|
|
121
|
-
text.setText(` ${theme.fg("
|
|
121
|
+
text.setText(` ${theme.fg("muted", "(empty)")}`);
|
|
122
122
|
return text;
|
|
123
123
|
}
|
|
124
124
|
|