cli-menu-kit 0.1.0
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/LICENSE +21 -0
- package/README.md +716 -0
- package/dist/api.d.ts +158 -0
- package/dist/api.js +128 -0
- package/dist/components/display/headers.d.ts +32 -0
- package/dist/components/display/headers.js +84 -0
- package/dist/components/display/index.d.ts +8 -0
- package/dist/components/display/index.js +31 -0
- package/dist/components/display/messages.d.ts +41 -0
- package/dist/components/display/messages.js +90 -0
- package/dist/components/display/progress.d.ts +41 -0
- package/dist/components/display/progress.js +82 -0
- package/dist/components/display/summary.d.ts +33 -0
- package/dist/components/display/summary.js +82 -0
- package/dist/components/inputs/index.d.ts +8 -0
- package/dist/components/inputs/index.js +15 -0
- package/dist/components/inputs/language-input.d.ts +11 -0
- package/dist/components/inputs/language-input.js +104 -0
- package/dist/components/inputs/modify-field.d.ts +11 -0
- package/dist/components/inputs/modify-field.js +42 -0
- package/dist/components/inputs/number-input.d.ts +11 -0
- package/dist/components/inputs/number-input.js +143 -0
- package/dist/components/inputs/text-input.d.ts +11 -0
- package/dist/components/inputs/text-input.js +114 -0
- package/dist/components/menus/boolean-menu.d.ts +11 -0
- package/dist/components/menus/boolean-menu.js +169 -0
- package/dist/components/menus/checkbox-menu.d.ts +11 -0
- package/dist/components/menus/checkbox-menu.js +161 -0
- package/dist/components/menus/index.d.ts +7 -0
- package/dist/components/menus/index.js +13 -0
- package/dist/components/menus/radio-menu.d.ts +11 -0
- package/dist/components/menus/radio-menu.js +158 -0
- package/dist/components.d.ts +55 -0
- package/dist/components.js +166 -0
- package/dist/core/colors.d.ts +64 -0
- package/dist/core/colors.js +139 -0
- package/dist/core/keyboard.d.ts +124 -0
- package/dist/core/keyboard.js +185 -0
- package/dist/core/renderer.d.ts +74 -0
- package/dist/core/renderer.js +217 -0
- package/dist/core/terminal.d.ts +89 -0
- package/dist/core/terminal.js +170 -0
- package/dist/features/commands.d.ts +57 -0
- package/dist/features/commands.js +161 -0
- package/dist/features/wizard.d.ts +62 -0
- package/dist/features/wizard.js +112 -0
- package/dist/i18n/languages/en.d.ts +5 -0
- package/dist/i18n/languages/en.js +54 -0
- package/dist/i18n/languages/zh.d.ts +5 -0
- package/dist/i18n/languages/zh.js +54 -0
- package/dist/i18n/registry.d.ts +36 -0
- package/dist/i18n/registry.js +82 -0
- package/dist/i18n/types.d.ts +65 -0
- package/dist/i18n/types.js +5 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +104 -0
- package/dist/input.d.ts +40 -0
- package/dist/input.js +211 -0
- package/dist/menu-core.d.ts +52 -0
- package/dist/menu-core.js +201 -0
- package/dist/menu-multi.d.ts +21 -0
- package/dist/menu-multi.js +119 -0
- package/dist/menu-single.d.ts +18 -0
- package/dist/menu-single.js +138 -0
- package/dist/menu.d.ts +66 -0
- package/dist/menu.js +78 -0
- package/dist/types/display.types.d.ts +57 -0
- package/dist/types/display.types.js +5 -0
- package/dist/types/input.types.d.ts +88 -0
- package/dist/types/input.types.js +5 -0
- package/dist/types/layout.types.d.ts +56 -0
- package/dist/types/layout.types.js +36 -0
- package/dist/types/menu.types.d.ts +85 -0
- package/dist/types/menu.types.js +5 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.js +5 -0
- package/package.json +35 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified API - Main entry point for CLI Menu Kit
|
|
3
|
+
* Provides a simple, consistent API for all components
|
|
4
|
+
*/
|
|
5
|
+
import { WizardConfig, WizardResult } from './features/wizard.js';
|
|
6
|
+
import { RadioMenuConfig, CheckboxMenuConfig, BooleanMenuConfig, RadioMenuResult, CheckboxMenuResult, BooleanMenuResult } from './types/menu.types.js';
|
|
7
|
+
import { TextInputConfig, NumberInputConfig, LanguageSelectorConfig, ModifyFieldConfig, TextInputResult, NumberInputResult, LanguageSelectorResult, ModifyFieldResult } from './types/input.types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Unified menu API
|
|
10
|
+
*/
|
|
11
|
+
export declare const menuAPI: {
|
|
12
|
+
/**
|
|
13
|
+
* Show a radio menu (single-select)
|
|
14
|
+
* @param config - Menu configuration
|
|
15
|
+
* @returns Promise resolving to selected option
|
|
16
|
+
*/
|
|
17
|
+
radio: (config: RadioMenuConfig) => Promise<RadioMenuResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Show a checkbox menu (multi-select)
|
|
20
|
+
* @param config - Menu configuration
|
|
21
|
+
* @returns Promise resolving to selected options
|
|
22
|
+
*/
|
|
23
|
+
checkbox: (config: CheckboxMenuConfig) => Promise<CheckboxMenuResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Show a boolean menu (yes/no)
|
|
26
|
+
* @param config - Menu configuration
|
|
27
|
+
* @returns Promise resolving to boolean result
|
|
28
|
+
*/
|
|
29
|
+
boolean: (config: BooleanMenuConfig) => Promise<BooleanMenuResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Show a boolean menu (horizontal)
|
|
32
|
+
* @param question - Question text
|
|
33
|
+
* @param defaultValue - Default value
|
|
34
|
+
* @returns Promise resolving to boolean result
|
|
35
|
+
*/
|
|
36
|
+
booleanH: (question: string, defaultValue?: boolean) => Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Show a boolean menu (vertical)
|
|
39
|
+
* @param question - Question text
|
|
40
|
+
* @param defaultValue - Default value
|
|
41
|
+
* @returns Promise resolving to boolean result
|
|
42
|
+
*/
|
|
43
|
+
booleanV: (question: string, defaultValue?: boolean) => Promise<boolean>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Unified input API
|
|
47
|
+
*/
|
|
48
|
+
export declare const inputAPI: {
|
|
49
|
+
/**
|
|
50
|
+
* Show a text input
|
|
51
|
+
* @param config - Input configuration
|
|
52
|
+
* @returns Promise resolving to entered text
|
|
53
|
+
*/
|
|
54
|
+
text: (config: TextInputConfig) => Promise<TextInputResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Show a number input
|
|
57
|
+
* @param config - Input configuration
|
|
58
|
+
* @returns Promise resolving to entered number
|
|
59
|
+
*/
|
|
60
|
+
number: (config: NumberInputConfig) => Promise<NumberInputResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Show a language selector
|
|
63
|
+
* @param config - Selector configuration
|
|
64
|
+
* @returns Promise resolving to selected language code
|
|
65
|
+
*/
|
|
66
|
+
language: (config: LanguageSelectorConfig) => Promise<LanguageSelectorResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Show a modify field prompt
|
|
69
|
+
* @param config - Field configuration
|
|
70
|
+
* @returns Promise resolving to modification result
|
|
71
|
+
*/
|
|
72
|
+
modifyField: (config: ModifyFieldConfig) => Promise<ModifyFieldResult>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Unified wizard API
|
|
76
|
+
*/
|
|
77
|
+
export declare const wizardAPI: {
|
|
78
|
+
/**
|
|
79
|
+
* Run a wizard
|
|
80
|
+
* @param config - Wizard configuration
|
|
81
|
+
* @returns Promise resolving to wizard results
|
|
82
|
+
*/
|
|
83
|
+
run: (config: WizardConfig) => Promise<WizardResult>;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Default export with all APIs
|
|
87
|
+
*/
|
|
88
|
+
declare const _default: {
|
|
89
|
+
menu: {
|
|
90
|
+
/**
|
|
91
|
+
* Show a radio menu (single-select)
|
|
92
|
+
* @param config - Menu configuration
|
|
93
|
+
* @returns Promise resolving to selected option
|
|
94
|
+
*/
|
|
95
|
+
radio: (config: RadioMenuConfig) => Promise<RadioMenuResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Show a checkbox menu (multi-select)
|
|
98
|
+
* @param config - Menu configuration
|
|
99
|
+
* @returns Promise resolving to selected options
|
|
100
|
+
*/
|
|
101
|
+
checkbox: (config: CheckboxMenuConfig) => Promise<CheckboxMenuResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Show a boolean menu (yes/no)
|
|
104
|
+
* @param config - Menu configuration
|
|
105
|
+
* @returns Promise resolving to boolean result
|
|
106
|
+
*/
|
|
107
|
+
boolean: (config: BooleanMenuConfig) => Promise<BooleanMenuResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Show a boolean menu (horizontal)
|
|
110
|
+
* @param question - Question text
|
|
111
|
+
* @param defaultValue - Default value
|
|
112
|
+
* @returns Promise resolving to boolean result
|
|
113
|
+
*/
|
|
114
|
+
booleanH: (question: string, defaultValue?: boolean) => Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Show a boolean menu (vertical)
|
|
117
|
+
* @param question - Question text
|
|
118
|
+
* @param defaultValue - Default value
|
|
119
|
+
* @returns Promise resolving to boolean result
|
|
120
|
+
*/
|
|
121
|
+
booleanV: (question: string, defaultValue?: boolean) => Promise<boolean>;
|
|
122
|
+
};
|
|
123
|
+
input: {
|
|
124
|
+
/**
|
|
125
|
+
* Show a text input
|
|
126
|
+
* @param config - Input configuration
|
|
127
|
+
* @returns Promise resolving to entered text
|
|
128
|
+
*/
|
|
129
|
+
text: (config: TextInputConfig) => Promise<TextInputResult>;
|
|
130
|
+
/**
|
|
131
|
+
* Show a number input
|
|
132
|
+
* @param config - Input configuration
|
|
133
|
+
* @returns Promise resolving to entered number
|
|
134
|
+
*/
|
|
135
|
+
number: (config: NumberInputConfig) => Promise<NumberInputResult>;
|
|
136
|
+
/**
|
|
137
|
+
* Show a language selector
|
|
138
|
+
* @param config - Selector configuration
|
|
139
|
+
* @returns Promise resolving to selected language code
|
|
140
|
+
*/
|
|
141
|
+
language: (config: LanguageSelectorConfig) => Promise<LanguageSelectorResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Show a modify field prompt
|
|
144
|
+
* @param config - Field configuration
|
|
145
|
+
* @returns Promise resolving to modification result
|
|
146
|
+
*/
|
|
147
|
+
modifyField: (config: ModifyFieldConfig) => Promise<ModifyFieldResult>;
|
|
148
|
+
};
|
|
149
|
+
wizard: {
|
|
150
|
+
/**
|
|
151
|
+
* Run a wizard
|
|
152
|
+
* @param config - Wizard configuration
|
|
153
|
+
* @returns Promise resolving to wizard results
|
|
154
|
+
*/
|
|
155
|
+
run: (config: WizardConfig) => Promise<WizardResult>;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export default _default;
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Unified API - Main entry point for CLI Menu Kit
|
|
4
|
+
* Provides a simple, consistent API for all components
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.wizardAPI = exports.inputAPI = exports.menuAPI = void 0;
|
|
8
|
+
const radio_menu_js_1 = require("./components/menus/radio-menu.js");
|
|
9
|
+
const checkbox_menu_js_1 = require("./components/menus/checkbox-menu.js");
|
|
10
|
+
const boolean_menu_js_1 = require("./components/menus/boolean-menu.js");
|
|
11
|
+
const text_input_js_1 = require("./components/inputs/text-input.js");
|
|
12
|
+
const number_input_js_1 = require("./components/inputs/number-input.js");
|
|
13
|
+
const language_input_js_1 = require("./components/inputs/language-input.js");
|
|
14
|
+
const modify_field_js_1 = require("./components/inputs/modify-field.js");
|
|
15
|
+
const wizard_js_1 = require("./features/wizard.js");
|
|
16
|
+
/**
|
|
17
|
+
* Unified menu API
|
|
18
|
+
*/
|
|
19
|
+
exports.menuAPI = {
|
|
20
|
+
/**
|
|
21
|
+
* Show a radio menu (single-select)
|
|
22
|
+
* @param config - Menu configuration
|
|
23
|
+
* @returns Promise resolving to selected option
|
|
24
|
+
*/
|
|
25
|
+
radio: (config) => {
|
|
26
|
+
return (0, radio_menu_js_1.showRadioMenu)(config);
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Show a checkbox menu (multi-select)
|
|
30
|
+
* @param config - Menu configuration
|
|
31
|
+
* @returns Promise resolving to selected options
|
|
32
|
+
*/
|
|
33
|
+
checkbox: (config) => {
|
|
34
|
+
return (0, checkbox_menu_js_1.showCheckboxMenu)(config);
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Show a boolean menu (yes/no)
|
|
38
|
+
* @param config - Menu configuration
|
|
39
|
+
* @returns Promise resolving to boolean result
|
|
40
|
+
*/
|
|
41
|
+
boolean: (config) => {
|
|
42
|
+
return (0, boolean_menu_js_1.showBooleanMenu)(config);
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Show a boolean menu (horizontal)
|
|
46
|
+
* @param question - Question text
|
|
47
|
+
* @param defaultValue - Default value
|
|
48
|
+
* @returns Promise resolving to boolean result
|
|
49
|
+
*/
|
|
50
|
+
booleanH: (question, defaultValue) => {
|
|
51
|
+
return (0, boolean_menu_js_1.showBooleanMenu)({
|
|
52
|
+
question,
|
|
53
|
+
orientation: 'horizontal',
|
|
54
|
+
defaultValue
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Show a boolean menu (vertical)
|
|
59
|
+
* @param question - Question text
|
|
60
|
+
* @param defaultValue - Default value
|
|
61
|
+
* @returns Promise resolving to boolean result
|
|
62
|
+
*/
|
|
63
|
+
booleanV: (question, defaultValue) => {
|
|
64
|
+
return (0, boolean_menu_js_1.showBooleanMenu)({
|
|
65
|
+
question,
|
|
66
|
+
orientation: 'vertical',
|
|
67
|
+
defaultValue
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Unified input API
|
|
73
|
+
*/
|
|
74
|
+
exports.inputAPI = {
|
|
75
|
+
/**
|
|
76
|
+
* Show a text input
|
|
77
|
+
* @param config - Input configuration
|
|
78
|
+
* @returns Promise resolving to entered text
|
|
79
|
+
*/
|
|
80
|
+
text: (config) => {
|
|
81
|
+
return (0, text_input_js_1.showTextInput)(config);
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Show a number input
|
|
85
|
+
* @param config - Input configuration
|
|
86
|
+
* @returns Promise resolving to entered number
|
|
87
|
+
*/
|
|
88
|
+
number: (config) => {
|
|
89
|
+
return (0, number_input_js_1.showNumberInput)(config);
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Show a language selector
|
|
93
|
+
* @param config - Selector configuration
|
|
94
|
+
* @returns Promise resolving to selected language code
|
|
95
|
+
*/
|
|
96
|
+
language: (config) => {
|
|
97
|
+
return (0, language_input_js_1.showLanguageSelector)(config);
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* Show a modify field prompt
|
|
101
|
+
* @param config - Field configuration
|
|
102
|
+
* @returns Promise resolving to modification result
|
|
103
|
+
*/
|
|
104
|
+
modifyField: (config) => {
|
|
105
|
+
return (0, modify_field_js_1.showModifyField)(config);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Unified wizard API
|
|
110
|
+
*/
|
|
111
|
+
exports.wizardAPI = {
|
|
112
|
+
/**
|
|
113
|
+
* Run a wizard
|
|
114
|
+
* @param config - Wizard configuration
|
|
115
|
+
* @returns Promise resolving to wizard results
|
|
116
|
+
*/
|
|
117
|
+
run: (config) => {
|
|
118
|
+
return (0, wizard_js_1.runWizard)(config);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Default export with all APIs
|
|
123
|
+
*/
|
|
124
|
+
exports.default = {
|
|
125
|
+
menu: exports.menuAPI,
|
|
126
|
+
input: exports.inputAPI,
|
|
127
|
+
wizard: exports.wizardAPI
|
|
128
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headers - Display header components
|
|
3
|
+
* Provides simple and ASCII art headers
|
|
4
|
+
*/
|
|
5
|
+
import { SimpleHeaderConfig, AsciiHeaderConfig } from '../../types/display.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Render a simple header
|
|
8
|
+
* @param config - Header configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderSimpleHeader(config: SimpleHeaderConfig): void;
|
|
11
|
+
/**
|
|
12
|
+
* Render an ASCII art header with decorations
|
|
13
|
+
* @param config - Header configuration
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderAsciiHeader(config: AsciiHeaderConfig): void;
|
|
16
|
+
/**
|
|
17
|
+
* Create a simple header
|
|
18
|
+
* @param text - Header text
|
|
19
|
+
* @param color - Optional color
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSimpleHeader(text: string, color?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Create an ASCII header
|
|
24
|
+
* @param asciiArt - ASCII art string
|
|
25
|
+
* @param options - Optional configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare function createAsciiHeader(asciiArt: string, options?: {
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
version?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
borderChar?: string;
|
|
32
|
+
}): void;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Headers - Display header components
|
|
4
|
+
* Provides simple and ASCII art headers
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.renderSimpleHeader = renderSimpleHeader;
|
|
8
|
+
exports.renderAsciiHeader = renderAsciiHeader;
|
|
9
|
+
exports.createSimpleHeader = createSimpleHeader;
|
|
10
|
+
exports.createAsciiHeader = createAsciiHeader;
|
|
11
|
+
const terminal_js_1 = require("../../core/terminal.js");
|
|
12
|
+
const colors_js_1 = require("../../core/colors.js");
|
|
13
|
+
const terminal_js_2 = require("../../core/terminal.js");
|
|
14
|
+
/**
|
|
15
|
+
* Render a simple header
|
|
16
|
+
* @param config - Header configuration
|
|
17
|
+
*/
|
|
18
|
+
function renderSimpleHeader(config) {
|
|
19
|
+
const { text, color } = config;
|
|
20
|
+
if (color) {
|
|
21
|
+
(0, terminal_js_1.writeLine)((0, colors_js_1.colorize)(text, color));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
(0, terminal_js_1.writeLine)(text);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Render an ASCII art header with decorations
|
|
29
|
+
* @param config - Header configuration
|
|
30
|
+
*/
|
|
31
|
+
function renderAsciiHeader(config) {
|
|
32
|
+
const { asciiArt, subtitle, version, url, borderChar = '═' } = config;
|
|
33
|
+
const termWidth = (0, terminal_js_2.getTerminalWidth)();
|
|
34
|
+
const border = borderChar.repeat(termWidth);
|
|
35
|
+
// Top border
|
|
36
|
+
(0, terminal_js_1.writeLine)(colors_js_1.colors.cyan + border + colors_js_1.colors.reset);
|
|
37
|
+
(0, terminal_js_1.writeLine)('');
|
|
38
|
+
// ASCII art (centered)
|
|
39
|
+
const artLines = asciiArt.split('\n');
|
|
40
|
+
artLines.forEach(line => {
|
|
41
|
+
(0, terminal_js_1.writeLine)(colors_js_1.colors.cyan + line + colors_js_1.colors.reset);
|
|
42
|
+
});
|
|
43
|
+
// Subtitle if provided
|
|
44
|
+
if (subtitle) {
|
|
45
|
+
(0, terminal_js_1.writeLine)('');
|
|
46
|
+
const padding = Math.floor((termWidth - subtitle.length) / 2);
|
|
47
|
+
(0, terminal_js_1.writeLine)(' '.repeat(padding) + colors_js_1.colors.brightCyan + subtitle + colors_js_1.colors.reset);
|
|
48
|
+
}
|
|
49
|
+
(0, terminal_js_1.writeLine)('');
|
|
50
|
+
// Bottom border
|
|
51
|
+
(0, terminal_js_1.writeLine)(colors_js_1.colors.cyan + border + colors_js_1.colors.reset);
|
|
52
|
+
// Footer info (version and URL)
|
|
53
|
+
if (version || url) {
|
|
54
|
+
const footerParts = [];
|
|
55
|
+
if (version)
|
|
56
|
+
footerParts.push(`Version: ${version}`);
|
|
57
|
+
if (url)
|
|
58
|
+
footerParts.push(url);
|
|
59
|
+
const footer = footerParts.join(' | ');
|
|
60
|
+
const footerPadding = Math.floor((termWidth - footer.length) / 2);
|
|
61
|
+
(0, terminal_js_1.writeLine)('');
|
|
62
|
+
(0, terminal_js_1.writeLine)(' '.repeat(footerPadding) + colors_js_1.colors.dim + footer + colors_js_1.colors.reset);
|
|
63
|
+
}
|
|
64
|
+
(0, terminal_js_1.writeLine)('');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a simple header
|
|
68
|
+
* @param text - Header text
|
|
69
|
+
* @param color - Optional color
|
|
70
|
+
*/
|
|
71
|
+
function createSimpleHeader(text, color) {
|
|
72
|
+
renderSimpleHeader({ text, color });
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create an ASCII header
|
|
76
|
+
* @param asciiArt - ASCII art string
|
|
77
|
+
* @param options - Optional configuration
|
|
78
|
+
*/
|
|
79
|
+
function createAsciiHeader(asciiArt, options) {
|
|
80
|
+
renderAsciiHeader({
|
|
81
|
+
asciiArt,
|
|
82
|
+
...options
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display components index
|
|
3
|
+
* Exports all display component functions
|
|
4
|
+
*/
|
|
5
|
+
export { renderSimpleHeader, renderAsciiHeader, createSimpleHeader, createAsciiHeader } from './headers.js';
|
|
6
|
+
export { renderProgressIndicator, renderStageHeader, renderStageSeparator, createProgressIndicator, createStageHeader, createStageSeparator } from './progress.js';
|
|
7
|
+
export { renderMessage, showSuccess, showError, showWarning, showInfo, showQuestion, createMessage } from './messages.js';
|
|
8
|
+
export { renderSummaryTable, createSummaryTable, createSimpleSummary } from './summary.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Display components index
|
|
4
|
+
* Exports all display component functions
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
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;
|
|
8
|
+
var headers_js_1 = require("./headers.js");
|
|
9
|
+
Object.defineProperty(exports, "renderSimpleHeader", { enumerable: true, get: function () { return headers_js_1.renderSimpleHeader; } });
|
|
10
|
+
Object.defineProperty(exports, "renderAsciiHeader", { enumerable: true, get: function () { return headers_js_1.renderAsciiHeader; } });
|
|
11
|
+
Object.defineProperty(exports, "createSimpleHeader", { enumerable: true, get: function () { return headers_js_1.createSimpleHeader; } });
|
|
12
|
+
Object.defineProperty(exports, "createAsciiHeader", { enumerable: true, get: function () { return headers_js_1.createAsciiHeader; } });
|
|
13
|
+
var progress_js_1 = require("./progress.js");
|
|
14
|
+
Object.defineProperty(exports, "renderProgressIndicator", { enumerable: true, get: function () { return progress_js_1.renderProgressIndicator; } });
|
|
15
|
+
Object.defineProperty(exports, "renderStageHeader", { enumerable: true, get: function () { return progress_js_1.renderStageHeader; } });
|
|
16
|
+
Object.defineProperty(exports, "renderStageSeparator", { enumerable: true, get: function () { return progress_js_1.renderStageSeparator; } });
|
|
17
|
+
Object.defineProperty(exports, "createProgressIndicator", { enumerable: true, get: function () { return progress_js_1.createProgressIndicator; } });
|
|
18
|
+
Object.defineProperty(exports, "createStageHeader", { enumerable: true, get: function () { return progress_js_1.createStageHeader; } });
|
|
19
|
+
Object.defineProperty(exports, "createStageSeparator", { enumerable: true, get: function () { return progress_js_1.createStageSeparator; } });
|
|
20
|
+
var messages_js_1 = require("./messages.js");
|
|
21
|
+
Object.defineProperty(exports, "renderMessage", { enumerable: true, get: function () { return messages_js_1.renderMessage; } });
|
|
22
|
+
Object.defineProperty(exports, "showSuccess", { enumerable: true, get: function () { return messages_js_1.showSuccess; } });
|
|
23
|
+
Object.defineProperty(exports, "showError", { enumerable: true, get: function () { return messages_js_1.showError; } });
|
|
24
|
+
Object.defineProperty(exports, "showWarning", { enumerable: true, get: function () { return messages_js_1.showWarning; } });
|
|
25
|
+
Object.defineProperty(exports, "showInfo", { enumerable: true, get: function () { return messages_js_1.showInfo; } });
|
|
26
|
+
Object.defineProperty(exports, "showQuestion", { enumerable: true, get: function () { return messages_js_1.showQuestion; } });
|
|
27
|
+
Object.defineProperty(exports, "createMessage", { enumerable: true, get: function () { return messages_js_1.createMessage; } });
|
|
28
|
+
var summary_js_1 = require("./summary.js");
|
|
29
|
+
Object.defineProperty(exports, "renderSummaryTable", { enumerable: true, get: function () { return summary_js_1.renderSummaryTable; } });
|
|
30
|
+
Object.defineProperty(exports, "createSummaryTable", { enumerable: true, get: function () { return summary_js_1.createSummaryTable; } });
|
|
31
|
+
Object.defineProperty(exports, "createSimpleSummary", { enumerable: true, get: function () { return summary_js_1.createSimpleSummary; } });
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messages - Message display components
|
|
3
|
+
* Displays success, error, warning, info, and question messages
|
|
4
|
+
*/
|
|
5
|
+
import { MessageConfig, MessageType } from '../../types/display.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Render a message with icon
|
|
8
|
+
* @param config - Message configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderMessage(config: MessageConfig): void;
|
|
11
|
+
/**
|
|
12
|
+
* Display a success message
|
|
13
|
+
* @param message - Message text
|
|
14
|
+
*/
|
|
15
|
+
export declare function showSuccess(message: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Display an error message
|
|
18
|
+
* @param message - Message text
|
|
19
|
+
*/
|
|
20
|
+
export declare function showError(message: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Display a warning message
|
|
23
|
+
* @param message - Message text
|
|
24
|
+
*/
|
|
25
|
+
export declare function showWarning(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Display an info message
|
|
28
|
+
* @param message - Message text
|
|
29
|
+
*/
|
|
30
|
+
export declare function showInfo(message: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Display a question message
|
|
33
|
+
* @param message - Message text
|
|
34
|
+
*/
|
|
35
|
+
export declare function showQuestion(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Create a message
|
|
38
|
+
* @param type - Message type
|
|
39
|
+
* @param message - Message text
|
|
40
|
+
*/
|
|
41
|
+
export declare function createMessage(type: MessageType, message: string): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Messages - Message display components
|
|
4
|
+
* Displays success, error, warning, info, and question messages
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.renderMessage = renderMessage;
|
|
8
|
+
exports.showSuccess = showSuccess;
|
|
9
|
+
exports.showError = showError;
|
|
10
|
+
exports.showWarning = showWarning;
|
|
11
|
+
exports.showInfo = showInfo;
|
|
12
|
+
exports.showQuestion = showQuestion;
|
|
13
|
+
exports.createMessage = createMessage;
|
|
14
|
+
const terminal_js_1 = require("../../core/terminal.js");
|
|
15
|
+
const colors_js_1 = require("../../core/colors.js");
|
|
16
|
+
/**
|
|
17
|
+
* Render a message with icon
|
|
18
|
+
* @param config - Message configuration
|
|
19
|
+
*/
|
|
20
|
+
function renderMessage(config) {
|
|
21
|
+
const { type, message } = config;
|
|
22
|
+
let icon = '';
|
|
23
|
+
let color = colors_js_1.colors.reset;
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'success':
|
|
26
|
+
icon = '✓';
|
|
27
|
+
color = colors_js_1.colors.green;
|
|
28
|
+
break;
|
|
29
|
+
case 'error':
|
|
30
|
+
icon = '✗';
|
|
31
|
+
color = colors_js_1.colors.red;
|
|
32
|
+
break;
|
|
33
|
+
case 'warning':
|
|
34
|
+
icon = '⚠';
|
|
35
|
+
color = colors_js_1.colors.yellow;
|
|
36
|
+
break;
|
|
37
|
+
case 'info':
|
|
38
|
+
icon = 'ℹ';
|
|
39
|
+
color = colors_js_1.colors.blue;
|
|
40
|
+
break;
|
|
41
|
+
case 'question':
|
|
42
|
+
icon = '?';
|
|
43
|
+
color = colors_js_1.colors.yellow;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
(0, terminal_js_1.writeLine)(`${color}${icon}${colors_js_1.colors.reset} ${message}`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Display a success message
|
|
50
|
+
* @param message - Message text
|
|
51
|
+
*/
|
|
52
|
+
function showSuccess(message) {
|
|
53
|
+
renderMessage({ type: 'success', message });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Display an error message
|
|
57
|
+
* @param message - Message text
|
|
58
|
+
*/
|
|
59
|
+
function showError(message) {
|
|
60
|
+
renderMessage({ type: 'error', message });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Display a warning message
|
|
64
|
+
* @param message - Message text
|
|
65
|
+
*/
|
|
66
|
+
function showWarning(message) {
|
|
67
|
+
renderMessage({ type: 'warning', message });
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Display an info message
|
|
71
|
+
* @param message - Message text
|
|
72
|
+
*/
|
|
73
|
+
function showInfo(message) {
|
|
74
|
+
renderMessage({ type: 'info', message });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Display a question message
|
|
78
|
+
* @param message - Message text
|
|
79
|
+
*/
|
|
80
|
+
function showQuestion(message) {
|
|
81
|
+
renderMessage({ type: 'question', message });
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a message
|
|
85
|
+
* @param type - Message type
|
|
86
|
+
* @param message - Message text
|
|
87
|
+
*/
|
|
88
|
+
function createMessage(type, message) {
|
|
89
|
+
renderMessage({ type, message });
|
|
90
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress - Progress indicator components
|
|
3
|
+
* Displays step flow and stage information
|
|
4
|
+
*/
|
|
5
|
+
import { ProgressConfig } from '../../types/display.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Render a progress indicator showing steps
|
|
8
|
+
* @param config - Progress configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderProgressIndicator(config: ProgressConfig): void;
|
|
11
|
+
/**
|
|
12
|
+
* Render a stage header with step number
|
|
13
|
+
* @param stageName - Name of the stage
|
|
14
|
+
* @param stepNumber - Step number (1-based)
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderStageHeader(stageName: string, stepNumber: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Render a stage separator
|
|
19
|
+
* @param char - Character to use for separator
|
|
20
|
+
* @param width - Width of separator (default: terminal width)
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderStageSeparator(char?: string, width?: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Create a progress indicator
|
|
25
|
+
* @param steps - Array of step names
|
|
26
|
+
* @param currentStep - Index of current step (0-based)
|
|
27
|
+
* @param separator - Optional separator character
|
|
28
|
+
*/
|
|
29
|
+
export declare function createProgressIndicator(steps: string[], currentStep: number, separator?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Create a stage header
|
|
32
|
+
* @param stageName - Name of the stage
|
|
33
|
+
* @param stepNumber - Step number (1-based)
|
|
34
|
+
*/
|
|
35
|
+
export declare function createStageHeader(stageName: string, stepNumber: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Create a stage separator
|
|
38
|
+
* @param char - Optional separator character
|
|
39
|
+
* @param width - Optional width
|
|
40
|
+
*/
|
|
41
|
+
export declare function createStageSeparator(char?: string, width?: number): void;
|