inquirerer 4.2.0 → 4.3.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/README.md +1 -1
- package/esm/keypress.js +48 -2
- package/keypress.d.ts +37 -1
- package/keypress.js +48 -2
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# inquirerer
|
|
2
2
|
|
|
3
3
|
<p align="center" width="100%">
|
|
4
|
-
<img height="
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center" width="100%">
|
package/esm/keypress.js
CHANGED
|
@@ -2,15 +2,61 @@ const defaultProcessWrapper = {
|
|
|
2
2
|
exit: (code) => process.exit(code)
|
|
3
3
|
};
|
|
4
4
|
export const KEY_CODES = {
|
|
5
|
+
// Arrow keys
|
|
5
6
|
UP_ARROW: '\u001b[A',
|
|
6
7
|
DOWN_ARROW: '\u001b[B',
|
|
7
8
|
RIGHT_ARROW: '\u001b[C',
|
|
8
9
|
LEFT_ARROW: '\u001b[D',
|
|
10
|
+
// Basic keys
|
|
9
11
|
ENTER: '\r',
|
|
10
12
|
SPACE: ' ',
|
|
11
|
-
|
|
13
|
+
TAB: '\t',
|
|
12
14
|
BACKSPACE: '\x7f', // Commonly used BACKSPACE key in Unix-like systems
|
|
13
|
-
BACKSPACE_LEGACY: '\x08' // For compatibility with some systems
|
|
15
|
+
BACKSPACE_LEGACY: '\x08', // For compatibility with some systems
|
|
16
|
+
DELETE: '\u001b[3~',
|
|
17
|
+
// Control keys
|
|
18
|
+
CTRL_C: '\u0003',
|
|
19
|
+
CTRL_D: '\u0004',
|
|
20
|
+
CTRL_A: '\u0001', // Start of line
|
|
21
|
+
CTRL_E: '\u0005', // End of line
|
|
22
|
+
CTRL_K: '\u000b', // Kill to end of line
|
|
23
|
+
CTRL_U: '\u0015', // Kill to start of line
|
|
24
|
+
CTRL_W: '\u0017', // Delete previous word
|
|
25
|
+
CTRL_L: '\u000c', // Clear screen
|
|
26
|
+
CTRL_N: '\u000e', // Next (down)
|
|
27
|
+
CTRL_P: '\u0010', // Previous (up)
|
|
28
|
+
CTRL_F: '\u0006', // Forward (right)
|
|
29
|
+
CTRL_B: '\u0002', // Back (left)
|
|
30
|
+
CTRL_J: '\u000a', // Newline (fallback for Shift+Enter)
|
|
31
|
+
// Alt/Meta key combinations (escape sequences)
|
|
32
|
+
// Note: Alt key sends ESC followed by the character
|
|
33
|
+
ALT_B: '\u001bb', // Word back
|
|
34
|
+
ALT_F: '\u001bf', // Word forward
|
|
35
|
+
ALT_D: '\u001bd', // Delete word forward
|
|
36
|
+
ALT_BACKSPACE: '\u001b\x7f', // Delete word backward
|
|
37
|
+
// Shift+Enter (varies by terminal, common sequences)
|
|
38
|
+
SHIFT_ENTER: '\u001b[13;2u', // CSI u encoding
|
|
39
|
+
SHIFT_ENTER_ALT: '\u001bOM', // Some terminals
|
|
40
|
+
// Home/End keys
|
|
41
|
+
HOME: '\u001b[H',
|
|
42
|
+
HOME_ALT: '\u001bOH',
|
|
43
|
+
HOME_ALT2: '\u001b[1~',
|
|
44
|
+
END: '\u001b[F',
|
|
45
|
+
END_ALT: '\u001bOF',
|
|
46
|
+
END_ALT2: '\u001b[4~',
|
|
47
|
+
// Page Up/Down
|
|
48
|
+
PAGE_UP: '\u001b[5~',
|
|
49
|
+
PAGE_DOWN: '\u001b[6~',
|
|
50
|
+
// Ctrl+Arrow (word navigation in some terminals)
|
|
51
|
+
CTRL_LEFT: '\u001b[1;5D',
|
|
52
|
+
CTRL_RIGHT: '\u001b[1;5C',
|
|
53
|
+
CTRL_UP: '\u001b[1;5A',
|
|
54
|
+
CTRL_DOWN: '\u001b[1;5B',
|
|
55
|
+
// Alt+Arrow (word navigation in some terminals)
|
|
56
|
+
ALT_LEFT: '\u001b[1;3D',
|
|
57
|
+
ALT_RIGHT: '\u001b[1;3C',
|
|
58
|
+
ALT_UP: '\u001b[1;3A',
|
|
59
|
+
ALT_DOWN: '\u001b[1;3B',
|
|
14
60
|
};
|
|
15
61
|
/**
|
|
16
62
|
* Handles keyboard input for interactive prompts.
|
package/keypress.d.ts
CHANGED
|
@@ -10,9 +10,45 @@ export declare const KEY_CODES: {
|
|
|
10
10
|
LEFT_ARROW: string;
|
|
11
11
|
ENTER: string;
|
|
12
12
|
SPACE: string;
|
|
13
|
-
|
|
13
|
+
TAB: string;
|
|
14
14
|
BACKSPACE: string;
|
|
15
15
|
BACKSPACE_LEGACY: string;
|
|
16
|
+
DELETE: string;
|
|
17
|
+
CTRL_C: string;
|
|
18
|
+
CTRL_D: string;
|
|
19
|
+
CTRL_A: string;
|
|
20
|
+
CTRL_E: string;
|
|
21
|
+
CTRL_K: string;
|
|
22
|
+
CTRL_U: string;
|
|
23
|
+
CTRL_W: string;
|
|
24
|
+
CTRL_L: string;
|
|
25
|
+
CTRL_N: string;
|
|
26
|
+
CTRL_P: string;
|
|
27
|
+
CTRL_F: string;
|
|
28
|
+
CTRL_B: string;
|
|
29
|
+
CTRL_J: string;
|
|
30
|
+
ALT_B: string;
|
|
31
|
+
ALT_F: string;
|
|
32
|
+
ALT_D: string;
|
|
33
|
+
ALT_BACKSPACE: string;
|
|
34
|
+
SHIFT_ENTER: string;
|
|
35
|
+
SHIFT_ENTER_ALT: string;
|
|
36
|
+
HOME: string;
|
|
37
|
+
HOME_ALT: string;
|
|
38
|
+
HOME_ALT2: string;
|
|
39
|
+
END: string;
|
|
40
|
+
END_ALT: string;
|
|
41
|
+
END_ALT2: string;
|
|
42
|
+
PAGE_UP: string;
|
|
43
|
+
PAGE_DOWN: string;
|
|
44
|
+
CTRL_LEFT: string;
|
|
45
|
+
CTRL_RIGHT: string;
|
|
46
|
+
CTRL_UP: string;
|
|
47
|
+
CTRL_DOWN: string;
|
|
48
|
+
ALT_LEFT: string;
|
|
49
|
+
ALT_RIGHT: string;
|
|
50
|
+
ALT_UP: string;
|
|
51
|
+
ALT_DOWN: string;
|
|
16
52
|
};
|
|
17
53
|
/**
|
|
18
54
|
* Handles keyboard input for interactive prompts.
|
package/keypress.js
CHANGED
|
@@ -5,15 +5,61 @@ const defaultProcessWrapper = {
|
|
|
5
5
|
exit: (code) => process.exit(code)
|
|
6
6
|
};
|
|
7
7
|
exports.KEY_CODES = {
|
|
8
|
+
// Arrow keys
|
|
8
9
|
UP_ARROW: '\u001b[A',
|
|
9
10
|
DOWN_ARROW: '\u001b[B',
|
|
10
11
|
RIGHT_ARROW: '\u001b[C',
|
|
11
12
|
LEFT_ARROW: '\u001b[D',
|
|
13
|
+
// Basic keys
|
|
12
14
|
ENTER: '\r',
|
|
13
15
|
SPACE: ' ',
|
|
14
|
-
|
|
16
|
+
TAB: '\t',
|
|
15
17
|
BACKSPACE: '\x7f', // Commonly used BACKSPACE key in Unix-like systems
|
|
16
|
-
BACKSPACE_LEGACY: '\x08' // For compatibility with some systems
|
|
18
|
+
BACKSPACE_LEGACY: '\x08', // For compatibility with some systems
|
|
19
|
+
DELETE: '\u001b[3~',
|
|
20
|
+
// Control keys
|
|
21
|
+
CTRL_C: '\u0003',
|
|
22
|
+
CTRL_D: '\u0004',
|
|
23
|
+
CTRL_A: '\u0001', // Start of line
|
|
24
|
+
CTRL_E: '\u0005', // End of line
|
|
25
|
+
CTRL_K: '\u000b', // Kill to end of line
|
|
26
|
+
CTRL_U: '\u0015', // Kill to start of line
|
|
27
|
+
CTRL_W: '\u0017', // Delete previous word
|
|
28
|
+
CTRL_L: '\u000c', // Clear screen
|
|
29
|
+
CTRL_N: '\u000e', // Next (down)
|
|
30
|
+
CTRL_P: '\u0010', // Previous (up)
|
|
31
|
+
CTRL_F: '\u0006', // Forward (right)
|
|
32
|
+
CTRL_B: '\u0002', // Back (left)
|
|
33
|
+
CTRL_J: '\u000a', // Newline (fallback for Shift+Enter)
|
|
34
|
+
// Alt/Meta key combinations (escape sequences)
|
|
35
|
+
// Note: Alt key sends ESC followed by the character
|
|
36
|
+
ALT_B: '\u001bb', // Word back
|
|
37
|
+
ALT_F: '\u001bf', // Word forward
|
|
38
|
+
ALT_D: '\u001bd', // Delete word forward
|
|
39
|
+
ALT_BACKSPACE: '\u001b\x7f', // Delete word backward
|
|
40
|
+
// Shift+Enter (varies by terminal, common sequences)
|
|
41
|
+
SHIFT_ENTER: '\u001b[13;2u', // CSI u encoding
|
|
42
|
+
SHIFT_ENTER_ALT: '\u001bOM', // Some terminals
|
|
43
|
+
// Home/End keys
|
|
44
|
+
HOME: '\u001b[H',
|
|
45
|
+
HOME_ALT: '\u001bOH',
|
|
46
|
+
HOME_ALT2: '\u001b[1~',
|
|
47
|
+
END: '\u001b[F',
|
|
48
|
+
END_ALT: '\u001bOF',
|
|
49
|
+
END_ALT2: '\u001b[4~',
|
|
50
|
+
// Page Up/Down
|
|
51
|
+
PAGE_UP: '\u001b[5~',
|
|
52
|
+
PAGE_DOWN: '\u001b[6~',
|
|
53
|
+
// Ctrl+Arrow (word navigation in some terminals)
|
|
54
|
+
CTRL_LEFT: '\u001b[1;5D',
|
|
55
|
+
CTRL_RIGHT: '\u001b[1;5C',
|
|
56
|
+
CTRL_UP: '\u001b[1;5A',
|
|
57
|
+
CTRL_DOWN: '\u001b[1;5B',
|
|
58
|
+
// Alt+Arrow (word navigation in some terminals)
|
|
59
|
+
ALT_LEFT: '\u001b[1;3D',
|
|
60
|
+
ALT_RIGHT: '\u001b[1;3C',
|
|
61
|
+
ALT_UP: '\u001b[1;3A',
|
|
62
|
+
ALT_DOWN: '\u001b[1;3B',
|
|
17
63
|
};
|
|
18
64
|
/**
|
|
19
65
|
* Handles keyboard input for interactive prompts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inquirerer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "TypeScript-first library for building beautiful CLI interfaces with interactive prompts",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,21 +29,22 @@
|
|
|
29
29
|
"dev:chat": "ts-node dev/demo-chat",
|
|
30
30
|
"dev:upgrade": "ts-node dev/demo-upgrade",
|
|
31
31
|
"dev:prompts": "ts-node dev/demo-prompts-engine",
|
|
32
|
+
"dev:ai-code": "ts-node dev/demo-ai-code",
|
|
32
33
|
"test": "jest",
|
|
33
34
|
"test:watch": "jest --watch"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"deepmerge": "^4.3.1",
|
|
37
|
-
"find-and-require-package-json": "0.8.
|
|
38
|
-
"js-yaml": "^4.1.0",
|
|
38
|
+
"find-and-require-package-json": "0.8.5",
|
|
39
39
|
"minimist": "^1.2.8",
|
|
40
|
-
"yanse": "0.1.
|
|
40
|
+
"yanse": "0.1.11"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [],
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
|
-
"clean-ansi": "0.1.
|
|
46
|
-
"makage": "0.1.8"
|
|
45
|
+
"clean-ansi": "0.1.8",
|
|
46
|
+
"makage": "0.1.8",
|
|
47
|
+
"string-width": "4.2.3"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "362a5e9b960edc67fb906bd036d281250c812cc0"
|
|
49
50
|
}
|