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.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +716 -0
  3. package/dist/api.d.ts +158 -0
  4. package/dist/api.js +128 -0
  5. package/dist/components/display/headers.d.ts +32 -0
  6. package/dist/components/display/headers.js +84 -0
  7. package/dist/components/display/index.d.ts +8 -0
  8. package/dist/components/display/index.js +31 -0
  9. package/dist/components/display/messages.d.ts +41 -0
  10. package/dist/components/display/messages.js +90 -0
  11. package/dist/components/display/progress.d.ts +41 -0
  12. package/dist/components/display/progress.js +82 -0
  13. package/dist/components/display/summary.d.ts +33 -0
  14. package/dist/components/display/summary.js +82 -0
  15. package/dist/components/inputs/index.d.ts +8 -0
  16. package/dist/components/inputs/index.js +15 -0
  17. package/dist/components/inputs/language-input.d.ts +11 -0
  18. package/dist/components/inputs/language-input.js +104 -0
  19. package/dist/components/inputs/modify-field.d.ts +11 -0
  20. package/dist/components/inputs/modify-field.js +42 -0
  21. package/dist/components/inputs/number-input.d.ts +11 -0
  22. package/dist/components/inputs/number-input.js +143 -0
  23. package/dist/components/inputs/text-input.d.ts +11 -0
  24. package/dist/components/inputs/text-input.js +114 -0
  25. package/dist/components/menus/boolean-menu.d.ts +11 -0
  26. package/dist/components/menus/boolean-menu.js +169 -0
  27. package/dist/components/menus/checkbox-menu.d.ts +11 -0
  28. package/dist/components/menus/checkbox-menu.js +161 -0
  29. package/dist/components/menus/index.d.ts +7 -0
  30. package/dist/components/menus/index.js +13 -0
  31. package/dist/components/menus/radio-menu.d.ts +11 -0
  32. package/dist/components/menus/radio-menu.js +158 -0
  33. package/dist/components.d.ts +55 -0
  34. package/dist/components.js +166 -0
  35. package/dist/core/colors.d.ts +64 -0
  36. package/dist/core/colors.js +139 -0
  37. package/dist/core/keyboard.d.ts +124 -0
  38. package/dist/core/keyboard.js +185 -0
  39. package/dist/core/renderer.d.ts +74 -0
  40. package/dist/core/renderer.js +217 -0
  41. package/dist/core/terminal.d.ts +89 -0
  42. package/dist/core/terminal.js +170 -0
  43. package/dist/features/commands.d.ts +57 -0
  44. package/dist/features/commands.js +161 -0
  45. package/dist/features/wizard.d.ts +62 -0
  46. package/dist/features/wizard.js +112 -0
  47. package/dist/i18n/languages/en.d.ts +5 -0
  48. package/dist/i18n/languages/en.js +54 -0
  49. package/dist/i18n/languages/zh.d.ts +5 -0
  50. package/dist/i18n/languages/zh.js +54 -0
  51. package/dist/i18n/registry.d.ts +36 -0
  52. package/dist/i18n/registry.js +82 -0
  53. package/dist/i18n/types.d.ts +65 -0
  54. package/dist/i18n/types.js +5 -0
  55. package/dist/index.d.ts +27 -0
  56. package/dist/index.js +104 -0
  57. package/dist/input.d.ts +40 -0
  58. package/dist/input.js +211 -0
  59. package/dist/menu-core.d.ts +52 -0
  60. package/dist/menu-core.js +201 -0
  61. package/dist/menu-multi.d.ts +21 -0
  62. package/dist/menu-multi.js +119 -0
  63. package/dist/menu-single.d.ts +18 -0
  64. package/dist/menu-single.js +138 -0
  65. package/dist/menu.d.ts +66 -0
  66. package/dist/menu.js +78 -0
  67. package/dist/types/display.types.d.ts +57 -0
  68. package/dist/types/display.types.js +5 -0
  69. package/dist/types/input.types.d.ts +88 -0
  70. package/dist/types/input.types.js +5 -0
  71. package/dist/types/layout.types.d.ts +56 -0
  72. package/dist/types/layout.types.js +36 -0
  73. package/dist/types/menu.types.d.ts +85 -0
  74. package/dist/types/menu.types.js +5 -0
  75. package/dist/types.d.ts +49 -0
  76. package/dist/types.js +5 -0
  77. 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;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Menu component types for CLI Menu Kit
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * CLI Menu Kit - Type Definitions
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
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
+ }