@seedcli/ui 0.1.0
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/LICENSE +21 -0
- package/dist/countdown.d.ts +6 -0
- package/dist/countdown.d.ts.map +1 -0
- package/dist/countdown.js +24 -0
- package/dist/countdown.js.map +1 -0
- package/dist/header.d.ts +8 -0
- package/dist/header.d.ts.map +1 -0
- package/dist/header.js +24 -0
- package/dist/header.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/list.d.ts +6 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/list.js +19 -0
- package/dist/list.js.map +1 -0
- package/dist/status.d.ts +6 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +15 -0
- package/dist/status.js.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Seed CLI Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown.d.ts","sourceRoot":"","sources":["../src/countdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBxE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display a countdown timer, updating in-place.
|
|
3
|
+
* Returns a promise that resolves when the countdown reaches zero.
|
|
4
|
+
*/
|
|
5
|
+
export function countdown(seconds, label) {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
let remaining = seconds;
|
|
8
|
+
const render = () => {
|
|
9
|
+
const text = label ? `${label} ${remaining}s` : `${remaining}s`;
|
|
10
|
+
process.stdout.write(`\r${text} `);
|
|
11
|
+
};
|
|
12
|
+
render();
|
|
13
|
+
const interval = setInterval(() => {
|
|
14
|
+
remaining--;
|
|
15
|
+
render();
|
|
16
|
+
if (remaining <= 0) {
|
|
17
|
+
clearInterval(interval);
|
|
18
|
+
process.stdout.write(`\r${" ".repeat((label?.length ?? 0) + 10)}\r`);
|
|
19
|
+
resolve();
|
|
20
|
+
}
|
|
21
|
+
}, 1000);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=countdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countdown.js","sourceRoot":"","sources":["../src/countdown.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,KAAc;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,IAAI,SAAS,GAAG,OAAO,CAAC;QAExB,MAAM,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC;YAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF,MAAM,EAAE,CAAC;QAET,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YACjC,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,CAAC;YAET,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;gBACpB,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;gBACrE,OAAO,EAAE,CAAC;YACX,CAAC;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/header.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HeaderOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render an ASCII art header inside a bordered box.
|
|
4
|
+
*
|
|
5
|
+
* Composes `figlet()` + `box()` from `@seedcli/print`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function header(title: string, options?: HeaderOptions): string;
|
|
8
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../src/header.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAoBrE"}
|
package/dist/header.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ascii, box, colors } from "@seedcli/print";
|
|
2
|
+
/**
|
|
3
|
+
* Render an ASCII art header inside a bordered box.
|
|
4
|
+
*
|
|
5
|
+
* Composes `figlet()` + `box()` from `@seedcli/print`.
|
|
6
|
+
*/
|
|
7
|
+
export function header(title, options) {
|
|
8
|
+
const color = options?.color
|
|
9
|
+
? colors[options.color]
|
|
10
|
+
: undefined;
|
|
11
|
+
let content = ascii(title);
|
|
12
|
+
if (options?.subtitle) {
|
|
13
|
+
content += `\n${options.subtitle}`;
|
|
14
|
+
}
|
|
15
|
+
if (color) {
|
|
16
|
+
content = color(content);
|
|
17
|
+
}
|
|
18
|
+
return box(content, {
|
|
19
|
+
padding: 1,
|
|
20
|
+
borderStyle: "round",
|
|
21
|
+
borderColor: options?.color,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../src/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,OAAuB;IAC5D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK;QAC3B,CAAC,CAAE,MAA2D,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7E,CAAC,CAAC,SAAS,CAAC;IAEb,IAAI,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,OAAO,EAAE,QAAQ,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,EAAE;QACnB,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,OAAO,EAAE,KAAK;KAC3B,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { DividerOptions, KeyValueOptions, KeyValuePair, ProgressBar, ProgressBarOptions, TreeNode, TreeOptions, } from "@seedcli/print";
|
|
2
|
+
export { divider, keyValue, progressBar as progress, tree } from "@seedcli/print";
|
|
3
|
+
export { countdown } from "./countdown.js";
|
|
4
|
+
export { header } from "./header.js";
|
|
5
|
+
export { list } from "./list.js";
|
|
6
|
+
export { status } from "./status.js";
|
|
7
|
+
export type { HeaderOptions, ListOptions, StatusState } from "./types.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACX,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,WAAW,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Higher-level UI components
|
|
2
|
+
// Re-exports from @seedcli/print
|
|
3
|
+
export { divider, keyValue, progressBar as progress, tree } from "@seedcli/print";
|
|
4
|
+
export { countdown } from "./countdown.js";
|
|
5
|
+
export { header } from "./header.js";
|
|
6
|
+
export { list } from "./list.js";
|
|
7
|
+
export { status } from "./status.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAW7B,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/list.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CASnE"}
|
package/dist/list.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const MARKERS = {
|
|
2
|
+
bullet: "•",
|
|
3
|
+
arrow: "→",
|
|
4
|
+
dash: "–",
|
|
5
|
+
number: "",
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Render a formatted list with configurable markers.
|
|
9
|
+
*/
|
|
10
|
+
export function list(items, options) {
|
|
11
|
+
const marker = options?.marker ?? (options?.ordered ? "number" : "bullet");
|
|
12
|
+
return items
|
|
13
|
+
.map((item, i) => {
|
|
14
|
+
const prefix = marker === "number" ? `${i + 1}.` : MARKERS[marker];
|
|
15
|
+
return ` ${prefix} ${item}`;
|
|
16
|
+
})
|
|
17
|
+
.join("\n");
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=list.js.map
|
package/dist/list.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;IACf,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,EAAE;CACD,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,KAAe,EAAE,OAAqB;IAC1D,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAE3E,OAAO,KAAK;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnE,OAAO,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC;IAC9B,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC"}
|
package/dist/status.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS9C;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAGhE"}
|
package/dist/status.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { colors } from "@seedcli/print";
|
|
2
|
+
const STATUS_CONFIG = {
|
|
3
|
+
success: { icon: "✔", color: colors.green },
|
|
4
|
+
fail: { icon: "✖", color: colors.red },
|
|
5
|
+
skip: { icon: "◌", color: colors.gray },
|
|
6
|
+
pending: { icon: "…", color: colors.yellow },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Render a status line with an icon and color based on state.
|
|
10
|
+
*/
|
|
11
|
+
export function status(label, state) {
|
|
12
|
+
const { icon, color } = STATUS_CONFIG[state];
|
|
13
|
+
return color(`${icon} ${label}`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,MAAM,aAAa,GAAwE;IAC1F,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;IAC3C,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,KAAkB;IACvD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,OAAO,KAAK,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface HeaderOptions {
|
|
2
|
+
subtitle?: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ListOptions {
|
|
6
|
+
ordered?: boolean;
|
|
7
|
+
marker?: "bullet" | "arrow" | "dash" | "number";
|
|
8
|
+
}
|
|
9
|
+
export type StatusState = "success" | "fail" | "skip" | "pending";
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CAChD;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seedcli/ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Terminal UI components: header, status indicators, list formatting",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Rully Ardiansyah <rully@dreamshive.io>",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/SeedCLI/seed",
|
|
11
|
+
"directory": "packages/ui"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://seedcli.dev",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"cli",
|
|
16
|
+
"ui",
|
|
17
|
+
"terminal",
|
|
18
|
+
"header",
|
|
19
|
+
"status",
|
|
20
|
+
"list"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"bun": ">=1.3.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"LICENSE"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@seedcli/print": "^0.1.0"
|
|
42
|
+
}
|
|
43
|
+
}
|