@xynogen/pix-pretty 1.7.3 → 1.7.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-pretty",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Enhanced tool output rendering with syntax highlighting, file icons, tree views, FFF search, and paste chip formatting",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -19,7 +19,7 @@ import { frameLines, modalWidth, selectListTheme } from "./modal-frame.js";
19
19
 
20
20
  // ── Types ─────────────────────────────────────────────────────────────────────
21
21
 
22
- export type OverlayAction = "approved" | "denied" | "timeout";
22
+ export type OverlayAction = "approved" | "denied" | "timeout"; // ponytail: timeout kept for back-compat; never emitted now
23
23
 
24
24
  export interface OverlayResult {
25
25
  action: OverlayAction;
@@ -40,7 +40,7 @@ interface BaseConfig {
40
40
  title: string;
41
41
  /** Optional body lines under the title. */
42
42
  body?: string[];
43
- /** Auto-deny after this many ms. 0 = no timeout. Default 30_000. */
43
+ /** @deprecated No-op timeout removed. Dialog waits indefinitely for user input. */
44
44
  timeoutMs?: number;
45
45
  /**
46
46
  * Choices shown in the SelectList.
@@ -96,10 +96,6 @@ export interface OverlayUI {
96
96
 
97
97
  // ── Constants ─────────────────────────────────────────────────────────────────
98
98
 
99
- const SECOND_MS = 1_000;
100
- const COUNTDOWN_WARN_S = 5;
101
- const DEFAULT_TIMEOUT_MS = 30_000;
102
-
103
99
  const DEFAULT_CHOICES: OverlayChoice[] = [
104
100
  { value: "yes", label: "Allow", description: "Proceed" },
105
101
  { value: "no", label: "Deny", description: "Block" },
@@ -214,17 +210,10 @@ export function showOverlay(
214
210
  config: OverlayConfig,
215
211
  ): Promise<OverlayResult> {
216
212
  const accent = config.accent ?? "accent";
217
- const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
218
213
  const choices = config.choices ?? DEFAULT_CHOICES;
219
214
  const approveVal = config.approveValue ?? "yes";
220
215
 
221
216
  return new Promise((resolve) => {
222
- const controller = new AbortController();
223
- const timer =
224
- timeoutMs > 0
225
- ? setTimeout(() => controller.abort(), timeoutMs)
226
- : undefined;
227
-
228
217
  ui.custom<OverlayResult>(
229
218
  (tui, theme, _kb, done) => {
230
219
  type Stage = "select" | "password";
@@ -245,35 +234,8 @@ export function showOverlay(
245
234
  );
246
235
  const maskedInput = new MaskedInput();
247
236
 
248
- // ── countdown ───────────────────────────────────────────────────
249
- let ticker: ReturnType<typeof setInterval> | undefined;
250
- if (timeoutMs > 0) {
251
- const deadlineMs = Date.now() + timeoutMs;
252
- const updateCountdown = () => {
253
- const remaining = Math.max(
254
- 0,
255
- Math.ceil((deadlineMs - Date.now()) / SECOND_MS),
256
- );
257
- countdownLine =
258
- theme.fg("dim", "Auto-deny in ") +
259
- theme.fg(
260
- remaining <= COUNTDOWN_WARN_S ? accent : "muted",
261
- `${remaining}s`,
262
- );
263
- };
264
- updateCountdown();
265
- ticker = setInterval(() => {
266
- updateCountdown();
267
- tui.requestRender();
268
- }, SECOND_MS);
269
- }
270
-
271
237
  // ── finish ───────────────────────────────────────────────────────
272
- const finish = (result: OverlayResult) => {
273
- if (timer !== undefined) clearTimeout(timer);
274
- if (ticker !== undefined) clearInterval(ticker);
275
- done(result);
276
- };
238
+ const finish = (result: OverlayResult) => done(result);
277
239
 
278
240
  // ── event wiring ─────────────────────────────────────────────────
279
241
  selectList.onSelect = (item) => {
@@ -292,10 +254,6 @@ export function showOverlay(
292
254
  finish({ action: "approved", password: pw });
293
255
  maskedInput.onEscape = () => finish({ action: "denied" });
294
256
 
295
- controller.signal.addEventListener("abort", () =>
296
- finish({ action: "timeout" }),
297
- );
298
-
299
257
  // ── component interface ──────────────────────────────────────────
300
258
  return {
301
259
  render: (w) => {
@@ -327,8 +285,7 @@ export function showOverlay(
327
285
  },
328
286
  { overlay: true },
329
287
  ).then((result) => {
330
- if (timer !== undefined) clearTimeout(timer);
331
- resolve(result ?? { action: "timeout" });
288
+ resolve(result ?? { action: "denied" });
332
289
  });
333
290
  });
334
291
  }