@inquirer/core 10.3.2 → 11.0.1

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.
Files changed (77) hide show
  1. package/README.md +4 -4
  2. package/dist/{esm/lib → lib}/Separator.js +2 -2
  3. package/dist/{esm/lib → lib}/create-prompt.js +1 -1
  4. package/dist/{commonjs/lib → lib}/theme.d.ts +16 -16
  5. package/dist/lib/theme.js +21 -0
  6. package/package.json +14 -37
  7. package/dist/commonjs/index.js +0 -46
  8. package/dist/commonjs/lib/Separator.js +0 -28
  9. package/dist/commonjs/lib/create-prompt.js +0 -156
  10. package/dist/commonjs/lib/errors.js +0 -29
  11. package/dist/commonjs/lib/hook-engine.js +0 -118
  12. package/dist/commonjs/lib/key.js +0 -29
  13. package/dist/commonjs/lib/make-theme.js +0 -33
  14. package/dist/commonjs/lib/pagination/use-pagination.js +0 -124
  15. package/dist/commonjs/lib/promise-polyfill.js +0 -18
  16. package/dist/commonjs/lib/screen-manager.js +0 -82
  17. package/dist/commonjs/lib/theme.js +0 -27
  18. package/dist/commonjs/lib/use-effect.js +0 -14
  19. package/dist/commonjs/lib/use-keypress.js +0 -23
  20. package/dist/commonjs/lib/use-memo.js +0 -17
  21. package/dist/commonjs/lib/use-prefix.js +0 -38
  22. package/dist/commonjs/lib/use-ref.js +0 -7
  23. package/dist/commonjs/lib/use-state.js +0 -23
  24. package/dist/commonjs/lib/utils.js +0 -32
  25. package/dist/commonjs/package.json +0 -3
  26. package/dist/esm/index.d.ts +0 -13
  27. package/dist/esm/lib/Separator.d.ts +0 -10
  28. package/dist/esm/lib/create-prompt.d.ts +0 -4
  29. package/dist/esm/lib/errors.d.ts +0 -20
  30. package/dist/esm/lib/hook-engine.d.ts +0 -23
  31. package/dist/esm/lib/key.d.ts +0 -12
  32. package/dist/esm/lib/make-theme.d.ts +0 -3
  33. package/dist/esm/lib/pagination/use-pagination.d.ts +0 -16
  34. package/dist/esm/lib/promise-polyfill.d.ts +0 -7
  35. package/dist/esm/lib/screen-manager.d.ts +0 -14
  36. package/dist/esm/lib/theme.d.ts +0 -155
  37. package/dist/esm/lib/theme.js +0 -21
  38. package/dist/esm/lib/use-effect.d.ts +0 -2
  39. package/dist/esm/lib/use-keypress.d.ts +0 -3
  40. package/dist/esm/lib/use-memo.d.ts +0 -1
  41. package/dist/esm/lib/use-prefix.d.ts +0 -5
  42. package/dist/esm/lib/use-ref.d.ts +0 -6
  43. package/dist/esm/lib/use-state.d.ts +0 -4
  44. package/dist/esm/lib/utils.d.ts +0 -13
  45. package/dist/esm/package.json +0 -3
  46. /package/dist/{commonjs/index.d.ts → index.d.ts} +0 -0
  47. /package/dist/{esm/index.js → index.js} +0 -0
  48. /package/dist/{commonjs/lib → lib}/Separator.d.ts +0 -0
  49. /package/dist/{commonjs/lib → lib}/create-prompt.d.ts +0 -0
  50. /package/dist/{commonjs/lib → lib}/errors.d.ts +0 -0
  51. /package/dist/{esm/lib → lib}/errors.js +0 -0
  52. /package/dist/{commonjs/lib → lib}/hook-engine.d.ts +0 -0
  53. /package/dist/{esm/lib → lib}/hook-engine.js +0 -0
  54. /package/dist/{commonjs/lib → lib}/key.d.ts +0 -0
  55. /package/dist/{esm/lib → lib}/key.js +0 -0
  56. /package/dist/{commonjs/lib → lib}/make-theme.d.ts +0 -0
  57. /package/dist/{esm/lib → lib}/make-theme.js +0 -0
  58. /package/dist/{commonjs/lib → lib}/pagination/use-pagination.d.ts +0 -0
  59. /package/dist/{esm/lib → lib}/pagination/use-pagination.js +0 -0
  60. /package/dist/{commonjs/lib → lib}/promise-polyfill.d.ts +0 -0
  61. /package/dist/{esm/lib → lib}/promise-polyfill.js +0 -0
  62. /package/dist/{commonjs/lib → lib}/screen-manager.d.ts +0 -0
  63. /package/dist/{esm/lib → lib}/screen-manager.js +0 -0
  64. /package/dist/{commonjs/lib → lib}/use-effect.d.ts +0 -0
  65. /package/dist/{esm/lib → lib}/use-effect.js +0 -0
  66. /package/dist/{commonjs/lib → lib}/use-keypress.d.ts +0 -0
  67. /package/dist/{esm/lib → lib}/use-keypress.js +0 -0
  68. /package/dist/{commonjs/lib → lib}/use-memo.d.ts +0 -0
  69. /package/dist/{esm/lib → lib}/use-memo.js +0 -0
  70. /package/dist/{commonjs/lib → lib}/use-prefix.d.ts +0 -0
  71. /package/dist/{esm/lib → lib}/use-prefix.js +0 -0
  72. /package/dist/{commonjs/lib → lib}/use-ref.d.ts +0 -0
  73. /package/dist/{esm/lib → lib}/use-ref.js +0 -0
  74. /package/dist/{commonjs/lib → lib}/use-state.d.ts +0 -0
  75. /package/dist/{esm/lib → lib}/use-state.js +0 -0
  76. /package/dist/{commonjs/lib → lib}/utils.d.ts +0 -0
  77. /package/dist/{esm/lib → lib}/utils.js +0 -0
@@ -1,155 +0,0 @@
1
- import type { Prettify } from '@inquirer/type';
2
- /**
3
- * Union type representing the possible statuses of a prompt.
4
- *
5
- * - `'loading'`: The prompt is currently loading.
6
- * - `'idle'`: The prompt is loaded and currently waiting for the user to
7
- * submit an answer.
8
- * - `'done'`: The user has submitted an answer and the prompt is finished.
9
- * - `string`: Any other string: The prompt is in a custom state.
10
- */
11
- export type Status = 'loading' | 'idle' | 'done' | (string & {});
12
- type DefaultTheme = {
13
- /**
14
- * Prefix to prepend to the message. If a function is provided, it will be
15
- * called with the current status of the prompt, and the return value will be
16
- * used as the prefix.
17
- *
18
- * @remarks
19
- * If `status === 'loading'`, this property is ignored and the spinner (styled
20
- * by the `spinner` property) will be displayed instead.
21
- *
22
- * @defaultValue
23
- * ```ts
24
- * // import colors from 'yoctocolors-cjs';
25
- * (status) => status === 'done' ? colors.green('✔') : colors.blue('?')
26
- * ```
27
- */
28
- prefix: string | Prettify<Omit<Record<Status, string>, 'loading'>>;
29
- /**
30
- * Configuration for the spinner that is displayed when the prompt is in the
31
- * `'loading'` state.
32
- *
33
- * We recommend the use of {@link https://github.com/sindresorhus/cli-spinners|cli-spinners} for a list of available spinners.
34
- */
35
- spinner: {
36
- /**
37
- * The time interval between frames, in milliseconds.
38
- *
39
- * @defaultValue
40
- * ```ts
41
- * 80
42
- * ```
43
- */
44
- interval: number;
45
- /**
46
- * A list of frames to show for the spinner.
47
- *
48
- * @defaultValue
49
- * ```ts
50
- * ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
51
- * ```
52
- */
53
- frames: string[];
54
- };
55
- /**
56
- * Object containing functions to style different parts of the prompt.
57
- */
58
- style: {
59
- /**
60
- * Style to apply to the user's answer once it has been submitted.
61
- *
62
- * @param text - The user's answer.
63
- * @returns The styled answer.
64
- *
65
- * @defaultValue
66
- * ```ts
67
- * // import colors from 'yoctocolors-cjs';
68
- * (text) => colors.cyan(text)
69
- * ```
70
- */
71
- answer: (text: string) => string;
72
- /**
73
- * Style to apply to the message displayed to the user.
74
- *
75
- * @param text - The message to style.
76
- * @param status - The current status of the prompt.
77
- * @returns The styled message.
78
- *
79
- * @defaultValue
80
- * ```ts
81
- * // import colors from 'yoctocolors-cjs';
82
- * (text, status) => colors.bold(text)
83
- * ```
84
- */
85
- message: (text: string, status: Status) => string;
86
- /**
87
- * Style to apply to error messages.
88
- *
89
- * @param text - The error message.
90
- * @returns The styled error message.
91
- *
92
- * @defaultValue
93
- * ```ts
94
- * // import colors from 'yoctocolors-cjs';
95
- * (text) => colors.red(`> ${text}`)
96
- * ```
97
- */
98
- error: (text: string) => string;
99
- /**
100
- * Style to apply to the default answer when one is provided.
101
- *
102
- * @param text - The default answer.
103
- * @returns The styled default answer.
104
- *
105
- * @defaultValue
106
- * ```ts
107
- * // import colors from 'yoctocolors-cjs';
108
- * (text) => colors.dim(`(${text})`)
109
- * ```
110
- */
111
- defaultAnswer: (text: string) => string;
112
- /**
113
- * Style to apply to help text.
114
- *
115
- * @param text - The help text.
116
- * @returns The styled help text.
117
- *
118
- * @defaultValue
119
- * ```ts
120
- * // import colors from 'yoctocolors-cjs';
121
- * (text) => colors.dim(text)
122
- * ```
123
- */
124
- help: (text: string) => string;
125
- /**
126
- * Style to apply to highlighted text.
127
- *
128
- * @param text - The text to highlight.
129
- * @returns The highlighted text.
130
- *
131
- * @defaultValue
132
- * ```ts
133
- * // import colors from 'yoctocolors-cjs';
134
- * (text) => colors.cyan(text)
135
- * ```
136
- */
137
- highlight: (text: string) => string;
138
- /**
139
- * Style to apply to keyboard keys referred to in help texts.
140
- *
141
- * @param text - The key to style.
142
- * @returns The styled key.
143
- *
144
- * @defaultValue
145
- * ```ts
146
- * // import colors from 'yoctocolors-cjs';
147
- * (text) => colors.cyan(colors.bold(`<${text}>`))
148
- * ```
149
- */
150
- key: (text: string) => string;
151
- };
152
- };
153
- export type Theme<Extension extends object = object> = Prettify<Extension & DefaultTheme>;
154
- export declare const defaultTheme: DefaultTheme;
155
- export {};
@@ -1,21 +0,0 @@
1
- import colors from 'yoctocolors-cjs';
2
- import figures from '@inquirer/figures';
3
- export const defaultTheme = {
4
- prefix: {
5
- idle: colors.blue('?'),
6
- done: colors.green(figures.tick),
7
- },
8
- spinner: {
9
- interval: 80,
10
- frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'].map((frame) => colors.yellow(frame)),
11
- },
12
- style: {
13
- answer: colors.cyan,
14
- message: colors.bold,
15
- error: (text) => colors.red(`> ${text}`),
16
- defaultAnswer: (text) => colors.dim(`(${text})`),
17
- help: colors.dim,
18
- highlight: colors.cyan,
19
- key: (text) => colors.cyan(colors.bold(`<${text}>`)),
20
- },
21
- };
@@ -1,2 +0,0 @@
1
- import type { InquirerReadline } from '@inquirer/type';
2
- export declare function useEffect(cb: (rl: InquirerReadline) => void | (() => void), depArray: ReadonlyArray<unknown>): void;
@@ -1,3 +0,0 @@
1
- import { type InquirerReadline } from '@inquirer/type';
2
- import { type KeypressEvent } from './key.ts';
3
- export declare function useKeypress(userHandler: (event: KeypressEvent, rl: InquirerReadline) => void | Promise<void>): void;
@@ -1 +0,0 @@
1
- export declare function useMemo<Value>(fn: () => Value, dependencies: ReadonlyArray<unknown>): Value;
@@ -1,5 +0,0 @@
1
- import type { Theme, Status } from './theme.ts';
2
- export declare function usePrefix({ status, theme, }: {
3
- status?: Status;
4
- theme?: Theme;
5
- }): string;
@@ -1,6 +0,0 @@
1
- export declare function useRef<Value>(val: Value): {
2
- current: Value;
3
- };
4
- export declare function useRef<Value>(val?: Value): {
5
- current: Value | undefined;
6
- };
@@ -1,4 +0,0 @@
1
- type NotFunction<T> = T extends (...args: never) => unknown ? never : T;
2
- export declare function useState<Value>(defaultValue: NotFunction<Value> | (() => Value)): [Value, (newValue: Value) => void];
3
- export declare function useState<Value>(defaultValue?: NotFunction<Value> | (() => Value)): [Value | undefined, (newValue?: Value) => void];
4
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
- * Force line returns at specific width. This function is ANSI code friendly and it'll
3
- * ignore invisible codes during width calculation.
4
- * @param {string} content
5
- * @param {number} width
6
- * @return {string}
7
- */
8
- export declare function breakLines(content: string, width: number): string;
9
- /**
10
- * Returns the width of the active readline, or 80 as default value.
11
- * @returns {number}
12
- */
13
- export declare function readlineWidth(): number;
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes