@xynogen/pix-pretty 1.32.1 → 1.33.1
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/command-preview.ts +2 -1
- package/src/gate-overlay.ts +9 -7
- package/src/icon-catalog.ts +2 -0
package/package.json
CHANGED
package/src/command-preview.ts
CHANGED
|
@@ -10,7 +10,8 @@ export function commandPreview(
|
|
|
10
10
|
state: Record<string, unknown>,
|
|
11
11
|
invalidate: () => void,
|
|
12
12
|
expanded = false,
|
|
13
|
-
|
|
13
|
+
/** Body column: under the tool name (2-col status glyph + space). */
|
|
14
|
+
indent = 3,
|
|
14
15
|
) {
|
|
15
16
|
type Slot = { code: string; language: string | undefined; theme: typeof theme; styled: string };
|
|
16
17
|
let slot = state.commandPreview as Slot | undefined;
|
package/src/gate-overlay.ts
CHANGED
|
@@ -38,6 +38,8 @@ export interface OverlayResult {
|
|
|
38
38
|
password?: string;
|
|
39
39
|
/** True when password validation exhausted every allowed attempt. */
|
|
40
40
|
passwordAttemptsExhausted?: boolean;
|
|
41
|
+
/** Value of the picked choice (absent on timeout or esc). */
|
|
42
|
+
choice?: string;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export interface OverlayChoice {
|
|
@@ -68,12 +70,12 @@ interface BaseConfig {
|
|
|
68
70
|
timeoutMs?: number;
|
|
69
71
|
/**
|
|
70
72
|
* Choices shown in the SelectList.
|
|
71
|
-
*
|
|
73
|
+
* A choice whose value is in approveValue counts as approval.
|
|
72
74
|
* Default: [{ value:"yes", label:"Allow" }, { value:"no", label:"Deny" }]
|
|
73
75
|
*/
|
|
74
76
|
choices?: OverlayChoice[];
|
|
75
|
-
/**
|
|
76
|
-
approveValue?: string;
|
|
77
|
+
/** Choice value(s) that mean "approved". Default "yes". `OverlayResult.choice` tells them apart. */
|
|
78
|
+
approveValue?: string | readonly string[];
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
export interface ConfirmConfig extends BaseConfig {
|
|
@@ -266,7 +268,7 @@ function buildSections(opts: {
|
|
|
266
268
|
export function showOverlay(ui: OverlayUI, config: OverlayConfig): Promise<OverlayResult> {
|
|
267
269
|
const accent = config.accent ?? "accent";
|
|
268
270
|
const choices = config.choices ?? DEFAULT_CHOICES;
|
|
269
|
-
const
|
|
271
|
+
const approveVals = [config.approveValue ?? "yes"].flat();
|
|
270
272
|
|
|
271
273
|
return new Promise((resolve) => {
|
|
272
274
|
ui.custom<OverlayResult>(
|
|
@@ -335,13 +337,13 @@ export function showOverlay(ui: OverlayUI, config: OverlayConfig): Promise<Overl
|
|
|
335
337
|
|
|
336
338
|
// ── event wiring ─────────────────────────────────────────────────
|
|
337
339
|
selectList.onSelect = (item) => {
|
|
338
|
-
if (item.value
|
|
339
|
-
finish({ action: "denied" });
|
|
340
|
+
if (!approveVals.includes(item.value)) {
|
|
341
|
+
finish({ action: "denied", choice: item.value });
|
|
340
342
|
} else if (config.mode === "sudo") {
|
|
341
343
|
stage = "password";
|
|
342
344
|
tui.requestRender();
|
|
343
345
|
} else {
|
|
344
|
-
finish({ action: "approved" });
|
|
346
|
+
finish({ action: "approved", choice: item.value });
|
|
345
347
|
}
|
|
346
348
|
};
|
|
347
349
|
selectList.onCancel = () => finish({ action: "denied" });
|
package/src/icon-catalog.ts
CHANGED
|
@@ -34,6 +34,8 @@ const PRETTY_CATALOG = {
|
|
|
34
34
|
"mode.normal": { nerd: "\u{F0174}", unicode: `\u276F${VS}`, ascii: ">" },
|
|
35
35
|
// ── model kind (pix-models picker) ─────────────────────────────────────
|
|
36
36
|
"model.classifier": { nerd: "\u{F05D1}", unicode: `\u2696${VS}`, ascii: "C" },
|
|
37
|
+
// ── steering hint (pix-nudge cards): advice, not a warning — keep it off `⚠` ──
|
|
38
|
+
nudge: { nerd: "\u{F0335}", unicode: `\u279C${VS}`, ascii: ">" },
|
|
37
39
|
} as const satisfies Record<string, Record<IconMode, string>>;
|
|
38
40
|
|
|
39
41
|
type PrettyIconKey = keyof typeof PRETTY_CATALOG;
|