@reliverse/relinka 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-npm/components/checkbox/index.js +8 -6
- package/dist-npm/components/confirm/index.js +7 -4
- package/dist-npm/components/core/Separator.d.ts +0 -4
- package/dist-npm/components/core/create-prompt.js +1 -1
- package/dist-npm/components/core/key.js +6 -6
- package/dist-npm/components/core/lines.d.ts +5 -17
- package/dist-npm/components/core/lines.js +6 -2
- package/dist-npm/components/core/make-theme.js +3 -1
- package/dist-npm/components/core/position.d.ts +0 -8
- package/dist-npm/components/core/position.js +9 -3
- package/dist-npm/components/core/promise-polyfill.js +2 -2
- package/dist-npm/components/core/screen-manager.js +2 -1
- package/dist-npm/components/core/theme.d.ts +12 -146
- package/dist-npm/components/core/theme.js +1 -1
- package/dist-npm/components/core/use-keypress.js +3 -1
- package/dist-npm/components/core/use-pagination.d.ts +4 -8
- package/dist-npm/components/core/use-prefix.js +1 -1
- package/dist-npm/components/core/useKeyPress.js +3 -1
- package/dist-npm/components/core/utils.d.ts +0 -11
- package/dist-npm/components/date/date.js +1 -1
- package/dist-npm/components/expand/index.js +4 -2
- package/dist-npm/components/figures/index.js +5 -5
- package/dist-npm/components/instance/basic.d.ts +0 -12
- package/dist-npm/components/instance/basic.js +1 -1
- package/dist-npm/components/instance/browser.d.ts +0 -14
- package/dist-npm/components/instance/reporter/browser.js +5 -5
- package/dist-npm/components/instance/reporter/fancy.d.ts +1 -1
- package/dist-npm/components/instance/reporter/fancy.js +1 -1
- package/dist-npm/components/mono/mono.js +9 -9
- package/dist-npm/components/mono/monoTwo.d.ts +13 -76
- package/dist-npm/components/password/password-main.js +1 -1
- package/dist-npm/components/progressbar/ProgressBar.d.ts +3 -14
- package/dist-npm/components/progressbar/ProgressBar.js +3 -14
- package/dist-npm/components/progressbar/helper.d.ts +2 -18
- package/dist-npm/components/prompts/create.d.ts +0 -13
- package/dist-npm/components/prompts/prompt.js +3 -3
- package/dist-npm/components/prompts/promptTwo.d.ts +34 -252
- package/dist-npm/components/prompts/promptTwo.js +6 -27
- package/dist-npm/components/prompts/relinka.d.ts +17 -114
- package/dist-npm/components/prompts/relinka.js +18 -103
- package/dist-npm/components/range/range.d.ts +12 -64
- package/dist-npm/components/range/range.js +36 -59
- package/dist-npm/components/rawlist/index.js +6 -4
- package/dist-npm/components/search/index.js +7 -5
- package/dist-npm/components/select/index.js +9 -3
- package/dist-npm/components/select/select-main.js +3 -1
- package/dist-npm/components/select/select-two.js +3 -1
- package/dist-npm/components/toggle/index.js +3 -1
- package/dist-npm/testing/index.js +1 -1
- package/dist-npm/types/general.d.ts +30 -141
- package/dist-npm/types/keypress.d.ts +0 -3
- package/dist-npm/types/keypress.js +1 -1
- package/dist-npm/types/readline.d.ts +1 -9
- package/dist-npm/types/relinka.d.ts +1 -9
- package/dist-npm/types/utils.d.ts +0 -12
- package/dist-npm/utils/box.d.ts +14 -104
- package/dist-npm/utils/color.d.ts +0 -20
- package/dist-npm/utils/colorize.js +2 -1
- package/dist-npm/utils/component.d.ts +5 -26
- package/dist-npm/utils/component.js +1 -2
- package/dist-npm/utils/constants.d.ts +0 -21
- package/dist-npm/utils/constants.js +8 -8
- package/dist-npm/utils/decoder.d.ts +2 -17
- package/dist-npm/utils/decoder.js +54 -25
- package/dist-npm/utils/error.d.ts +0 -5
- package/dist-npm/utils/errors.d.ts +1 -1
- package/dist-npm/utils/errors.js +8 -4
- package/dist-npm/utils/format.d.ts +0 -12
- package/dist-npm/utils/keypress.d.ts +0 -6
- package/dist-npm/utils/keypress.js +12 -23
- package/dist-npm/utils/log.d.ts +0 -11
- package/dist-npm/utils/prompt-tmp.js +2 -2
- package/dist-npm/utils/prompt-two.js +2 -2
- package/dist-npm/utils/skeleton.d.ts +0 -3
- package/dist-npm/utils/skeleton.js +66 -22
- package/dist-npm/utils/stream.d.ts +0 -13
- package/dist-npm/utils/string.d.ts +0 -45
- package/dist-npm/utils/tree.d.ts +5 -34
- package/dist-npm/utils/variants.js +9 -9
- package/package.json +9 -5
package/dist-npm/utils/tree.d.ts
CHANGED
|
@@ -1,41 +1,12 @@
|
|
|
1
1
|
import { type ColorName } from "./color.js";
|
|
2
2
|
export type TreeItemObject = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
text: string;
|
|
7
|
-
/**
|
|
8
|
-
* Children of the item
|
|
9
|
-
*/
|
|
10
|
-
children?: TreeItem[];
|
|
11
|
-
/**
|
|
12
|
-
* Color of the item
|
|
13
|
-
*/
|
|
14
|
-
color?: ColorName;
|
|
3
|
+
text: string;
|
|
4
|
+
children?: TreeItem[];
|
|
5
|
+
color?: ColorName;
|
|
15
6
|
};
|
|
16
7
|
export type TreeItem = string | TreeItemObject;
|
|
17
8
|
export type TreeOptions = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
color?: ColorName;
|
|
22
|
-
/**
|
|
23
|
-
* Prefix of the tree
|
|
24
|
-
*
|
|
25
|
-
* @default " "
|
|
26
|
-
*/
|
|
27
|
-
prefix?: string;
|
|
9
|
+
color?: ColorName;
|
|
10
|
+
prefix?: string;
|
|
28
11
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Formats a hierarchical list of items into a string representing a tree structure.
|
|
31
|
-
* Each item in the tree can be a simple string or an object defining the text of the item,
|
|
32
|
-
* optional children, and color. The tree structure can be customized with options
|
|
33
|
-
* Specify the overall color and the prefix used for indentation and tree lines.
|
|
34
|
-
*
|
|
35
|
-
* @param {TreeItem[]} items - An array of items to include in the tree. Each item can be
|
|
36
|
-
* either a string or an object with `text', `children' and `color' properties.
|
|
37
|
-
* @param {TreeOptions} [options] - Optional settings to customize the appearance of the tree, including
|
|
38
|
-
* the color of the tree text and the prefix for branches. See {@link TreeOptions}.
|
|
39
|
-
* @returns {string} The formatted tree as a string, ready for printing to the console or elsewhere.
|
|
40
|
-
*/
|
|
41
12
|
export declare function formatTree(items: TreeItem[], options?: TreeOptions): string;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { colorMap } from "./mapping.js";
|
|
2
2
|
export const variantMap = {
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
doubleBox: createDoubleBox
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
7
|
};
|
|
8
8
|
export async function applyVariant(lines, variant, options, borderColor) {
|
|
9
9
|
const linesArray = Array.isArray(lines) ? lines : [lines];
|
|
10
10
|
switch (variant) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
13
|
case "doubleBox":
|
|
14
14
|
return createDoubleBox(linesArray, options?.limit, borderColor);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
19
|
default:
|
|
20
20
|
return linesArray.join("\n");
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reliverse/relinka",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "@reliverse/relinka is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"appts": "bun typecheck && bun lint && bun format",
|
|
7
|
+
"appts": "bun typecheck && bun lint && bun format && bun optimize",
|
|
8
8
|
"build": "unbuild && bun build.optim.ts",
|
|
9
9
|
"unpub": "npm unpublish",
|
|
10
10
|
"bunp": "bun publish",
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"tsc": "tshy",
|
|
21
21
|
"knip": "knip",
|
|
22
22
|
"start": "node dist-npm/mod.js",
|
|
23
|
-
"dev": "bun examples/
|
|
24
|
-
"
|
|
23
|
+
"dev": "bun examples/main.ts",
|
|
24
|
+
"dex": "tsx examples/main.ts",
|
|
25
25
|
"test:tape": "tape test/*.js | tap-spec",
|
|
26
|
-
"release": "bumpp & bun pub"
|
|
26
|
+
"release": "bumpp & bun pub",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
27
28
|
},
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|
|
@@ -98,17 +99,20 @@
|
|
|
98
99
|
"@types/node": "^22.9.3",
|
|
99
100
|
"@types/sentencer": "^0.2.3",
|
|
100
101
|
"@types/signal-exit": "^3.0.4",
|
|
102
|
+
"@types/strip-comments": "^2.0.4",
|
|
101
103
|
"@types/tape": "^5.6.4",
|
|
102
104
|
"@types/window-size": "^1.1.4",
|
|
103
105
|
"bumpp": "^9.8.1",
|
|
104
106
|
"eslint": "^9.15.0",
|
|
105
107
|
"eslint-plugin-perfectionist": "^4.0.3",
|
|
108
|
+
"jiti": "^2.4.0",
|
|
106
109
|
"knip": "^5.37.2",
|
|
107
110
|
"mock-stdin": "^1.0.0",
|
|
108
111
|
"printj": "^1.3.1",
|
|
109
112
|
"putout": "^36.13.1",
|
|
110
113
|
"redrun": "^11.0.5",
|
|
111
114
|
"sentencer": "^0.2.1",
|
|
115
|
+
"strip-comments": "^2.0.1",
|
|
112
116
|
"tap-spec": "^5.0.0",
|
|
113
117
|
"tape": "^5.9.0",
|
|
114
118
|
"tshy": "^3.0.2",
|