@xynogen/pix-pretty 1.26.0 → 1.29.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.
package/src/index.ts CHANGED
@@ -9,11 +9,11 @@
9
9
  */
10
10
 
11
11
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
12
- import { registerFffCommands } from "./commands/fff.js";
13
- import { fffState } from "./fff.js";
14
- import { clearHighlightCache } from "./highlight.js";
15
- import { initIconMode } from "./icon-persist.js";
16
- import type { PiPrettyApi } from "./types.js";
12
+ import { registerFffCommands } from "./commands/fff.ts";
13
+ import { fffState } from "./fff.ts";
14
+ import { clearHighlightCache } from "./highlight.ts";
15
+ import { initIconMode } from "./icon-persist.ts";
16
+ import type { PiPrettyApi } from "./types.ts";
17
17
 
18
18
  export default function piPrettyExtension(pi: ExtensionAPI): void {
19
19
  const prettyPi = pi as unknown as PiPrettyApi;
package/src/lang.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { basename, extname } from "node:path";
2
2
 
3
- import type { BundledLanguage } from "./types.js";
3
+ import type { BundledLanguage } from "./types.ts";
4
4
 
5
5
  export const EXT_LANG: Record<string, BundledLanguage> = {
6
6
  ts: "typescript",
package/src/progress.ts CHANGED
@@ -19,8 +19,8 @@ import {
19
19
  modalOverlayOptions,
20
20
  modalWidth,
21
21
  terminalModalHeight,
22
- } from "./modal-frame.js";
23
- import { SPINNER } from "./widget-format.js";
22
+ } from "./modal-frame.ts";
23
+ import { SPINNER } from "./widget-format.ts";
24
24
 
25
25
  interface ProgressTheme {
26
26
  fg(color: string, text: string): string;
@@ -0,0 +1,534 @@
1
+ /**
2
+ * pix-pretty/provider-picker — color-coded provider settings used by /web and /voice.
3
+ *
4
+ * `showSettingsPicker` shows the sectioned overview. `showProviderPicker` shows the tree:
5
+ *
6
+ * One row per provider: default dot, status (connected / no API key needed / N variables
7
+ * not set), and an expandable list of shell variables with set state and an export
8
+ * example. A provider row with a `model` also shows a model row when expanded.
9
+ */
10
+
11
+ import {
12
+ decodeKittyPrintable,
13
+ Input,
14
+ Key,
15
+ type KeybindingsManager,
16
+ matchesKey,
17
+ truncateToWidth,
18
+ visibleWidth,
19
+ } from "@earendil-works/pi-tui";
20
+ import {
21
+ frameModal,
22
+ MIN_MODAL_HEIGHT,
23
+ ModalPager,
24
+ modalOverlayOptions,
25
+ modalWidth,
26
+ terminalModalHeight,
27
+ } from "./modal-frame.ts";
28
+ import { getErrorMessage } from "./utils.ts";
29
+
30
+ export interface ProviderPickerRow {
31
+ id: string;
32
+ configured: boolean;
33
+ env: string[];
34
+ /** Show "no API key needed" in place of "connected". */
35
+ noKey?: boolean;
36
+ /** Current model. When set, the expanded row shows an editable model line. */
37
+ model?: string;
38
+ }
39
+
40
+ export interface ProviderPickerOptions {
41
+ title: string;
42
+ subtitle: string;
43
+ /** Rows in display order. An `auto` row renders as a choice, not a provider. */
44
+ rows: ProviderPickerRow[];
45
+ current: string;
46
+ /** Canonical name → legacy alias. Either one counts as set. */
47
+ envAliases?: Record<string, string>;
48
+ envExample?: (name: string) => string;
49
+ }
50
+
51
+ export type ProviderPickerAction =
52
+ | { kind: "select"; id: string }
53
+ | { kind: "model"; id: string; value: string };
54
+
55
+ interface PickerTheme {
56
+ fg(color: string, text: string): string;
57
+ bg(color: string, text: string): string;
58
+ bold(text: string): string;
59
+ }
60
+
61
+ export interface ProviderPickerUI {
62
+ custom<T>(
63
+ cb: (
64
+ tui: { requestRender(): void; terminal?: { rows?: number } },
65
+ theme: PickerTheme,
66
+ keybindings: KeybindingsManager,
67
+ done: (value: T) => void,
68
+ ) => {
69
+ render(width: number): string[];
70
+ invalidate(): void;
71
+ handleInput(data: string): void;
72
+ dispose?(): void;
73
+ },
74
+ opts?: { overlay?: boolean; overlayOptions?: ReturnType<typeof modalOverlayOptions> },
75
+ ): Promise<T | undefined>;
76
+ }
77
+
78
+ type Node =
79
+ | { kind: "provider"; row: ProviderPickerRow }
80
+ | { kind: "env"; name: string }
81
+ | { kind: "model"; row: ProviderPickerRow };
82
+
83
+ function defaultExample(name: string): string {
84
+ return name.endsWith("_URL")
85
+ ? `export ${name}="https://example.com"`
86
+ : `export ${name}="your-api-key"`;
87
+ }
88
+
89
+ /** Render the tree body. Exported for tests. */
90
+ export function renderProviderRows(
91
+ opts: ProviderPickerOptions,
92
+ theme: Pick<PickerTheme, "fg">,
93
+ state: { cursor: number; expanded: Set<string>; field?: { render(width: number): string[] } },
94
+ width: number,
95
+ ): { lines: string[]; nodes: Node[]; selected: { start: number; end: number } } {
96
+ const aliases = opts.envAliases ?? {};
97
+ const envIsSet = (name: string) => {
98
+ const alias = aliases[name];
99
+ return Boolean(process.env[name] || (alias && process.env[alias]));
100
+ };
101
+ const expandable = (row: ProviderPickerRow) =>
102
+ row.model !== undefined || row.env.some((name) => !envIsSet(name));
103
+ const nodes: Node[] = [];
104
+ for (const row of opts.rows) {
105
+ nodes.push({ kind: "provider", row });
106
+ if (!state.expanded.has(row.id)) continue;
107
+ for (const name of row.env) nodes.push({ kind: "env", name });
108
+ if (row.model !== undefined) nodes.push({ kind: "model", row });
109
+ }
110
+ const mute = (value: string) => theme.fg("muted", value);
111
+ const lines: string[] = [];
112
+ let selected = { start: 0, end: 1 };
113
+ nodes.forEach((node, index) => {
114
+ const marker = index === state.cursor ? theme.fg("accent", "\u25B6") : " ";
115
+ const start = lines.length;
116
+ if (node.kind === "model") {
117
+ const label = `${marker} ${theme.fg("accent", "model")}:`;
118
+ const field = index === state.cursor ? state.field : undefined;
119
+ lines.push(
120
+ field
121
+ ? `${label} ${field.render(Math.max(10, width - 15))[0] ?? ""}`
122
+ : `${label} ${mute(node.row.model ?? "")}`,
123
+ );
124
+ } else if (node.kind === "env") {
125
+ // ponytail: show only presence. Pix never reads or stores the secret value.
126
+ const names = aliases[node.name] ? `${node.name} / ${aliases[node.name]}` : node.name;
127
+ if (envIsSet(node.name)) {
128
+ lines.push(
129
+ `${marker} ${theme.fg("accent", names)} ${theme.fg("success", "\u25CF set")}`,
130
+ );
131
+ } else {
132
+ lines.push(
133
+ `${marker} ${theme.fg("accent", names)} ${mute("\u25CB not set")}`,
134
+ ` ${theme.fg("warning", (opts.envExample ?? defaultExample)(node.name))}`,
135
+ );
136
+ }
137
+ } else {
138
+ const { id, configured, env, noKey } = node.row;
139
+ const unset = env.filter((name) => !envIsSet(name)).length;
140
+ const arrow = expandable(node.row) ? mute(state.expanded.has(id) ? "\u25BE" : "\u25B8") : " ";
141
+ const isDefault = opts.current === id;
142
+ const dot = isDefault ? theme.fg("accent", "\u25CF") : mute("\u25CB");
143
+ const status =
144
+ id === "auto"
145
+ ? mute("choice")
146
+ : configured
147
+ ? theme.fg("success", noKey ? "no API key needed" : "connected")
148
+ : theme.fg("warning", `${unset} variable${unset === 1 ? "" : "s"} not set`);
149
+ const tail = isDefault ? mute(" \u00b7 default") : "";
150
+ lines.push(`${marker} ${arrow} ${dot} ${theme.fg("accent", id)} ${status}${tail}`);
151
+ }
152
+ if (index === state.cursor) selected = { start, end: lines.length };
153
+ });
154
+ return { lines, nodes, selected };
155
+ }
156
+
157
+ export interface SettingsRow {
158
+ key: string;
159
+ section: string;
160
+ label: string;
161
+ value: string;
162
+ /** Theme role for the value. Default `success`. */
163
+ tone?: "success" | "warning" | "muted";
164
+ /** Enter edits `value` in a text field inside the row, not in a new dialog. */
165
+ editable?: boolean;
166
+ /**
167
+ * Enter opens a list under the row, inside the same modal. Typing filters it. With
168
+ * `editable`, the list also has a "type a value…" item that opens the text field.
169
+ */
170
+ choices?: SettingsChoice[];
171
+ }
172
+
173
+ export interface SettingsChoice {
174
+ value: string;
175
+ /** Readable text shown in place of `value`, for example a device name. */
176
+ label?: string;
177
+ /** Muted text after the label, for example the language name. */
178
+ hint?: string;
179
+ }
180
+
181
+ const CUSTOM_CHOICE = "\u0000custom";
182
+
183
+ /** Choices that match `query` by value or hint, case-insensitive. Exported for tests. */
184
+ export function filterChoices(choices: SettingsChoice[], query: string): SettingsChoice[] {
185
+ const q = query.trim().toLowerCase();
186
+ if (!q) return choices;
187
+ return choices.filter((choice) =>
188
+ [choice.value, choice.label, choice.hint].some((text) => text?.toLowerCase().includes(q)),
189
+ );
190
+ }
191
+
192
+ export type SettingsAction = { key: string; value?: string };
193
+
194
+ /** Render the sectioned settings overview body. Exported for tests. */
195
+ export function renderSettingsRows(
196
+ rows: SettingsRow[],
197
+ theme: Pick<PickerTheme, "fg">,
198
+ selected: number,
199
+ field?: { render(width: number): string[] },
200
+ width = 80,
201
+ list?: { choices: SettingsChoice[]; cursor: number; query: string; max?: number },
202
+ ): { lines: string[]; rowLines: number[]; listLine?: number } {
203
+ const labelWidth = Math.max(...rows.map((row) => row.label.length));
204
+ const lines: string[] = [];
205
+ const rowLines: number[] = [];
206
+ let listLine: number | undefined;
207
+ let section = "";
208
+ rows.forEach((row, index) => {
209
+ if (row.section !== section) {
210
+ if (section) lines.push("");
211
+ lines.push(theme.fg("dim", ` ${row.section}`));
212
+ section = row.section;
213
+ }
214
+ const active = index === selected;
215
+ rowLines[index] = lines.length;
216
+ const label = `${active ? theme.fg("accent", "→") : " "} ${theme.fg(active ? "accent" : "text", row.label.padEnd(labelWidth))} `;
217
+ const editing = active ? field : undefined;
218
+ const valueWidth = Math.max(10, width - labelWidth - 4);
219
+ lines.push(
220
+ editing
221
+ ? `${label}${editing.render(valueWidth)[0] ?? ""}`
222
+ : // One line per row. A long value (a device name) wraps and breaks the cursor math.
223
+ `${label}${theme.fg(row.tone ?? "success", truncateToWidth(row.value, valueWidth, "…"))}`,
224
+ );
225
+ if (!active || !list) return;
226
+ // ponytail: a window of `max` items around the cursor. Add a scrollbar if lists grow past ~50.
227
+ const max = list.max ?? 8;
228
+ const start = Math.max(
229
+ 0,
230
+ Math.min(list.cursor - Math.floor(max / 2), list.choices.length - max),
231
+ );
232
+ const pad = " ".repeat(labelWidth + 4);
233
+ lines.push(`${pad}${theme.fg("muted", "filter:")} ${list.query}${theme.fg("accent", "█")}`);
234
+ list.choices.slice(start, start + max).forEach((choice, offset) => {
235
+ const on = start + offset === list.cursor;
236
+ if (on) listLine = lines.length;
237
+ // One line per choice, like the row value. A long device name must not wrap.
238
+ // Cut plain text before the color, so the cut never splits a style.
239
+ const room = Math.max(10, width - pad.length - 2);
240
+ const name = truncateToWidth(choice.label ?? choice.value, room, "…");
241
+ const left = room - visibleWidth(name);
242
+ const hint = choice.hint && left > 3 ? truncateToWidth(` ${choice.hint}`, left, "…") : "";
243
+ const text =
244
+ choice.value === CUSTOM_CHOICE
245
+ ? theme.fg(on ? "accent" : "dim", "type a value…")
246
+ : `${theme.fg(on ? "accent" : "text", name)}${hint ? theme.fg("muted", hint) : ""}`;
247
+ lines.push(`${pad}${on ? theme.fg("accent", "▸") : " "} ${text}`);
248
+ });
249
+ if (list.choices.length === 0) lines.push(`${pad} ${theme.fg("muted", "no match")}`);
250
+ });
251
+ return { lines, rowLines, listLine };
252
+ }
253
+
254
+ export interface SettingsPickerOptions {
255
+ title: string;
256
+ /** Rows are read again after each action, so a changed value shows at once. */
257
+ rows: () => SettingsRow[];
258
+ /**
259
+ * Run a row action while the modal stays open. Return `"close"` to close it and
260
+ * resolve with the action, for example to open another view.
261
+ */
262
+ onAction: (action: SettingsAction) => Promise<"close" | undefined> | "close" | undefined;
263
+ /** Extra lines under the rows, for example a live level meter. Read on each render. */
264
+ status?: () => string[];
265
+ /** Called with a redraw function while the modal is open, for live status lines. */
266
+ onMount?: (redraw: () => void) => () => void;
267
+ /** Start row. */
268
+ selected?: number;
269
+ }
270
+
271
+ /**
272
+ * Show the sectioned settings overview. It stays open until esc, or until
273
+ * `onAction` returns `"close"`. For an `editable` row, enter opens a text field in
274
+ * the row. Resolves with the closing action, or null on escape.
275
+ */
276
+ export async function showSettingsPicker(
277
+ ui: ProviderPickerUI,
278
+ opts: SettingsPickerOptions,
279
+ ): Promise<SettingsAction | null> {
280
+ const result = await ui.custom<SettingsAction | null>(
281
+ (tui, theme, keybindings, done) => {
282
+ let rows = opts.rows();
283
+ let selected = Math.min(opts.selected ?? 0, Math.max(0, rows.length - 1));
284
+ let field: Input | undefined;
285
+ let list: { row: SettingsRow; query: string; cursor: number } | undefined;
286
+ let busy = false;
287
+ let error = "";
288
+ const redraw = () => tui.requestRender();
289
+ const unmount = opts.onMount?.(redraw);
290
+ const close = (value: SettingsAction | null) => {
291
+ unmount?.();
292
+ done(value);
293
+ };
294
+ const run = async (action: SettingsAction) => {
295
+ busy = true;
296
+ error = "";
297
+ try {
298
+ if ((await opts.onAction(action)) === "close") return close(action);
299
+ } catch (cause) {
300
+ error = getErrorMessage(cause);
301
+ }
302
+ busy = false;
303
+ rows = opts.rows();
304
+ redraw();
305
+ };
306
+ const edit = (row: SettingsRow) => {
307
+ const input = new Input({ prompt: "" });
308
+ input.setValue(row.value);
309
+ input.focused = true;
310
+ input.onEscape = () => {
311
+ field = undefined;
312
+ };
313
+ input.onSubmit = (raw) => {
314
+ const value = raw.trim();
315
+ field = undefined;
316
+ if (value && value !== row.value) void run({ key: row.key, value });
317
+ };
318
+ field = input;
319
+ };
320
+ const listChoices = () => {
321
+ if (!list) return [];
322
+ const shown = filterChoices(list.row.choices ?? [], list.query);
323
+ return list.row.editable ? [...shown, { value: CUSTOM_CHOICE }] : shown;
324
+ };
325
+ const openList = (row: SettingsRow) => {
326
+ const index = (row.choices ?? []).findIndex((choice) => choice.value === row.value);
327
+ list = { row, query: "", cursor: Math.max(0, index) };
328
+ };
329
+ const listInput = (data: string) => {
330
+ if (!list) return;
331
+ const choices = listChoices();
332
+ if (keybindings.matches(data, "tui.select.cancel")) list = undefined;
333
+ else if (keybindings.matches(data, "tui.select.up"))
334
+ list.cursor = (list.cursor - 1 + choices.length) % Math.max(1, choices.length);
335
+ else if (keybindings.matches(data, "tui.select.down"))
336
+ list.cursor = (list.cursor + 1) % Math.max(1, choices.length);
337
+ else if (matchesKey(data, Key.enter)) {
338
+ const choice = choices[list.cursor];
339
+ const { row, query } = list;
340
+ list = undefined;
341
+ if (!choice) return;
342
+ if (choice.value === CUSTOM_CHOICE) {
343
+ edit(row);
344
+ if (query) field?.setValue(query);
345
+ } else if (choice.value !== row.value) void run({ key: row.key, value: choice.value });
346
+ } else if (matchesKey(data, Key.backspace)) {
347
+ list.query = list.query.slice(0, -1);
348
+ list.cursor = 0;
349
+ } else {
350
+ const char = decodeKittyPrintable(data) ?? data;
351
+ if (char.length !== 1 || char < " ") return;
352
+ list.query += char;
353
+ list.cursor = 0;
354
+ }
355
+ redraw();
356
+ };
357
+ return {
358
+ render(width: number) {
359
+ const mw = modalWidth(width);
360
+ const body = renderSettingsRows(
361
+ rows,
362
+ theme,
363
+ selected,
364
+ field,
365
+ mw - 4,
366
+ list && { choices: listChoices(), cursor: list.cursor, query: list.query },
367
+ );
368
+ const status = opts.status?.() ?? [];
369
+ if (error) status.push(theme.fg("error", error));
370
+ if (status.length) body.lines.push("", ...status);
371
+ return frameModal({
372
+ width: mw,
373
+ maxHeight: terminalModalHeight(tui.terminal?.rows),
374
+ minHeight: MIN_MODAL_HEIGHT,
375
+ title: opts.title,
376
+ titleColor: (text) => theme.fg("accent", theme.bold(text)),
377
+ header: [""],
378
+ body: body.lines,
379
+ footer: [
380
+ "",
381
+ theme.fg(
382
+ "muted",
383
+ field
384
+ ? "enter save · esc cancel"
385
+ : list
386
+ ? "type to filter · ↑↓ move · enter pick · esc cancel"
387
+ : "↑↓ move · enter change · esc close",
388
+ ),
389
+ ],
390
+ selectedBodyLine: body.listLine ?? body.rowLines[selected],
391
+ color: (text) => theme.fg("accent", text),
392
+ bg: (text) => theme.bg("customMessageBg", text),
393
+ }).lines;
394
+ },
395
+ invalidate() {},
396
+ dispose: unmount,
397
+ handleInput(data: string) {
398
+ if (field) {
399
+ field.handleInput(data);
400
+ return redraw();
401
+ }
402
+ if (list) return listInput(data);
403
+ if (keybindings.matches(data, "tui.select.cancel")) return close(null);
404
+ if (busy) return;
405
+ const row = rows[selected];
406
+ if (matchesKey(data, Key.enter)) {
407
+ if (!row) return;
408
+ if (row.choices?.length) openList(row);
409
+ else if (row.editable) edit(row);
410
+ else void run({ key: row.key });
411
+ return redraw();
412
+ }
413
+ if (keybindings.matches(data, "tui.select.up"))
414
+ selected = (selected - 1 + rows.length) % rows.length;
415
+ else if (keybindings.matches(data, "tui.select.down"))
416
+ selected = (selected + 1) % rows.length;
417
+ else return;
418
+ redraw();
419
+ },
420
+ };
421
+ },
422
+ { overlay: true, overlayOptions: modalOverlayOptions() },
423
+ );
424
+ return result ?? null;
425
+ }
426
+
427
+ /** Show the provider tree. Resolves the chosen action, or null on escape. */
428
+ export async function showProviderPicker(
429
+ ui: ProviderPickerUI,
430
+ opts: ProviderPickerOptions,
431
+ ): Promise<ProviderPickerAction | null> {
432
+ const result = await ui.custom<ProviderPickerAction | null>(
433
+ (tui, theme, keybindings, done) => {
434
+ const guide = (key: string, action: string) =>
435
+ theme.fg("text", key) + theme.fg("muted", ` ${action}`);
436
+ const sep = theme.fg("muted", " \u00b7 ");
437
+ const expanded = new Set<string>();
438
+ const pager = new ModalPager();
439
+ let field: Input | undefined;
440
+ let nodes = renderProviderRows(opts, theme, { cursor: -1, expanded }, 80).nodes;
441
+ let cursor = Math.max(
442
+ 0,
443
+ nodes.findIndex((node) => node.kind === "provider" && node.row.id === opts.current),
444
+ );
445
+
446
+ const openField = (row: ProviderPickerRow) => {
447
+ const input = new Input({ prompt: "" });
448
+ input.setValue(row.model ?? "");
449
+ input.focused = true;
450
+ input.onEscape = () => {
451
+ field = undefined;
452
+ };
453
+ input.onSubmit = (raw) => {
454
+ const value = raw.trim();
455
+ field = undefined;
456
+ if (value) done({ kind: "model", id: row.id, value });
457
+ };
458
+ field = input;
459
+ };
460
+
461
+ const select = () => {
462
+ const node = nodes[cursor];
463
+ if (node?.kind === "provider") return done({ kind: "select", id: node.row.id });
464
+ if (node?.kind !== "model") return;
465
+ openField(node.row);
466
+ };
467
+
468
+ const toggle = () => {
469
+ const node = nodes[cursor];
470
+ if (node?.kind !== "provider") return;
471
+ if (expanded.has(node.row.id)) expanded.delete(node.row.id);
472
+ else expanded.add(node.row.id);
473
+ nodes = renderProviderRows(opts, theme, { cursor, expanded }, 80).nodes;
474
+ };
475
+
476
+ return {
477
+ render(width: number) {
478
+ const mw = modalWidth(width);
479
+ const body = renderProviderRows(opts, theme, { cursor, expanded, field }, mw - 4);
480
+ nodes = body.nodes;
481
+ const frame = frameModal({
482
+ width: mw,
483
+ maxHeight: terminalModalHeight(tui.terminal?.rows),
484
+ minHeight: MIN_MODAL_HEIGHT,
485
+ header: [
486
+ theme.fg("accent", theme.bold(opts.title)),
487
+ theme.fg("dim", opts.subtitle),
488
+ "",
489
+ ],
490
+ body: body.lines,
491
+ selectedBodyRange: pager.selectedRange(body.selected),
492
+ footer: [
493
+ "",
494
+ field
495
+ ? guide("enter", "submit") + sep + guide("esc", "cancel")
496
+ : guide("\u2191\u2193", "navigate") +
497
+ sep +
498
+ guide("enter", "set default") +
499
+ sep +
500
+ guide("space", "open") +
501
+ sep +
502
+ guide("esc", "close"),
503
+ ],
504
+ bodyOffset: pager.bodyOffset,
505
+ color: (value) => theme.fg("accent", value),
506
+ bg: (value) => theme.bg("customMessageBg", value),
507
+ fg: (value) => theme.fg("text", value),
508
+ });
509
+ pager.sync(frame);
510
+ return frame.lines;
511
+ },
512
+ invalidate() {},
513
+ handleInput(data: string) {
514
+ if (field) field.handleInput(data);
515
+ else if (pager.handleInput(data, keybindings, true)) {
516
+ // paged
517
+ } else if (matchesKey(data, Key.escape)) return done(null);
518
+ else if (matchesKey(data, Key.enter)) return select();
519
+ else if (matchesKey(data, Key.space)) toggle();
520
+ else if (matchesKey(data, Key.up) || keybindings.matches(data, "tui.select.up")) {
521
+ cursor = Math.max(0, cursor - 1);
522
+ pager.followSelection();
523
+ } else if (matchesKey(data, Key.down) || keybindings.matches(data, "tui.select.down")) {
524
+ cursor = Math.min(nodes.length - 1, cursor + 1);
525
+ pager.followSelection();
526
+ }
527
+ tui.requestRender();
528
+ },
529
+ };
530
+ },
531
+ { overlay: true, overlayOptions: modalOverlayOptions() },
532
+ );
533
+ return result ?? null;
534
+ }
package/src/renderers.ts CHANGED
@@ -2,13 +2,13 @@ import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works
2
2
  import { config } from "@xynogen/pix-runtime/config";
3
3
  import { prettySection } from "@xynogen/pix-runtime/sections";
4
4
 
5
- import { FG_DIM, FG_LNUM, FG_RULE, RST } from "./ansi.js";
6
- import { MAX_PREVIEW_LINES } from "./config.js";
7
- import { hlBlock } from "./highlight.js";
8
- import { dirIcon, fileColor, fileIcon } from "./icons.js";
9
- import { lang } from "./lang.js";
10
- import type { FgTheme } from "./types.js";
11
- import { lnum, normalizeLineEndings, pluralize, rule, termW } from "./utils.js";
5
+ import { FG_DIM, FG_LNUM, FG_RULE, RST } from "./ansi.ts";
6
+ import { MAX_PREVIEW_LINES } from "./config.ts";
7
+ import { hlBlock } from "./highlight.ts";
8
+ import { dirIcon, fileColor, fileIcon } from "./icons.ts";
9
+ import { lang } from "./lang.ts";
10
+ import type { FgTheme } from "./types.ts";
11
+ import { lnum, normalizeLineEndings, pluralize, rule, termW } from "./utils.ts";
12
12
 
13
13
  /** Layout controls for {@link renderFileContent}. */
14
14
  export interface RenderFileContentOptions {