@xynogen/pix-optimizer 1.1.24 → 1.1.26

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/opt.ts +7 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-optimizer",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "Performance optimization suite for Pi Coding Agent - caveman mode + RTK tool rewriting + ponytail lazy-dev mode",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/opt.ts CHANGED
@@ -20,15 +20,12 @@ import {
20
20
  frameModal,
21
21
  MIN_MODAL_HEIGHT,
22
22
  ModalPager,
23
+ modalOverlayOptions,
23
24
  terminalModalHeight,
24
25
  } from "@xynogen/pix-pretty/modal-frame";
25
26
  import type { OptimizerHandle, OptimizerStatus, OptimizerTool } from "./status.ts";
26
27
  import { toolIcon } from "./status.ts";
27
28
 
28
- /** Min/max content width for the overlay box (excludes 4 cols of chrome). */
29
- const MIN_CONTENT = 28;
30
- const MAX_CONTENT = 60;
31
-
32
29
  /** Fixed render order — matches the status-bar cell. */
33
30
  const TOOL_ORDER: readonly OptimizerTool[] = ["caveman", "rtk", "ponytail"];
34
31
 
@@ -88,8 +85,9 @@ export function registerOptCommand(
88
85
  overlay?: boolean;
89
86
  overlayOptions?: {
90
87
  anchor?: string;
91
- width?: number;
92
- maxHeight?: string;
88
+ width?: number | `${number}%`;
89
+ maxHeight?: number | `${number}%`;
90
+ margin?: number;
93
91
  };
94
92
  },
95
93
  ) => Promise<T>;
@@ -107,15 +105,6 @@ export function registerOptCommand(
107
105
  const valueWidth = Math.max(
108
106
  ...TOOL_ORDER.flatMap((t) => handles[t].values.map((v) => v.length)),
109
107
  );
110
- // Fixed content width: widest help summary (the box's longest line) vs
111
- // title, clamped. Fixed so the box doesn't resize as values/selection
112
- // change and so the overlay can be centered at exactly this width.
113
- const widestHelp = Math.max(
114
- ...TOOL_ORDER.map((t) => helpSummary(handles[t].help).length),
115
- "󱎫 Optimizer".length,
116
- );
117
- const content = Math.min(MAX_CONTENT, Math.max(MIN_CONTENT, widestHelp));
118
- const boxW = content + 4; // + chrome (2 border + 2 padding)
119
108
 
120
109
  await ui.custom<null>(
121
110
  (
@@ -144,7 +133,7 @@ export function registerOptCommand(
144
133
  };
145
134
 
146
135
  return {
147
- render: () => {
136
+ render: (width: number) => {
148
137
  const rows = TOOL_ORDER.map((tool, i) => {
149
138
  const on = handles[tool].current() !== "off";
150
139
  const sel = i === selected;
@@ -160,7 +149,7 @@ export function registerOptCommand(
160
149
  return `${cursor} ${glyph} ${name} ${value} ${bar}`;
161
150
  });
162
151
  const result = frameModal({
163
- width: boxW,
152
+ width,
164
153
  maxHeight: terminalModalHeight(tui.terminal?.rows),
165
154
  minHeight: MIN_MODAL_HEIGHT,
166
155
  header: [theme.fg("accent", theme.bold("󱎫 Optimizer")), ""],
@@ -212,10 +201,7 @@ export function registerOptCommand(
212
201
  },
213
202
  };
214
203
  },
215
- {
216
- overlay: true,
217
- overlayOptions: { anchor: "center", width: boxW, maxHeight: "80%" },
218
- },
204
+ { overlay: true, overlayOptions: modalOverlayOptions() },
219
205
  );
220
206
  },
221
207
  });