mepcli 0.2.6 → 0.2.7

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/core.d.ts CHANGED
@@ -9,8 +9,8 @@ export declare class MepCLI {
9
9
  */
10
10
  static spin<T>(message: string, taskPromise: Promise<T>): Promise<T>;
11
11
  static text(options: TextOptions): Promise<string>;
12
- static select(options: SelectOptions): Promise<any>;
13
- static checkbox(options: CheckboxOptions): Promise<any[]>;
12
+ static select<const V>(options: SelectOptions<V>): Promise<V>;
13
+ static checkbox<const V>(options: CheckboxOptions<V>): Promise<V[]>;
14
14
  static confirm(options: ConfirmOptions): Promise<boolean>;
15
15
  static password(options: TextOptions): Promise<string>;
16
16
  static number(options: NumberOptions): Promise<number>;
@@ -19,5 +19,5 @@ export declare class MepCLI {
19
19
  static slider(options: SliderOptions): Promise<number>;
20
20
  static date(options: DateOptions): Promise<Date>;
21
21
  static file(options: FileOptions): Promise<string>;
22
- static multiSelect(options: MultiSelectOptions): Promise<any[]>;
22
+ static multiSelect<const V>(options: MultiSelectOptions<V>): Promise<V[]>;
23
23
  }
@@ -1,12 +1,12 @@
1
1
  import { Prompt } from '../base';
2
2
  import { CheckboxOptions } from '../types';
3
- export declare class CheckboxPrompt extends Prompt<any[], CheckboxOptions> {
3
+ export declare class CheckboxPrompt<V> extends Prompt<any[], CheckboxOptions<V>> {
4
4
  private selectedIndex;
5
5
  private checkedState;
6
6
  private errorMsg;
7
7
  private scrollTop;
8
8
  private readonly pageSize;
9
- constructor(options: CheckboxOptions);
9
+ constructor(options: CheckboxOptions<V>);
10
10
  protected render(firstRender: boolean): void;
11
11
  protected handleInput(char: string): void;
12
12
  }
@@ -1,13 +1,13 @@
1
1
  import { Prompt } from '../base';
2
2
  import { MultiSelectOptions } from '../types';
3
- export declare class MultiSelectPrompt extends Prompt<any[], MultiSelectOptions> {
3
+ export declare class MultiSelectPrompt<V> extends Prompt<any[], MultiSelectOptions<V>> {
4
4
  private selectedIndex;
5
5
  private checkedState;
6
6
  private searchBuffer;
7
7
  private scrollTop;
8
8
  private readonly pageSize;
9
9
  private errorMsg;
10
- constructor(options: MultiSelectOptions);
10
+ constructor(options: MultiSelectOptions<V>);
11
11
  private getFilteredChoices;
12
12
  protected render(firstRender: boolean): void;
13
13
  protected handleInput(char: string): void;
@@ -1,11 +1,11 @@
1
1
  import { Prompt } from '../base';
2
2
  import { SelectOptions } from '../types';
3
- export declare class SelectPrompt extends Prompt<any, SelectOptions> {
3
+ export declare class SelectPrompt<V> extends Prompt<any, SelectOptions<V>> {
4
4
  private selectedIndex;
5
5
  private searchBuffer;
6
6
  private scrollTop;
7
7
  private readonly pageSize;
8
- constructor(options: SelectOptions);
8
+ constructor(options: SelectOptions<V>);
9
9
  private isSeparator;
10
10
  private findNextSelectableIndex;
11
11
  private getFilteredChoices;
package/dist/types.d.ts CHANGED
@@ -22,19 +22,19 @@ export interface Separator {
22
22
  separator: true;
23
23
  text?: string;
24
24
  }
25
- export interface SelectChoice {
25
+ export interface SelectChoice<V> {
26
26
  title: string;
27
- value: any;
27
+ value: V;
28
28
  description?: string;
29
29
  }
30
- export interface SelectOptions extends BaseOptions {
31
- choices: (SelectChoice | Separator)[];
30
+ export interface SelectOptions<V> extends BaseOptions {
31
+ choices: (SelectChoice<V> | Separator)[];
32
32
  }
33
- export interface CheckboxChoice extends SelectChoice {
33
+ export interface CheckboxChoice<V> extends SelectChoice<V> {
34
34
  selected?: boolean;
35
35
  }
36
- export interface CheckboxOptions extends BaseOptions {
37
- choices: CheckboxChoice[];
36
+ export interface CheckboxOptions<V> extends BaseOptions {
37
+ choices: CheckboxChoice<V>[];
38
38
  min?: number;
39
39
  max?: number;
40
40
  }
@@ -75,5 +75,5 @@ export interface FileOptions extends BaseOptions {
75
75
  extensions?: string[];
76
76
  onlyDirectories?: boolean;
77
77
  }
78
- export interface MultiSelectOptions extends CheckboxOptions {
78
+ export interface MultiSelectOptions<V> extends CheckboxOptions<V> {
79
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mepcli",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Zero-dependency, minimalist interactive CLI prompt for Node.js",
5
5
  "repository": {
6
6
  "type": "git",