@inquirer/core 5.1.1 → 6.0.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.
|
@@ -9,7 +9,7 @@ const use_ref_mjs_1 = require('../use-ref.js');
|
|
|
9
9
|
const utils_mjs_1 = require('../utils.js');
|
|
10
10
|
const lines_mjs_1 = require('./lines.js');
|
|
11
11
|
const position_mjs_1 = require('./position.js');
|
|
12
|
-
function usePagination({ items, active, renderItem, pageSize
|
|
12
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true, }) {
|
|
13
13
|
const state = (0, use_ref_mjs_1.useRef)({ position: 0, lastActive: 0 });
|
|
14
14
|
const position = loop
|
|
15
15
|
? (0, position_mjs_1.infinite)({
|
|
@@ -6,8 +6,8 @@ export declare function usePagination<T>({ items, active, renderItem, pageSize,
|
|
|
6
6
|
active: number;
|
|
7
7
|
/** Renders an item as part of a page. */
|
|
8
8
|
renderItem: (layout: Prettify<Layout<T>>) => string;
|
|
9
|
-
/** The size of the page.
|
|
10
|
-
pageSize
|
|
9
|
+
/** The size of the page. */
|
|
10
|
+
pageSize: number;
|
|
11
11
|
/** Allows creating an infinitely looping list. `true` if unspecified. */
|
|
12
12
|
loop?: boolean;
|
|
13
13
|
}): string;
|
|
@@ -3,7 +3,7 @@ import { useRef } from '../use-ref.mjs';
|
|
|
3
3
|
import { readlineWidth } from '../utils.mjs';
|
|
4
4
|
import { lines } from './lines.mjs';
|
|
5
5
|
import { finite, infinite } from './position.mjs';
|
|
6
|
-
export function usePagination({ items, active, renderItem, pageSize
|
|
6
|
+
export function usePagination({ items, active, renderItem, pageSize, loop = true, }) {
|
|
7
7
|
const state = useRef({ position: 0, lastActive: 0 });
|
|
8
8
|
const position = loop
|
|
9
9
|
? infinite({
|
|
@@ -6,8 +6,8 @@ export declare function usePagination<T>({ items, active, renderItem, pageSize,
|
|
|
6
6
|
active: number;
|
|
7
7
|
/** Renders an item as part of a page. */
|
|
8
8
|
renderItem: (layout: Prettify<Layout<T>>) => string;
|
|
9
|
-
/** The size of the page.
|
|
10
|
-
pageSize
|
|
9
|
+
/** The size of the page. */
|
|
10
|
+
pageSize: number;
|
|
11
11
|
/** Allows creating an infinitely looping list. `true` if unspecified. */
|
|
12
12
|
loop?: boolean;
|
|
13
13
|
}): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.18.0"
|
|
6
6
|
},
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/core/README.md",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@inquirer/type": "^1.1.
|
|
60
|
+
"@inquirer/type": "^1.1.6",
|
|
61
61
|
"@types/mute-stream": "^0.0.4",
|
|
62
|
-
"@types/node": "^20.
|
|
62
|
+
"@types/node": "^20.10.7",
|
|
63
63
|
"@types/wrap-ansi": "^3.0.0",
|
|
64
64
|
"ansi-escapes": "^4.3.2",
|
|
65
65
|
"chalk": "^4.1.2",
|
|
66
|
-
"cli-spinners": "^2.9.
|
|
66
|
+
"cli-spinners": "^2.9.2",
|
|
67
67
|
"cli-width": "^4.1.0",
|
|
68
68
|
"figures": "^3.2.0",
|
|
69
69
|
"mute-stream": "^1.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"wrap-ansi": "^6.2.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@inquirer/testing": "^2.1.
|
|
76
|
+
"@inquirer/testing": "^2.1.10"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "4dee2b11d89a7c8a698c9eeda546ba8092b84f64"
|
|
99
99
|
}
|