@xynogen/pix-ask 0.2.12 → 0.2.14
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 +2 -2
- package/src/questionnaire.ts +24 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-ask",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Pi tool — structured questionnaire UI (ask_user)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@xynogen/pix-pretty": "^1.7.9",
|
|
39
|
-
"@xynogen/pix-runtime": "^0.
|
|
39
|
+
"@xynogen/pix-runtime": "^0.4.0",
|
|
40
40
|
"typebox": "^1.1.38"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
package/src/questionnaire.ts
CHANGED
|
@@ -523,6 +523,8 @@ export class AskQuestionnaire extends Container {
|
|
|
523
523
|
let footer: string[] = [];
|
|
524
524
|
|
|
525
525
|
const row = (content: string): string => truncateToWidth(content, width, "");
|
|
526
|
+
const guide = (key: string, action: string) => t.fg("text", key) + t.fg("dim", ` ${action}`);
|
|
527
|
+
const guideSep = t.fg("dim", " • ");
|
|
526
528
|
|
|
527
529
|
// Tab bar — rendered as the framed top edge (frameLines `top`).
|
|
528
530
|
let top: string | undefined;
|
|
@@ -558,7 +560,17 @@ export class AskQuestionnaire extends Container {
|
|
|
558
560
|
.render(width)
|
|
559
561
|
.map((line) => truncateToWidth(line, width, "")),
|
|
560
562
|
);
|
|
561
|
-
footer = [
|
|
563
|
+
footer = [
|
|
564
|
+
row(
|
|
565
|
+
guide("PgUp/PgDn", "inspect") +
|
|
566
|
+
guideSep +
|
|
567
|
+
guide("enter", "submit") +
|
|
568
|
+
guideSep +
|
|
569
|
+
guide("esc", "back") +
|
|
570
|
+
guideSep +
|
|
571
|
+
guide("ctrl+c", "cancel"),
|
|
572
|
+
),
|
|
573
|
+
];
|
|
562
574
|
return this.frame(mw, header, body, footer, top);
|
|
563
575
|
}
|
|
564
576
|
|
|
@@ -588,11 +600,15 @@ export class AskQuestionnaire extends Container {
|
|
|
588
600
|
}
|
|
589
601
|
|
|
590
602
|
// Footer hints
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
603
|
+
const hints: Array<[string, string]> = [["↑↓", "nav"]];
|
|
604
|
+
if (this.params.questions.length > 1) hints.push(["←→", "question"]);
|
|
605
|
+
if (isMulti) {
|
|
606
|
+
hints.push(["space", "toggle"], ["enter", "commit"]);
|
|
607
|
+
} else {
|
|
608
|
+
hints.push(["type", "filter"], ["enter", "select"]);
|
|
609
|
+
}
|
|
610
|
+
hints.push(["esc", "clear"], ["ctrl+c", "cancel"], ["PgUp/PgDn", "inspect"]);
|
|
611
|
+
footer = [row(hints.map(([key, action]) => guide(key, action)).join(guideSep))];
|
|
596
612
|
|
|
597
613
|
return this.frame(mw, header, body, footer, top);
|
|
598
614
|
}
|
|
@@ -610,9 +626,9 @@ export class AskQuestionnaire extends Container {
|
|
|
610
626
|
width: outerWidth,
|
|
611
627
|
maxHeight: terminalModalHeight(this.tui.terminal.rows),
|
|
612
628
|
minHeight: MIN_MODAL_HEIGHT,
|
|
613
|
-
header,
|
|
629
|
+
header: [...header, ""],
|
|
614
630
|
body,
|
|
615
|
-
footer,
|
|
631
|
+
footer: ["", ...footer],
|
|
616
632
|
bodyOffset: this.pager.bodyOffset,
|
|
617
633
|
selectedBodyRange:
|
|
618
634
|
this.selectedOptionRows === undefined
|