Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

358
Frontend-Learner/node_modules/@clack/core/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,358 @@
# @clack/core
## 1.0.0-alpha.7
### Patch Changes
- 0718b07: fix: export `*Options` types for prompts.
- 4ba2d78: Support short terminal windows when re-rendering by accounting for off-screen lines
- acc4c3a: Add a new `withGuide` option to all prompts to disable the default clack border
## 1.0.0-alpha.6
### Patch Changes
- b103ad3: Allow disabled options in multi-select and select prompts.
## 1.0.0-alpha.5
### Minor Changes
- 55645c2: Support wrapping autocomplete and select prompts.
### Patch Changes
- 71b5029: Add missing nullish checks around values.
- 2310b43: Allow custom writables as output stream.
## 1.0.0-alpha.4
### Patch Changes
- d98e033: add invert selection for multiselect prompt
## 1.0.0-alpha.3
### Minor Changes
- 1604f97: Add `clearOnError` option to password prompt to automatically clear input when validation fails
### Patch Changes
- 1a45f93: Switched from wrap-ansi to fast-wrap-ansi
## 1.0.0-alpha.2
### Patch Changes
- 7df841d: Removed all trailing space in prompt output and fixed various padding rendering bugs.
## 1.0.0-alpha.1
### Minor Changes
- 7bc3301: Prompts now have a `userInput` stored separately from their `value`.
- 2837845: Adds suggestion and path prompts
- df4eea1: Remove `suggestion` prompt and change `path` prompt to be an autocomplete prompt.
### Patch Changes
- bfe0dd3: Prevents placeholder from being used as input value in text prompts
- 34f52fe: Validates initial values immediately when using text prompts with initialValue and validate props.
- 94fee2a: Changes `placeholder` to be a visual hint rather than a tabbable value.
- 4f6b3c2: Set initial values of auto complete prompt to first option when multiple is false.
- 8ead5d3: Avoid passing initial values to core when using auto complete prompt
## 1.0.0-alpha.0
### Major Changes
- c713fd5: The package is now distributed as ESM-only. In `v0` releases, the package was dual-published as CJS and ESM.
For existing CJS projects using Node v20+, please see Node's guide on [Loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v20.x/api/modules.html#loading-ecmascript-modules-using-require).
### Minor Changes
- 729bbb6: Add support for customizable spinner cancel and error messages. Users can now customize these messages either per spinner instance or globally via the `updateSettings` function to support multilingual CLIs.
This update also improves the architecture by exposing the core settings to the prompts package, enabling more consistent default message handling across the codebase.
```ts
// Per-instance customization
const spinner = prompts.spinner({
cancelMessage: "Operación cancelada", // "Operation cancelled" in Spanish
errorMessage: "Se produjo un error", // "An error occurred" in Spanish
});
// Global customization via updateSettings
prompts.updateSettings({
messages: {
cancel: "Operación cancelada", // "Operation cancelled" in Spanish
error: "Se produjo un error", // "An error occurred" in Spanish
},
});
// Settings can now be accessed directly
console.log(prompts.settings.messages.cancel); // "Operación cancelada"
// Direct options take priority over global settings
const spinner = prompts.spinner({
cancelMessage: "Cancelled", // This will be used instead of the global setting
});
```
- f2c2b89: Adds `AutocompletePrompt` to core with comprehensive tests and implement both `autocomplete` and `autocomplete-multiselect` components in prompts package.
### Patch Changes
- 6868c1c: 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.
- a4f5034: 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.
- a36292b: 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
Frontend-Learner/node_modules/@clack/core/LICENSE generated vendored Normal file
View 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
Frontend-Learner/node_modules/@clack/core/README.md generated vendored Normal file
View 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);
}
```

View file

@ -0,0 +1,278 @@
import { Key } from 'node:readline';
import { Readable, Writable } from 'node:stream';
declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
type Action = (typeof actions)[number];
/** Global settings for Clack programs, stored in memory */
interface InternalClackSettings {
actions: Set<Action>;
aliases: Map<string, Action>;
messages: {
cancel: string;
error: string;
};
withGuide: boolean;
}
declare const settings: InternalClackSettings;
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>;
/**
* Custom messages for prompts
*/
messages?: {
/**
* Custom message to display when a spinner is cancelled
* @default "Canceled"
*/
cancel?: string;
/**
* Custom message to display when a spinner encounters an error
* @default "Something went wrong"
*/
error?: string;
};
withGuide?: boolean;
}
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<TValue> {
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 | undefined, info: Key) => void;
value: (value?: TValue) => void;
userInput: (value: string) => void;
confirm: (value?: boolean) => void;
finalize: () => void;
beforePrompt: () => void;
}
interface PromptOptions<TValue, Self extends Prompt<TValue>> {
render(this: Omit<Self, 'prompt'>): string | undefined;
initialValue?: any;
initialUserInput?: string;
validate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;
input?: Readable;
output?: Writable;
debug?: boolean;
signal?: AbortSignal;
}
declare class Prompt<TValue> {
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: TValue | undefined;
userInput: string;
constructor(options: PromptOptions<TValue, Prompt<TValue>>, 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<TValue>>(event: T, cb: ClackEvents<TValue>[T]): void;
/**
* Subscribe to an event once
* @param event - The event name
* @param cb - The callback
*/
once<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[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<TValue>>(event: T, ...data: Parameters<ClackEvents<TValue>[T]>): void;
prompt(): Promise<symbol | TValue | undefined>;
protected _isActionKey(char: string | undefined, _key: Key): boolean;
protected _setValue(value: TValue | undefined): void;
protected _setUserInput(value: string | undefined, write?: boolean): void;
protected _clearUserInput(): void;
private onKeypress;
protected close(): void;
private restoreCursor;
private render;
}
interface OptionLike$1 {
value: unknown;
label?: string;
}
type FilterFunction<T extends OptionLike$1> = (search: string, opt: T) => boolean;
interface AutocompleteOptions<T extends OptionLike$1> extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {
options: T[] | ((this: AutocompletePrompt<T>) => T[]);
filter?: FilterFunction<T>;
multiple?: boolean;
}
declare class AutocompletePrompt<T extends OptionLike$1> extends Prompt<T['value'] | T['value'][]> {
#private;
filteredOptions: T[];
multiple: boolean;
isNavigating: boolean;
selectedValues: Array<T['value']>;
focusedValue: T['value'] | undefined;
get cursor(): number;
get userInputWithCursor(): string;
get options(): T[];
constructor(opts: AutocompleteOptions<T>);
protected _isActionKey(char: string | undefined, key: Key): boolean;
deselectAll(): void;
toggleSelected(value: T['value']): void;
}
interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {
active: string;
inactive: string;
initialValue?: boolean;
}
declare class ConfirmPrompt extends Prompt<boolean> {
get cursor(): 0 | 1;
private get _value();
constructor(opts: ConfirmOptions);
}
interface GroupMultiSelectOptions<T extends {
value: any;
}> extends PromptOptions<T['value'][], 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<T['value'][]> {
#private;
options: (T & {
group: string | boolean;
})[];
cursor: number;
getGroupItems(group: string): T[];
isGroupSelected(group: string): boolean;
private toggleValue;
constructor(opts: GroupMultiSelectOptions<T>);
}
interface OptionLike {
value: any;
disabled?: boolean;
}
interface MultiSelectOptions<T extends OptionLike> extends PromptOptions<T['value'][], MultiSelectPrompt<T>> {
options: T[];
initialValues?: T['value'][];
required?: boolean;
cursorAt?: T['value'];
}
declare class MultiSelectPrompt<T extends OptionLike> extends Prompt<T['value'][]> {
options: T[];
cursor: number;
private get _value();
private get _enabledOptions();
private toggleAll;
private toggleInvert;
private toggleValue;
constructor(opts: MultiSelectOptions<T>);
}
interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {
mask?: string;
}
declare class PasswordPrompt extends Prompt<string> {
private _mask;
get cursor(): number;
get masked(): string;
get userInputWithCursor(): string;
clear(): void;
constructor({ mask, ...opts }: PasswordOptions);
}
interface SelectOptions<T extends {
value: any;
disabled?: boolean;
}> extends PromptOptions<T['value'], SelectPrompt<T>> {
options: T[];
initialValue?: T['value'];
}
declare class SelectPrompt<T extends {
value: any;
disabled?: boolean;
}> extends Prompt<T['value']> {
options: T[];
cursor: number;
private get _selectedValue();
private changeValue;
constructor(opts: SelectOptions<T>);
}
interface SelectKeyOptions<T extends {
value: string;
}> extends PromptOptions<T['value'], SelectKeyPrompt<T>> {
options: T[];
}
declare class SelectKeyPrompt<T extends {
value: string;
}> extends Prompt<T['value']> {
options: T[];
cursor: number;
constructor(opts: SelectKeyOptions<T>);
}
interface TextOptions extends PromptOptions<string, TextPrompt> {
placeholder?: string;
defaultValue?: string;
}
declare class TextPrompt extends Prompt<string> {
get userInputWithCursor(): string;
get cursor(): number;
constructor(opts: TextOptions);
}
declare function isCancel(value: unknown): value is symbol;
interface BlockOptions {
input?: Readable;
output?: Writable;
overwrite?: boolean;
hideCursor?: boolean;
}
declare function block({ input, output, overwrite, hideCursor, }?: BlockOptions): () => void;
declare const getColumns: (output: Writable) => number;
declare const getRows: (output: Writable) => number;
declare function wrapTextWithPrefix(output: Writable | undefined, text: string, prefix: string, startPrefix?: string): string;
export { AutocompletePrompt, ConfirmPrompt, GroupMultiSelectPrompt, MultiSelectPrompt, PasswordPrompt, Prompt, SelectKeyPrompt, SelectPrompt, TextPrompt, block, getColumns, getRows, isCancel, settings, updateSettings, wrapTextWithPrefix };
export type { AutocompleteOptions, ClackSettings, ConfirmOptions, GroupMultiSelectOptions, MultiSelectOptions, PasswordOptions, PromptOptions, SelectKeyOptions, SelectOptions, ClackState as State, TextOptions };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

61
Frontend-Learner/node_modules/@clack/core/package.json generated vendored Normal file
View file

@ -0,0 +1,61 @@
{
"name": "@clack/core",
"version": "1.0.0-alpha.7",
"type": "module",
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"types": "./dist/index.d.mts",
"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": "^3.2.4",
"fast-wrap-ansi": "^0.1.3"
},
"scripts": {
"build": "unbuild",
"test": "vitest run"
}
}

View file

@ -0,0 +1,609 @@
# @clack/prompts
## 1.0.0-alpha.8
### Patch Changes
- 43aed55: Change styling of disabled multi-select options to have strikethrough.
- 2feaebb: Fix duplicated logs when scrolling through options with multiline messages by calculating `rowPadding` dynamically based on actual rendered lines instead of using a hardcoded value.
- 42adff8: fix: add missing guide line in autocomplete-multiselect
- 8e2e30a: fix: fix autocomplete bar color when validate
- 9b92161: Show symbol when withGuide is true for log messages
## 1.0.0-alpha.7
### Minor Changes
- 38019c7: Updates the API for stopping spinners and progress bars to be clearer
Previously, both the spinner and progress bar components used a single `stop` method that accepted a code to indicate success, cancellation, or error. This update separates these into distinct methods: `stop()`, `cancel()`, and `error()`:
```diff
const spinner = prompts.spinner();
spinner.start();
// Cancelling a spinner
- spinner.stop(undefined, 1);
+ spinner.cancel();
// Stopping with an error
- spinner.stop(undefined, 2);
+ spinner.error();
```
As before, you can pass a message to each method to customize the output displayed:
```js
spinner.cancel("Operation cancelled by user");
progressBar.error("An error occurred during processing");
```
### Patch Changes
- 4d1d83b: Fixes rendering of multi-line messages and options in select prompt.
- 6176ced: Add withGuide support to note prompt
- 69681ea: Strip destructive ANSI codes from task log messages.
- b0fa7d8: Add support for wrapped messages in multi line prompts
- 7530af0: Fixes wrapping of cancelled and success messages of select prompt
- acc4c3a: Add a new `withGuide` option to all prompts to disable the default clack border
- Updated dependencies [0718b07]
- Updated dependencies [4ba2d78]
- Updated dependencies [acc4c3a]
- @clack/core@1.0.0-alpha.7
## 1.0.0-alpha.6
### Minor Changes
- 8409f2c: feat: add styleFrame option for spinner
### Patch Changes
- aea4573: Clamp scrolling windows to 5 rows.
- b103ad3: Allow disabled options in multi-select and select prompts.
- Updated dependencies [b103ad3]
- @clack/core@1.0.0-alpha.6
## 1.0.0-alpha.5
### Minor Changes
- 55645c2: Support wrapping autocomplete and select prompts.
### Patch Changes
- 9999adf: fix note component overflow bug
- 2839c66: fix(note): hard wrap text to column limit
- 71b5029: Add missing nullish checks around values.
- d25f6d0: fix(note, box): handle CJK correctly
- 0b852e1: Handle `stop` calls on spinners which have not yet been started.
- 09e596c: refactor(progress): remove unnecessary return statement in start function
- 2310b43: Allow custom writables as output stream.
- Updated dependencies [71b5029]
- Updated dependencies [55645c2]
- Updated dependencies [2310b43]
- @clack/core@1.0.0-alpha.5
## 1.0.0-alpha.4
### Patch Changes
- 7b009df: Fix spinner clearing too many lines upwards when non-wrapping.
- ae84dd0: Update key binding text to show tab/space when navigating, and tab otherwise.
- Updated dependencies [d98e033]
- @clack/core@1.0.0-alpha.4
## 1.0.0-alpha.3
### Minor Changes
- 76fd17f: Added new `box` prompt for rendering boxed text, similar a note.
- 1604f97: Add `clearOnError` option to password prompt to automatically clear input when validation fails
### Patch Changes
- 1a45f93: Switched from wrap-ansi to fast-wrap-ansi
- 4c89dd7: chore: use more accurate type to replace any in group select
- Updated dependencies [1a45f93]
- Updated dependencies [1604f97]
- @clack/core@1.0.0-alpha.3
## 1.0.0-alpha.2
### Minor Changes
- f10071e: Using the `group` method, task logs can now have groups which themselves can have scrolling windows of logs.
### Patch Changes
- 282b39e: Wrap spinner output to allow for multi-line/wrapped messages.
- 7df841d: Removed all trailing space in prompt output and fixed various padding rendering bugs.
- 17d3650: Use a default import for picocolors to avoid run time errors in some environments.
- Updated dependencies [7df841d]
- @clack/core@1.0.0-alpha.2
## 1.0.0-alpha.1
### Minor Changes
- 7bc3301: Prompts now have a `userInput` stored separately from their `value`.
- 2837845: Adds suggestion and path prompts
- 9e5bc6c: Add support for signals in prompts, allowing them to be aborted.
- df4eea1: Remove `suggestion` prompt and change `path` prompt to be an autocomplete prompt.
- 9bd8072: Add a `required` option to autocomplete multiselect.
### Patch Changes
- bfe0dd3: Prevents placeholder from being used as input value in text prompts
- 94fee2a: Changes `placeholder` to be a visual hint rather than a tabbable value.
- Updated dependencies [bfe0dd3]
- Updated dependencies [7bc3301]
- Updated dependencies [2837845]
- Updated dependencies [34f52fe]
- Updated dependencies [94fee2a]
- Updated dependencies [4f6b3c2]
- Updated dependencies [df4eea1]
- Updated dependencies [8ead5d3]
- @clack/core@1.0.0-alpha.1
## 1.0.0-alpha.0
### Major Changes
- c713fd5: The package is now distributed as ESM-only. In `v0` releases, the package was dual-published as CJS and ESM.
For existing CJS projects using Node v20+, please see Node's guide on [Loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v20.x/api/modules.html#loading-ecmascript-modules-using-require).
### Minor Changes
- 99c3530: Adds `format` option to the note prompt to allow formatting of individual lines
- 0aaee4c: Added new `taskLog` prompt for log output which is cleared on success
- 729bbb6: Add support for customizable spinner cancel and error messages. Users can now customize these messages either per spinner instance or globally via the `updateSettings` function to support multilingual CLIs.
This update also improves the architecture by exposing the core settings to the prompts package, enabling more consistent default message handling across the codebase.
```ts
// Per-instance customization
const spinner = prompts.spinner({
cancelMessage: "Operación cancelada", // "Operation cancelled" in Spanish
errorMessage: "Se produjo un error", // "An error occurred" in Spanish
});
// Global customization via updateSettings
prompts.updateSettings({
messages: {
cancel: "Operación cancelada", // "Operation cancelled" in Spanish
error: "Se produjo un error", // "An error occurred" in Spanish
},
});
// Settings can now be accessed directly
console.log(prompts.settings.messages.cancel); // "Operación cancelada"
// Direct options take priority over global settings
const spinner = prompts.spinner({
cancelMessage: "Cancelled", // This will be used instead of the global setting
});
```
- 44df9af: Adds a new `groupSpacing` option to grouped multi-select prompts. If set to an integer greater than 0, it will add that number of new lines between each group.
- f2c2b89: Adds `AutocompletePrompt` to core with comprehensive tests and implement both `autocomplete` and `autocomplete-multiselect` components in prompts package.
- c45b9fb: Adds support for detecting spinner cancellation via CTRL+C. This allows for graceful handling of user interruptions during long-running operations.
- 9a09318: Adds new `progress` prompt to display a progess-bar
- 19558b9: Added support for custom frames in spinner prompt
### Patch Changes
- 46dc0a4: Fixes multiselect only shows hints on the first item in the options list. Now correctly shows hints for all selected options with hint property.
- 17342d2: Exposes a new `SpinnerResult` type to describe the return type of `spinner`
- 6868c1c: 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.
- 7a556ad: Updates all prompts to accept a custom `output` and `input` stream
- 7cc8a55: Messages passed to the `stop` method of a spinner no longer have dots stripped.
- 2048eb1: Fix spinner's dots behavior with custom frames
- Updated dependencies [729bbb6]
- Updated dependencies [6868c1c]
- Updated dependencies [a4f5034]
- Updated dependencies [c713fd5]
- Updated dependencies [a36292b]
- Updated dependencies [f2c2b89]
- @clack/core@1.0.0-alpha.0
## 0.10.0
### Minor Changes
- 613179d: Adds a new `indicator` option to `spinner`, which supports the original `"dots"` loading animation or a new `"timer"` loading animation.
```ts
import * as p from "@clack/prompts";
const spin = p.spinner({ indicator: "timer" });
spin.start("Loading");
await sleep(3000);
spin.stop("Loaded");
```
- a38b2bc: Adds `stream` API which provides the same methods as `log`, but for iterable (even async) message streams. This is particularly useful for AI responses which are dynamically generated by LLMs.
```ts
import * as p from "@clack/prompts";
await p.stream.step(
(async function* () {
yield* generateLLMResponse(question);
})()
);
```
## 0.9.1
### Patch Changes
- 8093f3c: Adds `Error` support to the `validate` function
- 98925e3: Exports the `Option` type and improves JSDocannotations
- 1904e57: Replace custom utility for stripping ANSI control sequences with Node's built-in [`stripVTControlCharacters`](https://nodejs.org/docs/latest/api/util.html#utilstripvtcontrolcharactersstr) utility.
- Updated dependencies [8093f3c]
- Updated dependencies [e5ba09a]
- Updated dependencies [8cba8e3]
- @clack/core@0.4.1
## 0.9.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/prompts";
// 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).
One example use case is automatically cancelling a prompt after a timeout.
```ts
const shouldContinue = await confirm({
message: "This message will self destruct in 5 seconds",
signal: AbortSignal.timeout(5000),
});
```
Another use case is racing a long running task with a manual prompt.
```ts
const abortController = new AbortController();
const projectType = await Promise.race([
detectProjectType({
signal: abortController.signal,
}),
select({
message: "Pick a project type.",
options: [
{ value: "ts", label: "TypeScript" },
{ value: "js", label: "JavaScript" },
{ value: "coffee", label: "CoffeeScript", hint: "oh no" },
],
signal: abortController.signal,
}),
]);
abortController.abort();
```
- 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
- f9f139d: Adapts `spinner` output for static CI environments
- Updated dependencies [a83d2f8]
- Updated dependencies [801246b]
- Updated dependencies [a83d2f8]
- Updated dependencies [51e12bc]
- @clack/core@0.4.0
## 0.8.2
### Patch Changes
- Updated dependencies [4845f4f]
- Updated dependencies [d7b2fb9]
- @clack/core@0.3.5
## 0.8.1
### Patch Changes
- 360afeb: feat: adaptative max items
## 0.8.0
### Minor Changes
- 9acccde: Add tasks function for executing tasks in spinners
### Patch Changes
- b5c6b9b: Feat multiselect maxItems option
- 50ed94a: fix: clear `spinner` hooks on `spinner.stop`
- Updated dependencies [a04e418]
- Updated dependencies [4f6fcf5]
- @clack/core@0.3.4
## 0.7.0
### Minor Changes
- b27a701: add maxItems option to select prompt
- 89371be: added a new method called `spinner.message(msg: string)`
### Patch Changes
- 52183c4: Fix `spinner` conflict with terminal on error between `spinner.start()` and `spinner.stop()`
- ab51d29: Fixes cases where the note title length was miscalculated due to ansi characters
- Updated dependencies [cd79076]
- @clack/core@0.3.3
## 0.6.3
### Patch Changes
- c96eda5: Enable hard line-wrapping behavior for long words without spaces
- Updated dependencies [c96eda5]
- @clack/core@0.3.2
## 0.6.2
### Patch Changes
- 58a1df1: Fix line duplication bug by automatically wrapping prompts to `process.stdout.columns`
- Updated dependencies [58a1df1]
- @clack/core@0.3.1
## 0.6.1
### Patch Changes
- ca08fb6: Support complex value types for `select`, `multiselect` and `groupMultiselect`.
## 0.6.0
### Minor Changes
- 8a4a12f: add `groupMultiselect` prompt
- 165a1b3: Add `log` APIs. Supports `log.info`, `log.success`, `log.warn`, and `log.error`. For low-level control, `log.message` is also exposed.
### Patch Changes
- Updated dependencies [8a4a12f]
- Updated dependencies [8a4a12f]
- @clack/core@0.3.0
## 0.5.1
### Patch Changes
- cc11917: Update default `password` mask
- Updated dependencies [ec812b6]
- @clack/core@0.2.1
## 0.5.0
### Minor Changes
- d74dd05: Adds a `selectKey` prompt type
- 54c1bc3: **Breaking Change** `multiselect` has renamed `initialValue` to `initialValues`
### Patch Changes
- Updated dependencies [d74dd05]
- Updated dependencies [54c1bc3]
- @clack/core@0.2.0
## 0.4.5
### Patch Changes
- 1251132: Multiselect: return `Value[]` instead of `Option[]`.
- 8994382: Add a password prompt to `@clack/prompts`
- Updated dependencies [1251132]
- Updated dependencies [8994382]
- @clack/core@0.1.9
## 0.4.4
### Patch Changes
- d96071c: Don't mutate `initialValue` in `multiselect`, fix parameter type for `validate()`.
Credits to @banjo for the bug report and initial PR!
- Updated dependencies [d96071c]
- @clack/core@0.1.8
## 0.4.3
### Patch Changes
- 83d890e: Fix text cancel display bug
## 0.4.2
### Patch Changes
- Update README
## 0.4.1
### Patch Changes
- 7fb5375: Adds a new `defaultValue` option to the text prompt, removes automatic usage of the placeholder value.
- Updated dependencies [7fb5375]
- @clack/core@0.1.6
## 0.4.0
### Minor Changes
- 61b88b6: Add `group` construct to group many prompts together
### Patch Changes
- de1314e: Support `required` option for multi-select
- Updated dependencies [de1314e]
- @clack/core@0.1.5
## 0.3.0
### Minor Changes
- 493c592: Improve types for select/multiselect prompts. Numbers and booleans are now supported as the `value` option.
- 15558e3: Improved Windows/non-unicode support
### Patch Changes
- ca77da1: Fix multiselect initial value logic
- Updated dependencies [ca77da1]
- Updated dependencies [8aed606]
- @clack/core@0.1.4
## 0.2.2
### Patch Changes
- 94b24d9: Fix CJS `ansi-regex` interop
## 0.2.1
### Patch Changes
- a99c458: Support `initialValue` option for text prompt
- Updated dependencies [a99c458]
- @clack/core@0.1.3
## 0.2.0
### Minor Changes
- Improved type safety
- b1341d6: Updated styles, new note component
### Patch Changes
- Updated dependencies [7dcad8f]
- Updated dependencies [2242f13]
- Updated dependencies [b1341d6]
- @clack/core@0.1.2
## 0.1.1
### Patch Changes
- fa09bf5: Use circle for radio, square for checkbox
- Updated dependencies [4be7dbf]
- Updated dependencies [b480679]
- @clack/core@0.1.1
## 0.1.0
### Minor Changes
- 7015ec9: Create new prompt: multi-select
### Patch Changes
- Updated dependencies [7015ec9]
- @clack/core@0.1.0
## 0.0.10
### Patch Changes
- e0b49e5: Update spinner so it actually spins
## 0.0.9
### Patch Changes
- Update README
## 0.0.8
### Patch Changes
- Updated dependencies [9d371c3]
- @clack/core@0.0.12
## 0.0.7
### Patch Changes
- Update README
## 0.0.6
### Patch Changes
- d20ef2a: Update keywords, URLs
- Updated dependencies [441d5b7]
- Updated dependencies [d20ef2a]
- Updated dependencies [fe13c2f]
- @clack/core@0.0.11
## 0.0.5
### Patch Changes
- Update README
## 0.0.4
### Patch Changes
- 80404ab: Update README
## 0.0.3
### Patch Changes
- a0cb382: Add `main` entrypoint
- Updated dependencies [a0cb382]
- @clack/core@0.0.10
## 0.0.2
### Patch Changes
- Updated dependencies
- @clack/core@0.0.9
## 0.0.1
### Patch Changes
- a4b5e13: Initial release
- Updated dependencies [a4b5e13]
- @clack/core@0.0.8

9
Frontend-Learner/node_modules/@clack/prompts/LICENSE generated vendored Normal file
View 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.

270
Frontend-Learner/node_modules/@clack/prompts/README.md generated vendored Normal file
View file

@ -0,0 +1,270 @@
# `@clack/prompts`
Effortlessly build beautiful command-line apps 🪄 [Try the demo](https://stackblitz.com/edit/clack-prompts?file=index.js)
![clack-prompt](https://github.com/bombshell-dev/clack/blob/main/.github/assets/clack-demo.gif)
---
`@clack/prompts` is an opinionated, pre-styled wrapper around [`@clack/core`](https://www.npmjs.com/package/@clack/core).
- 🤏 80% smaller than other options
- 💎 Beautiful, minimal UI
- ✅ Simple API
- 🧱 Comes with `text`, `confirm`, `select`, `multiselect`, and `spinner` components
## Basics
### Setup
The `intro` and `outro` functions will print a message to begin or end a prompt session, respectively.
```js
import { intro, outro } from '@clack/prompts';
intro(`create-my-app`);
// Do stuff
outro(`You're all set!`);
```
### Cancellation
The `isCancel` function is a guard that detects when a user cancels a question with `CTRL + C`. You should handle this situation for each prompt, optionally providing a nice cancellation message with the `cancel` utility.
```js
import { isCancel, cancel, text } from '@clack/prompts';
const value = await text({
message: 'What is the meaning of life?',
});
if (isCancel(value)) {
cancel('Operation cancelled.');
process.exit(0);
}
```
## Components
### Text
The text component accepts a single line of text.
```js
import { text } from '@clack/prompts';
const meaning = await text({
message: 'What is the meaning of life?',
placeholder: 'Not sure',
initialValue: '42',
validate(value) {
if (value.length === 0) return `Value is required!`;
},
});
```
### Confirm
The confirm component accepts a yes or no answer. The result is a boolean value of `true` or `false`.
```js
import { confirm } from '@clack/prompts';
const shouldContinue = await confirm({
message: 'Do you want to continue?',
});
```
### Select
The select component allows a user to choose one value from a list of options. The result is the `value` prop of a given option.
```js
import { select } from '@clack/prompts';
const projectType = await select({
message: 'Pick a project type.',
options: [
{ value: 'ts', label: 'TypeScript' },
{ value: 'js', label: 'JavaScript', disabled: true },
{ value: 'coffee', label: 'CoffeeScript', hint: 'oh no' },
],
});
```
### Multi-Select
The `multiselect` component allows a user to choose many values from a list of options. The result is an array with all selected `value` props.
```js
import { multiselect } from '@clack/prompts';
const additionalTools = await multiselect({
message: 'Select additional tools.',
options: [
{ value: 'eslint', label: 'ESLint', hint: 'recommended' },
{ value: 'prettier', label: 'Prettier', disabled: true },
{ value: 'gh-action', label: 'GitHub Action' },
],
required: false,
});
```
It is also possible to select multiple items arranged into hierarchy by using `groupMultiselect`:
```js
import { groupMultiselect } from '@clack/prompts';
const basket = await groupMultiselect({
message: 'Select your favorite fruits and vegetables:',
options: {
fruits: [
{ value: 'apple', label: 'apple' },
{ value: 'banana', label: 'banana' },
{ value: 'cherry', label: 'cherry' },
],
vegetables: [
{ value: 'carrot', label: 'carrot' },
{ value: 'spinach', label: 'spinach' },
{ value: 'potato', label: 'potato' },
]
}
});
```
### Spinner
The spinner component surfaces a pending action, such as a long-running download or dependency installation.
```js
import { spinner } from '@clack/prompts';
const s = spinner();
s.start('Installing via npm');
// Do installation here
s.stop('Installed via npm');
```
### Progress
The progress component extends the spinner component to add a progress bar to visualize the progression of an action.
```js
import { progress } from '@clack/prompts';
const p = progress({ max: 10 });
p.start('Downloading archive');
// Do download here
p.advance(3, 'Downloading (30%)');
// ...
p.advance(8, 'Downloading (80%)');
// ...
p.stop('Archive downloaded');
```
## Utilities
### Grouping
Grouping prompts together is a great way to keep your code organized. This accepts a JSON object with a name that can be used to reference the group later. The second argument is an optional but has a `onCancel` callback that will be called if the user cancels one of the prompts in the group.
```js
import * as p from '@clack/prompts';
const group = await p.group(
{
name: () => p.text({ message: 'What is your name?' }),
age: () => p.text({ message: 'What is your age?' }),
color: ({ results }) =>
p.multiselect({
message: `What is your favorite color ${results.name}?`,
options: [
{ value: 'red', label: 'Red' },
{ value: 'green', label: 'Green' },
{ value: 'blue', label: 'Blue' },
],
}),
},
{
// On Cancel callback that wraps the group
// So if the user cancels one of the prompts in the group this function will be called
onCancel: ({ results }) => {
p.cancel('Operation cancelled.');
process.exit(0);
},
}
);
console.log(group.name, group.age, group.color);
```
### Tasks
Execute multiple tasks in spinners.
```js
import { tasks } from '@clack/prompts';
await tasks([
{
title: 'Installing via npm',
task: async (message) => {
// Do installation here
return 'Installed via npm';
},
},
]);
```
### Logs
```js
import { log } from '@clack/prompts';
log.info('Info!');
log.success('Success!');
log.step('Step!');
log.warn('Warn!');
log.error('Error!');
log.message('Hello, World', { symbol: color.cyan('~') });
```
### Stream
When interacting with dynamic LLMs or other streaming message providers, use the `stream` APIs to log messages from an iterable, even an async one.
```js
import { stream } from '@clack/prompts';
stream.info((function *() { yield 'Info!'; })());
stream.success((function *() { yield 'Success!'; })());
stream.step((function *() { yield 'Step!'; })());
stream.warn((function *() { yield 'Warn!'; })());
stream.error((function *() { yield 'Error!'; })());
stream.message((function *() { yield 'Hello'; yield ", World" })(), { symbol: color.cyan('~') });
```
![clack-log-prompts](https://github.com/bombshell-dev/clack/blob/main/.github/assets/clack-logs.png)
### Task Log
When executing a sub-process or a similar sub-task, `taskLog` can be used to render the output continuously and clear it at the end if it was successful.
```js
import { taskLog } from '@clack/prompts';
const log = taskLog({
title: 'Running npm install'
});
for await (const line of npmInstall()) {
log.message(line);
}
if (success) {
log.success('Done!');
} else {
log.error('Failed!');
}
```

View file

@ -0,0 +1,366 @@
import { State, AutocompletePrompt } from '@clack/core';
export { ClackSettings, isCancel, settings, updateSettings } from '@clack/core';
import { Readable, Writable } from 'node:stream';
declare const unicode: boolean;
declare const isCI: () => boolean;
declare const isTTY: (output: Writable) => boolean;
declare const unicodeOr: (c: string, fallback: string) => string;
declare const S_STEP_ACTIVE: string;
declare const S_STEP_CANCEL: string;
declare const S_STEP_ERROR: string;
declare const S_STEP_SUBMIT: string;
declare const S_BAR_START: string;
declare const S_BAR: string;
declare const S_BAR_END: string;
declare const S_BAR_START_RIGHT: string;
declare const S_BAR_END_RIGHT: string;
declare const S_RADIO_ACTIVE: string;
declare const S_RADIO_INACTIVE: string;
declare const S_CHECKBOX_ACTIVE: string;
declare const S_CHECKBOX_SELECTED: string;
declare const S_CHECKBOX_INACTIVE: string;
declare const S_PASSWORD_MASK: string;
declare const S_BAR_H: string;
declare const S_CORNER_TOP_RIGHT: string;
declare const S_CONNECT_LEFT: string;
declare const S_CORNER_BOTTOM_RIGHT: string;
declare const S_CORNER_BOTTOM_LEFT: string;
declare const S_CORNER_TOP_LEFT: string;
declare const S_INFO: string;
declare const S_SUCCESS: string;
declare const S_WARN: string;
declare const S_ERROR: string;
declare const symbol: (state: State) => string;
declare const symbolBar: (state: State) => string;
interface CommonOptions {
input?: Readable;
output?: Writable;
signal?: AbortSignal;
withGuide?: boolean;
}
type Primitive = Readonly<string | boolean | number>;
type Option<Value> = Value extends Primitive ? {
/**
* Internal data for this option.
*/
value: Value;
/**
* The optional, user-facing text for this option.
*
* By default, the `value` is converted to a string.
*/
label?: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
/**
* Whether this option is disabled.
* Disabled options are visible but cannot be selected.
*
* By default, options are not disabled.
*/
disabled?: boolean;
} : {
/**
* Internal data for this option.
*/
value: Value;
/**
* Required. The user-facing text for this option.
*/
label: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
/**
* Whether this option is disabled.
* Disabled options are visible but cannot be selected.
*
* By default, options are not disabled.
*/
disabled?: boolean;
};
interface SelectOptions<Value> extends CommonOptions {
message: string;
options: Option<Value>[];
initialValue?: Value;
maxItems?: number;
}
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
interface AutocompleteSharedOptions<Value> extends CommonOptions {
/**
* The message to display to the user.
*/
message: string;
/**
* Available options for the autocomplete prompt.
*/
options: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);
/**
* Maximum number of items to display at once.
*/
maxItems?: number;
/**
* Placeholder text to display when no input is provided.
*/
placeholder?: string;
/**
* Validates the value
*/
validate?: (value: Value | Value[] | undefined) => string | Error | undefined;
}
interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {
/**
* The initial selected value.
*/
initialValue?: Value;
/**
* The initial user input
*/
initialUserInput?: string;
}
declare const autocomplete: <Value>(opts: AutocompleteOptions<Value>) => Promise<Value | symbol>;
interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {
/**
* The initial selected values
*/
initialValues?: Value[];
/**
* If true, at least one option must be selected
*/
required?: boolean;
}
/**
* Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI
*/
declare const autocompleteMultiselect: <Value>(opts: AutocompleteMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
type BoxAlignment = 'left' | 'center' | 'right';
interface BoxOptions extends CommonOptions {
contentAlign?: BoxAlignment;
titleAlign?: BoxAlignment;
width?: number | 'auto';
titlePadding?: number;
contentPadding?: number;
rounded?: boolean;
formatBorder?: (text: string) => string;
}
declare const box: (message?: string, title?: string, opts?: BoxOptions) => void;
interface ConfirmOptions extends CommonOptions {
message: string;
active?: string;
inactive?: string;
initialValue?: boolean;
}
declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
type Prettify<T> = {
[P in keyof T]: T[P];
} & {};
type PromptGroupAwaitedReturn<T> = {
[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
};
interface PromptGroupOptions<T> {
/**
* Control how the group can be canceled
* if one of the prompts is canceled.
*/
onCancel?: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
}) => void;
}
type PromptGroup<T> = {
[P in keyof T]: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
}) => undefined | Promise<T[P] | undefined>;
};
/**
* Define a group of prompts to be displayed
* and return a results of objects within the group
*/
declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
interface GroupMultiSelectOptions<Value> extends CommonOptions {
message: string;
options: Record<string, Option<Value>[]>;
initialValues?: Value[];
required?: boolean;
cursorAt?: Value;
selectableGroups?: boolean;
groupSpacing?: number;
}
declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
interface LimitOptionsParams<TOption> extends CommonOptions {
options: TOption[];
maxItems: number | undefined;
cursor: number;
style: (option: TOption, active: boolean) => string;
columnPadding?: number;
rowPadding?: number;
}
declare const limitOptions: <TOption>(params: LimitOptionsParams<TOption>) => string[];
interface LogMessageOptions extends CommonOptions {
symbol?: string;
spacing?: number;
secondarySymbol?: string;
}
declare const log: {
message: (message?: string | string[], { symbol, secondarySymbol, output, spacing, withGuide, }?: LogMessageOptions) => void;
info: (message: string, opts?: LogMessageOptions) => void;
success: (message: string, opts?: LogMessageOptions) => void;
step: (message: string, opts?: LogMessageOptions) => void;
warn: (message: string, opts?: LogMessageOptions) => void;
/** alias for `log.warn()`. */
warning: (message: string, opts?: LogMessageOptions) => void;
error: (message: string, opts?: LogMessageOptions) => void;
};
declare const cancel: (message?: string, opts?: CommonOptions) => void;
declare const intro: (title?: string, opts?: CommonOptions) => void;
declare const outro: (message?: string, opts?: CommonOptions) => void;
interface MultiSelectOptions<Value> extends CommonOptions {
message: string;
options: Option<Value>[];
initialValues?: Value[];
maxItems?: number;
required?: boolean;
cursorAt?: Value;
}
declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
type FormatFn = (line: string) => string;
interface NoteOptions extends CommonOptions {
format?: FormatFn;
}
declare const note: (message?: string, title?: string, opts?: NoteOptions) => void;
interface PasswordOptions extends CommonOptions {
message: string;
mask?: string;
validate?: (value: string | undefined) => string | Error | undefined;
clearOnError?: boolean;
}
declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
interface PathOptions extends CommonOptions {
root?: string;
directory?: boolean;
initialValue?: string;
message: string;
validate?: (value: string | undefined) => string | Error | undefined;
}
declare const path: (opts: PathOptions) => Promise<string | symbol>;
interface SpinnerOptions extends CommonOptions {
indicator?: 'dots' | 'timer';
onCancel?: () => void;
cancelMessage?: string;
errorMessage?: string;
frames?: string[];
delay?: number;
styleFrame?: (frame: string) => string;
}
interface SpinnerResult {
start(msg?: string): void;
stop(msg?: string): void;
cancel(msg?: string): void;
error(msg?: string): void;
message(msg?: string): void;
readonly isCancelled: boolean;
}
declare const spinner: ({ indicator, onCancel, output, cancelMessage, errorMessage, frames, delay, signal, ...opts }?: SpinnerOptions) => SpinnerResult;
interface ProgressOptions extends SpinnerOptions {
style?: 'light' | 'heavy' | 'block';
max?: number;
size?: number;
}
interface ProgressResult extends SpinnerResult {
advance(step?: number, msg?: string): void;
}
declare function progress({ style, max: userMax, size: userSize, ...spinnerOptions }?: ProgressOptions): ProgressResult;
declare const selectKey: <Value extends string>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
declare const stream: {
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
/** alias for `log.warn()`. */
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
};
type Task = {
/**
* Task title
*/
title: string;
/**
* Task function
*/
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
/**
* If enabled === false the task will be skipped
*/
enabled?: boolean;
};
/**
* Define a group of tasks to be executed
*/
declare const tasks: (tasks: Task[], opts?: CommonOptions) => Promise<void>;
interface TaskLogOptions extends CommonOptions {
title: string;
limit?: number;
spacing?: number;
retainLog?: boolean;
}
interface TaskLogMessageOptions {
raw?: boolean;
}
interface TaskLogCompletionOptions {
showLog?: boolean;
}
/**
* Renders a log which clears on success and remains on failure
*/
declare const taskLog: (opts: TaskLogOptions) => {
message(msg: string, mopts?: TaskLogMessageOptions): void;
group(name: string): {
message(msg: string, mopts?: TaskLogMessageOptions): void;
error(message: string): void;
success(message: string): void;
};
error(message: string, opts?: TaskLogCompletionOptions): void;
success(message: string, opts?: TaskLogCompletionOptions): void;
};
interface TextOptions extends CommonOptions {
message: string;
placeholder?: string;
defaultValue?: string;
initialValue?: string;
validate?: (value: string | undefined) => string | Error | undefined;
}
declare const text: (opts: TextOptions) => Promise<string | symbol>;
export { S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, autocomplete, autocompleteMultiselect, box, cancel, confirm, group, groupMultiselect, intro, isCI, isTTY, limitOptions, log, multiselect, note, outro, password, path, progress, select, selectKey, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr };
export type { AutocompleteMultiSelectOptions, AutocompleteOptions, BoxAlignment, BoxOptions, CommonOptions, ConfirmOptions, GroupMultiSelectOptions, LimitOptionsParams, LogMessageOptions, MultiSelectOptions, NoteOptions, Option, PasswordOptions, PathOptions, ProgressOptions, ProgressResult, PromptGroup, PromptGroupAwaitedReturn, PromptGroupOptions, SelectOptions, SpinnerOptions, SpinnerResult, Task, TaskLogCompletionOptions, TaskLogMessageOptions, TaskLogOptions, TextOptions };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,66 @@
{
"name": "@clack/prompts",
"version": "1.0.0-alpha.8",
"type": "module",
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"types": "./dist/index.d.mts",
"repository": {
"type": "git",
"url": "git+https://github.com/bombshell-dev/clack.git",
"directory": "packages/prompts"
},
"bugs": {
"url": "https://github.com/bombshell-dev/clack/issues"
},
"homepage": "https://github.com/bombshell-dev/clack/tree/main/packages/prompts#readme",
"files": [
"dist",
"CHANGELOG.md"
],
"author": {
"name": "Nate Moore",
"email": "nate@natemoo.re",
"url": "https://twitter.com/n_moore"
},
"license": "MIT",
"keywords": [
"ask",
"clack",
"cli",
"command-line",
"command",
"input",
"interact",
"interface",
"menu",
"prompt",
"prompts",
"stdin",
"ui"
],
"dependencies": {
"picocolors": "^1.0.0",
"sisteransi": "^1.0.5",
"@clack/core": "1.0.0-alpha.7"
},
"devDependencies": {
"fast-string-width": "^1.1.0",
"fast-wrap-ansi": "^0.1.3",
"is-unicode-supported": "^1.3.0",
"memfs": "^4.17.2",
"vitest": "^3.2.4",
"vitest-ansi-serializer": "^0.1.2"
},
"scripts": {
"build": "unbuild",
"test": "vitest run"
}
}