@inquirer/core 9.2.1 → 10.0.1
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/{cjs → commonjs}/index.js +22 -22
- package/dist/{cjs → commonjs}/lib/Separator.js +2 -12
- package/dist/{cjs → commonjs}/lib/create-prompt.js +16 -17
- package/dist/commonjs/lib/errors.js +29 -0
- package/dist/{cjs/types → commonjs}/lib/hook-engine.d.ts +1 -1
- package/dist/{cjs → commonjs}/lib/hook-engine.js +5 -6
- package/dist/{cjs → commonjs}/lib/make-theme.js +2 -2
- package/dist/{cjs → commonjs}/lib/pagination/lines.js +2 -2
- package/dist/{cjs → commonjs}/lib/pagination/use-pagination.js +9 -9
- package/dist/{cjs → commonjs}/lib/screen-manager.js +11 -30
- package/dist/{cjs → commonjs}/lib/use-effect.js +3 -3
- package/dist/{cjs → commonjs}/lib/use-keypress.js +6 -6
- package/dist/{cjs → commonjs}/lib/use-memo.js +2 -2
- package/dist/{cjs → commonjs}/lib/use-prefix.js +7 -7
- package/dist/{cjs → commonjs}/lib/use-ref.js +2 -2
- package/dist/{cjs → commonjs}/lib/use-state.js +3 -3
- package/dist/{cjs → commonjs}/lib/utils.js +2 -2
- package/dist/commonjs/package.json +3 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/{types/index.d.ts → esm/index.js} +0 -1
- package/dist/esm/lib/{create-prompt.mjs → create-prompt.js} +5 -5
- package/dist/esm/{types/lib/hook-engine.d.mts → lib/hook-engine.d.ts} +1 -1
- package/dist/esm/lib/{hook-engine.mjs → hook-engine.js} +1 -1
- package/dist/esm/lib/{make-theme.mjs → make-theme.js} +1 -1
- package/dist/esm/lib/pagination/{lines.mjs → lines.js} +1 -1
- package/dist/esm/lib/pagination/{use-pagination.mjs → use-pagination.js} +4 -4
- package/dist/esm/lib/{screen-manager.mjs → screen-manager.js} +1 -1
- package/dist/esm/lib/{use-effect.mjs → use-effect.js} +1 -1
- package/dist/esm/{types/lib/use-keypress.d.mts → lib/use-keypress.d.ts} +1 -1
- package/dist/esm/lib/{use-keypress.mjs → use-keypress.js} +3 -3
- package/dist/esm/lib/{use-memo.mjs → use-memo.js} +1 -1
- package/dist/esm/{types/lib/use-prefix.d.mts → lib/use-prefix.d.ts} +1 -1
- package/dist/esm/lib/{use-prefix.mjs → use-prefix.js} +3 -3
- package/dist/esm/lib/{use-ref.mjs → use-ref.js} +1 -1
- package/dist/esm/lib/{use-state.mjs → use-state.js} +1 -1
- package/dist/esm/lib/{utils.mjs → utils.js} +1 -1
- package/dist/esm/package.json +3 -0
- package/package.json +52 -39
- package/dist/cjs/lib/errors.js +0 -76
- package/dist/esm/index.mjs +0 -12
- package/dist/esm/types/index.d.mts +0 -13
- package/dist/esm/types/lib/create-prompt.d.mts +0 -4
- package/dist/esm/types/lib/key.d.mts +0 -10
- package/dist/esm/types/lib/make-theme.d.mts +0 -3
- package/dist/esm/types/lib/pagination/lines.d.mts +0 -26
- package/dist/esm/types/lib/pagination/position.d.mts +0 -20
- package/dist/esm/types/lib/pagination/use-pagination.d.mts +0 -15
- package/dist/esm/types/lib/use-effect.d.mts +0 -2
- package/dist/esm/types/lib/use-memo.d.mts +0 -1
- package/dist/esm/types/lib/use-ref.d.mts +0 -6
- package/dist/esm/types/lib/utils.d.mts +0 -13
- package/dist/types/lib/Separator.d.ts +0 -10
- package/dist/types/lib/errors.d.ts +0 -9
- package/dist/types/lib/hook-engine.d.ts +0 -30
- package/dist/types/lib/pagination/lines.test.d.ts +0 -1
- package/dist/types/lib/screen-manager.d.ts +0 -13
- package/dist/types/lib/theme.d.ts +0 -20
- package/dist/types/lib/use-keypress.d.ts +0 -3
- package/dist/types/lib/use-prefix.d.ts +0 -5
- package/dist/types/lib/use-state.d.ts +0 -4
- /package/dist/{cjs/types → commonjs}/index.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/Separator.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/create-prompt.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/errors.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/key.d.ts +0 -0
- /package/dist/{cjs → commonjs}/lib/key.js +0 -0
- /package/dist/{cjs/types → commonjs}/lib/make-theme.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/pagination/lines.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/pagination/position.d.ts +0 -0
- /package/dist/{cjs → commonjs}/lib/pagination/position.js +0 -0
- /package/dist/{cjs/types → commonjs}/lib/pagination/use-pagination.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/promise-polyfill.d.ts +0 -0
- /package/dist/{cjs → commonjs}/lib/promise-polyfill.js +0 -0
- /package/dist/{cjs/types → commonjs}/lib/screen-manager.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/theme.d.ts +0 -0
- /package/dist/{cjs → commonjs}/lib/theme.js +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-effect.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-keypress.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-memo.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-prefix.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-ref.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/use-state.d.ts +0 -0
- /package/dist/{cjs/types → commonjs}/lib/utils.d.ts +0 -0
- /package/dist/esm/{types/lib/Separator.d.mts → lib/Separator.d.ts} +0 -0
- /package/dist/esm/lib/{Separator.mjs → Separator.js} +0 -0
- /package/dist/{types → esm}/lib/create-prompt.d.ts +0 -0
- /package/dist/esm/{types/lib/errors.d.mts → lib/errors.d.ts} +0 -0
- /package/dist/esm/lib/{errors.mjs → errors.js} +0 -0
- /package/dist/{types → esm}/lib/key.d.ts +0 -0
- /package/dist/esm/lib/{key.mjs → key.js} +0 -0
- /package/dist/{types → esm}/lib/make-theme.d.ts +0 -0
- /package/dist/{types → esm}/lib/pagination/lines.d.ts +0 -0
- /package/dist/{types → esm}/lib/pagination/position.d.ts +0 -0
- /package/dist/esm/lib/pagination/{position.mjs → position.js} +0 -0
- /package/dist/{types → esm}/lib/pagination/use-pagination.d.ts +0 -0
- /package/dist/esm/{types/lib/promise-polyfill.d.mts → lib/promise-polyfill.d.ts} +0 -0
- /package/dist/esm/lib/{promise-polyfill.mjs → promise-polyfill.js} +0 -0
- /package/dist/esm/{types/lib/screen-manager.d.mts → lib/screen-manager.d.ts} +0 -0
- /package/dist/esm/{types/lib/theme.d.mts → lib/theme.d.ts} +0 -0
- /package/dist/esm/lib/{theme.mjs → theme.js} +0 -0
- /package/dist/{types → esm}/lib/use-effect.d.ts +0 -0
- /package/dist/{types → esm}/lib/use-memo.d.ts +0 -0
- /package/dist/{types → esm}/lib/use-ref.d.ts +0 -0
- /package/dist/esm/{types/lib/use-state.d.mts → lib/use-state.d.ts} +0 -0
- /package/dist/{types → esm}/lib/utils.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRef } from './use-ref.
|
|
2
|
-
import { useEffect } from './use-effect.
|
|
3
|
-
import { withUpdates } from './hook-engine.
|
|
1
|
+
import { useRef } from './use-ref.js';
|
|
2
|
+
import { useEffect } from './use-effect.js';
|
|
3
|
+
import { withUpdates } from './hook-engine.js';
|
|
4
4
|
export function useKeypress(userHandler) {
|
|
5
5
|
const signal = useRef(userHandler);
|
|
6
6
|
signal.current = userHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncResource } from 'node:async_hooks';
|
|
2
|
-
import { useState } from './use-state.
|
|
3
|
-
import { useEffect } from './use-effect.
|
|
4
|
-
import { makeTheme } from './make-theme.
|
|
2
|
+
import { useState } from './use-state.js';
|
|
3
|
+
import { useEffect } from './use-effect.js';
|
|
4
|
+
import { makeTheme } from './make-theme.js';
|
|
5
5
|
export function usePrefix({ status = 'idle', theme, }) {
|
|
6
6
|
const [showLoader, setShowLoader] = useState(false);
|
|
7
7
|
const [tick, setTick] = useState(0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cliWidth from 'cli-width';
|
|
2
2
|
import wrapAnsi from 'wrap-ansi';
|
|
3
|
-
import { readline } from './hook-engine.
|
|
3
|
+
import { readline } from './hook-engine.js';
|
|
4
4
|
/**
|
|
5
5
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
6
6
|
* ignore invisible codes during width calculation.
|
package/package.json
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "
|
|
4
|
-
"engines": {
|
|
5
|
-
"node": ">=18"
|
|
6
|
-
},
|
|
3
|
+
"version": "10.0.1",
|
|
7
4
|
"description": "Core Inquirer prompt API",
|
|
8
|
-
"main": "./dist/cjs/index.js",
|
|
9
|
-
"typings": "./dist/cjs/types/index.d.ts",
|
|
10
|
-
"files": [
|
|
11
|
-
"dist/**/*"
|
|
12
|
-
],
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
|
16
|
-
},
|
|
17
5
|
"keywords": [
|
|
18
6
|
"answer",
|
|
19
7
|
"answers",
|
|
@@ -53,47 +41,72 @@
|
|
|
53
41
|
"yo",
|
|
54
42
|
"zsh"
|
|
55
43
|
],
|
|
56
|
-
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
57
|
-
"license": "MIT",
|
|
58
44
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/README.md",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
51
|
+
"sideEffects": false,
|
|
52
|
+
"type": "module",
|
|
53
|
+
"exports": {
|
|
54
|
+
"./package.json": "./package.json",
|
|
55
|
+
".": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/esm/index.d.ts",
|
|
58
|
+
"default": "./dist/esm/index.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
62
|
+
"default": "./dist/commonjs/index.js"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"main": "./dist/commonjs/index.js",
|
|
67
|
+
"module": "./dist/esm/index.js",
|
|
68
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
72
|
+
"scripts": {
|
|
73
|
+
"attw": "attw --pack",
|
|
74
|
+
"tsc": "tshy"
|
|
75
|
+
},
|
|
59
76
|
"dependencies": {
|
|
60
|
-
"@inquirer/figures": "^1.0.
|
|
61
|
-
"@inquirer/type": "^
|
|
62
|
-
"@types/mute-stream": "^0.0.4",
|
|
63
|
-
"@types/node": "^22.5.5",
|
|
64
|
-
"@types/wrap-ansi": "^3.0.0",
|
|
77
|
+
"@inquirer/figures": "^1.0.7",
|
|
78
|
+
"@inquirer/type": "^3.0.0",
|
|
65
79
|
"ansi-escapes": "^4.3.2",
|
|
66
80
|
"cli-width": "^4.1.0",
|
|
67
|
-
"mute-stream": "^
|
|
81
|
+
"mute-stream": "^2.0.0",
|
|
68
82
|
"signal-exit": "^4.1.0",
|
|
69
83
|
"strip-ansi": "^6.0.1",
|
|
70
84
|
"wrap-ansi": "^6.2.0",
|
|
71
85
|
"yoctocolors-cjs": "^2.1.2"
|
|
72
86
|
},
|
|
73
87
|
"devDependencies": {
|
|
74
|
-
"@
|
|
88
|
+
"@arethetypeswrong/cli": "^0.16.4",
|
|
89
|
+
"@inquirer/testing": "^2.1.36",
|
|
90
|
+
"@repo/tsconfig": "workspace:*",
|
|
91
|
+
"@types/mute-stream": "^0.0.4",
|
|
92
|
+
"@types/node": "^22.8.0",
|
|
93
|
+
"@types/wrap-ansi": "^3.0.0",
|
|
94
|
+
"tshy": "^3.0.2"
|
|
75
95
|
},
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
|
|
79
|
-
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
|
|
80
|
-
"attw": "attw --pack"
|
|
96
|
+
"engines": {
|
|
97
|
+
"node": ">=18"
|
|
81
98
|
},
|
|
82
99
|
"publishConfig": {
|
|
83
100
|
"access": "public"
|
|
84
101
|
},
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
"types": "./dist/cjs/types/index.d.ts",
|
|
93
|
-
"default": "./dist/cjs/index.js"
|
|
94
|
-
}
|
|
102
|
+
"tshy": {
|
|
103
|
+
"exclude": [
|
|
104
|
+
"src/**/*.test.ts"
|
|
105
|
+
],
|
|
106
|
+
"exports": {
|
|
107
|
+
"./package.json": "./package.json",
|
|
108
|
+
".": "./src/index.ts"
|
|
95
109
|
}
|
|
96
110
|
},
|
|
97
|
-
"
|
|
98
|
-
"gitHead": "9e29035c2efc78f44aed3c7732aee46ab1d64ca2"
|
|
111
|
+
"gitHead": "da3dd749325495266025f2dbdb339a812da468f8"
|
|
99
112
|
}
|
package/dist/cjs/lib/errors.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidationError = exports.HookError = exports.ExitPromptError = exports.CancelPromptError = exports.AbortPromptError = void 0;
|
|
4
|
-
class AbortPromptError extends Error {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
super();
|
|
7
|
-
Object.defineProperty(this, "name", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: 'AbortPromptError'
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "message", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 'Prompt was aborted'
|
|
18
|
-
});
|
|
19
|
-
this.cause = options === null || options === void 0 ? void 0 : options.cause;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.AbortPromptError = AbortPromptError;
|
|
23
|
-
class CancelPromptError extends Error {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
Object.defineProperty(this, "name", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true,
|
|
30
|
-
value: 'CancelPromptError'
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(this, "message", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: 'Prompt was canceled'
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.CancelPromptError = CancelPromptError;
|
|
41
|
-
class ExitPromptError extends Error {
|
|
42
|
-
constructor() {
|
|
43
|
-
super(...arguments);
|
|
44
|
-
Object.defineProperty(this, "name", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
configurable: true,
|
|
47
|
-
writable: true,
|
|
48
|
-
value: 'ExitPromptError'
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.ExitPromptError = ExitPromptError;
|
|
53
|
-
class HookError extends Error {
|
|
54
|
-
constructor() {
|
|
55
|
-
super(...arguments);
|
|
56
|
-
Object.defineProperty(this, "name", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
configurable: true,
|
|
59
|
-
writable: true,
|
|
60
|
-
value: 'HookError'
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.HookError = HookError;
|
|
65
|
-
class ValidationError extends Error {
|
|
66
|
-
constructor() {
|
|
67
|
-
super(...arguments);
|
|
68
|
-
Object.defineProperty(this, "name", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true,
|
|
71
|
-
writable: true,
|
|
72
|
-
value: 'ValidationError'
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.ValidationError = ValidationError;
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './lib/key.mjs';
|
|
2
|
-
export * from './lib/errors.mjs';
|
|
3
|
-
export { usePrefix } from './lib/use-prefix.mjs';
|
|
4
|
-
export { useState } from './lib/use-state.mjs';
|
|
5
|
-
export { useEffect } from './lib/use-effect.mjs';
|
|
6
|
-
export { useMemo } from './lib/use-memo.mjs';
|
|
7
|
-
export { useRef } from './lib/use-ref.mjs';
|
|
8
|
-
export { useKeypress } from './lib/use-keypress.mjs';
|
|
9
|
-
export { makeTheme } from './lib/make-theme.mjs';
|
|
10
|
-
export { usePagination } from './lib/pagination/use-pagination.mjs';
|
|
11
|
-
export { createPrompt } from './lib/create-prompt.mjs';
|
|
12
|
-
export { Separator } from './lib/Separator.mjs';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './lib/key.mjs';
|
|
2
|
-
export * from './lib/errors.mjs';
|
|
3
|
-
export { usePrefix } from './lib/use-prefix.mjs';
|
|
4
|
-
export { useState } from './lib/use-state.mjs';
|
|
5
|
-
export { useEffect } from './lib/use-effect.mjs';
|
|
6
|
-
export { useMemo } from './lib/use-memo.mjs';
|
|
7
|
-
export { useRef } from './lib/use-ref.mjs';
|
|
8
|
-
export { useKeypress } from './lib/use-keypress.mjs';
|
|
9
|
-
export { makeTheme } from './lib/make-theme.mjs';
|
|
10
|
-
export type { Theme, Status } from './lib/theme.mjs';
|
|
11
|
-
export { usePagination } from './lib/pagination/use-pagination.mjs';
|
|
12
|
-
export { createPrompt } from './lib/create-prompt.mjs';
|
|
13
|
-
export { Separator } from './lib/Separator.mjs';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Prompt, type Prettify } from '@inquirer/type';
|
|
2
|
-
type ViewFunction<Value, Config> = (config: Prettify<Config>, done: (value: Value) => void) => string | [string, string | undefined];
|
|
3
|
-
export declare function createPrompt<Value, Config>(view: ViewFunction<Value, Config>): Prompt<Value, Config>;
|
|
4
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type KeypressEvent = {
|
|
2
|
-
name: string;
|
|
3
|
-
ctrl: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare const isUpKey: (key: KeypressEvent) => boolean;
|
|
6
|
-
export declare const isDownKey: (key: KeypressEvent) => boolean;
|
|
7
|
-
export declare const isSpaceKey: (key: KeypressEvent) => boolean;
|
|
8
|
-
export declare const isBackspaceKey: (key: KeypressEvent) => boolean;
|
|
9
|
-
export declare const isNumberKey: (key: KeypressEvent) => boolean;
|
|
10
|
-
export declare const isEnterKey: (key: KeypressEvent) => boolean;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Prettify, PartialDeep } from '@inquirer/type';
|
|
2
|
-
import { type Theme } from './theme.mjs';
|
|
3
|
-
export declare function makeTheme<SpecificTheme extends object>(...themes: ReadonlyArray<undefined | PartialDeep<Theme<SpecificTheme>>>): Prettify<Theme<SpecificTheme>>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type Prettify } from '@inquirer/type';
|
|
2
|
-
/** Represents an item that's part of a layout, about to be rendered */
|
|
3
|
-
export type Layout<T> = {
|
|
4
|
-
item: T;
|
|
5
|
-
index: number;
|
|
6
|
-
isActive: boolean;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Renders a page of items as lines that fit within the given width ensuring
|
|
10
|
-
* that the number of lines is not greater than the page size, and the active
|
|
11
|
-
* item renders at the provided position, while prioritizing that as many lines
|
|
12
|
-
* of the active item get rendered as possible.
|
|
13
|
-
*/
|
|
14
|
-
export declare function lines<T>({ items, width, renderItem, active, position: requested, pageSize, }: {
|
|
15
|
-
items: ReadonlyArray<T>;
|
|
16
|
-
/** The width of a rendered line in characters. */
|
|
17
|
-
width: number;
|
|
18
|
-
/** Renders an item as part of a page. */
|
|
19
|
-
renderItem: (layout: Prettify<Layout<T>>) => string;
|
|
20
|
-
/** The index of the active item in the list of items. */
|
|
21
|
-
active: number;
|
|
22
|
-
/** The position on the page at which to render the active item. */
|
|
23
|
-
position: number;
|
|
24
|
-
/** The number of lines to render per page. */
|
|
25
|
-
pageSize: number;
|
|
26
|
-
}): string[];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates the next position for the active item considering a finite list of
|
|
3
|
-
* items to be rendered on a page.
|
|
4
|
-
*/
|
|
5
|
-
export declare function finite({ active, pageSize, total, }: {
|
|
6
|
-
active: number;
|
|
7
|
-
pageSize: number;
|
|
8
|
-
total: number;
|
|
9
|
-
}): number;
|
|
10
|
-
/**
|
|
11
|
-
* Creates the next position for the active item considering an infinitely
|
|
12
|
-
* looping list of items to be rendered on the page.
|
|
13
|
-
*/
|
|
14
|
-
export declare function infinite({ active, lastActive, total, pageSize, pointer, }: {
|
|
15
|
-
active: number;
|
|
16
|
-
lastActive: number;
|
|
17
|
-
total: number;
|
|
18
|
-
pageSize: number;
|
|
19
|
-
pointer: number;
|
|
20
|
-
}): number;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Prettify } from '@inquirer/type';
|
|
2
|
-
import { type Theme } from '../theme.mjs';
|
|
3
|
-
import { type Layout } from './lines.mjs';
|
|
4
|
-
export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, }: {
|
|
5
|
-
items: ReadonlyArray<T>;
|
|
6
|
-
/** The index of the active item. */
|
|
7
|
-
active: number;
|
|
8
|
-
/** Renders an item as part of a page. */
|
|
9
|
-
renderItem: (layout: Prettify<Layout<T>>) => string;
|
|
10
|
-
/** The size of the page. */
|
|
11
|
-
pageSize: number;
|
|
12
|
-
/** Allows creating an infinitely looping list. `true` if unspecified. */
|
|
13
|
-
loop?: boolean;
|
|
14
|
-
theme?: Theme;
|
|
15
|
-
}): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useMemo<Value>(fn: () => Value, dependencies: ReadonlyArray<unknown>): Value;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
3
|
-
* ignore invisible codes during width calculation.
|
|
4
|
-
* @param {string} content
|
|
5
|
-
* @param {number} width
|
|
6
|
-
* @return {string}
|
|
7
|
-
*/
|
|
8
|
-
export declare function breakLines(content: string, width: number): string;
|
|
9
|
-
/**
|
|
10
|
-
* Returns the width of the active readline, or 80 as default value.
|
|
11
|
-
* @returns {number}
|
|
12
|
-
*/
|
|
13
|
-
export declare function readlineWidth(): number;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Separator object
|
|
3
|
-
* Used to space/separate choices group
|
|
4
|
-
*/
|
|
5
|
-
export declare class Separator {
|
|
6
|
-
readonly separator: string;
|
|
7
|
-
readonly type = "separator";
|
|
8
|
-
constructor(separator?: string);
|
|
9
|
-
static isSeparator(choice: undefined | Separator | Record<string, unknown>): choice is Separator;
|
|
10
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { InquirerReadline } from '@inquirer/type';
|
|
2
|
-
type HookStore = {
|
|
3
|
-
rl: InquirerReadline;
|
|
4
|
-
hooks: any[];
|
|
5
|
-
hooksCleanup: Array<void | (() => void)>;
|
|
6
|
-
hooksEffect: Array<() => void>;
|
|
7
|
-
index: number;
|
|
8
|
-
handleChange: () => void;
|
|
9
|
-
};
|
|
10
|
-
export declare function withHooks(rl: InquirerReadline, cb: (store: HookStore) => void): void;
|
|
11
|
-
export declare function readline(): InquirerReadline;
|
|
12
|
-
export declare function withUpdates<T extends (...args: any) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
13
|
-
type SetPointer<Value> = {
|
|
14
|
-
get(): Value;
|
|
15
|
-
set(value: Value): void;
|
|
16
|
-
initialized: true;
|
|
17
|
-
};
|
|
18
|
-
type UnsetPointer<Value> = {
|
|
19
|
-
get(): void;
|
|
20
|
-
set(value: Value): void;
|
|
21
|
-
initialized: false;
|
|
22
|
-
};
|
|
23
|
-
type Pointer<Value> = SetPointer<Value> | UnsetPointer<Value>;
|
|
24
|
-
export declare function withPointer<Value, ReturnValue>(cb: (pointer: Pointer<Value>) => ReturnValue): ReturnValue;
|
|
25
|
-
export declare function handleChange(): void;
|
|
26
|
-
export declare const effectScheduler: {
|
|
27
|
-
queue(cb: (readline: InquirerReadline) => void): void;
|
|
28
|
-
run(): void;
|
|
29
|
-
};
|
|
30
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { InquirerReadline } from '@inquirer/type';
|
|
2
|
-
export default class ScreenManager {
|
|
3
|
-
private readonly rl;
|
|
4
|
-
private height;
|
|
5
|
-
private extraLinesUnderPrompt;
|
|
6
|
-
private cursorPos;
|
|
7
|
-
constructor(rl: InquirerReadline);
|
|
8
|
-
render(content: string, bottomContent?: string): void;
|
|
9
|
-
checkCursorPos(): void;
|
|
10
|
-
clean(): void;
|
|
11
|
-
clearContent(): void;
|
|
12
|
-
done(): void;
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Prettify } from '@inquirer/type';
|
|
2
|
-
type DefaultTheme = {
|
|
3
|
-
prefix: string;
|
|
4
|
-
spinner: {
|
|
5
|
-
interval: number;
|
|
6
|
-
frames: string[];
|
|
7
|
-
};
|
|
8
|
-
style: {
|
|
9
|
-
answer: (text: string) => string;
|
|
10
|
-
message: (text: string) => string;
|
|
11
|
-
error: (text: string) => string;
|
|
12
|
-
defaultAnswer: (text: string) => string;
|
|
13
|
-
help: (text: string) => string;
|
|
14
|
-
highlight: (text: string) => string;
|
|
15
|
-
key: (text: string) => string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type Theme<Extension extends object = object> = Prettify<Extension & DefaultTheme>;
|
|
19
|
-
export declare const defaultTheme: DefaultTheme;
|
|
20
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
type NotFunction<T> = T extends Function ? never : T;
|
|
2
|
-
export declare function useState<Value>(defaultValue: NotFunction<Value> | (() => Value)): [Value, (newValue: Value) => void];
|
|
3
|
-
export declare function useState<Value>(defaultValue?: NotFunction<Value> | (() => Value)): [Value | undefined, (newValue?: Value | undefined) => void];
|
|
4
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|