Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@inquirer/core

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/core - npm Package Compare versions

Comparing version
11.1.10
to
11.2.0
+1
-0
dist/lib/key.d.ts

@@ -7,2 +7,3 @@ export type KeypressEvent = {

export type Keybinding = 'emacs' | 'vim';
export declare function getDefaultKeybindings(): ReadonlyArray<Keybinding>;
export declare const isUpKey: (key: KeypressEvent, keybindings?: ReadonlyArray<Keybinding>) => boolean;

@@ -9,0 +10,0 @@ export declare const isDownKey: (key: KeypressEvent, keybindings?: ReadonlyArray<Keybinding>) => boolean;

@@ -0,1 +1,15 @@

const keybindings = ['emacs', 'vim'];
const keybindingLookup = new Set(keybindings);
function isKeybinding(value) {
return keybindingLookup.has(value);
}
export function getDefaultKeybindings() {
const env = process.env['INQUIRER_KEYBINDINGS'];
if (!env)
return [];
return Array.from(new Set(env
.toLowerCase()
.split(/[\s,]+/)
.filter(isKeybinding)));
}
export const isUpKey = (key, keybindings = []) =>

@@ -2,0 +16,0 @@ // The up key

+2
-2

@@ -1,2 +0,2 @@

import { defaultTheme } from "./theme.js";
import { getDefaultTheme } from "./theme.js";
function isPlainObject(value) {

@@ -28,3 +28,3 @@ if (typeof value !== 'object' || value === null)

const themesToMerge = [
defaultTheme,
getDefaultTheme(),
...themes.filter((theme) => theme != null),

@@ -31,0 +31,0 @@ ];

import type { Prettify } from '@inquirer/type';
import { type Keybinding } from './key.ts';
/**

@@ -56,2 +57,11 @@ * Union type representing the possible statuses of a prompt.

/**
* Alternative keybindings enabled for prompt navigation.
*
* @defaultValue
* ```ts
* process.env['INQUIRER_KEYBINDINGS']
* ```
*/
keybindings: ReadonlyArray<Keybinding>;
/**
* Object containing functions to style different parts of the prompt.

@@ -156,2 +166,3 @@ */

export declare const defaultTheme: DefaultTheme;
export declare function getDefaultTheme(): DefaultTheme;
export {};
import { styleText } from 'node:util';
import figures from '@inquirer/figures';
import { getDefaultKeybindings } from "./key.js";
export const defaultTheme = {

@@ -12,2 +13,3 @@ prefix: {

},
keybindings: [],
style: {

@@ -23,1 +25,7 @@ answer: (text) => styleText('cyan', text),

};
export function getDefaultTheme() {
return {
...defaultTheme,
keybindings: getDefaultKeybindings(),
};
}

@@ -14,3 +14,3 @@ import cliWidth from 'cli-width';

.split('\n')
.flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true })
.flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false })
.split('\n')

@@ -17,0 +17,0 @@ .map((str) => str.trimEnd()))

{
"name": "@inquirer/core",
"version": "11.1.10",
"version": "11.2.0",
"description": "Core Inquirer prompt API",

@@ -70,8 +70,8 @@ "keywords": [

"dependencies": {
"@inquirer/ansi": "^2.0.5",
"@inquirer/figures": "^2.0.5",
"@inquirer/type": "^4.0.5",
"@inquirer/ansi": "^2.0.6",
"@inquirer/figures": "^2.0.6",
"@inquirer/type": "^4.0.6",
"cli-width": "^4.1.0",
"fast-wrap-ansi": "^0.2.0",
"mute-stream": "^3.0.0",
"mute-stream": "^4.0.0",
"signal-exit": "^4.1.0"

@@ -97,3 +97,3 @@ },

"types": "./dist/index.d.ts",
"gitHead": "113558c67f0d781d774cf3cf4db48fbcd8738b13"
"gitHead": "5ca6d1101d5d3f8fb066cd5b389bccfdafbbe0c0"
}

@@ -251,2 +251,4 @@ # `@inquirer/core`

Set `INQUIRER_KEYBINDINGS=vim`, `INQUIRER_KEYBINDINGS=emacs`, or `INQUIRER_KEYBINDINGS=vim,emacs` to enable alternative navigation keybindings globally. Prompt-level `theme.keybindings` values override the environment variable.
## Theming

@@ -309,2 +311,3 @@

};
keybindings: readonly ('emacs' | 'vim')[];
style: {

@@ -311,0 +314,0 @@ answer: (text: string) => string;