first commit
This commit is contained in:
263
node_modules/@clack/core/CHANGELOG.md
generated
vendored
Normal file
263
node_modules/@clack/core/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
# @clack/core
|
||||
|
||||
## 0.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 07ca32d: Reverted a change where placeholders were being set as values on return.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 30aa7ed: Adds a new `selectableGroups` boolean to the group multi-select prompt. Using `selectableGroups: false` will disable the ability to select a top-level group, but still allow every child to be selected individually.
|
||||
- 5dfce8a: Fixes an edge case for placeholder values. Previously, when pressing `enter` on an empty prompt, placeholder values would be ignored. Now, placeholder values are treated as the prompt value.
|
||||
- f574297: Fix "TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)" error happening on Windows for non-tty terminals.
|
||||
|
||||
## 0.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 8093f3c: Adds `Error` support to the `validate` function
|
||||
- e5ba09a: Fixes a cursor display bug in terminals that do not support the "hidden" escape sequence. See [Issue #127](https://github.com/bombshell-dev/clack/issues/127).
|
||||
- 8cba8e3: Fixes a rendering bug with cursor positions for `TextPrompt`
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- a83d2f8: Adds a new `updateSettings()` function to support new global keybindings.
|
||||
|
||||
`updateSettings()` accepts an `aliases` object that maps custom keys to an action (`up | down | left | right | space | enter | cancel`).
|
||||
|
||||
```ts
|
||||
import { updateSettings } from "@clack/core";
|
||||
|
||||
// Support custom keybindings
|
||||
updateSettings({
|
||||
aliases: {
|
||||
w: "up",
|
||||
a: "left",
|
||||
s: "down",
|
||||
d: "right",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> In order to enforce consistent, user-friendly defaults across the ecosystem, `updateSettings` does not support disabling Clack's default keybindings.
|
||||
|
||||
- 801246b: Adds a new `signal` option to support programmatic prompt cancellation with an [abort controller](https://kettanaito.com/blog/dont-sleep-on-abort-controller).
|
||||
|
||||
- a83d2f8: Updates default keybindings to support Vim motion shortcuts and map the `escape` key to cancel (`ctrl+c`).
|
||||
|
||||
| alias | action |
|
||||
| ----- | ------ |
|
||||
| `k` | up |
|
||||
| `l` | right |
|
||||
| `j` | down |
|
||||
| `h` | left |
|
||||
| `esc` | cancel |
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 51e12bc: Improves types for events and interaction states.
|
||||
|
||||
## 0.3.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4845f4f: Fixes a bug which kept the terminal cursor hidden after a prompt is cancelled
|
||||
- d7b2fb9: Adds missing `LICENSE` file. Since the `package.json` file has always included `"license": "MIT"`, please consider this a licensing clarification rather than a licensing change.
|
||||
|
||||
## 0.3.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a04e418: fix(@clack/core): keyboard input not working after await in spinner
|
||||
- 4f6fcf5: feat(@clack/core): allow tab completion for placeholders
|
||||
|
||||
## 0.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- cd79076: fix: restore raw mode on unblock
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c96eda5: Enable hard line-wrapping behavior for long words without spaces
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 58a1df1: Fix line duplication bug by automatically wrapping prompts to `process.stdout.columns`
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 8a4a12f: Add `GroupMultiSelect` prompt
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 8a4a12f: add `groupMultiselect` prompt
|
||||
|
||||
## 0.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ec812b6: fix `readline` hang on Windows
|
||||
|
||||
## 0.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- d74dd05: Adds a `selectKey` prompt type
|
||||
- 54c1bc3: **Breaking Change** `multiselect` has renamed `initialValue` to `initialValues`
|
||||
|
||||
## 0.1.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 1251132: Multiselect: return `Value[]` instead of `Option[]`.
|
||||
- 8994382: Add a password prompt to `@clack/prompts`
|
||||
|
||||
## 0.1.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- d96071c: Don't mutate `initialValue` in `multiselect`, fix parameter type for `validate()`.
|
||||
|
||||
Credits to @banjo for the bug report and initial PR!
|
||||
|
||||
## 0.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 6d9e675: Add support for neovim cursor motion (`hjkl`)
|
||||
|
||||
Thanks [@esau-morais](https://github.com/esau-morais) for the assist!
|
||||
|
||||
## 0.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7fb5375: Adds a new `defaultValue` option to the text prompt, removes automatic usage of the placeholder value.
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- de1314e: Support `required` option for multi-select
|
||||
|
||||
## 0.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ca77da1: Fix multiselect initial value logic
|
||||
- 8aed606: Fix `MaxListenersExceededWarning` by detaching `stdin` listeners on close
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a99c458: Support `initialValue` option for text prompt
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Allow isCancel to type guard any unknown value
|
||||
- 7dcad8f: Allow placeholder to be passed to TextPrompt
|
||||
- 2242f13: Fix multiselect returning undefined
|
||||
- b1341d6: Improved placeholder handling
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4be7dbf: Ensure raw mode is unset on submit
|
||||
- b480679: Preserve value if validation fails
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 7015ec9: Create new prompt: multi-select
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9d371c3: Fix rendering bug when using y/n to confirm
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 441d5b7: fix select return undefined
|
||||
- d20ef2a: Update keywords, URLs
|
||||
- fe13c2f: fix cursor missing after submit
|
||||
|
||||
## 0.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a0cb382: Add `main` entrypoint
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix node@16 issue (cannot read "createInterface" of undefined)
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a4b5e13: Bug fixes, exposes `block` utility
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix cursor bug
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix error with character check
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 491f9e0: update readme
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7372d5c: Fix bug with line deletion
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 5605d28: Do not bundle dependencies (take II)
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2ee67cb: don't bundle deps
|
||||
|
||||
## 0.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 306598e: Initial publish, still WIP
|
||||
9
node_modules/@clack/core/LICENSE
generated
vendored
Normal file
9
node_modules/@clack/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Nate Moore
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
22
node_modules/@clack/core/README.md
generated
vendored
Normal file
22
node_modules/@clack/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# `@clack/core`
|
||||
|
||||
Clack contains low-level primitives for implementing your own command-line applications.
|
||||
|
||||
Currently, `TextPrompt`, `SelectPrompt`, and `ConfirmPrompt` are exposed as well as the base `Prompt` class.
|
||||
|
||||
Each `Prompt` accepts a `render` function.
|
||||
|
||||
```js
|
||||
import { TextPrompt, isCancel } from '@clack/core';
|
||||
|
||||
const p = new TextPrompt({
|
||||
render() {
|
||||
return `What's your name?\n${this.valueWithCursor}`;
|
||||
},
|
||||
});
|
||||
|
||||
const name = await p.prompt();
|
||||
if (isCancel(name)) {
|
||||
process.exit(0);
|
||||
}
|
||||
```
|
||||
15
node_modules/@clack/core/dist/index.cjs
generated
vendored
Normal file
15
node_modules/@clack/core/dist/index.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@clack/core/dist/index.cjs.map
generated
vendored
Normal file
1
node_modules/@clack/core/dist/index.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
211
node_modules/@clack/core/dist/index.d.cts
generated
vendored
Normal file
211
node_modules/@clack/core/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
import { Readable, Writable } from 'node:stream';
|
||||
|
||||
declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
|
||||
type Action = (typeof actions)[number];
|
||||
interface ClackSettings {
|
||||
/**
|
||||
* Set custom global aliases for the default actions.
|
||||
* This will not overwrite existing aliases, it will only add new ones!
|
||||
*
|
||||
* @param aliases - An object that maps aliases to actions
|
||||
* @default { k: 'up', j: 'down', h: 'left', l: 'right', '\x03': 'cancel', 'escape': 'cancel' }
|
||||
*/
|
||||
aliases: Record<string, Action>;
|
||||
}
|
||||
declare function updateSettings(updates: ClackSettings): void;
|
||||
|
||||
/**
|
||||
* The state of the prompt
|
||||
*/
|
||||
type ClackState = 'initial' | 'active' | 'cancel' | 'submit' | 'error';
|
||||
/**
|
||||
* Typed event emitter for clack
|
||||
*/
|
||||
interface ClackEvents {
|
||||
initial: (value?: any) => void;
|
||||
active: (value?: any) => void;
|
||||
cancel: (value?: any) => void;
|
||||
submit: (value?: any) => void;
|
||||
error: (value?: any) => void;
|
||||
cursor: (key?: Action) => void;
|
||||
key: (key?: string) => void;
|
||||
value: (value?: string) => void;
|
||||
confirm: (value?: boolean) => void;
|
||||
finalize: () => void;
|
||||
}
|
||||
|
||||
interface PromptOptions<Self extends Prompt> {
|
||||
render(this: Omit<Self, 'prompt'>): string | undefined;
|
||||
placeholder?: string;
|
||||
initialValue?: any;
|
||||
validate?: ((value: any) => string | Error | undefined) | undefined;
|
||||
input?: Readable;
|
||||
output?: Writable;
|
||||
debug?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
declare class Prompt {
|
||||
protected input: Readable;
|
||||
protected output: Writable;
|
||||
private _abortSignal?;
|
||||
private rl;
|
||||
private opts;
|
||||
private _render;
|
||||
private _track;
|
||||
private _prevFrame;
|
||||
private _subscribers;
|
||||
protected _cursor: number;
|
||||
state: ClackState;
|
||||
error: string;
|
||||
value: any;
|
||||
constructor(options: PromptOptions<Prompt>, trackValue?: boolean);
|
||||
/**
|
||||
* Unsubscribe all listeners
|
||||
*/
|
||||
protected unsubscribe(): void;
|
||||
/**
|
||||
* Set a subscriber with opts
|
||||
* @param event - The event name
|
||||
*/
|
||||
private setSubscriber;
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
on<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Subscribe to an event once
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
once<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Emit an event with data
|
||||
* @param event - The event name
|
||||
* @param data - The data to pass to the callback
|
||||
*/
|
||||
emit<T extends keyof ClackEvents>(event: T, ...data: Parameters<ClackEvents[T]>): void;
|
||||
prompt(): Promise<string | symbol>;
|
||||
private onKeypress;
|
||||
protected close(): void;
|
||||
private restoreCursor;
|
||||
private render;
|
||||
}
|
||||
|
||||
interface ConfirmOptions extends PromptOptions<ConfirmPrompt> {
|
||||
active: string;
|
||||
inactive: string;
|
||||
initialValue?: boolean;
|
||||
}
|
||||
declare class ConfirmPrompt extends Prompt {
|
||||
get cursor(): 0 | 1;
|
||||
private get _value();
|
||||
constructor(opts: ConfirmOptions);
|
||||
}
|
||||
|
||||
interface GroupMultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<GroupMultiSelectPrompt<T>> {
|
||||
options: Record<string, T[]>;
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
selectableGroups?: boolean;
|
||||
}
|
||||
declare class GroupMultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
#private;
|
||||
options: (T & {
|
||||
group: string | boolean;
|
||||
})[];
|
||||
cursor: number;
|
||||
getGroupItems(group: string): T[];
|
||||
isGroupSelected(group: string): boolean;
|
||||
private toggleValue;
|
||||
constructor(opts: GroupMultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface MultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<MultiSelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
}
|
||||
declare class MultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private toggleAll;
|
||||
private toggleValue;
|
||||
constructor(opts: MultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface PasswordOptions extends PromptOptions<PasswordPrompt> {
|
||||
mask?: string;
|
||||
}
|
||||
declare class PasswordPrompt extends Prompt {
|
||||
valueWithCursor: string;
|
||||
private _mask;
|
||||
get cursor(): number;
|
||||
get masked(): any;
|
||||
constructor({ mask, ...opts }: PasswordOptions);
|
||||
}
|
||||
|
||||
interface SelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValue?: T['value'];
|
||||
}
|
||||
declare class SelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private changeValue;
|
||||
constructor(opts: SelectOptions<T>);
|
||||
}
|
||||
|
||||
interface SelectKeyOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectKeyPrompt<T>> {
|
||||
options: T[];
|
||||
}
|
||||
declare class SelectKeyPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
constructor(opts: SelectKeyOptions<T>);
|
||||
}
|
||||
|
||||
interface TextOptions extends PromptOptions<TextPrompt> {
|
||||
placeholder?: string;
|
||||
defaultValue?: string;
|
||||
}
|
||||
declare class TextPrompt extends Prompt {
|
||||
get valueWithCursor(): any;
|
||||
get cursor(): number;
|
||||
constructor(opts: TextOptions);
|
||||
}
|
||||
|
||||
declare function isCancel(value: unknown): value is symbol;
|
||||
declare function block({ input, output, overwrite, hideCursor, }?: {
|
||||
input?: (NodeJS.ReadStream & {
|
||||
fd: 0;
|
||||
}) | undefined;
|
||||
output?: (NodeJS.WriteStream & {
|
||||
fd: 1;
|
||||
}) | undefined;
|
||||
overwrite?: boolean | undefined;
|
||||
hideCursor?: boolean | undefined;
|
||||
}): () => void;
|
||||
|
||||
export { type ClackSettings, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, type ClackState as State, TextPrompt, block, isCancel, updateSettings };
|
||||
211
node_modules/@clack/core/dist/index.d.mts
generated
vendored
Normal file
211
node_modules/@clack/core/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
import { Readable, Writable } from 'node:stream';
|
||||
|
||||
declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
|
||||
type Action = (typeof actions)[number];
|
||||
interface ClackSettings {
|
||||
/**
|
||||
* Set custom global aliases for the default actions.
|
||||
* This will not overwrite existing aliases, it will only add new ones!
|
||||
*
|
||||
* @param aliases - An object that maps aliases to actions
|
||||
* @default { k: 'up', j: 'down', h: 'left', l: 'right', '\x03': 'cancel', 'escape': 'cancel' }
|
||||
*/
|
||||
aliases: Record<string, Action>;
|
||||
}
|
||||
declare function updateSettings(updates: ClackSettings): void;
|
||||
|
||||
/**
|
||||
* The state of the prompt
|
||||
*/
|
||||
type ClackState = 'initial' | 'active' | 'cancel' | 'submit' | 'error';
|
||||
/**
|
||||
* Typed event emitter for clack
|
||||
*/
|
||||
interface ClackEvents {
|
||||
initial: (value?: any) => void;
|
||||
active: (value?: any) => void;
|
||||
cancel: (value?: any) => void;
|
||||
submit: (value?: any) => void;
|
||||
error: (value?: any) => void;
|
||||
cursor: (key?: Action) => void;
|
||||
key: (key?: string) => void;
|
||||
value: (value?: string) => void;
|
||||
confirm: (value?: boolean) => void;
|
||||
finalize: () => void;
|
||||
}
|
||||
|
||||
interface PromptOptions<Self extends Prompt> {
|
||||
render(this: Omit<Self, 'prompt'>): string | undefined;
|
||||
placeholder?: string;
|
||||
initialValue?: any;
|
||||
validate?: ((value: any) => string | Error | undefined) | undefined;
|
||||
input?: Readable;
|
||||
output?: Writable;
|
||||
debug?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
declare class Prompt {
|
||||
protected input: Readable;
|
||||
protected output: Writable;
|
||||
private _abortSignal?;
|
||||
private rl;
|
||||
private opts;
|
||||
private _render;
|
||||
private _track;
|
||||
private _prevFrame;
|
||||
private _subscribers;
|
||||
protected _cursor: number;
|
||||
state: ClackState;
|
||||
error: string;
|
||||
value: any;
|
||||
constructor(options: PromptOptions<Prompt>, trackValue?: boolean);
|
||||
/**
|
||||
* Unsubscribe all listeners
|
||||
*/
|
||||
protected unsubscribe(): void;
|
||||
/**
|
||||
* Set a subscriber with opts
|
||||
* @param event - The event name
|
||||
*/
|
||||
private setSubscriber;
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
on<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Subscribe to an event once
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
once<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Emit an event with data
|
||||
* @param event - The event name
|
||||
* @param data - The data to pass to the callback
|
||||
*/
|
||||
emit<T extends keyof ClackEvents>(event: T, ...data: Parameters<ClackEvents[T]>): void;
|
||||
prompt(): Promise<string | symbol>;
|
||||
private onKeypress;
|
||||
protected close(): void;
|
||||
private restoreCursor;
|
||||
private render;
|
||||
}
|
||||
|
||||
interface ConfirmOptions extends PromptOptions<ConfirmPrompt> {
|
||||
active: string;
|
||||
inactive: string;
|
||||
initialValue?: boolean;
|
||||
}
|
||||
declare class ConfirmPrompt extends Prompt {
|
||||
get cursor(): 0 | 1;
|
||||
private get _value();
|
||||
constructor(opts: ConfirmOptions);
|
||||
}
|
||||
|
||||
interface GroupMultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<GroupMultiSelectPrompt<T>> {
|
||||
options: Record<string, T[]>;
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
selectableGroups?: boolean;
|
||||
}
|
||||
declare class GroupMultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
#private;
|
||||
options: (T & {
|
||||
group: string | boolean;
|
||||
})[];
|
||||
cursor: number;
|
||||
getGroupItems(group: string): T[];
|
||||
isGroupSelected(group: string): boolean;
|
||||
private toggleValue;
|
||||
constructor(opts: GroupMultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface MultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<MultiSelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
}
|
||||
declare class MultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private toggleAll;
|
||||
private toggleValue;
|
||||
constructor(opts: MultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface PasswordOptions extends PromptOptions<PasswordPrompt> {
|
||||
mask?: string;
|
||||
}
|
||||
declare class PasswordPrompt extends Prompt {
|
||||
valueWithCursor: string;
|
||||
private _mask;
|
||||
get cursor(): number;
|
||||
get masked(): any;
|
||||
constructor({ mask, ...opts }: PasswordOptions);
|
||||
}
|
||||
|
||||
interface SelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValue?: T['value'];
|
||||
}
|
||||
declare class SelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private changeValue;
|
||||
constructor(opts: SelectOptions<T>);
|
||||
}
|
||||
|
||||
interface SelectKeyOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectKeyPrompt<T>> {
|
||||
options: T[];
|
||||
}
|
||||
declare class SelectKeyPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
constructor(opts: SelectKeyOptions<T>);
|
||||
}
|
||||
|
||||
interface TextOptions extends PromptOptions<TextPrompt> {
|
||||
placeholder?: string;
|
||||
defaultValue?: string;
|
||||
}
|
||||
declare class TextPrompt extends Prompt {
|
||||
get valueWithCursor(): any;
|
||||
get cursor(): number;
|
||||
constructor(opts: TextOptions);
|
||||
}
|
||||
|
||||
declare function isCancel(value: unknown): value is symbol;
|
||||
declare function block({ input, output, overwrite, hideCursor, }?: {
|
||||
input?: (NodeJS.ReadStream & {
|
||||
fd: 0;
|
||||
}) | undefined;
|
||||
output?: (NodeJS.WriteStream & {
|
||||
fd: 1;
|
||||
}) | undefined;
|
||||
overwrite?: boolean | undefined;
|
||||
hideCursor?: boolean | undefined;
|
||||
}): () => void;
|
||||
|
||||
export { type ClackSettings, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, type ClackState as State, TextPrompt, block, isCancel, updateSettings };
|
||||
211
node_modules/@clack/core/dist/index.d.ts
generated
vendored
Normal file
211
node_modules/@clack/core/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
import { Readable, Writable } from 'node:stream';
|
||||
|
||||
declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
|
||||
type Action = (typeof actions)[number];
|
||||
interface ClackSettings {
|
||||
/**
|
||||
* Set custom global aliases for the default actions.
|
||||
* This will not overwrite existing aliases, it will only add new ones!
|
||||
*
|
||||
* @param aliases - An object that maps aliases to actions
|
||||
* @default { k: 'up', j: 'down', h: 'left', l: 'right', '\x03': 'cancel', 'escape': 'cancel' }
|
||||
*/
|
||||
aliases: Record<string, Action>;
|
||||
}
|
||||
declare function updateSettings(updates: ClackSettings): void;
|
||||
|
||||
/**
|
||||
* The state of the prompt
|
||||
*/
|
||||
type ClackState = 'initial' | 'active' | 'cancel' | 'submit' | 'error';
|
||||
/**
|
||||
* Typed event emitter for clack
|
||||
*/
|
||||
interface ClackEvents {
|
||||
initial: (value?: any) => void;
|
||||
active: (value?: any) => void;
|
||||
cancel: (value?: any) => void;
|
||||
submit: (value?: any) => void;
|
||||
error: (value?: any) => void;
|
||||
cursor: (key?: Action) => void;
|
||||
key: (key?: string) => void;
|
||||
value: (value?: string) => void;
|
||||
confirm: (value?: boolean) => void;
|
||||
finalize: () => void;
|
||||
}
|
||||
|
||||
interface PromptOptions<Self extends Prompt> {
|
||||
render(this: Omit<Self, 'prompt'>): string | undefined;
|
||||
placeholder?: string;
|
||||
initialValue?: any;
|
||||
validate?: ((value: any) => string | Error | undefined) | undefined;
|
||||
input?: Readable;
|
||||
output?: Writable;
|
||||
debug?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
declare class Prompt {
|
||||
protected input: Readable;
|
||||
protected output: Writable;
|
||||
private _abortSignal?;
|
||||
private rl;
|
||||
private opts;
|
||||
private _render;
|
||||
private _track;
|
||||
private _prevFrame;
|
||||
private _subscribers;
|
||||
protected _cursor: number;
|
||||
state: ClackState;
|
||||
error: string;
|
||||
value: any;
|
||||
constructor(options: PromptOptions<Prompt>, trackValue?: boolean);
|
||||
/**
|
||||
* Unsubscribe all listeners
|
||||
*/
|
||||
protected unsubscribe(): void;
|
||||
/**
|
||||
* Set a subscriber with opts
|
||||
* @param event - The event name
|
||||
*/
|
||||
private setSubscriber;
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
on<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Subscribe to an event once
|
||||
* @param event - The event name
|
||||
* @param cb - The callback
|
||||
*/
|
||||
once<T extends keyof ClackEvents>(event: T, cb: ClackEvents[T]): void;
|
||||
/**
|
||||
* Emit an event with data
|
||||
* @param event - The event name
|
||||
* @param data - The data to pass to the callback
|
||||
*/
|
||||
emit<T extends keyof ClackEvents>(event: T, ...data: Parameters<ClackEvents[T]>): void;
|
||||
prompt(): Promise<string | symbol>;
|
||||
private onKeypress;
|
||||
protected close(): void;
|
||||
private restoreCursor;
|
||||
private render;
|
||||
}
|
||||
|
||||
interface ConfirmOptions extends PromptOptions<ConfirmPrompt> {
|
||||
active: string;
|
||||
inactive: string;
|
||||
initialValue?: boolean;
|
||||
}
|
||||
declare class ConfirmPrompt extends Prompt {
|
||||
get cursor(): 0 | 1;
|
||||
private get _value();
|
||||
constructor(opts: ConfirmOptions);
|
||||
}
|
||||
|
||||
interface GroupMultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<GroupMultiSelectPrompt<T>> {
|
||||
options: Record<string, T[]>;
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
selectableGroups?: boolean;
|
||||
}
|
||||
declare class GroupMultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
#private;
|
||||
options: (T & {
|
||||
group: string | boolean;
|
||||
})[];
|
||||
cursor: number;
|
||||
getGroupItems(group: string): T[];
|
||||
isGroupSelected(group: string): boolean;
|
||||
private toggleValue;
|
||||
constructor(opts: GroupMultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface MultiSelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<MultiSelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValues?: T['value'][];
|
||||
required?: boolean;
|
||||
cursorAt?: T['value'];
|
||||
}
|
||||
declare class MultiSelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private toggleAll;
|
||||
private toggleValue;
|
||||
constructor(opts: MultiSelectOptions<T>);
|
||||
}
|
||||
|
||||
interface PasswordOptions extends PromptOptions<PasswordPrompt> {
|
||||
mask?: string;
|
||||
}
|
||||
declare class PasswordPrompt extends Prompt {
|
||||
valueWithCursor: string;
|
||||
private _mask;
|
||||
get cursor(): number;
|
||||
get masked(): any;
|
||||
constructor({ mask, ...opts }: PasswordOptions);
|
||||
}
|
||||
|
||||
interface SelectOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectPrompt<T>> {
|
||||
options: T[];
|
||||
initialValue?: T['value'];
|
||||
}
|
||||
declare class SelectPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
private get _value();
|
||||
private changeValue;
|
||||
constructor(opts: SelectOptions<T>);
|
||||
}
|
||||
|
||||
interface SelectKeyOptions<T extends {
|
||||
value: any;
|
||||
}> extends PromptOptions<SelectKeyPrompt<T>> {
|
||||
options: T[];
|
||||
}
|
||||
declare class SelectKeyPrompt<T extends {
|
||||
value: any;
|
||||
}> extends Prompt {
|
||||
options: T[];
|
||||
cursor: number;
|
||||
constructor(opts: SelectKeyOptions<T>);
|
||||
}
|
||||
|
||||
interface TextOptions extends PromptOptions<TextPrompt> {
|
||||
placeholder?: string;
|
||||
defaultValue?: string;
|
||||
}
|
||||
declare class TextPrompt extends Prompt {
|
||||
get valueWithCursor(): any;
|
||||
get cursor(): number;
|
||||
constructor(opts: TextOptions);
|
||||
}
|
||||
|
||||
declare function isCancel(value: unknown): value is symbol;
|
||||
declare function block({ input, output, overwrite, hideCursor, }?: {
|
||||
input?: (NodeJS.ReadStream & {
|
||||
fd: 0;
|
||||
}) | undefined;
|
||||
output?: (NodeJS.WriteStream & {
|
||||
fd: 1;
|
||||
}) | undefined;
|
||||
overwrite?: boolean | undefined;
|
||||
hideCursor?: boolean | undefined;
|
||||
}): () => void;
|
||||
|
||||
export { type ClackSettings, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, type ClackState as State, TextPrompt, block, isCancel, updateSettings };
|
||||
15
node_modules/@clack/core/dist/index.mjs
generated
vendored
Normal file
15
node_modules/@clack/core/dist/index.mjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@clack/core/dist/index.mjs.map
generated
vendored
Normal file
1
node_modules/@clack/core/dist/index.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
62
node_modules/@clack/core/package.json
generated
vendored
Normal file
62
node_modules/@clack/core/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "@clack/core",
|
||||
"version": "0.5.0",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bombshell-dev/clack.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/bombshell-dev/clack/issues"
|
||||
},
|
||||
"homepage": "https://github.com/bombshell-dev/clack/tree/main/packages/core#readme",
|
||||
"files": [
|
||||
"dist",
|
||||
"CHANGELOG.md"
|
||||
],
|
||||
"keywords": [
|
||||
"ask",
|
||||
"clack",
|
||||
"cli",
|
||||
"command-line",
|
||||
"command",
|
||||
"input",
|
||||
"interact",
|
||||
"interface",
|
||||
"menu",
|
||||
"prompt",
|
||||
"prompts",
|
||||
"stdin",
|
||||
"ui"
|
||||
],
|
||||
"author": {
|
||||
"name": "Nate Moore",
|
||||
"email": "nate@natemoo.re",
|
||||
"url": "https://twitter.com/n_moore"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"picocolors": "^1.0.0",
|
||||
"sisteransi": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "^1.6.0",
|
||||
"wrap-ansi": "^8.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"test": "vitest run"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user