cli-menu-kit 0.1.9 → 0.1.13
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/dist/components/display/header.js +13 -11
- package/dist/components/display/headers.d.ts +30 -8
- package/dist/components/display/headers.js +45 -15
- package/dist/components/display/index.d.ts +1 -1
- package/dist/components/display/index.js +3 -1
- package/dist/components/menus/radio-menu.js +2 -1
- package/dist/core/colors.d.ts +21 -0
- package/dist/core/colors.js +27 -1
- package/dist/core/renderer.js +17 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const terminal_js_1 = require("../../core/terminal.js");
|
|
|
12
12
|
* @param config - Header configuration
|
|
13
13
|
*/
|
|
14
14
|
function renderHeader(config) {
|
|
15
|
-
const { asciiArt = [], title = '', description = '', version, url, menuTitle, boxWidth = 60, color = colors_js_1.
|
|
15
|
+
const { asciiArt = [], title = '', description = '', version, url, menuTitle, boxWidth = 60, color = colors_js_1.uiColors.border } = config;
|
|
16
16
|
const boldColor = `${color}${colors_js_1.colors.bold}`;
|
|
17
17
|
// Top border
|
|
18
18
|
(0, terminal_js_1.writeLine)('');
|
|
@@ -27,30 +27,32 @@ function renderHeader(config) {
|
|
|
27
27
|
});
|
|
28
28
|
(0, terminal_js_1.writeLine)(`${boldColor}║${' '.repeat(boxWidth - 2)}║${colors_js_1.colors.reset}`);
|
|
29
29
|
}
|
|
30
|
-
// Title (left-aligned with 2 spaces padding)
|
|
30
|
+
// Title (left-aligned with 2 spaces padding, black text)
|
|
31
31
|
if (title) {
|
|
32
32
|
const paddedTitle = ` ${title}`.padEnd(boxWidth - 2, ' ');
|
|
33
|
-
(0, terminal_js_1.writeLine)(`${boldColor}║${paddedTitle}║${colors_js_1.colors.reset}`);
|
|
33
|
+
(0, terminal_js_1.writeLine)(`${boldColor}║${colors_js_1.colors.reset}${paddedTitle}${boldColor}║${colors_js_1.colors.reset}`);
|
|
34
34
|
(0, terminal_js_1.writeLine)(`${boldColor}║${' '.repeat(boxWidth - 2)}║${colors_js_1.colors.reset}`);
|
|
35
35
|
}
|
|
36
|
-
// Description (left-aligned with 2 spaces padding)
|
|
36
|
+
// Description (left-aligned with 2 spaces padding, gray text)
|
|
37
37
|
if (description) {
|
|
38
|
-
const paddedDesc = ` ${description}`.padEnd(boxWidth - 2, ' ');
|
|
38
|
+
const paddedDesc = ` ${colors_js_1.uiColors.textSecondary}${description}${colors_js_1.colors.reset}`.padEnd(boxWidth - 2 + colors_js_1.uiColors.textSecondary.length + colors_js_1.colors.reset.length, ' ');
|
|
39
39
|
(0, terminal_js_1.writeLine)(`${boldColor}║${paddedDesc}║${colors_js_1.colors.reset}`);
|
|
40
40
|
(0, terminal_js_1.writeLine)(`${boldColor}║${' '.repeat(boxWidth - 2)}║${colors_js_1.colors.reset}`);
|
|
41
41
|
}
|
|
42
42
|
// Bottom border
|
|
43
43
|
(0, terminal_js_1.writeLine)(`${boldColor}╚${'═'.repeat(boxWidth - 2)}╝${colors_js_1.colors.reset}`);
|
|
44
|
-
//
|
|
44
|
+
// Blank line after box
|
|
45
|
+
(0, terminal_js_1.writeLine)('');
|
|
46
|
+
// Version and URL (outside the box, with colors)
|
|
45
47
|
if (version || url) {
|
|
46
|
-
const versionText = version ?
|
|
47
|
-
const urlText = url
|
|
48
|
-
const separator = version && url ?
|
|
49
|
-
(0, terminal_js_1.writeLine)(
|
|
48
|
+
const versionText = version ? `${colors_js_1.uiColors.info}Version: ${version}${colors_js_1.colors.reset}` : '';
|
|
49
|
+
const urlText = url ? `${colors_js_1.uiColors.accent}${url}${colors_js_1.colors.reset}` : '';
|
|
50
|
+
const separator = version && url ? `${colors_js_1.uiColors.textSecondary} | ${colors_js_1.colors.reset}` : '';
|
|
51
|
+
(0, terminal_js_1.writeLine)(` ${versionText}${separator}${urlText}`);
|
|
50
52
|
}
|
|
51
|
-
(0, terminal_js_1.writeLine)('');
|
|
52
53
|
// Menu title (optional)
|
|
53
54
|
if (menuTitle) {
|
|
55
|
+
(0, terminal_js_1.writeLine)('');
|
|
54
56
|
(0, terminal_js_1.writeLine)(`${color} ${menuTitle}${colors_js_1.colors.reset}`);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -1,28 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Headers - Display header components
|
|
3
|
-
* Provides
|
|
3
|
+
* Provides three header modes: full, section, and simple
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { AsciiHeaderConfig } from '../../types/display.types.js';
|
|
6
6
|
/**
|
|
7
|
-
* Render a simple header
|
|
8
|
-
*
|
|
7
|
+
* Render a simple header with equals signs
|
|
8
|
+
* Format: === Title ===
|
|
9
|
+
* @param text - Header text
|
|
10
|
+
* @param color - Optional color (default: cyan)
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderSimpleHeader(text: string, color?: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Render a section header with double-line borders
|
|
15
|
+
* Format:
|
|
16
|
+
* ══════════════════════════════════════════════════
|
|
17
|
+
* Title
|
|
18
|
+
* ══════════════════════════════════════════════════
|
|
19
|
+
* @param text - Header text
|
|
20
|
+
* @param width - Border width (default: 50)
|
|
21
|
+
* @param color - Optional color (default: cyan)
|
|
9
22
|
*/
|
|
10
|
-
export declare function
|
|
23
|
+
export declare function renderSectionHeader(text: string, width?: number, color?: string): void;
|
|
11
24
|
/**
|
|
12
|
-
* Render an ASCII art header with decorations
|
|
25
|
+
* Render an ASCII art header with decorations (legacy)
|
|
13
26
|
* @param config - Header configuration
|
|
27
|
+
* @deprecated Use renderHeader from header.ts for full headers
|
|
14
28
|
*/
|
|
15
29
|
export declare function renderAsciiHeader(config: AsciiHeaderConfig): void;
|
|
16
30
|
/**
|
|
17
|
-
* Create a simple header
|
|
31
|
+
* Create a simple header (convenience function)
|
|
18
32
|
* @param text - Header text
|
|
19
33
|
* @param color - Optional color
|
|
20
34
|
*/
|
|
21
35
|
export declare function createSimpleHeader(text: string, color?: string): void;
|
|
22
36
|
/**
|
|
23
|
-
* Create
|
|
37
|
+
* Create a section header (convenience function)
|
|
38
|
+
* @param text - Header text
|
|
39
|
+
* @param width - Border width
|
|
40
|
+
* @param color - Optional color
|
|
41
|
+
*/
|
|
42
|
+
export declare function createSectionHeader(text: string, width?: number, color?: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Create an ASCII header (convenience function)
|
|
24
45
|
* @param asciiArt - ASCII art string
|
|
25
46
|
* @param options - Optional configuration
|
|
47
|
+
* @deprecated Use renderHeader from header.ts for full headers
|
|
26
48
|
*/
|
|
27
49
|
export declare function createAsciiHeader(asciiArt: string, options?: {
|
|
28
50
|
subtitle?: string;
|
|
@@ -1,32 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Headers - Display header components
|
|
4
|
-
* Provides
|
|
4
|
+
* Provides three header modes: full, section, and simple
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.renderSimpleHeader = renderSimpleHeader;
|
|
8
|
+
exports.renderSectionHeader = renderSectionHeader;
|
|
8
9
|
exports.renderAsciiHeader = renderAsciiHeader;
|
|
9
10
|
exports.createSimpleHeader = createSimpleHeader;
|
|
11
|
+
exports.createSectionHeader = createSectionHeader;
|
|
10
12
|
exports.createAsciiHeader = createAsciiHeader;
|
|
11
13
|
const terminal_js_1 = require("../../core/terminal.js");
|
|
12
14
|
const colors_js_1 = require("../../core/colors.js");
|
|
13
15
|
const terminal_js_2 = require("../../core/terminal.js");
|
|
14
16
|
/**
|
|
15
|
-
* Render a simple header
|
|
16
|
-
*
|
|
17
|
+
* Render a simple header with equals signs
|
|
18
|
+
* Format: === Title ===
|
|
19
|
+
* @param text - Header text
|
|
20
|
+
* @param color - Optional color (default: cyan)
|
|
17
21
|
*/
|
|
18
|
-
function renderSimpleHeader(
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else {
|
|
24
|
-
(0, terminal_js_1.writeLine)(text);
|
|
25
|
-
}
|
|
22
|
+
function renderSimpleHeader(text, color) {
|
|
23
|
+
const headerColor = color || colors_js_1.uiColors.primary;
|
|
24
|
+
const line = `=== ${text} ===`;
|
|
25
|
+
(0, terminal_js_1.writeLine)(`${headerColor}${line}${colors_js_1.colors.reset}`);
|
|
26
|
+
(0, terminal_js_1.writeLine)('');
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* Render
|
|
29
|
+
* Render a section header with double-line borders
|
|
30
|
+
* Format:
|
|
31
|
+
* ══════════════════════════════════════════════════
|
|
32
|
+
* Title
|
|
33
|
+
* ══════════════════════════════════════════════════
|
|
34
|
+
* @param text - Header text
|
|
35
|
+
* @param width - Border width (default: 50)
|
|
36
|
+
* @param color - Optional color (default: cyan)
|
|
37
|
+
*/
|
|
38
|
+
function renderSectionHeader(text, width = 50, color) {
|
|
39
|
+
const headerColor = color || colors_js_1.uiColors.border;
|
|
40
|
+
const border = '═'.repeat(width);
|
|
41
|
+
(0, terminal_js_1.writeLine)(`${headerColor}${border}${colors_js_1.colors.reset}`);
|
|
42
|
+
(0, terminal_js_1.writeLine)(` ${text}`);
|
|
43
|
+
(0, terminal_js_1.writeLine)(`${headerColor}${border}${colors_js_1.colors.reset}`);
|
|
44
|
+
(0, terminal_js_1.writeLine)('');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render an ASCII art header with decorations (legacy)
|
|
29
48
|
* @param config - Header configuration
|
|
49
|
+
* @deprecated Use renderHeader from header.ts for full headers
|
|
30
50
|
*/
|
|
31
51
|
function renderAsciiHeader(config) {
|
|
32
52
|
const { asciiArt, subtitle, version, url, borderChar = '═' } = config;
|
|
@@ -64,17 +84,27 @@ function renderAsciiHeader(config) {
|
|
|
64
84
|
(0, terminal_js_1.writeLine)('');
|
|
65
85
|
}
|
|
66
86
|
/**
|
|
67
|
-
* Create a simple header
|
|
87
|
+
* Create a simple header (convenience function)
|
|
68
88
|
* @param text - Header text
|
|
69
89
|
* @param color - Optional color
|
|
70
90
|
*/
|
|
71
91
|
function createSimpleHeader(text, color) {
|
|
72
|
-
renderSimpleHeader(
|
|
92
|
+
renderSimpleHeader(text, color);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a section header (convenience function)
|
|
96
|
+
* @param text - Header text
|
|
97
|
+
* @param width - Border width
|
|
98
|
+
* @param color - Optional color
|
|
99
|
+
*/
|
|
100
|
+
function createSectionHeader(text, width, color) {
|
|
101
|
+
renderSectionHeader(text, width, color);
|
|
73
102
|
}
|
|
74
103
|
/**
|
|
75
|
-
* Create an ASCII header
|
|
104
|
+
* Create an ASCII header (convenience function)
|
|
76
105
|
* @param asciiArt - ASCII art string
|
|
77
106
|
* @param options - Optional configuration
|
|
107
|
+
* @deprecated Use renderHeader from header.ts for full headers
|
|
78
108
|
*/
|
|
79
109
|
function createAsciiHeader(asciiArt, options) {
|
|
80
110
|
renderAsciiHeader({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Display components index
|
|
3
3
|
* Exports all display component functions
|
|
4
4
|
*/
|
|
5
|
-
export { renderSimpleHeader, renderAsciiHeader, createSimpleHeader, createAsciiHeader } from './headers.js';
|
|
5
|
+
export { renderSimpleHeader, renderSectionHeader, renderAsciiHeader, createSimpleHeader, createSectionHeader, createAsciiHeader } from './headers.js';
|
|
6
6
|
export { renderProgressIndicator, renderStageHeader, renderStageSeparator, createProgressIndicator, createStageHeader, createStageSeparator } from './progress.js';
|
|
7
7
|
export { renderMessage, showSuccess, showError, showWarning, showInfo, showQuestion, createMessage } from './messages.js';
|
|
8
8
|
export { renderSummaryTable, createSummaryTable, createSimpleSummary } from './summary.js';
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* Exports all display component functions
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.renderHeader = exports.createSimpleSummary = exports.createSummaryTable = exports.renderSummaryTable = exports.createMessage = exports.showQuestion = exports.showInfo = exports.showWarning = exports.showError = exports.showSuccess = exports.renderMessage = exports.createStageSeparator = exports.createStageHeader = exports.createProgressIndicator = exports.renderStageSeparator = exports.renderStageHeader = exports.renderProgressIndicator = exports.createAsciiHeader = exports.createSimpleHeader = exports.renderAsciiHeader = exports.renderSimpleHeader = void 0;
|
|
7
|
+
exports.renderHeader = exports.createSimpleSummary = exports.createSummaryTable = exports.renderSummaryTable = exports.createMessage = exports.showQuestion = exports.showInfo = exports.showWarning = exports.showError = exports.showSuccess = exports.renderMessage = exports.createStageSeparator = exports.createStageHeader = exports.createProgressIndicator = exports.renderStageSeparator = exports.renderStageHeader = exports.renderProgressIndicator = exports.createAsciiHeader = exports.createSectionHeader = exports.createSimpleHeader = exports.renderAsciiHeader = exports.renderSectionHeader = exports.renderSimpleHeader = void 0;
|
|
8
8
|
var headers_js_1 = require("./headers.js");
|
|
9
9
|
Object.defineProperty(exports, "renderSimpleHeader", { enumerable: true, get: function () { return headers_js_1.renderSimpleHeader; } });
|
|
10
|
+
Object.defineProperty(exports, "renderSectionHeader", { enumerable: true, get: function () { return headers_js_1.renderSectionHeader; } });
|
|
10
11
|
Object.defineProperty(exports, "renderAsciiHeader", { enumerable: true, get: function () { return headers_js_1.renderAsciiHeader; } });
|
|
11
12
|
Object.defineProperty(exports, "createSimpleHeader", { enumerable: true, get: function () { return headers_js_1.createSimpleHeader; } });
|
|
13
|
+
Object.defineProperty(exports, "createSectionHeader", { enumerable: true, get: function () { return headers_js_1.createSectionHeader; } });
|
|
12
14
|
Object.defineProperty(exports, "createAsciiHeader", { enumerable: true, get: function () { return headers_js_1.createAsciiHeader; } });
|
|
13
15
|
var progress_js_1 = require("./progress.js");
|
|
14
16
|
Object.defineProperty(exports, "renderProgressIndicator", { enumerable: true, get: function () { return progress_js_1.renderProgressIndicator; } });
|
|
@@ -118,13 +118,14 @@ async function showRadioMenu(config) {
|
|
|
118
118
|
const prefix = (numberMatch || letterMatch) ? '' : `${selectableIndices.indexOf(index) + 1}. `;
|
|
119
119
|
// Check if this is an Exit option (contains "Exit" or "Quit")
|
|
120
120
|
const isExitOption = /\b(exit|quit)\b/i.test(item.value);
|
|
121
|
-
const displayValue = isExitOption ? `${colors_js_1.
|
|
121
|
+
const displayValue = isExitOption ? `${colors_js_1.uiColors.error}${item.value}${colors_js_1.colors.reset}` : item.value;
|
|
122
122
|
// For radio menus, don't show selection indicator (pass undefined instead of false)
|
|
123
123
|
(0, renderer_js_1.renderOption)(displayValue, undefined, index === selectedIndex, prefix);
|
|
124
124
|
// Add blank line after last item before next separator
|
|
125
125
|
const nextIndex = index + 1;
|
|
126
126
|
if (nextIndex < optionData.length && optionData[nextIndex].isSeparator) {
|
|
127
127
|
(0, terminal_js_1.writeLine)('');
|
|
128
|
+
lineCount++; // Count the blank line
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
lineCount++;
|
package/dist/core/colors.d.ts
CHANGED
|
@@ -39,6 +39,27 @@ export declare const colors: {
|
|
|
39
39
|
readonly hidden: "\u001B[8m";
|
|
40
40
|
readonly strikethrough: "\u001B[9m";
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Semantic color hierarchy for UI elements
|
|
44
|
+
* Defines consistent colors for different levels of information
|
|
45
|
+
*/
|
|
46
|
+
export declare const uiColors: {
|
|
47
|
+
readonly primary: "\u001B[36m";
|
|
48
|
+
readonly accent: "\u001B[34m";
|
|
49
|
+
readonly textPrimary: "\u001B[0m";
|
|
50
|
+
readonly textSecondary: "\u001B[2m";
|
|
51
|
+
readonly textMuted: "\u001B[90m";
|
|
52
|
+
readonly success: "\u001B[32m";
|
|
53
|
+
readonly error: "\u001B[31m";
|
|
54
|
+
readonly warning: "\u001B[33m";
|
|
55
|
+
readonly info: "\u001B[34m";
|
|
56
|
+
readonly cursor: "\u001B[36m";
|
|
57
|
+
readonly selected: "\u001B[32m";
|
|
58
|
+
readonly disabled: "\u001B[2m";
|
|
59
|
+
readonly border: "\u001B[36m";
|
|
60
|
+
readonly separator: "\u001B[2m";
|
|
61
|
+
readonly prefix: "\u001B[2m";
|
|
62
|
+
};
|
|
42
63
|
/**
|
|
43
64
|
* Create a gradient between two colors
|
|
44
65
|
* @param startColor - Starting ANSI color code
|
package/dist/core/colors.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Supports single colors and two-color gradients
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.colors = void 0;
|
|
7
|
+
exports.uiColors = exports.colors = void 0;
|
|
8
8
|
exports.createGradient = createGradient;
|
|
9
9
|
exports.applyGradient = applyGradient;
|
|
10
10
|
exports.colorize = colorize;
|
|
@@ -50,6 +50,32 @@ exports.colors = {
|
|
|
50
50
|
hidden: '\x1b[8m',
|
|
51
51
|
strikethrough: '\x1b[9m'
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Semantic color hierarchy for UI elements
|
|
55
|
+
* Defines consistent colors for different levels of information
|
|
56
|
+
*/
|
|
57
|
+
exports.uiColors = {
|
|
58
|
+
// Primary elements
|
|
59
|
+
primary: exports.colors.cyan, // Main interactive elements, highlights
|
|
60
|
+
accent: exports.colors.blue, // Secondary highlights, links
|
|
61
|
+
// Text hierarchy
|
|
62
|
+
textPrimary: exports.colors.reset, // Main text (black/default)
|
|
63
|
+
textSecondary: exports.colors.dim, // Descriptions, hints, less important text
|
|
64
|
+
textMuted: exports.colors.brightBlack, // Very subtle text
|
|
65
|
+
// Status colors
|
|
66
|
+
success: exports.colors.green, // Success states, confirmations
|
|
67
|
+
error: exports.colors.red, // Errors, warnings, exit
|
|
68
|
+
warning: exports.colors.yellow, // Warnings, cautions
|
|
69
|
+
info: exports.colors.blue, // Informational messages
|
|
70
|
+
// Interactive elements
|
|
71
|
+
cursor: exports.colors.cyan, // Cursor indicator
|
|
72
|
+
selected: exports.colors.green, // Selected items
|
|
73
|
+
disabled: exports.colors.dim, // Disabled/inactive items
|
|
74
|
+
// Structural elements
|
|
75
|
+
border: exports.colors.cyan, // Borders, frames
|
|
76
|
+
separator: exports.colors.dim, // Separators, dividers
|
|
77
|
+
prefix: exports.colors.dim // Number/letter prefixes
|
|
78
|
+
};
|
|
53
79
|
/**
|
|
54
80
|
* Parse ANSI color code to RGB values
|
|
55
81
|
* Supports basic 8 colors and bright variants
|
package/dist/core/renderer.js
CHANGED
|
@@ -51,25 +51,35 @@ function renderOption(text, isSelected, isHighlighted, prefix) {
|
|
|
51
51
|
let line = '';
|
|
52
52
|
// Add cursor indicator if highlighted
|
|
53
53
|
if (isHighlighted) {
|
|
54
|
-
line += `${colors_js_1.
|
|
54
|
+
line += `${colors_js_1.uiColors.cursor}❯ ${colors_js_1.colors.reset}`;
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
line += ' ';
|
|
58
58
|
}
|
|
59
59
|
// Add checkbox for multi-select
|
|
60
60
|
if (isSelected !== undefined && typeof isSelected === 'boolean') {
|
|
61
|
-
line += isSelected ? `${colors_js_1.
|
|
61
|
+
line += isSelected ? `${colors_js_1.uiColors.selected}◉${colors_js_1.colors.reset} ` : `${colors_js_1.uiColors.disabled}○${colors_js_1.colors.reset} `;
|
|
62
62
|
}
|
|
63
63
|
// Add prefix if provided
|
|
64
64
|
if (prefix) {
|
|
65
|
-
line += `${colors_js_1.
|
|
65
|
+
line += `${colors_js_1.uiColors.prefix}${prefix}${colors_js_1.colors.reset}`;
|
|
66
66
|
}
|
|
67
67
|
// Add option text
|
|
68
|
+
// Split text by " - " to separate main text from description
|
|
69
|
+
const parts = text.split(' - ');
|
|
70
|
+
const mainText = parts[0];
|
|
71
|
+
const description = parts.length > 1 ? parts.slice(1).join(' - ') : '';
|
|
68
72
|
if (isHighlighted) {
|
|
69
|
-
line += `${colors_js_1.
|
|
73
|
+
line += `${colors_js_1.uiColors.primary}${mainText}${colors_js_1.colors.reset}`;
|
|
74
|
+
if (description) {
|
|
75
|
+
line += ` ${colors_js_1.uiColors.textSecondary}- ${description}${colors_js_1.colors.reset}`;
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
78
|
else {
|
|
72
|
-
line +=
|
|
79
|
+
line += mainText;
|
|
80
|
+
if (description) {
|
|
81
|
+
line += ` ${colors_js_1.uiColors.textSecondary}- ${description}${colors_js_1.colors.reset}`;
|
|
82
|
+
}
|
|
73
83
|
}
|
|
74
84
|
(0, terminal_js_1.writeLine)(line);
|
|
75
85
|
}
|
|
@@ -127,14 +137,14 @@ function renderSeparator(char = '─', width) {
|
|
|
127
137
|
*/
|
|
128
138
|
function renderSectionLabel(label) {
|
|
129
139
|
if (label) {
|
|
130
|
-
const totalWidth =
|
|
140
|
+
const totalWidth = 30; // Fixed total width for consistency
|
|
131
141
|
const padding = 2; // Spaces around label
|
|
132
142
|
const labelWithPadding = ` ${label} `;
|
|
133
143
|
const labelLength = labelWithPadding.length;
|
|
134
144
|
const dashesTotal = totalWidth - labelLength;
|
|
135
145
|
const dashesLeft = Math.floor(dashesTotal / 2);
|
|
136
146
|
const dashesRight = dashesTotal - dashesLeft;
|
|
137
|
-
const line = ` ${colors_js_1.
|
|
147
|
+
const line = ` ${colors_js_1.uiColors.separator}${'─'.repeat(dashesLeft)}${labelWithPadding}${'─'.repeat(dashesRight)}${colors_js_1.colors.reset}`;
|
|
138
148
|
(0, terminal_js_1.writeLine)(line);
|
|
139
149
|
}
|
|
140
150
|
else {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { menuAPI as menu, inputAPI as input, wizardAPI as wizard } from './api.j
|
|
|
6
6
|
export { default } from './api.js';
|
|
7
7
|
export { showRadioMenu, showCheckboxMenu, showBooleanMenu } from './components/menus/index.js';
|
|
8
8
|
export { showTextInput, showNumberInput, showLanguageSelector, showModifyField } from './components/inputs/index.js';
|
|
9
|
-
export { renderSimpleHeader, renderAsciiHeader, createSimpleHeader, createAsciiHeader, renderProgressIndicator, renderStageHeader, renderStageSeparator, createProgressIndicator, createStageHeader, createStageSeparator, renderMessage, showSuccess, showError, showWarning, showInfo, showQuestion, createMessage, renderSummaryTable, createSummaryTable, createSimpleSummary, renderHeader, type HeaderConfig } from './components/display/index.js';
|
|
9
|
+
export { renderSimpleHeader, renderSectionHeader, renderAsciiHeader, createSimpleHeader, createSectionHeader, createAsciiHeader, renderProgressIndicator, renderStageHeader, renderStageSeparator, createProgressIndicator, createStageHeader, createStageSeparator, renderMessage, showSuccess, showError, showWarning, showInfo, showQuestion, createMessage, renderSummaryTable, createSummaryTable, createSimpleSummary, renderHeader, type HeaderConfig } from './components/display/index.js';
|
|
10
10
|
export { runWizard, createWizard, WizardConfig, WizardStep, WizardResult } from './features/wizard.js';
|
|
11
11
|
export { registerCommand, unregisterCommand, clearCustomCommands, isCommand, parseCommand, handleCommand, getAvailableCommands, showCommandHelp } from './features/commands.js';
|
|
12
12
|
export { getCurrentLanguage, setLanguage, t, registerLanguage, getAvailableLanguages, getCurrentLanguageMap } from './i18n/registry.js';
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
21
21
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.
|
|
25
|
-
exports.LAYOUT_PRESETS = exports.KEY_CODES = exports.colorize = exports.applyGradient = void 0;
|
|
24
|
+
exports.getCurrentLanguageMap = exports.getAvailableLanguages = exports.registerLanguage = exports.t = exports.setLanguage = exports.getCurrentLanguage = exports.showCommandHelp = exports.getAvailableCommands = exports.handleCommand = exports.parseCommand = exports.isCommand = exports.clearCustomCommands = exports.unregisterCommand = exports.registerCommand = exports.createWizard = exports.runWizard = exports.renderHeader = exports.createSimpleSummary = exports.createSummaryTable = exports.renderSummaryTable = exports.createMessage = exports.showQuestion = exports.showInfo = exports.showWarning = exports.showError = exports.showSuccess = exports.renderMessage = exports.createStageSeparator = exports.createStageHeader = exports.createProgressIndicator = exports.renderStageSeparator = exports.renderStageHeader = exports.renderProgressIndicator = exports.createAsciiHeader = exports.createSectionHeader = exports.createSimpleHeader = exports.renderAsciiHeader = exports.renderSectionHeader = exports.renderSimpleHeader = exports.showModifyField = exports.showLanguageSelector = exports.showNumberInput = exports.showTextInput = exports.showBooleanMenu = exports.showCheckboxMenu = exports.showRadioMenu = exports.default = exports.wizard = exports.input = exports.menu = void 0;
|
|
25
|
+
exports.LAYOUT_PRESETS = exports.KEY_CODES = exports.colorize = exports.applyGradient = exports.createGradient = exports.colors = void 0;
|
|
26
26
|
// Export unified API
|
|
27
27
|
var api_js_1 = require("./api.js");
|
|
28
28
|
Object.defineProperty(exports, "menu", { enumerable: true, get: function () { return api_js_1.menuAPI; } });
|
|
@@ -44,8 +44,10 @@ Object.defineProperty(exports, "showModifyField", { enumerable: true, get: funct
|
|
|
44
44
|
// Export display components
|
|
45
45
|
var index_js_3 = require("./components/display/index.js");
|
|
46
46
|
Object.defineProperty(exports, "renderSimpleHeader", { enumerable: true, get: function () { return index_js_3.renderSimpleHeader; } });
|
|
47
|
+
Object.defineProperty(exports, "renderSectionHeader", { enumerable: true, get: function () { return index_js_3.renderSectionHeader; } });
|
|
47
48
|
Object.defineProperty(exports, "renderAsciiHeader", { enumerable: true, get: function () { return index_js_3.renderAsciiHeader; } });
|
|
48
49
|
Object.defineProperty(exports, "createSimpleHeader", { enumerable: true, get: function () { return index_js_3.createSimpleHeader; } });
|
|
50
|
+
Object.defineProperty(exports, "createSectionHeader", { enumerable: true, get: function () { return index_js_3.createSectionHeader; } });
|
|
49
51
|
Object.defineProperty(exports, "createAsciiHeader", { enumerable: true, get: function () { return index_js_3.createAsciiHeader; } });
|
|
50
52
|
Object.defineProperty(exports, "renderProgressIndicator", { enumerable: true, get: function () { return index_js_3.renderProgressIndicator; } });
|
|
51
53
|
Object.defineProperty(exports, "renderStageHeader", { enumerable: true, get: function () { return index_js_3.renderStageHeader; } });
|
package/package.json
CHANGED