@inquirer/core 7.1.2 → 8.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.
package/README.md CHANGED
@@ -141,7 +141,6 @@ export default createPrompt((config, done) => {
141
141
  renderItem: ({ item, index, isActive }) => `${isActive ? ">" : " "}${index}. ${item.toString()}`
142
142
  pageSize: config.pageSize,
143
143
  loop: config.loop,
144
- theme, config.theme,
145
144
  });
146
145
 
147
146
  return `... ${page}`;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Separator = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
- const figures_1 = __importDefault(require("figures"));
8
+ const figures_1 = __importDefault(require("@inquirer/figures"));
9
9
  /**
10
10
  * Separator object
11
11
  * Used to space/separate choices group
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.usePagination = void 0;
4
4
  const use_ref_mjs_1 = require('../use-ref.js');
5
5
  const utils_mjs_1 = require('../utils.js');
6
- const make_theme_mjs_1 = require('../make-theme.js');
7
6
  const lines_mjs_1 = require('./lines.js');
8
7
  const position_mjs_1 = require('./position.js');
9
- function usePagination({ items, active, renderItem, pageSize, loop = true, theme: defaultTheme, }) {
8
+ function usePagination({ items, active, renderItem, pageSize, loop = true, }) {
10
9
  const state = (0, use_ref_mjs_1.useRef)({ position: 0, lastActive: 0 });
11
- const theme = (0, make_theme_mjs_1.makeTheme)(defaultTheme);
12
10
  const position = loop
13
11
  ? (0, position_mjs_1.infinite)({
14
12
  active,
@@ -24,7 +22,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true, theme
24
22
  });
25
23
  state.current.position = position;
26
24
  state.current.lastActive = active;
27
- const visibleLines = (0, lines_mjs_1.lines)({
25
+ return (0, lines_mjs_1.lines)({
28
26
  items,
29
27
  width: (0, utils_mjs_1.readlineWidth)(),
30
28
  renderItem,
@@ -32,9 +30,5 @@ function usePagination({ items, active, renderItem, pageSize, loop = true, theme
32
30
  position,
33
31
  pageSize,
34
32
  }).join('\n');
35
- if (items.length > pageSize) {
36
- return `${visibleLines}\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
37
- }
38
- return visibleLines;
39
33
  }
40
34
  exports.usePagination = usePagination;
@@ -1,7 +1,7 @@
1
1
  import type { Prettify } from '@inquirer/type';
2
2
  import { type Theme } from '../theme.js';
3
3
  import { type Layout } from './lines.js';
4
- export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, theme: defaultTheme, }: {
4
+ export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, }: {
5
5
  items: readonly T[];
6
6
  /** The index of the active item. */
7
7
  active: number;
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import figures from 'figures';
2
+ import figures from '@inquirer/figures';
3
3
  /**
4
4
  * Separator object
5
5
  * Used to space/separate choices group
@@ -1,11 +1,9 @@
1
1
  import { useRef } from '../use-ref.mjs';
2
2
  import { readlineWidth } from '../utils.mjs';
3
- import { makeTheme } from '../make-theme.mjs';
4
3
  import { lines } from './lines.mjs';
5
4
  import { finite, infinite } from './position.mjs';
6
- export function usePagination({ items, active, renderItem, pageSize, loop = true, theme: defaultTheme, }) {
5
+ export function usePagination({ items, active, renderItem, pageSize, loop = true, }) {
7
6
  const state = useRef({ position: 0, lastActive: 0 });
8
- const theme = makeTheme(defaultTheme);
9
7
  const position = loop
10
8
  ? infinite({
11
9
  active,
@@ -21,7 +19,7 @@ export function usePagination({ items, active, renderItem, pageSize, loop = true
21
19
  });
22
20
  state.current.position = position;
23
21
  state.current.lastActive = active;
24
- const visibleLines = lines({
22
+ return lines({
25
23
  items,
26
24
  width: readlineWidth(),
27
25
  renderItem,
@@ -29,8 +27,4 @@ export function usePagination({ items, active, renderItem, pageSize, loop = true
29
27
  position,
30
28
  pageSize,
31
29
  }).join('\n');
32
- if (items.length > pageSize) {
33
- return `${visibleLines}\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
34
- }
35
- return visibleLines;
36
30
  }
@@ -1,7 +1,7 @@
1
1
  import type { Prettify } from '@inquirer/type';
2
2
  import { type Theme } from '../theme.mjs';
3
3
  import { type Layout } from './lines.mjs';
4
- export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, theme: defaultTheme, }: {
4
+ export declare function usePagination<T>({ items, active, renderItem, pageSize, loop, }: {
5
5
  items: readonly T[];
6
6
  /** The index of the active item. */
7
7
  active: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/core",
3
- "version": "7.1.2",
3
+ "version": "8.0.0",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
@@ -57,22 +57,22 @@
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.2.1",
60
+ "@inquirer/figures": "^1.0.0",
61
+ "@inquirer/type": "^1.3.0",
61
62
  "@types/mute-stream": "^0.0.4",
62
- "@types/node": "^20.12.4",
63
+ "@types/node": "^20.12.7",
63
64
  "@types/wrap-ansi": "^3.0.0",
64
65
  "ansi-escapes": "^4.3.2",
65
66
  "chalk": "^4.1.2",
66
67
  "cli-spinners": "^2.9.2",
67
68
  "cli-width": "^4.1.0",
68
- "figures": "^3.2.0",
69
69
  "mute-stream": "^1.0.0",
70
70
  "signal-exit": "^4.1.0",
71
71
  "strip-ansi": "^6.0.1",
72
72
  "wrap-ansi": "^6.2.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@inquirer/testing": "^2.1.15"
75
+ "@inquirer/testing": "^2.1.17"
76
76
  },
77
77
  "scripts": {
78
78
  "tsc": "yarn run tsc:esm && yarn run tsc:cjs",
@@ -95,5 +95,5 @@
95
95
  }
96
96
  }
97
97
  },
98
- "gitHead": "e5300568c6b043f325a1107e38e99d931593510e"
98
+ "gitHead": "bb5b6b857d227b0fe8fd55951784f03800cdf73c"
99
99
  }