@xynogen/pix-pretty 1.7.25 → 1.7.27

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.25",
3
+ "version": "1.7.27",
4
4
  "description": "Enhanced tool output rendering with syntax highlighting, file icons, tree views, diff rendering, and FFF search",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@xynogen/pix-data": "^0.4.0",
62
- "@xynogen/pix-runtime": "^0.2.0",
62
+ "@xynogen/pix-runtime": "^0.3.0",
63
63
  "chalk": "^4.1.2",
64
64
  "cli-highlight": "^2.1.11",
65
65
  "@ff-labs/fff-node": "^0.5.2",
@@ -27,7 +27,10 @@ interface Wired {
27
27
  * the SelectList keys; simpler: we expose the live component so the test can
28
28
  * call its handlers. We do the latter via the captured component ref.
29
29
  */
30
- function makeUI(onReady: (comp: Wired, finish: (v: unknown) => void) => void): OverlayUI {
30
+ function makeUI(
31
+ onReady: (comp: Wired, finish: (v: unknown) => void) => void,
32
+ onOptions?: (options: unknown) => void,
33
+ ): OverlayUI {
31
34
  return {
32
35
  custom: async <T>(
33
36
  cb: (
@@ -36,7 +39,9 @@ function makeUI(onReady: (comp: Wired, finish: (v: unknown) => void) => void): O
36
39
  kb: unknown,
37
40
  done: (v: T) => void,
38
41
  ) => Wired,
42
+ options?: unknown,
39
43
  ): Promise<T | undefined> => {
44
+ onOptions?.(options);
40
45
  let resolved: T | undefined;
41
46
  const done = (v: T) => {
42
47
  resolved = v;
@@ -55,6 +60,20 @@ const ENTER = "\r";
55
60
  const DOWN = "\x1b[B";
56
61
 
57
62
  describe("showOverlay — confirm mode", () => {
63
+ test("caps overlay at 80% of terminal height", async () => {
64
+ let options: unknown;
65
+ await showOverlay(
66
+ makeUI(
67
+ (comp) => comp.handleInput(ENTER),
68
+ (value) => {
69
+ options = value;
70
+ },
71
+ ),
72
+ { mode: "confirm", title: "T" },
73
+ );
74
+ expect(options).toEqual({ overlay: true, overlayOptions: { maxHeight: "80%" } });
75
+ });
76
+
58
77
  test("selecting the approve choice (first) returns approved", async () => {
59
78
  const result = await showOverlay(
60
79
  makeUI((comp) => {
@@ -100,7 +100,7 @@ export interface OverlayUI {
100
100
  kb: unknown,
101
101
  done: (v: T) => void,
102
102
  ) => OverlayComponent,
103
- opts?: { overlay?: boolean },
103
+ opts?: { overlay?: boolean; overlayOptions?: { maxHeight?: number | `${number}%` } },
104
104
  ): Promise<T | undefined>;
105
105
  }
106
106
 
@@ -355,7 +355,7 @@ export function showOverlay(ui: OverlayUI, config: OverlayConfig): Promise<Overl
355
355
  },
356
356
  };
357
357
  },
358
- { overlay: true },
358
+ { overlay: true, overlayOptions: { maxHeight: "80%" } },
359
359
  ).then((result) => {
360
360
  resolve(result ?? { action: "denied" });
361
361
  });