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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu component types for CLI Menu Kit
|
|
3
|
+
*/
|
|
4
|
+
import { MenuLayout } from './layout.types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Menu option (can be string or object with label)
|
|
7
|
+
*/
|
|
8
|
+
export type MenuOption = string | {
|
|
9
|
+
label: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Base menu configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface BaseMenuConfig {
|
|
16
|
+
/** Menu title/header */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** Input prompt text */
|
|
19
|
+
prompt?: string;
|
|
20
|
+
/** Hint texts to display */
|
|
21
|
+
hints?: string[];
|
|
22
|
+
/** Layout configuration */
|
|
23
|
+
layout?: MenuLayout;
|
|
24
|
+
/** Color for highlighted items */
|
|
25
|
+
highlightColor?: string;
|
|
26
|
+
/** Goodbye message function */
|
|
27
|
+
onExit?: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Radio menu (single-select) configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface RadioMenuConfig extends BaseMenuConfig {
|
|
33
|
+
/** Menu options */
|
|
34
|
+
options: MenuOption[];
|
|
35
|
+
/** Default selected index */
|
|
36
|
+
defaultIndex?: number;
|
|
37
|
+
/** Allow number key selection */
|
|
38
|
+
allowNumberKeys?: boolean;
|
|
39
|
+
/** Allow letter key selection */
|
|
40
|
+
allowLetterKeys?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checkbox menu (multi-select) configuration
|
|
44
|
+
*/
|
|
45
|
+
export interface CheckboxMenuConfig extends BaseMenuConfig {
|
|
46
|
+
/** Menu options */
|
|
47
|
+
options: MenuOption[];
|
|
48
|
+
/** Default selected indices */
|
|
49
|
+
defaultSelected?: number[];
|
|
50
|
+
/** Minimum selections required */
|
|
51
|
+
minSelections?: number;
|
|
52
|
+
/** Maximum selections allowed */
|
|
53
|
+
maxSelections?: number;
|
|
54
|
+
/** Allow select all */
|
|
55
|
+
allowSelectAll?: boolean;
|
|
56
|
+
/** Allow invert selection */
|
|
57
|
+
allowInvert?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Boolean menu configuration
|
|
61
|
+
*/
|
|
62
|
+
export interface BooleanMenuConfig extends BaseMenuConfig {
|
|
63
|
+
/** Question text */
|
|
64
|
+
question: string;
|
|
65
|
+
/** Default value */
|
|
66
|
+
defaultValue?: boolean;
|
|
67
|
+
/** Yes text */
|
|
68
|
+
yesText?: string;
|
|
69
|
+
/** No text */
|
|
70
|
+
noText?: string;
|
|
71
|
+
/** Orientation */
|
|
72
|
+
orientation?: 'horizontal' | 'vertical';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Menu result types
|
|
76
|
+
*/
|
|
77
|
+
export interface RadioMenuResult {
|
|
78
|
+
index: number;
|
|
79
|
+
value: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CheckboxMenuResult {
|
|
82
|
+
indices: number[];
|
|
83
|
+
values: string[];
|
|
84
|
+
}
|
|
85
|
+
export type BooleanMenuResult = boolean;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Menu Kit - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
export interface MenuOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value?: any;
|
|
7
|
+
}
|
|
8
|
+
export type MenuType = 'main' | 'sub' | 'firstRun';
|
|
9
|
+
export type HintKey = 'arrows' | 'number' | 'letter' | 'enter' | 'esc' | 'space' | 'all' | 'invert';
|
|
10
|
+
export interface MenuConfig {
|
|
11
|
+
lang?: 'zh' | 'en';
|
|
12
|
+
type?: MenuType;
|
|
13
|
+
title?: string;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
showPrompt?: boolean;
|
|
16
|
+
showHints?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface MultiSelectConfig {
|
|
19
|
+
lang?: 'zh' | 'en';
|
|
20
|
+
defaultSelected?: number[];
|
|
21
|
+
}
|
|
22
|
+
export interface Colors {
|
|
23
|
+
reset: string;
|
|
24
|
+
red: string;
|
|
25
|
+
green: string;
|
|
26
|
+
yellow: string;
|
|
27
|
+
blue: string;
|
|
28
|
+
cyan: string;
|
|
29
|
+
gray: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Theme {
|
|
32
|
+
primary: string;
|
|
33
|
+
success: string;
|
|
34
|
+
warning: string;
|
|
35
|
+
error: string;
|
|
36
|
+
muted: string;
|
|
37
|
+
active: string;
|
|
38
|
+
title: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Symbol {
|
|
41
|
+
icon: string;
|
|
42
|
+
color: string;
|
|
43
|
+
}
|
|
44
|
+
export interface Symbols {
|
|
45
|
+
success: Symbol;
|
|
46
|
+
error: Symbol;
|
|
47
|
+
warning: Symbol;
|
|
48
|
+
info: Symbol;
|
|
49
|
+
}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cli-menu-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A lightweight, customizable CLI menu system with keyboard shortcuts and real-time rendering",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"menu",
|
|
18
|
+
"terminal",
|
|
19
|
+
"interactive",
|
|
20
|
+
"prompt",
|
|
21
|
+
"select",
|
|
22
|
+
"keyboard",
|
|
23
|
+
"shortcuts",
|
|
24
|
+
"ui"
|
|
25
|
+
],
|
|
26
|
+
"author": "",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^25.2.3",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=14.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|