Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

158
node_modules/@inquirer/select/dist/cjs/index.js generated vendored Normal file
View file

@ -0,0 +1,158 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Separator = void 0;
const core_1 = require("@inquirer/core");
const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
const figures_1 = __importDefault(require("@inquirer/figures"));
const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
const selectTheme = {
icon: { cursor: figures_1.default.pointer },
style: {
disabled: (text) => yoctocolors_cjs_1.default.dim(`- ${text}`),
description: (text) => yoctocolors_cjs_1.default.cyan(text),
},
helpMode: 'auto',
};
function isSelectable(item) {
return !core_1.Separator.isSeparator(item) && !item.disabled;
}
function normalizeChoices(choices) {
return choices.map((choice) => {
var _a, _b, _c;
if (core_1.Separator.isSeparator(choice))
return choice;
if (typeof choice === 'string') {
return {
value: choice,
name: choice,
short: choice,
disabled: false,
};
}
const name = (_a = choice.name) !== null && _a !== void 0 ? _a : String(choice.value);
return {
value: choice.value,
name,
description: choice.description,
short: (_b = choice.short) !== null && _b !== void 0 ? _b : name,
disabled: (_c = choice.disabled) !== null && _c !== void 0 ? _c : false,
};
});
}
exports.default = (0, core_1.createPrompt)((config, done) => {
const { loop = true, pageSize = 7 } = config;
const firstRender = (0, core_1.useRef)(true);
const theme = (0, core_1.makeTheme)(selectTheme, config.theme);
const prefix = (0, core_1.usePrefix)({ theme });
const [status, setStatus] = (0, core_1.useState)('pending');
const searchTimeoutRef = (0, core_1.useRef)();
const items = (0, core_1.useMemo)(() => normalizeChoices(config.choices), [config.choices]);
const bounds = (0, core_1.useMemo)(() => {
const first = items.findIndex(isSelectable);
const last = items.findLastIndex(isSelectable);
if (first < 0) {
throw new core_1.ValidationError('[select prompt] No selectable choices. All choices are disabled.');
}
return { first, last };
}, [items]);
const defaultItemIndex = (0, core_1.useMemo)(() => {
if (!('default' in config))
return -1;
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
}, [config.default, items]);
const [active, setActive] = (0, core_1.useState)(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
// Safe to assume the cursor position always point to a Choice.
const selectedChoice = items[active];
(0, core_1.useKeypress)((key, rl) => {
clearTimeout(searchTimeoutRef.current);
if ((0, core_1.isEnterKey)(key)) {
setStatus('done');
done(selectedChoice.value);
}
else if ((0, core_1.isUpKey)(key) || (0, core_1.isDownKey)(key)) {
rl.clearLine(0);
if (loop ||
((0, core_1.isUpKey)(key) && active !== bounds.first) ||
((0, core_1.isDownKey)(key) && active !== bounds.last)) {
const offset = (0, core_1.isUpKey)(key) ? -1 : 1;
let next = active;
do {
next = (next + offset + items.length) % items.length;
} while (!isSelectable(items[next]));
setActive(next);
}
}
else if ((0, core_1.isNumberKey)(key)) {
rl.clearLine(0);
const position = Number(key.name) - 1;
const item = items[position];
if (item != null && isSelectable(item)) {
setActive(position);
}
}
else if ((0, core_1.isBackspaceKey)(key)) {
rl.clearLine(0);
}
else {
// Default to search
const searchTerm = rl.line.toLowerCase();
const matchIndex = items.findIndex((item) => {
if (core_1.Separator.isSeparator(item) || !isSelectable(item))
return false;
return item.name.toLowerCase().startsWith(searchTerm);
});
if (matchIndex >= 0) {
setActive(matchIndex);
}
searchTimeoutRef.current = setTimeout(() => {
rl.clearLine(0);
}, 700);
}
});
(0, core_1.useEffect)(() => () => {
clearTimeout(searchTimeoutRef.current);
}, []);
const message = theme.style.message(config.message);
let helpTipTop = '';
let helpTipBottom = '';
if (theme.helpMode === 'always' ||
(theme.helpMode === 'auto' && firstRender.current)) {
firstRender.current = false;
if (items.length > pageSize) {
helpTipBottom = `\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
}
else {
helpTipTop = theme.style.help('(Use arrow keys)');
}
}
const page = (0, core_1.usePagination)({
items,
active,
renderItem({ item, isActive }) {
if (core_1.Separator.isSeparator(item)) {
return ` ${item.separator}`;
}
if (item.disabled) {
const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';
return theme.style.disabled(`${item.name} ${disabledLabel}`);
}
const color = isActive ? theme.style.highlight : (x) => x;
const cursor = isActive ? theme.icon.cursor : ` `;
return color(`${cursor} ${item.name}`);
},
pageSize,
loop,
});
if (status === 'done') {
return `${prefix} ${message} ${theme.style.answer(selectedChoice.short)}`;
}
const choiceDescription = selectedChoice.description
? `\n${theme.style.description(selectedChoice.description)}`
: ``;
return `${[prefix, message, helpTipTop].filter(Boolean).join(' ')}\n${page}${helpTipBottom}${choiceDescription}${ansi_escapes_1.default.cursorHide}`;
});
var core_2 = require("@inquirer/core");
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return core_2.Separator; } });

View file

@ -0,0 +1,30 @@
import { Separator, type Theme } from '@inquirer/core';
import type { PartialDeep } from '@inquirer/type';
type SelectTheme = {
icon: {
cursor: string;
};
style: {
disabled: (text: string) => string;
description: (text: string) => string;
};
helpMode: 'always' | 'never' | 'auto';
};
type Choice<Value> = {
value: Value;
name?: string;
description?: string;
short?: string;
disabled?: boolean | string;
type?: never;
};
declare const _default: <Value>(config: {
message: string;
choices: readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[];
pageSize?: number | undefined;
loop?: boolean | undefined;
default?: unknown;
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
export default _default;
export { Separator } from '@inquirer/core';

150
node_modules/@inquirer/select/dist/esm/index.mjs generated vendored Normal file
View file

@ -0,0 +1,150 @@
import { createPrompt, useState, useKeypress, usePrefix, usePagination, useRef, useMemo, useEffect, isBackspaceKey, isEnterKey, isUpKey, isDownKey, isNumberKey, Separator, ValidationError, makeTheme, } from '@inquirer/core';
import colors from 'yoctocolors-cjs';
import figures from '@inquirer/figures';
import ansiEscapes from 'ansi-escapes';
const selectTheme = {
icon: { cursor: figures.pointer },
style: {
disabled: (text) => colors.dim(`- ${text}`),
description: (text) => colors.cyan(text),
},
helpMode: 'auto',
};
function isSelectable(item) {
return !Separator.isSeparator(item) && !item.disabled;
}
function normalizeChoices(choices) {
return choices.map((choice) => {
if (Separator.isSeparator(choice))
return choice;
if (typeof choice === 'string') {
return {
value: choice,
name: choice,
short: choice,
disabled: false,
};
}
const name = choice.name ?? String(choice.value);
return {
value: choice.value,
name,
description: choice.description,
short: choice.short ?? name,
disabled: choice.disabled ?? false,
};
});
}
export default createPrompt((config, done) => {
const { loop = true, pageSize = 7 } = config;
const firstRender = useRef(true);
const theme = makeTheme(selectTheme, config.theme);
const prefix = usePrefix({ theme });
const [status, setStatus] = useState('pending');
const searchTimeoutRef = useRef();
const items = useMemo(() => normalizeChoices(config.choices), [config.choices]);
const bounds = useMemo(() => {
const first = items.findIndex(isSelectable);
const last = items.findLastIndex(isSelectable);
if (first < 0) {
throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');
}
return { first, last };
}, [items]);
const defaultItemIndex = useMemo(() => {
if (!('default' in config))
return -1;
return items.findIndex((item) => isSelectable(item) && item.value === config.default);
}, [config.default, items]);
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
// Safe to assume the cursor position always point to a Choice.
const selectedChoice = items[active];
useKeypress((key, rl) => {
clearTimeout(searchTimeoutRef.current);
if (isEnterKey(key)) {
setStatus('done');
done(selectedChoice.value);
}
else if (isUpKey(key) || isDownKey(key)) {
rl.clearLine(0);
if (loop ||
(isUpKey(key) && active !== bounds.first) ||
(isDownKey(key) && active !== bounds.last)) {
const offset = isUpKey(key) ? -1 : 1;
let next = active;
do {
next = (next + offset + items.length) % items.length;
} while (!isSelectable(items[next]));
setActive(next);
}
}
else if (isNumberKey(key)) {
rl.clearLine(0);
const position = Number(key.name) - 1;
const item = items[position];
if (item != null && isSelectable(item)) {
setActive(position);
}
}
else if (isBackspaceKey(key)) {
rl.clearLine(0);
}
else {
// Default to search
const searchTerm = rl.line.toLowerCase();
const matchIndex = items.findIndex((item) => {
if (Separator.isSeparator(item) || !isSelectable(item))
return false;
return item.name.toLowerCase().startsWith(searchTerm);
});
if (matchIndex >= 0) {
setActive(matchIndex);
}
searchTimeoutRef.current = setTimeout(() => {
rl.clearLine(0);
}, 700);
}
});
useEffect(() => () => {
clearTimeout(searchTimeoutRef.current);
}, []);
const message = theme.style.message(config.message);
let helpTipTop = '';
let helpTipBottom = '';
if (theme.helpMode === 'always' ||
(theme.helpMode === 'auto' && firstRender.current)) {
firstRender.current = false;
if (items.length > pageSize) {
helpTipBottom = `\n${theme.style.help('(Use arrow keys to reveal more choices)')}`;
}
else {
helpTipTop = theme.style.help('(Use arrow keys)');
}
}
const page = usePagination({
items,
active,
renderItem({ item, isActive }) {
if (Separator.isSeparator(item)) {
return ` ${item.separator}`;
}
if (item.disabled) {
const disabledLabel = typeof item.disabled === 'string' ? item.disabled : '(disabled)';
return theme.style.disabled(`${item.name} ${disabledLabel}`);
}
const color = isActive ? theme.style.highlight : (x) => x;
const cursor = isActive ? theme.icon.cursor : ` `;
return color(`${cursor} ${item.name}`);
},
pageSize,
loop,
});
if (status === 'done') {
return `${prefix} ${message} ${theme.style.answer(selectedChoice.short)}`;
}
const choiceDescription = selectedChoice.description
? `\n${theme.style.description(selectedChoice.description)}`
: ``;
return `${[prefix, message, helpTipTop].filter(Boolean).join(' ')}\n${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
});
export { Separator } from '@inquirer/core';

View file

@ -0,0 +1,30 @@
import { Separator, type Theme } from '@inquirer/core';
import type { PartialDeep } from '@inquirer/type';
type SelectTheme = {
icon: {
cursor: string;
};
style: {
disabled: (text: string) => string;
description: (text: string) => string;
};
helpMode: 'always' | 'never' | 'auto';
};
type Choice<Value> = {
value: Value;
name?: string;
description?: string;
short?: string;
disabled?: boolean | string;
type?: never;
};
declare const _default: <Value>(config: {
message: string;
choices: readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[];
pageSize?: number | undefined;
loop?: boolean | undefined;
default?: unknown;
theme?: PartialDeep<Theme<SelectTheme>> | undefined;
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
export default _default;
export { Separator } from '@inquirer/core';

28
node_modules/@inquirer/select/dist/types/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,28 @@
import { Separator, type Theme } from '@inquirer/core';
import type { PartialDeep } from '@inquirer/type';
type SelectTheme = {
icon: {
cursor: string;
};
style: {
disabled: (text: string) => string;
};
helpMode: 'always' | 'never' | 'auto';
};
type Choice<Value> = {
value: Value;
name?: string;
description?: string;
disabled?: boolean | string;
type?: never;
};
declare const _default: <Value>(config: {
message: string;
choices: readonly (Separator | Choice<Value>)[];
pageSize?: number;
loop?: boolean;
default?: unknown;
theme?: PartialDeep<Theme<SelectTheme>>;
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
export default _default;
export { Separator } from '@inquirer/core';