@estebanforge/pi-tui-dialogs 0.1.2 → 0.1.3
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 +6 -0
- package/package.json +2 -2
- package/src/choice.ts +2 -2
- package/src/frame.ts +8 -0
- package/src/index.ts +1 -0
- package/src/input.ts +2 -2
- package/src/menu.ts +2 -2
package/README.md
CHANGED
|
@@ -12,6 +12,12 @@ Dialog pattern adapted from
|
|
|
12
12
|
- `frameDialog` / `dialogHeight` / `DIALOG_OPTIONS` — shared rounded frame:
|
|
13
13
|
title in the top border, body, footer line above the bottom border, padded to
|
|
14
14
|
a stable height so centered overlays do not jump between views.
|
|
15
|
+
- `dialogBlocked(title)` — the pi 1.5.1 overlay `blocked` option payload
|
|
16
|
+
(`{ kind: "question", message: title }`): pi reports the overlay as waiting
|
|
17
|
+
on user input (OSC 7501) until `done()`, also while hidden. `dialogMenu`,
|
|
18
|
+
`dialogInput`, and `dialogChoice` pass it for you; hand-rolled overlays can
|
|
19
|
+
spread it into their own `ctx.ui.custom` options. Hosts older than pi 1.5.1
|
|
20
|
+
ignore the field.
|
|
15
21
|
- `DialogMenu` / `dialogMenu` — framed menu with `label │ value` rows, a
|
|
16
22
|
counter line, a muted help panel for the selected row, optional tab groups
|
|
17
23
|
(left/right to switch) and type-to-search within the active tab. Rows with
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estebanforge/pi-tui-dialogs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Framed TUI dialog kit for @estebanforge Pi extensions: bordered settings menus with label/value columns, help panel, tabs, type-to-search, and validated input dialogs. Dialog pattern adapted from pi-subagent-manager (MIT). Plain library, no Pi entrypoint: consumers depend on it and Pi installs it transitively.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
36
|
+
"@earendil-works/pi-coding-agent": "^1.5.1",
|
|
37
37
|
"@earendil-works/pi-tui": "^1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
package/src/choice.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// from pi-antigravity-bridge's first-run engine picker.
|
|
4
4
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { wrapTextWithAnsi, type SelectItem, SelectList } from "@earendil-works/pi-tui";
|
|
6
|
-
import { DIALOG_OPTIONS, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
6
|
+
import { DIALOG_OPTIONS, dialogBlocked, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
7
7
|
import type { DialogContext } from "./menu.js";
|
|
8
8
|
|
|
9
9
|
/** Hard cap on the option list. A closed choice stays scannable; past ten
|
|
@@ -148,6 +148,6 @@ export async function dialogChoice(
|
|
|
148
148
|
assertChoiceOptions(options.options, options.selected);
|
|
149
149
|
return ctx.ui.custom<string | undefined>(
|
|
150
150
|
(host, theme, _keys, done) => new ChoiceView(host, theme, title, options, done),
|
|
151
|
-
DIALOG_OPTIONS,
|
|
151
|
+
{ ...DIALOG_OPTIONS, blocked: dialogBlocked(title) },
|
|
152
152
|
);
|
|
153
153
|
}
|
package/src/frame.ts
CHANGED
|
@@ -23,6 +23,14 @@ export const DIALOG_OPTIONS = {
|
|
|
23
23
|
},
|
|
24
24
|
} as const;
|
|
25
25
|
|
|
26
|
+
/** Blocked program status (OSC 7501) for a dialog overlay: pi reports the
|
|
27
|
+
* overlay as waiting on user input until done(), also while hidden. Hosts
|
|
28
|
+
* older than pi 1.5.1 ignore the field. Pi's own selectors use the same
|
|
29
|
+
* convention: kind "question", message = dialog title. */
|
|
30
|
+
export function dialogBlocked(title: string): { kind: "question"; message: string } {
|
|
31
|
+
return { kind: "question", message: title };
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
/** Strip ANSI and control characters from untrusted row text. */
|
|
27
35
|
export function dialogText(text: string): string {
|
|
28
36
|
return stripTerminalSequences(text).replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
package/src/index.ts
CHANGED
package/src/input.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// (MIT, Copyright (c) 2026 pi-subagent contributors).
|
|
5
5
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Input, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
7
|
-
import { DIALOG_OPTIONS, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
7
|
+
import { DIALOG_OPTIONS, dialogBlocked, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
8
8
|
import type { DialogContext } from "./menu.js";
|
|
9
9
|
|
|
10
10
|
export interface DialogInputOptions {
|
|
@@ -102,6 +102,6 @@ export function dialogInput(
|
|
|
102
102
|
): Promise<string | undefined> {
|
|
103
103
|
return ctx.ui.custom<string | undefined>(
|
|
104
104
|
(host, theme, _keys, done) => new InputView(host, theme, title, options, done),
|
|
105
|
-
DIALOG_OPTIONS,
|
|
105
|
+
{ ...DIALOG_OPTIONS, blocked: dialogBlocked(title) },
|
|
106
106
|
);
|
|
107
107
|
}
|
package/src/menu.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// contributors.
|
|
6
6
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { getKeybindings, matchesKey, Key, truncateToWidth, visibleWidth, wrapTextWithAnsi, type SettingItem } from "@earendil-works/pi-tui";
|
|
8
|
-
import { DIALOG_OPTIONS, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
8
|
+
import { DIALOG_OPTIONS, dialogBlocked, dialogHeight, dialogText, frameDialog, type DialogHost } from "./frame.js";
|
|
9
9
|
|
|
10
10
|
/** A menu row is a pi-tui SettingItem; `onEdit` additionally opens a custom
|
|
11
11
|
* editor (input dialog, submenu) on Enter and keeps the menu open. Rows with
|
|
@@ -250,7 +250,7 @@ export function dialogMenu(
|
|
|
250
250
|
return ctx.ui.custom(
|
|
251
251
|
(host, theme, _keys, done) =>
|
|
252
252
|
new DialogMenu(host, theme, { title, rows, ...options }, done),
|
|
253
|
-
DIALOG_OPTIONS,
|
|
253
|
+
{ ...DIALOG_OPTIONS, blocked: dialogBlocked(title) },
|
|
254
254
|
);
|
|
255
255
|
}
|
|
256
256
|
|