cli-menu-kit 0.1.22 → 0.1.23

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.
@@ -77,13 +77,15 @@ function renderSummaryTable(config) {
77
77
  sections.forEach((section, sectionIndex) => {
78
78
  // Section header if provided
79
79
  if (section.header) {
80
- const headerLine = ` ${colors_js_1.colors.brightCyan}${section.header}${colors_js_1.colors.reset}`;
80
+ const headerLine = ` ${section.header}`;
81
81
  const remainingSpace = boxWidth - section.header.length - 4;
82
82
  (0, terminal_js_1.writeLine)(`│${headerLine}${' '.repeat(remainingSpace)}│`);
83
83
  }
84
+ // Calculate keyPadding based on longest key in this section
85
+ const maxKeyLength = Math.max(...section.items.map(item => item.key.length));
86
+ const keyPadding = maxKeyLength + 3; // +3 for colon and spacing
84
87
  // Section items
85
88
  section.items.forEach(item => {
86
- const keyPadding = 15;
87
89
  const valueMaxWidth = contentWidth - keyPadding - 2; // 2 for leading spaces
88
90
  // Check if value needs wrapping
89
91
  const plainValue = item.value.replace(/\x1b\[[0-9;]*m/g, '');
@@ -91,7 +93,7 @@ function renderSummaryTable(config) {
91
93
  // Wrap the value
92
94
  const wrappedLines = wrapText(plainValue, valueMaxWidth);
93
95
  // First line with key
94
- const firstLine = ` ${item.key}:${' '.repeat(Math.max(1, keyPadding - item.key.length))}${wrappedLines[0]}`;
96
+ const firstLine = ` ${colors_js_1.colors.cyan}${item.key}:${colors_js_1.colors.reset}${' '.repeat(Math.max(1, keyPadding - item.key.length))}${wrappedLines[0]}`;
95
97
  const plainFirstLine = firstLine.replace(/\x1b\[[0-9;]*m/g, '');
96
98
  const remainingSpace = boxWidth - plainFirstLine.length - 2;
97
99
  (0, terminal_js_1.writeLine)(`│${firstLine}${' '.repeat(Math.max(0, remainingSpace))}│`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-menu-kit",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
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",