inquirer-plugins 1.0.5 → 1.0.6

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
@@ -31,10 +31,13 @@ This plugin has been customized to support TypeScript and symbol input.
31
31
  all: true
32
32
  linked: true
33
33
  -->
34
+
34
35
  [TABLE PLUGIN][md_hopper:inquirer-plugins-table]
36
+
35
37
  <!-- MD_HOPPER: END_LINKS: -->
36
38
 
37
39
  <!-- MD_HOPPER: BEGIN_DEFINE_LINKS: -->
40
+
38
41
  [md_hopper:main]: ../../README.md 'MyPackages'
39
42
  [md_hopper:inquirer-plugins-table]: ./src/lib/_internal/plugins/table/README.md 'TABLE PLUGIN'
40
43
  [md_hopper:md-hopper]: ../md-hopper/README.md 'MD HOPPER'
@@ -43,4 +46,5 @@ linked: true
43
46
  [md_hopper:my-gadgetry-dev-ops]: ../my-gadgetry/src/lib/_internal/dev-ops/README.md 'Dev Ops'
44
47
  [md_hopper:test]: ../test/README.md 'test'
45
48
  [md_hopper:plugins-builder]: ../../plugins/builder/README.md 'builder'
49
+
46
50
  <!-- MD_HOPPER: END_DEFINE_LINKS: -->
@@ -1,21 +1,18 @@
1
- import { ParseType } from '../../../types/parse-types.js'
2
- import { Message } from '../../../types/chalk.js'
3
- import { ValidateResult } from './common.js'
1
+ import { ParseType } from '../../../types/parse-types.js';
2
+ import { Message } from '../../../types/chalk.js';
3
+ import { ValidateResult } from './common.js';
4
4
  interface DisabledColumn {
5
- name: Message
6
- value: string
7
- disabled: true
5
+ name: Message;
6
+ value: string;
7
+ disabled: true;
8
8
  }
9
- interface EditableColumn<
10
- P extends (...args: any[]) => any = (...args: any[]) => any,
11
- V extends (...args: any[]) => ValidateResult = (...args: any[]) => ValidateResult
12
- > {
13
- name: Message
14
- value: string
15
- type: ParseType
16
- validate?: V
17
- parser?: P
9
+ interface EditableColumn<P extends (...args: any[]) => any = (...args: any[]) => any, V extends (...args: any[]) => ValidateResult = (...args: any[]) => ValidateResult> {
10
+ name: Message;
11
+ value: string;
12
+ type: ParseType;
13
+ validate?: V;
14
+ parser?: P;
18
15
  }
19
- export type Column = DisabledColumn | EditableColumn
20
- export {}
21
- //# sourceMappingURL=columns.d.ts.map
16
+ export type Column = DisabledColumn | EditableColumn;
17
+ export {};
18
+ //# sourceMappingURL=columns.d.ts.map
@@ -1,25 +1,25 @@
1
- import { Cell } from '../../../types/table.js'
2
- import { ChalkInstance } from 'chalk'
3
- export declare const DEFAULT_PAGE_SIZE = 5
1
+ import { Cell } from '../../../types/table.js';
2
+ import { ChalkInstance } from 'chalk';
3
+ export declare const DEFAULT_PAGE_SIZE = 5;
4
4
  export declare const END_STATUSES: Readonly<{
5
- readonly confirmed: 'confirmed'
6
- readonly escaped: 'escaped'
7
- }>
8
- export type EndStatus = (typeof END_STATUSES)[keyof typeof END_STATUSES]
5
+ readonly confirmed: "confirmed";
6
+ readonly escaped: "escaped";
7
+ }>;
8
+ export type EndStatus = (typeof END_STATUSES)[keyof typeof END_STATUSES];
9
9
  export interface ValidateResult {
10
- isValid: boolean
11
- message: string
10
+ isValid: boolean;
11
+ message: string;
12
12
  }
13
13
  export interface Colors {
14
- selected: ChalkInstance
15
- editable: ChalkInstance
16
- editing: ChalkInstance
14
+ selected: ChalkInstance;
15
+ editable: ChalkInstance;
16
+ editing: ChalkInstance;
17
17
  }
18
18
  export interface Typing {
19
- current: Cell
20
- backup: Cell
19
+ current: Cell;
20
+ backup: Cell;
21
21
  }
22
22
  export interface NextClose {
23
- escape: boolean
23
+ escape: boolean;
24
24
  }
25
- //# sourceMappingURL=common.d.ts.map
25
+ //# sourceMappingURL=common.d.ts.map
@@ -8,10 +8,10 @@ export declare const TablePlugin: import("@inquirer/type").Prompt<{
8
8
  columns: import("./table/types.js").Column[];
9
9
  rows: import("../types/table.js").Rows;
10
10
  colors?: Partial<import("./table/types.js").Colors> | undefined;
11
- title?: string | import("chalk").ChalkInstance | undefined;
12
- description?: string | import("chalk").ChalkInstance | undefined;
13
11
  messages?: import("./table/types.js").Messages | undefined;
14
12
  validate?: ((...args: any[]) => import("./table/types.js").ValidateResult) | undefined;
13
+ title?: string | import("chalk").ChalkInstance | undefined;
14
+ description?: string | import("chalk").ChalkInstance | undefined;
15
15
  pageSize?: import("../types/table.js").PageSize | undefined;
16
16
  }>;
17
17
  //# sourceMappingURL=table.d.ts.map
@@ -1,7 +1,7 @@
1
- import { ChalkInstance } from 'chalk'
2
- export type Message = string | ChalkInstance
1
+ import { ChalkInstance } from 'chalk';
2
+ export type Message = string | ChalkInstance;
3
3
  export interface ExtractedAnsiText {
4
- text: string
5
- attach: (v: any) => string
4
+ text: string;
5
+ attach: (v: any) => string;
6
6
  }
7
- //# sourceMappingURL=chalk.d.ts.map
7
+ //# sourceMappingURL=chalk.d.ts.map
@@ -1,7 +1,7 @@
1
1
  export declare const PARSE_TYPES: Readonly<{
2
- readonly input: 'input'
3
- readonly number: 'number'
4
- readonly confirm: 'confirm'
5
- }>
6
- export type ParseType = (typeof PARSE_TYPES)[keyof typeof PARSE_TYPES]
7
- //# sourceMappingURL=parse-types.d.ts.map
2
+ readonly input: "input";
3
+ readonly number: "number";
4
+ readonly confirm: "confirm";
5
+ }>;
6
+ export type ParseType = (typeof PARSE_TYPES)[keyof typeof PARSE_TYPES];
7
+ //# sourceMappingURL=parse-types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export const PARSE_TYPES = Object.freeze({
2
- input: 'input',
3
- number: 'number',
4
- confirm: 'confirm',
5
- })
2
+ input: 'input',
3
+ number: 'number',
4
+ confirm: 'confirm',
5
+ });
@@ -1,15 +1,15 @@
1
- import { ExtractedAnsiText } from './chalk.js'
2
- export type PageSize = number | null
1
+ import { ExtractedAnsiText } from './chalk.js';
2
+ export type PageSize = number | null;
3
3
  export interface Paginator {
4
- indexFrom: number
5
- indexTo: number | null
4
+ indexFrom: number;
5
+ indexTo: number | null;
6
6
  }
7
7
  export interface PointerIndexes {
8
- row: number
9
- column: number
8
+ row: number;
9
+ column: number;
10
10
  }
11
- export type Cell = number | string | boolean
12
- export type Rows = Cell[][]
13
- export type ExtractedRow = ExtractedAnsiText
14
- export type ExtractedRows = ExtractedAnsiText[][]
15
- //# sourceMappingURL=table.d.ts.map
11
+ export type Cell = number | string | boolean;
12
+ export type Rows = Cell[][];
13
+ export type ExtractedRow = ExtractedAnsiText;
14
+ export type ExtractedRows = ExtractedAnsiText[][];
15
+ //# sourceMappingURL=table.d.ts.map
@@ -1,12 +1,12 @@
1
- import { ExtractedAnsiText } from '../types/chalk.js'
2
- export declare const trim: (txt: string) => string
3
- export declare const extractAnsiWrapper: (val: number | string | boolean) => ExtractedAnsiText
4
- export declare const success: import('chalk').ChalkInstance
5
- export declare const warn: import('chalk').ChalkInstance
6
- export declare const info: import('chalk').ChalkInstance
7
- export declare const error: import('chalk').ChalkInstance
8
- export declare const hop: import('chalk').ChalkInstance
9
- export declare const cyan: import('chalk').ChalkInstance
10
- export declare const bold: import('chalk').ChalkInstance
11
- export declare const dim: import('chalk').ChalkInstance
12
- //# sourceMappingURL=chalk.d.ts.map
1
+ import { ExtractedAnsiText } from '../types/chalk.js';
2
+ export declare const trim: (txt: string) => string;
3
+ export declare const extractAnsiWrapper: (val: number | string | boolean) => ExtractedAnsiText;
4
+ export declare const success: import("chalk").ChalkInstance;
5
+ export declare const warn: import("chalk").ChalkInstance;
6
+ export declare const info: import("chalk").ChalkInstance;
7
+ export declare const error: import("chalk").ChalkInstance;
8
+ export declare const hop: import("chalk").ChalkInstance;
9
+ export declare const cyan: import("chalk").ChalkInstance;
10
+ export declare const bold: import("chalk").ChalkInstance;
11
+ export declare const dim: import("chalk").ChalkInstance;
12
+ //# sourceMappingURL=chalk.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Cell } from '../types/table.js'
2
- export declare const isTrue: (value: Cell) => boolean
3
- export declare const getCheckbox: (bool: Cell) => string
4
- //# sourceMappingURL=common.d.ts.map
1
+ import { Cell } from '../types/table.js';
2
+ export declare const isTrue: (value: Cell) => boolean;
3
+ export declare const getCheckbox: (bool: Cell) => string;
4
+ //# sourceMappingURL=common.d.ts.map
@@ -1,12 +1,12 @@
1
- import { Key } from 'readline'
2
- export declare const getKeypressValue: (key: Key) => string
3
- export declare const getBackspaceText: (str: string) => string
4
- export declare const isUpKey: (key: Key) => boolean
5
- export declare const isDownKey: (key: Key) => boolean
6
- export declare const isLeftKey: (key: Key) => boolean
7
- export declare const isRightKey: (key: Key) => boolean
8
- export declare const isEscapeKey: (key: Key) => boolean
9
- export declare const isSpaceKey: (key: Key) => boolean
10
- export declare const isDeleteKey: (key: Key) => boolean
11
- export declare const isBackspaceKey: (key: Key) => boolean
12
- //# sourceMappingURL=keypress.d.ts.map
1
+ import { Key } from 'readline';
2
+ export declare const getKeypressValue: (key: Key) => string;
3
+ export declare const getBackspaceText: (str: string) => string;
4
+ export declare const isUpKey: (key: Key) => boolean;
5
+ export declare const isDownKey: (key: Key) => boolean;
6
+ export declare const isLeftKey: (key: Key) => boolean;
7
+ export declare const isRightKey: (key: Key) => boolean;
8
+ export declare const isEscapeKey: (key: Key) => boolean;
9
+ export declare const isSpaceKey: (key: Key) => boolean;
10
+ export declare const isDeleteKey: (key: Key) => boolean;
11
+ export declare const isBackspaceKey: (key: Key) => boolean;
12
+ //# sourceMappingURL=keypress.d.ts.map
@@ -1,28 +1,28 @@
1
- export const getKeypressValue = key => {
2
- switch (key.name) {
3
- case 'escape':
4
- case 'delete':
5
- case 'backspace':
6
- case 'down':
7
- case 'up':
8
- case 'left':
9
- case 'right':
10
- return ''
11
- default:
12
- return key.sequence || ''
13
- }
14
- }
15
- export const getBackspaceText = str => {
16
- if (!str) {
17
- return ''
18
- }
19
- return str.slice(0, -1)
20
- }
21
- export const isUpKey = key => key.name === 'up'
22
- export const isDownKey = key => key.name === 'down'
23
- export const isLeftKey = key => key.name === 'left'
24
- export const isRightKey = key => key.name === 'right'
25
- export const isEscapeKey = key => key.name === 'escape'
26
- export const isSpaceKey = key => key.name === 'space'
27
- export const isDeleteKey = key => key.name === 'delete'
28
- export const isBackspaceKey = key => key.name === 'backspace'
1
+ export const getKeypressValue = (key) => {
2
+ switch (key.name) {
3
+ case 'escape':
4
+ case 'delete':
5
+ case 'backspace':
6
+ case 'down':
7
+ case 'up':
8
+ case 'left':
9
+ case 'right':
10
+ return '';
11
+ default:
12
+ return key.sequence || '';
13
+ }
14
+ };
15
+ export const getBackspaceText = (str) => {
16
+ if (!str) {
17
+ return '';
18
+ }
19
+ return str.slice(0, -1);
20
+ };
21
+ export const isUpKey = (key) => key.name === 'up';
22
+ export const isDownKey = (key) => key.name === 'down';
23
+ export const isLeftKey = (key) => key.name === 'left';
24
+ export const isRightKey = (key) => key.name === 'right';
25
+ export const isEscapeKey = (key) => key.name === 'escape';
26
+ export const isSpaceKey = (key) => key.name === 'space';
27
+ export const isDeleteKey = (key) => key.name === 'delete';
28
+ export const isBackspaceKey = (key) => key.name === 'backspace';
@@ -1,4 +1,4 @@
1
- import { ParseType } from '../types/parse-types.js'
2
- export declare const parse: (value: string, type: ParseType) => string | number | boolean
3
- export declare const parseView: (value: string, type: ParseType) => string | number | boolean
4
- //# sourceMappingURL=parse-types.d.ts.map
1
+ import { ParseType } from '../types/parse-types.js';
2
+ export declare const parse: (value: string, type: ParseType) => string | number | boolean;
3
+ export declare const parseView: (value: string, type: ParseType) => string | number | boolean;
4
+ //# sourceMappingURL=parse-types.d.ts.map
@@ -1,23 +1,23 @@
1
- import { isNumber } from 'my-gadgetry/type-check'
2
- import { PARSE_TYPES } from '../types/parse-types.js'
3
- const BOOL_VALUES = Object.freeze(['Y', 'y', 'yes', 'YES', 'x', 'v', 'o', 'true'])
1
+ import { isNumber } from 'my-gadgetry/type-check';
2
+ import { PARSE_TYPES } from '../types/parse-types.js';
3
+ const BOOL_VALUES = Object.freeze(['Y', 'y', 'yes', 'YES', 'x', 'v', 'o', 'true']);
4
4
  export const parse = (value, type) => {
5
- switch (type) {
6
- case PARSE_TYPES.number:
7
- return isNumber(value, true) ? Number(value) : 0
8
- case PARSE_TYPES.confirm:
9
- return BOOL_VALUES.includes(value)
10
- default:
11
- return value
12
- }
13
- }
5
+ switch (type) {
6
+ case PARSE_TYPES.number:
7
+ return isNumber(value, true) ? Number(value) : 0;
8
+ case PARSE_TYPES.confirm:
9
+ return BOOL_VALUES.includes(value);
10
+ default:
11
+ return value;
12
+ }
13
+ };
14
14
  export const parseView = (value, type) => {
15
- switch (type) {
16
- case PARSE_TYPES.number:
17
- return value ? Number(value) : 0
18
- case PARSE_TYPES.confirm:
19
- return value === 'true'
20
- default:
21
- return value
22
- }
23
- }
15
+ switch (type) {
16
+ case PARSE_TYPES.number:
17
+ return value ? Number(value) : 0;
18
+ case PARSE_TYPES.confirm:
19
+ return value === 'true';
20
+ default:
21
+ return value;
22
+ }
23
+ };
@@ -1,14 +1,5 @@
1
- import { Key } from 'readline'
2
- import { PageSize, Paginator, PointerIndexes } from '../../types/table.js'
3
- import { SetUseState } from '../../types/inquirer.js'
4
- export declare const onArrowKeyPress: (
5
- key: Key,
6
- pointerIndexes: PointerIndexes,
7
- setPointer: SetUseState<PointerIndexes>,
8
- setPaginator: SetUseState<Paginator>,
9
- pageSize: PageSize,
10
- maxColumnIndex: number,
11
- maxRowIndex: number,
12
- disableColumnIndexes: number[]
13
- ) => void
14
- //# sourceMappingURL=arrow-key.d.ts.map
1
+ import { Key } from 'readline';
2
+ import { PageSize, Paginator, PointerIndexes } from '../../types/table.js';
3
+ import { SetUseState } from '../../types/inquirer.js';
4
+ export declare const onArrowKeyPress: (key: Key, pointerIndexes: PointerIndexes, setPointer: SetUseState<PointerIndexes>, setPaginator: SetUseState<Paginator>, pageSize: PageSize, maxColumnIndex: number, maxRowIndex: number, disableColumnIndexes: number[]) => void;
5
+ //# sourceMappingURL=arrow-key.d.ts.map
@@ -1,3 +1,3 @@
1
- import { ExtractedRows, Cell } from '../../types/table.js'
2
- export declare const getCellValue: (columnIndex: number, rowIndex: number, rows: ExtractedRows) => Cell
3
- //# sourceMappingURL=cell.d.ts.map
1
+ import { ExtractedRows, Cell } from '../../types/table.js';
2
+ export declare const getCellValue: (columnIndex: number, rowIndex: number, rows: ExtractedRows) => Cell;
3
+ //# sourceMappingURL=cell.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Paginator, PointerIndexes, PageSize } from '../../types/table.js'
2
- export declare const getPageCount: (maxRowIndex: number, pageSize: PageSize) => number
3
- export declare const paginate: (pointerIndexes: PointerIndexes, pageSize: PageSize, maxRowIndex: number) => Paginator
4
- //# sourceMappingURL=pagenate.d.ts.map
1
+ import { Paginator, PointerIndexes, PageSize } from '../../types/table.js';
2
+ export declare const getPageCount: (maxRowIndex: number, pageSize: PageSize) => number;
3
+ export declare const paginate: (pointerIndexes: PointerIndexes, pageSize: PageSize, maxRowIndex: number) => Paginator;
4
+ //# sourceMappingURL=pagenate.d.ts.map
@@ -1,3 +1,3 @@
1
- import { ExtractedRows, Rows } from '../../types/table.js'
2
- export declare const getExtractedAnsiRows: (rows: Rows) => ExtractedRows
3
- //# sourceMappingURL=rows.d.ts.map
1
+ import { ExtractedRows, Rows } from '../../types/table.js';
2
+ export declare const getExtractedAnsiRows: (rows: Rows) => ExtractedRows;
3
+ //# sourceMappingURL=rows.d.ts.map
@@ -1,2 +1,2 @@
1
- export * from '../_internal/plugins/table.js'
2
- //# sourceMappingURL=table.d.ts.map
1
+ export * from '../_internal/plugins/table.js';
2
+ //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- export * from '../_internal/plugins/table.js'
1
+ export * from '../_internal/plugins/table.js';
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "inquirer-plugins",
3
+ "version": "1.0.5",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "answer",
8
+ "answers",
9
+ "ask",
10
+ "confirm",
11
+ "generator",
12
+ "input",
13
+ "inquire",
14
+ "inquirer",
15
+ "prompt",
16
+ "prompts",
17
+ "table",
18
+ "question"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/cilly-yllic/my-packages.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/cilly-yllic/my-packages/issues"
26
+ },
27
+ "homepage": "https://github.com/cilly-yllic/my-packages/blob/main/packages/inquirer-plugins/src/lib/_internal/plugins/table/README.md",
28
+ "main": "./dist/index.js",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ "./package.json": "./package.json",
33
+ ".": {
34
+ "development": "./src/index.ts",
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js",
37
+ "default": "./dist/index.js"
38
+ },
39
+ "./table": "./dist/lib/modules/table.js",
40
+ "./types/chalk": "./dist/lib/modules/types/chalk.js",
41
+ "./types/inquirer": "./dist/lib/modules/types/inquirer.js",
42
+ "./types/parse-types": "./dist/lib/modules/types/parse-types.js",
43
+ "./types/table": "./dist/lib/modules/types/table.js"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "!**/*.tsbuildinfo"
48
+ ],
49
+ "dependencies": {
50
+ "@inquirer/core": "^10.1.10",
51
+ "chalk": "^5.4.1",
52
+ "cli-cursor": "^5.0.0",
53
+ "cli-table3": "^0.6.5",
54
+ "figures": "^6.1.0",
55
+ "my-gadgetry": "1.3.8",
56
+ "tslib": "^2.3.0",
57
+ "@inquirer/type": "3.0.6"
58
+ }
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inquirer-plugins",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -52,7 +52,7 @@
52
52
  "cli-cursor": "^5.0.0",
53
53
  "cli-table3": "^0.6.5",
54
54
  "figures": "^6.1.0",
55
- "my-gadgetry": "1.3.8",
55
+ "my-gadgetry": "1.3.9",
56
56
  "tslib": "^2.3.0",
57
57
  "@inquirer/type": "3.0.6"
58
58
  }
@@ -1,2 +0,0 @@
1
- export {}
2
- //# sourceMappingURL=table.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../../src/lib/_internal/plugins/table/table.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export {}
@@ -1,7 +0,0 @@
1
- export declare const getColumnIndex: (
2
- diff: number,
3
- currentIndex: number,
4
- maxIndex: number,
5
- disableColumnIndexes?: number[]
6
- ) => number
7
- //# sourceMappingURL=columns.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../../../src/lib/_internal/utils/columns.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,cAAc,SACnB,MAAM,gBACE,MAAM,YACV,MAAM,yBACM,MAAM,EAAE,WAU/B,CAAA"}
@@ -1,28 +0,0 @@
1
- const isValidColumnIndex = (index, maxIndex, disableIndexes) => {
2
- if (index > maxIndex || index < 0) {
3
- return false
4
- }
5
- if (disableIndexes.includes(index)) {
6
- return false
7
- }
8
- return true
9
- }
10
- const getNextIndex = (index, maxIndex, num) => {
11
- if (index + num > maxIndex) {
12
- return 0
13
- }
14
- if (index + num < 0) {
15
- return maxIndex
16
- }
17
- return index + num
18
- }
19
- export const getColumnIndex = (diff, currentIndex, maxIndex, disableColumnIndexes = []) => {
20
- let index = currentIndex
21
- for (let i = 0; i <= maxIndex; i++) {
22
- index = getNextIndex(index, maxIndex, diff)
23
- if (isValidColumnIndex(index, maxIndex, disableColumnIndexes)) {
24
- break
25
- }
26
- }
27
- return index
28
- }