cli-menu-kit 0.1.19 → 0.1.20

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.
@@ -89,6 +89,8 @@ async function showRadioMenu(config) {
89
89
  selectableIndices.push(index);
90
90
  }
91
91
  });
92
+ // Use MINIMAL layout for single-option menus
93
+ const effectiveLayout = selectableIndices.length === 1 ? layout_types_js_1.LAYOUT_PRESETS.MINIMAL : layout;
92
94
  // Ensure selectedIndex points to a selectable option
93
95
  if (!selectableIndices.includes(selectedIndex)) {
94
96
  selectedIndex = selectableIndices[0] || 0;
@@ -114,16 +116,16 @@ async function showRadioMenu(config) {
114
116
  (0, terminal_js_1.clearMenu)(state);
115
117
  let lineCount = 0;
116
118
  // Render based on layout order
117
- layout.order.forEach(element => {
119
+ effectiveLayout.order.forEach(element => {
118
120
  // Add spacing before element
119
121
  const spacingKey = `before${element.charAt(0).toUpperCase() + element.slice(1)}`;
120
- if (layout.spacing?.[spacingKey]) {
121
- (0, renderer_js_1.renderBlankLines)(layout.spacing[spacingKey]);
122
- lineCount += layout.spacing[spacingKey];
122
+ if (effectiveLayout.spacing?.[spacingKey]) {
123
+ (0, renderer_js_1.renderBlankLines)(effectiveLayout.spacing[spacingKey]);
124
+ lineCount += effectiveLayout.spacing[spacingKey];
123
125
  }
124
126
  switch (element) {
125
127
  case 'header':
126
- if (layout.visible.header && title) {
128
+ if (effectiveLayout.visible.header && title) {
127
129
  (0, renderer_js_1.renderHeader)(` ${title}`, colors_js_1.colors.cyan);
128
130
  lineCount++;
129
131
  }
@@ -156,7 +158,7 @@ async function showRadioMenu(config) {
156
158
  });
157
159
  break;
158
160
  case 'input':
159
- if (layout.visible.input) {
161
+ if (effectiveLayout.visible.input) {
160
162
  // Calculate display value (current selection number)
161
163
  let displayValue = '';
162
164
  const currentItem = optionData[selectedIndex];
@@ -174,7 +176,7 @@ async function showRadioMenu(config) {
174
176
  }
175
177
  break;
176
178
  case 'hints':
177
- if (layout.visible.hints && displayHints.length > 0) {
179
+ if (effectiveLayout.visible.hints && displayHints.length > 0) {
178
180
  (0, renderer_js_1.renderHints)(displayHints);
179
181
  lineCount++;
180
182
  }
@@ -182,9 +184,9 @@ async function showRadioMenu(config) {
182
184
  }
183
185
  // Add spacing after element
184
186
  const afterSpacingKey = `after${element.charAt(0).toUpperCase() + element.slice(1)}`;
185
- if (layout.spacing?.[afterSpacingKey]) {
186
- (0, renderer_js_1.renderBlankLines)(layout.spacing[afterSpacingKey]);
187
- lineCount += layout.spacing[afterSpacingKey];
187
+ if (effectiveLayout.spacing?.[afterSpacingKey]) {
188
+ (0, renderer_js_1.renderBlankLines)(effectiveLayout.spacing[afterSpacingKey]);
189
+ lineCount += effectiveLayout.spacing[afterSpacingKey];
188
190
  }
189
191
  });
190
192
  state.renderedLines = lineCount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-menu-kit",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "A lightweight, customizable CLI menu system with keyboard shortcuts and real-time rendering",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",