@outfitter/cli 0.3.0 → 0.4.1
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/README.md +48 -4
- package/dist/actions.js +0 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -2
- package/dist/{render → colors}/colors.d.ts +1 -1
- package/dist/{render → colors}/colors.js +2 -6
- package/dist/colors/index.d.ts +1 -1
- package/dist/colors/index.js +3 -4
- package/dist/command.d.ts +2 -2
- package/dist/command.js +11 -2
- package/dist/completion.d.ts +36 -0
- package/dist/completion.js +91 -0
- package/dist/flags.d.ts +167 -0
- package/dist/flags.js +31 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -4
- package/dist/input.d.ts +3 -26
- package/dist/input.js +1 -31
- package/dist/output.d.ts +2 -2
- package/dist/output.js +0 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +0 -2
- package/dist/query.d.ts +50 -0
- package/dist/query.js +51 -0
- package/dist/shared/@outfitter/cli-b2zk8fb3.js +357 -0
- package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
- package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-k0yvzn6d.d.ts} +1 -1
- package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-md9347gn.d.ts} +155 -13
- package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
- package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
- package/dist/terminal/detection.js +1 -5
- package/dist/terminal/index.js +1 -6
- package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
- package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -2
- package/dist/verbs.d.ts +50 -0
- package/dist/verbs.js +61 -0
- package/package.json +50 -204
- package/dist/borders/index.d.ts +0 -3
- package/dist/borders/index.js +0 -13
- package/dist/box/index.d.ts +0 -4
- package/dist/box/index.js +0 -13
- package/dist/demo/index.d.ts +0 -78
- package/dist/demo/index.js +0 -148
- package/dist/demo/registry.d.ts +0 -7
- package/dist/demo/registry.js +0 -28
- package/dist/demo/renderers/borders.d.ts +0 -7
- package/dist/demo/renderers/borders.js +0 -17
- package/dist/demo/renderers/box.d.ts +0 -7
- package/dist/demo/renderers/box.js +0 -18
- package/dist/demo/renderers/colors.d.ts +0 -7
- package/dist/demo/renderers/colors.js +0 -18
- package/dist/demo/renderers/indicators.d.ts +0 -7
- package/dist/demo/renderers/indicators.js +0 -17
- package/dist/demo/renderers/list.d.ts +0 -7
- package/dist/demo/renderers/list.js +0 -19
- package/dist/demo/renderers/markdown.d.ts +0 -7
- package/dist/demo/renderers/markdown.js +0 -18
- package/dist/demo/renderers/progress.d.ts +0 -7
- package/dist/demo/renderers/progress.js +0 -17
- package/dist/demo/renderers/spinner.d.ts +0 -7
- package/dist/demo/renderers/spinner.js +0 -19
- package/dist/demo/renderers/table.d.ts +0 -7
- package/dist/demo/renderers/table.js +0 -19
- package/dist/demo/renderers/text.d.ts +0 -7
- package/dist/demo/renderers/text.js +0 -16
- package/dist/demo/renderers/tree.d.ts +0 -7
- package/dist/demo/renderers/tree.js +0 -18
- package/dist/demo/section.d.ts +0 -5
- package/dist/demo/section.js +0 -23
- package/dist/demo/templates.d.ts +0 -4
- package/dist/demo/templates.js +0 -10
- package/dist/demo/types.d.ts +0 -3
- package/dist/demo/types.js +0 -8
- package/dist/list/index.d.ts +0 -3
- package/dist/list/index.js +0 -9
- package/dist/preset/full.d.ts +0 -14
- package/dist/preset/full.js +0 -41
- package/dist/preset/standard.d.ts +0 -11
- package/dist/preset/standard.js +0 -30
- package/dist/prompt/confirm.d.ts +0 -4
- package/dist/prompt/confirm.js +0 -9
- package/dist/prompt/group.d.ts +0 -4
- package/dist/prompt/group.js +0 -9
- package/dist/prompt/index.d.ts +0 -7
- package/dist/prompt/index.js +0 -32
- package/dist/prompt/select.d.ts +0 -4
- package/dist/prompt/select.js +0 -11
- package/dist/prompt/text.d.ts +0 -4
- package/dist/prompt/text.js +0 -11
- package/dist/prompt/types.d.ts +0 -3
- package/dist/prompt/types.js +0 -8
- package/dist/prompt/validators.d.ts +0 -2
- package/dist/prompt/validators.js +0 -8
- package/dist/render/borders.d.ts +0 -2
- package/dist/render/borders.js +0 -15
- package/dist/render/box.d.ts +0 -3
- package/dist/render/box.js +0 -23
- package/dist/render/date.d.ts +0 -2
- package/dist/render/date.js +0 -12
- package/dist/render/format-relative.d.ts +0 -2
- package/dist/render/format-relative.js +0 -8
- package/dist/render/format.d.ts +0 -2
- package/dist/render/format.js +0 -10
- package/dist/render/heading.d.ts +0 -3
- package/dist/render/heading.js +0 -14
- package/dist/render/index.d.ts +0 -32
- package/dist/render/index.js +0 -235
- package/dist/render/indicators.d.ts +0 -2
- package/dist/render/indicators.js +0 -16
- package/dist/render/json.d.ts +0 -2
- package/dist/render/json.js +0 -10
- package/dist/render/layout.d.ts +0 -5
- package/dist/render/layout.js +0 -25
- package/dist/render/list.d.ts +0 -2
- package/dist/render/list.js +0 -8
- package/dist/render/markdown.d.ts +0 -2
- package/dist/render/markdown.js +0 -10
- package/dist/render/progress.d.ts +0 -2
- package/dist/render/progress.js +0 -8
- package/dist/render/separator.d.ts +0 -3
- package/dist/render/separator.js +0 -14
- package/dist/render/shapes.d.ts +0 -2
- package/dist/render/shapes.js +0 -35
- package/dist/render/spinner.d.ts +0 -2
- package/dist/render/spinner.js +0 -12
- package/dist/render/stack.d.ts +0 -3
- package/dist/render/stack.js +0 -38
- package/dist/render/table.d.ts +0 -3
- package/dist/render/table.js +0 -12
- package/dist/render/text.d.ts +0 -2
- package/dist/render/text.js +0 -27
- package/dist/render/tree.d.ts +0 -2
- package/dist/render/tree.js +0 -10
- package/dist/render/types.d.ts +0 -2
- package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
- package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
- package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
- package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
- package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
- package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
- package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
- package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
- package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
- package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
- package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
- package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
- package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
- package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
- package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
- package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
- package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
- package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
- package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
- package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
- package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
- package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
- package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
- package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
- package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
- package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
- package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
- package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
- package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
- package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
- package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
- package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
- package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
- package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
- package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
- package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
- package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
- package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
- package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
- package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
- package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
- package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
- package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
- package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
- package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
- package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
- package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
- package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
- package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
- package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
- package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
- package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
- package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
- package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
- package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
- package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
- package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
- package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
- package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
- package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
- package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
- package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
- package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
- package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
- package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
- package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
- package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
- package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
- package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
- package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
- package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
- package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
- package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
- package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
- package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
- package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
- package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
- package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
- package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
- package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
- package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
- package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
- package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
- package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
- package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
- package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
- package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
- package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
- package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
- package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
- package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
- package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
- package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
- package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
- package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
- package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
- package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
- package/dist/shared/@outfitter/cli-znc47004.js +0 -134
- package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
- package/dist/streaming/ansi.d.ts +0 -2
- package/dist/streaming/ansi.js +0 -8
- package/dist/streaming/index.d.ts +0 -4
- package/dist/streaming/index.js +0 -17
- package/dist/streaming/spinner.d.ts +0 -3
- package/dist/streaming/spinner.js +0 -10
- package/dist/streaming/writer.d.ts +0 -2
- package/dist/streaming/writer.js +0 -9
- package/dist/table/index.d.ts +0 -4
- package/dist/table/index.js +0 -13
- package/dist/theme/context.d.ts +0 -9
- package/dist/theme/context.js +0 -14
- package/dist/theme/create.d.ts +0 -8
- package/dist/theme/create.js +0 -12
- package/dist/theme/index.d.ts +0 -17
- package/dist/theme/index.js +0 -42
- package/dist/theme/presets/bold.d.ts +0 -8
- package/dist/theme/presets/bold.js +0 -12
- package/dist/theme/presets/default.d.ts +0 -8
- package/dist/theme/presets/default.js +0 -11
- package/dist/theme/presets/index.d.ts +0 -12
- package/dist/theme/presets/index.js +0 -24
- package/dist/theme/presets/minimal.d.ts +0 -8
- package/dist/theme/presets/minimal.js +0 -12
- package/dist/theme/presets/rounded.d.ts +0 -8
- package/dist/theme/presets/rounded.js +0 -12
- package/dist/theme/resolve.d.ts +0 -8
- package/dist/theme/resolve.js +0 -11
- package/dist/theme/types.d.ts +0 -7
- package/dist/theme/types.js +0 -1
- package/dist/tree/index.d.ts +0 -3
- package/dist/tree/index.js +0 -11
- /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
- /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CancelledError, PromptResult } from "./cli-9bcm4zhf";
|
|
2
|
-
import { Result } from "better-result";
|
|
3
|
-
/**
|
|
4
|
-
* A step in a prompt group.
|
|
5
|
-
*/
|
|
6
|
-
type PromptStep<T> = () => PromptResult<T>;
|
|
7
|
-
/**
|
|
8
|
-
* Collects multiple prompts into a single result object.
|
|
9
|
-
*
|
|
10
|
-
* If any prompt is cancelled, the entire group fails with CancelledError.
|
|
11
|
-
*
|
|
12
|
-
* @param steps - Object of named prompt steps
|
|
13
|
-
* @returns Ok with collected values or Err with CancelledError
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { promptGroup, promptText, promptSelect } from "@outfitter/cli/prompt";
|
|
18
|
-
*
|
|
19
|
-
* const result = await promptGroup({
|
|
20
|
-
* name: () => promptText({ message: "Name:" }),
|
|
21
|
-
* role: () => promptSelect({
|
|
22
|
-
* message: "Role:",
|
|
23
|
-
* options: [
|
|
24
|
-
* { value: "admin", label: "Admin" },
|
|
25
|
-
* { value: "user", label: "User" },
|
|
26
|
-
* ],
|
|
27
|
-
* }),
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* if (result.isOk()) {
|
|
31
|
-
* console.log(`Creating ${result.value.role}: ${result.value.name}`);
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
declare function promptGroup<T extends Record<string, unknown>>(steps: { [K in keyof T] : PromptStep<T[K]> }): Promise<Result<T, CancelledError>>;
|
|
36
|
-
export { PromptStep, promptGroup };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
renderMarkdown
|
|
4
|
-
} from "./cli-ndem6tz8.js";
|
|
5
|
-
import {
|
|
6
|
-
getExample
|
|
7
|
-
} from "./cli-xep6v2c0.js";
|
|
8
|
-
import {
|
|
9
|
-
demoSection
|
|
10
|
-
} from "./cli-sam2sq50.js";
|
|
11
|
-
|
|
12
|
-
// packages/cli/src/demo/renderers/markdown.ts
|
|
13
|
-
function renderMarkdownDemo(config, theme) {
|
|
14
|
-
const showCode = config.showCode ?? true;
|
|
15
|
-
const lines = [];
|
|
16
|
-
lines.push(demoSection("Markdown Rendering"));
|
|
17
|
-
lines.push("");
|
|
18
|
-
if (showCode) {
|
|
19
|
-
lines.push('import { renderMarkdown } from "@outfitter/cli/render";');
|
|
20
|
-
lines.push("");
|
|
21
|
-
}
|
|
22
|
-
const sample = getExample("markdownSample", config.examples);
|
|
23
|
-
lines.push("Input:");
|
|
24
|
-
lines.push(theme.muted("\u2500".repeat(40)));
|
|
25
|
-
for (const line of sample.split(`
|
|
26
|
-
`)) {
|
|
27
|
-
lines.push(theme.muted(line));
|
|
28
|
-
}
|
|
29
|
-
lines.push(theme.muted("\u2500".repeat(40)));
|
|
30
|
-
lines.push("");
|
|
31
|
-
lines.push("Output:");
|
|
32
|
-
lines.push("\u2500".repeat(40));
|
|
33
|
-
lines.push(renderMarkdown(sample));
|
|
34
|
-
lines.push("\u2500".repeat(40));
|
|
35
|
-
lines.push("");
|
|
36
|
-
lines.push(demoSection("Supported Elements"));
|
|
37
|
-
lines.push("");
|
|
38
|
-
const elements = [
|
|
39
|
-
{
|
|
40
|
-
name: "Headings",
|
|
41
|
-
markdown: `# Heading 1
|
|
42
|
-
## Heading 2`,
|
|
43
|
-
desc: "Rendered bold"
|
|
44
|
-
},
|
|
45
|
-
{ name: "Bold", markdown: "**bold text**", desc: "Rendered bold" },
|
|
46
|
-
{ name: "Italic", markdown: "*italic text*", desc: "Rendered italic" },
|
|
47
|
-
{ name: "Inline code", markdown: "`code`", desc: "Rendered cyan" },
|
|
48
|
-
{
|
|
49
|
-
name: "Code block",
|
|
50
|
-
markdown: "```\ncode block\n```",
|
|
51
|
-
desc: "Rendered dim"
|
|
52
|
-
}
|
|
53
|
-
];
|
|
54
|
-
for (const el of elements) {
|
|
55
|
-
lines.push(`${el.name}:`);
|
|
56
|
-
lines.push(theme.muted(` ${el.desc}`));
|
|
57
|
-
lines.push(` Input: ${el.markdown.replace(/\n/g, "\\n")}`);
|
|
58
|
-
lines.push(` Output: ${renderMarkdown(el.markdown).replace(/\n/g, " ")}`);
|
|
59
|
-
lines.push("");
|
|
60
|
-
}
|
|
61
|
-
lines.push(demoSection("Color Support"));
|
|
62
|
-
lines.push("");
|
|
63
|
-
lines.push("\u2022 Colors applied when terminal supports ANSI");
|
|
64
|
-
lines.push("\u2022 Respects NO_COLOR environment variable");
|
|
65
|
-
lines.push("\u2022 Markdown syntax stripped when colors disabled");
|
|
66
|
-
return lines.join(`
|
|
67
|
-
`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { renderMarkdownDemo };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
createCancelledError
|
|
4
|
-
} from "./cli-8bwaw3pz.js";
|
|
5
|
-
|
|
6
|
-
// packages/cli/src/prompt/group.ts
|
|
7
|
-
import { Result as R } from "better-result";
|
|
8
|
-
async function promptGroup(steps) {
|
|
9
|
-
const result = {};
|
|
10
|
-
for (const [key, step] of Object.entries(steps)) {
|
|
11
|
-
const stepResult = await step();
|
|
12
|
-
if (stepResult.isErr()) {
|
|
13
|
-
return R.err(createCancelledError(stepResult.error.message));
|
|
14
|
-
}
|
|
15
|
-
result[key] = stepResult.value;
|
|
16
|
-
}
|
|
17
|
-
return R.ok(result);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { promptGroup };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { PartialVisualTheme, VisualTheme } from "./cli-8hngbjyr";
|
|
2
|
-
/**
|
|
3
|
-
* Options for creating a visual theme.
|
|
4
|
-
*/
|
|
5
|
-
interface CreateVisualThemeOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Base theme to extend from.
|
|
8
|
-
* Properties not overridden will be inherited from this theme.
|
|
9
|
-
* @default defaultTheme
|
|
10
|
-
*/
|
|
11
|
-
extends?: VisualTheme;
|
|
12
|
-
/**
|
|
13
|
-
* Properties to override on the base/extended theme.
|
|
14
|
-
* Supports partial overrides for nested objects (colors, spacing, markers).
|
|
15
|
-
*/
|
|
16
|
-
overrides?: PartialVisualTheme;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Creates a visual theme by extending and/or overriding a base theme.
|
|
20
|
-
*
|
|
21
|
-
* This is the primary factory for creating custom themes. You can:
|
|
22
|
-
* - Start from scratch (no options → defaultTheme)
|
|
23
|
-
* - Extend an existing preset
|
|
24
|
-
* - Override specific properties
|
|
25
|
-
* - Combine extension and overrides
|
|
26
|
-
*
|
|
27
|
-
* When changing the `border` property, `borderChars` is automatically
|
|
28
|
-
* updated to match the new border style.
|
|
29
|
-
*
|
|
30
|
-
* @param options - Configuration for theme creation
|
|
31
|
-
* @returns A complete VisualTheme
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* // Start with defaults
|
|
36
|
-
* const theme = createVisualTheme();
|
|
37
|
-
*
|
|
38
|
-
* // Extend a preset
|
|
39
|
-
* const rounded = createVisualTheme({ extends: roundedTheme });
|
|
40
|
-
*
|
|
41
|
-
* // Override specific properties
|
|
42
|
-
* const custom = createVisualTheme({
|
|
43
|
-
* overrides: {
|
|
44
|
-
* border: "double",
|
|
45
|
-
* colors: { success: "\x1b[38;5;82m" },
|
|
46
|
-
* spacing: { boxPadding: 2 }
|
|
47
|
-
* }
|
|
48
|
-
* });
|
|
49
|
-
*
|
|
50
|
-
* // Extend and override
|
|
51
|
-
* const brandTheme = createVisualTheme({
|
|
52
|
-
* extends: roundedTheme,
|
|
53
|
-
* overrides: {
|
|
54
|
-
* name: "brand",
|
|
55
|
-
* colors: { accent: "\x1b[38;5;39m" }
|
|
56
|
-
* }
|
|
57
|
-
* });
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
declare function createVisualTheme(options?: CreateVisualThemeOptions): VisualTheme;
|
|
61
|
-
export { CreateVisualThemeOptions, createVisualTheme };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
defaultTheme
|
|
4
|
-
} from "./cli-z78mkrc7.js";
|
|
5
|
-
|
|
6
|
-
// packages/cli/src/theme/context.ts
|
|
7
|
-
function createThemedContext(options) {
|
|
8
|
-
const theme = options.theme ?? options.parent?.theme ?? defaultTheme;
|
|
9
|
-
const width = options.width ?? options.parent?.width ?? process.stdout.columns ?? 80;
|
|
10
|
-
return {
|
|
11
|
-
width,
|
|
12
|
-
theme,
|
|
13
|
-
...options.parent && { parent: options.parent }
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function getContextTheme(ctx) {
|
|
17
|
-
return ctx?.theme ?? defaultTheme;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { createThemedContext, getContextTheme };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { WidthMode } from "./cli-2g8bx1aq";
|
|
2
|
-
/**
|
|
3
|
-
* Separator style for headings.
|
|
4
|
-
*/
|
|
5
|
-
type SeparatorStyle = "=" | "-" | "─" | "━" | "═";
|
|
6
|
-
/**
|
|
7
|
-
* Width mode for headings.
|
|
8
|
-
*
|
|
9
|
-
* Note: Headings only support "text", "full", and numeric widths.
|
|
10
|
-
* Use the shared WidthMode type for full container-relative support.
|
|
11
|
-
*
|
|
12
|
-
* @see WidthMode for the complete type definition
|
|
13
|
-
*/
|
|
14
|
-
type HeadingWidthMode = Extract<WidthMode, "text" | "full" | number>;
|
|
15
|
-
/**
|
|
16
|
-
* Case transformation for heading text.
|
|
17
|
-
*/
|
|
18
|
-
type CaseMode = "upper" | "lower" | "title" | "none";
|
|
19
|
-
/**
|
|
20
|
-
* Options for rendering a heading.
|
|
21
|
-
*/
|
|
22
|
-
interface HeadingOptions {
|
|
23
|
-
/** Separator character/style (default: "=") */
|
|
24
|
-
separator?: SeparatorStyle;
|
|
25
|
-
/** Width mode (default: "text") */
|
|
26
|
-
width?: HeadingWidthMode;
|
|
27
|
-
/** Case transformation (default: "upper") */
|
|
28
|
-
case?: CaseMode;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Renders a section heading with a separator line below.
|
|
32
|
-
*
|
|
33
|
-
* @param text - The heading text
|
|
34
|
-
* @param options - Rendering options
|
|
35
|
-
* @returns Formatted heading string
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* import { renderHeading } from "@outfitter/cli/render";
|
|
40
|
-
*
|
|
41
|
-
* console.log(renderHeading("Theme Colors"));
|
|
42
|
-
* // THEME COLORS
|
|
43
|
-
* // ============
|
|
44
|
-
*
|
|
45
|
-
* console.log(renderHeading("Status", { separator: "─", case: "none" }));
|
|
46
|
-
* // Status
|
|
47
|
-
* // ──────
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
declare function renderHeading(text: string, options?: HeadingOptions): string;
|
|
51
|
-
export { SeparatorStyle, HeadingWidthMode, CaseMode, HeadingOptions, renderHeading };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { VisualTheme } from "./cli-8hngbjyr";
|
|
2
|
-
import { LayoutContext } from "./cli-2g8bx1aq";
|
|
3
|
-
/**
|
|
4
|
-
* Layout context extended with theme information.
|
|
5
|
-
*
|
|
6
|
-
* Allows themes to cascade through component hierarchies. Children
|
|
7
|
-
* inherit their parent's theme unless explicitly overridden.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { createThemedContext, roundedTheme } from "@outfitter/cli/theme";
|
|
12
|
-
*
|
|
13
|
-
* // Create root context with theme
|
|
14
|
-
* const ctx = createThemedContext({ theme: roundedTheme, width: 80 });
|
|
15
|
-
*
|
|
16
|
-
* // Child inherits theme from parent
|
|
17
|
-
* const childCtx = createThemedContext({ width: 40, parent: ctx });
|
|
18
|
-
* console.log(childCtx.theme.border); // "rounded" (inherited)
|
|
19
|
-
*
|
|
20
|
-
* // Child can override theme
|
|
21
|
-
* const overrideCtx = createThemedContext({
|
|
22
|
-
* theme: boldTheme,
|
|
23
|
-
* width: 40,
|
|
24
|
-
* parent: ctx
|
|
25
|
-
* });
|
|
26
|
-
* console.log(overrideCtx.theme.border); // "heavy"
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
interface ThemedLayoutContext extends LayoutContext {
|
|
30
|
-
/** The visual theme for this context */
|
|
31
|
-
readonly theme: VisualTheme;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Options for creating a themed layout context.
|
|
35
|
-
*/
|
|
36
|
-
interface ThemedContextOptions {
|
|
37
|
-
/** Visual theme (inherited from parent if not specified) */
|
|
38
|
-
theme?: VisualTheme;
|
|
39
|
-
/** Available width in characters */
|
|
40
|
-
width?: number;
|
|
41
|
-
/** Parent context for inheritance */
|
|
42
|
-
parent?: ThemedLayoutContext;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a themed layout context with cascading inheritance.
|
|
46
|
-
*
|
|
47
|
-
* Theme inheritance rules:
|
|
48
|
-
* 1. Explicit theme → use it
|
|
49
|
-
* 2. Parent exists → inherit parent's theme
|
|
50
|
-
* 3. No theme or parent → use defaultTheme
|
|
51
|
-
*
|
|
52
|
-
* Width inheritance rules:
|
|
53
|
-
* 1. Explicit width → use it
|
|
54
|
-
* 2. Parent exists → inherit parent's width
|
|
55
|
-
* 3. No width or parent → use terminal width (via getTerminalWidth)
|
|
56
|
-
*
|
|
57
|
-
* @param options - Context configuration
|
|
58
|
-
* @returns A ThemedLayoutContext with resolved theme and width
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* // Root context with explicit theme and width
|
|
63
|
-
* const root = createThemedContext({ theme: roundedTheme, width: 100 });
|
|
64
|
-
*
|
|
65
|
-
* // Child with inherited theme, explicit width
|
|
66
|
-
* const child = createThemedContext({ width: 50, parent: root });
|
|
67
|
-
*
|
|
68
|
-
* // Nested child with overridden theme
|
|
69
|
-
* const nested = createThemedContext({
|
|
70
|
-
* theme: boldTheme,
|
|
71
|
-
* parent: child
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
declare function createThemedContext(options: ThemedContextOptions): ThemedLayoutContext;
|
|
76
|
-
/**
|
|
77
|
-
* Gets the theme from a context, with fallback to defaultTheme.
|
|
78
|
-
*
|
|
79
|
-
* Useful when you have an optional context and need a theme.
|
|
80
|
-
*
|
|
81
|
-
* @param ctx - Optional themed context
|
|
82
|
-
* @returns The context's theme or defaultTheme if no context
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* function renderComponent(ctx?: ThemedLayoutContext) {
|
|
87
|
-
* const theme = getContextTheme(ctx);
|
|
88
|
-
* // theme is always defined
|
|
89
|
-
* }
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare function getContextTheme(ctx?: ThemedLayoutContext): VisualTheme;
|
|
93
|
-
export { ThemedLayoutContext, ThemedContextOptions, createThemedContext, getContextTheme };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
BORDER_STYLE_META,
|
|
4
|
-
getBorderStyles
|
|
5
|
-
} from "./cli-d8ahdd9d.js";
|
|
6
|
-
import {
|
|
7
|
-
demoSection
|
|
8
|
-
} from "./cli-sam2sq50.js";
|
|
9
|
-
import {
|
|
10
|
-
BORDERS,
|
|
11
|
-
drawHorizontalLine,
|
|
12
|
-
init_borders
|
|
13
|
-
} from "./cli-85fg2vr5.js";
|
|
14
|
-
|
|
15
|
-
// packages/cli/src/demo/renderers/borders.ts
|
|
16
|
-
init_borders();
|
|
17
|
-
function renderBordersDemo(config, theme) {
|
|
18
|
-
const showCode = config.showCode ?? true;
|
|
19
|
-
const showDescriptions = config.showDescriptions ?? true;
|
|
20
|
-
const lines = [];
|
|
21
|
-
lines.push(demoSection("Border Styles"));
|
|
22
|
-
lines.push("");
|
|
23
|
-
if (showCode) {
|
|
24
|
-
lines.push('import { BORDERS, getBorderCharacters } from "@outfitter/cli/render";');
|
|
25
|
-
lines.push("");
|
|
26
|
-
}
|
|
27
|
-
const styles = getBorderStyles().filter((s) => s !== "none");
|
|
28
|
-
for (const style of styles) {
|
|
29
|
-
const meta = BORDER_STYLE_META[style];
|
|
30
|
-
const chars = BORDERS[style];
|
|
31
|
-
lines.push(`${meta.label.toUpperCase()} (${style})`);
|
|
32
|
-
if (showDescriptions) {
|
|
33
|
-
lines.push(theme.muted(meta.description));
|
|
34
|
-
}
|
|
35
|
-
lines.push("");
|
|
36
|
-
const width = 20;
|
|
37
|
-
lines.push(drawHorizontalLine(width, chars, "top"));
|
|
38
|
-
lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
|
|
39
|
-
lines.push(`${chars.vertical}${" Content here".padEnd(width)}${chars.vertical}`);
|
|
40
|
-
lines.push(`${chars.vertical}${" ".repeat(width)}${chars.vertical}`);
|
|
41
|
-
lines.push(drawHorizontalLine(width, chars, "bottom"));
|
|
42
|
-
lines.push("");
|
|
43
|
-
}
|
|
44
|
-
lines.push(demoSection("Characters Reference"));
|
|
45
|
-
lines.push("");
|
|
46
|
-
for (const style of styles) {
|
|
47
|
-
const chars = BORDERS[style];
|
|
48
|
-
const meta = BORDER_STYLE_META[style];
|
|
49
|
-
lines.push(`${meta.label}:`);
|
|
50
|
-
const charDisplay = [
|
|
51
|
-
` Corners: ${chars.topLeft} ${chars.topRight} ${chars.bottomLeft} ${chars.bottomRight}`,
|
|
52
|
-
` Lines: ${chars.horizontal} ${chars.vertical}`,
|
|
53
|
-
` T's: ${chars.topT} ${chars.bottomT} ${chars.leftT} ${chars.rightT} Cross: ${chars.cross}`
|
|
54
|
-
];
|
|
55
|
-
lines.push(...charDisplay);
|
|
56
|
-
lines.push("");
|
|
57
|
-
}
|
|
58
|
-
return lines.join(`
|
|
59
|
-
`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { renderBordersDemo };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/render/indicators.ts
|
|
3
|
-
var INDICATORS = {
|
|
4
|
-
status: {
|
|
5
|
-
success: { unicode: "\u2714", fallback: "[ok]", color: "green" },
|
|
6
|
-
error: { unicode: "\u2716", fallback: "[x]", color: "red" },
|
|
7
|
-
warning: { unicode: "\u26A0", fallback: "[!]", color: "yellow" },
|
|
8
|
-
info: { unicode: "\u2139", fallback: "[i]", color: "blue" }
|
|
9
|
-
},
|
|
10
|
-
marker: {
|
|
11
|
-
circle: { unicode: "\u25CF", fallback: "*" },
|
|
12
|
-
circleOutline: { unicode: "\u25CB", fallback: "o" },
|
|
13
|
-
circleDotted: { unicode: "\u25CC", fallback: "o" },
|
|
14
|
-
circleSmall: { unicode: "\u2022", fallback: "\xB7" },
|
|
15
|
-
circleDot: { unicode: "\u25C9", fallback: "(*)" },
|
|
16
|
-
circleDotOutline: { unicode: "\u25EF", fallback: "( )" },
|
|
17
|
-
square: { unicode: "\u25A0", fallback: "[#]" },
|
|
18
|
-
squareOutline: { unicode: "\u25A1", fallback: "[ ]" },
|
|
19
|
-
squareSmall: { unicode: "\u25FC", fallback: "[#]" },
|
|
20
|
-
squareSmallOutline: { unicode: "\u25FB", fallback: "[ ]" },
|
|
21
|
-
lozenge: { unicode: "\u25C6", fallback: "\u2666" },
|
|
22
|
-
lozengeOutline: { unicode: "\u25C7", fallback: "\u25CA" },
|
|
23
|
-
lozengeDot: { unicode: "\u25C8", fallback: "\u2666\u2666" },
|
|
24
|
-
dash: { unicode: "\u2013", fallback: "-" },
|
|
25
|
-
pointer: { unicode: "\u276F", fallback: ">" },
|
|
26
|
-
pointerSmall: { unicode: "\u203A", fallback: ">" },
|
|
27
|
-
checkbox: { unicode: "\u2610", fallback: "[ ]" },
|
|
28
|
-
checkboxChecked: { unicode: "\u2611", fallback: "[x]" },
|
|
29
|
-
checkboxCross: { unicode: "\u2612", fallback: "[X]" }
|
|
30
|
-
},
|
|
31
|
-
progress: {
|
|
32
|
-
circleEmpty: { unicode: "\u25CB", fallback: "." },
|
|
33
|
-
circleQuarter: { unicode: "\u25D4", fallback: "o" },
|
|
34
|
-
circleHalf: { unicode: "\u25D1", fallback: "O" },
|
|
35
|
-
circleThree: { unicode: "\u25D5", fallback: "0" },
|
|
36
|
-
circleFull: { unicode: "\u25CF", fallback: "@" },
|
|
37
|
-
vertical1: { unicode: "\u2581", fallback: "_" },
|
|
38
|
-
vertical2: { unicode: "\u2582", fallback: "_" },
|
|
39
|
-
vertical3: { unicode: "\u2583", fallback: "=" },
|
|
40
|
-
vertical4: { unicode: "\u2584", fallback: "=" },
|
|
41
|
-
vertical5: { unicode: "\u2585", fallback: "#" },
|
|
42
|
-
vertical6: { unicode: "\u2586", fallback: "#" },
|
|
43
|
-
vertical7: { unicode: "\u2587", fallback: "#" },
|
|
44
|
-
verticalFull: { unicode: "\u2588", fallback: "#" },
|
|
45
|
-
horizontal1: { unicode: "\u258F", fallback: "|" },
|
|
46
|
-
horizontal2: { unicode: "\u258E", fallback: "|" },
|
|
47
|
-
horizontal3: { unicode: "\u258D", fallback: "|" },
|
|
48
|
-
horizontal4: { unicode: "\u258C", fallback: "|" },
|
|
49
|
-
horizontal5: { unicode: "\u258B", fallback: "|" },
|
|
50
|
-
horizontal6: { unicode: "\u258A", fallback: "|" },
|
|
51
|
-
horizontal7: { unicode: "\u2589", fallback: "|" },
|
|
52
|
-
horizontalFull: { unicode: "\u2588", fallback: "#" },
|
|
53
|
-
shadeLight: { unicode: "\u2591", fallback: "." },
|
|
54
|
-
shadeMedium: { unicode: "\u2592", fallback: ":" },
|
|
55
|
-
shadeDark: { unicode: "\u2593", fallback: "#" }
|
|
56
|
-
},
|
|
57
|
-
triangle: {
|
|
58
|
-
up: { unicode: "\u25B2", fallback: "^" },
|
|
59
|
-
upSmall: { unicode: "\u25B4", fallback: "^" },
|
|
60
|
-
upOutline: { unicode: "\u25B3", fallback: "^" },
|
|
61
|
-
down: { unicode: "\u25BC", fallback: "v" },
|
|
62
|
-
downSmall: { unicode: "\u25BE", fallback: "v" },
|
|
63
|
-
downOutline: { unicode: "\u25BD", fallback: "v" },
|
|
64
|
-
left: { unicode: "\u25C0", fallback: "<" },
|
|
65
|
-
leftSmall: { unicode: "\u25C2", fallback: "<" },
|
|
66
|
-
leftOutline: { unicode: "\u25C1", fallback: "<" },
|
|
67
|
-
right: { unicode: "\u25B6", fallback: ">" },
|
|
68
|
-
rightSmall: { unicode: "\u25B8", fallback: ">" },
|
|
69
|
-
rightOutline: { unicode: "\u25B7", fallback: ">" }
|
|
70
|
-
},
|
|
71
|
-
special: {
|
|
72
|
-
star: { unicode: "\u2605", fallback: "*" },
|
|
73
|
-
starOutline: { unicode: "\u2606", fallback: "*" },
|
|
74
|
-
heart: { unicode: "\u2665", fallback: "<3" },
|
|
75
|
-
heartOutline: { unicode: "\u2661", fallback: "<3" },
|
|
76
|
-
flag: { unicode: "\u2691", fallback: "[F]" },
|
|
77
|
-
flagOutline: { unicode: "\u2690", fallback: "[f]" },
|
|
78
|
-
gear: { unicode: "\u2699", fallback: "[*]" }
|
|
79
|
-
},
|
|
80
|
-
directional: {
|
|
81
|
-
arrowUp: { unicode: "\u2191", fallback: "^" },
|
|
82
|
-
arrowDown: { unicode: "\u2193", fallback: "v" },
|
|
83
|
-
arrowLeft: { unicode: "\u2190", fallback: "<-" },
|
|
84
|
-
arrowRight: { unicode: "\u2192", fallback: "->" },
|
|
85
|
-
arrowLeftRight: { unicode: "\u2194", fallback: "<->" },
|
|
86
|
-
arrowUpDown: { unicode: "\u2195", fallback: "^v" }
|
|
87
|
-
},
|
|
88
|
-
math: {
|
|
89
|
-
almostEqual: { unicode: "\u2248", fallback: "~=" },
|
|
90
|
-
notEqual: { unicode: "\u2260", fallback: "!=" },
|
|
91
|
-
lessOrEqual: { unicode: "\u2264", fallback: "<=" },
|
|
92
|
-
greaterOrEqual: { unicode: "\u2265", fallback: ">=" },
|
|
93
|
-
identical: { unicode: "\u2261", fallback: "===" },
|
|
94
|
-
infinity: { unicode: "\u221E", fallback: "inf" }
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
function isUnicodeSupported() {
|
|
98
|
-
if (process.env["CI"]) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
if (process.env["WT_SESSION"]) {
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
if (process.env["ConEmuTask"]) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
const term = process.env["TERM"] ?? "";
|
|
108
|
-
if (term === "xterm-256color" || term === "xterm" || term.includes("256color") || term.includes("truecolor")) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
const lang = process.env["LANG"] ?? process.env["LC_ALL"] ?? "";
|
|
112
|
-
if (lang.toLowerCase().includes("utf-8") || lang.toLowerCase().includes("utf8")) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (process.platform !== "win32") {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
function getIndicator(category, name, forceUnicode) {
|
|
121
|
-
const indicator = INDICATORS[category][name];
|
|
122
|
-
if (!indicator) {
|
|
123
|
-
return "";
|
|
124
|
-
}
|
|
125
|
-
const useUnicode = forceUnicode ?? isUnicodeSupported();
|
|
126
|
-
return useUnicode ? indicator.unicode : indicator.fallback;
|
|
127
|
-
}
|
|
128
|
-
var PROGRESS_SEQUENCES = {
|
|
129
|
-
circle: [
|
|
130
|
-
"circleEmpty",
|
|
131
|
-
"circleQuarter",
|
|
132
|
-
"circleHalf",
|
|
133
|
-
"circleThree",
|
|
134
|
-
"circleFull"
|
|
135
|
-
],
|
|
136
|
-
vertical: [
|
|
137
|
-
"vertical1",
|
|
138
|
-
"vertical2",
|
|
139
|
-
"vertical3",
|
|
140
|
-
"vertical4",
|
|
141
|
-
"vertical5",
|
|
142
|
-
"vertical6",
|
|
143
|
-
"vertical7",
|
|
144
|
-
"verticalFull"
|
|
145
|
-
],
|
|
146
|
-
horizontal: [
|
|
147
|
-
"horizontal1",
|
|
148
|
-
"horizontal2",
|
|
149
|
-
"horizontal3",
|
|
150
|
-
"horizontal4",
|
|
151
|
-
"horizontal5",
|
|
152
|
-
"horizontal6",
|
|
153
|
-
"horizontal7",
|
|
154
|
-
"horizontalFull"
|
|
155
|
-
],
|
|
156
|
-
shade: ["shadeLight", "shadeMedium", "shadeDark"]
|
|
157
|
-
};
|
|
158
|
-
function getProgressIndicator(style, current, max, forceUnicode) {
|
|
159
|
-
const sequence = PROGRESS_SEQUENCES[style];
|
|
160
|
-
const steps = sequence.length;
|
|
161
|
-
const ratio = max <= 0 ? 0 : Math.max(0, Math.min(1, current / max));
|
|
162
|
-
const index = Math.round(ratio * (steps - 1));
|
|
163
|
-
const name = sequence[index];
|
|
164
|
-
if (name === undefined) {
|
|
165
|
-
return "";
|
|
166
|
-
}
|
|
167
|
-
return getIndicator("progress", name, forceUnicode);
|
|
168
|
-
}
|
|
169
|
-
var SEVERITY_MARKERS = {
|
|
170
|
-
minor: "lozengeOutline",
|
|
171
|
-
moderate: "lozenge",
|
|
172
|
-
severe: "lozengeDot"
|
|
173
|
-
};
|
|
174
|
-
function getSeverityIndicator(level, forceUnicode) {
|
|
175
|
-
const name = SEVERITY_MARKERS[level];
|
|
176
|
-
return getIndicator("marker", name, forceUnicode);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export { INDICATORS, isUnicodeSupported, getIndicator, getProgressIndicator, getSeverityIndicator };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
defaultTheme
|
|
4
|
-
} from "./cli-z78mkrc7.js";
|
|
5
|
-
import {
|
|
6
|
-
BORDERS,
|
|
7
|
-
init_borders
|
|
8
|
-
} from "./cli-85fg2vr5.js";
|
|
9
|
-
|
|
10
|
-
// packages/cli/src/theme/presets/bold.ts
|
|
11
|
-
init_borders();
|
|
12
|
-
var boldTheme = {
|
|
13
|
-
...defaultTheme,
|
|
14
|
-
name: "bold",
|
|
15
|
-
border: "heavy",
|
|
16
|
-
borderChars: BORDERS.heavy,
|
|
17
|
-
treeGuide: "heavy"
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { boldTheme };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progress bar rendering utilities.
|
|
3
|
-
*
|
|
4
|
-
* Renders progress bars with filled and empty segments.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Configuration options for {@link renderProgress}.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const options: ProgressOptions = {
|
|
14
|
-
* current: 75,
|
|
15
|
-
* total: 100,
|
|
16
|
-
* width: 20,
|
|
17
|
-
* showPercent: true,
|
|
18
|
-
* };
|
|
19
|
-
* // Renders: [###############.....] 75%
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
interface ProgressOptions {
|
|
23
|
-
/** Current progress value */
|
|
24
|
-
current: number;
|
|
25
|
-
/** Total value (100% when current equals total) */
|
|
26
|
-
total: number;
|
|
27
|
-
/** Width of the progress bar in characters (default: 20) */
|
|
28
|
-
width?: number;
|
|
29
|
-
/** Whether to show percentage after the bar (default: false) */
|
|
30
|
-
showPercent?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Renders a progress bar with filled and empty segments.
|
|
34
|
-
*
|
|
35
|
-
* Uses unicode block characters: filled segments, empty segments.
|
|
36
|
-
* Optionally displays percentage after the bar.
|
|
37
|
-
*
|
|
38
|
-
* Handles edge cases:
|
|
39
|
-
* - `total <= 0`: Returns empty bar with 0%
|
|
40
|
-
* - `current > total`: Caps at 100%
|
|
41
|
-
* - `current < 0`: Floors at 0%
|
|
42
|
-
*
|
|
43
|
-
* @param options - Progress bar configuration
|
|
44
|
-
* @returns Formatted progress bar string
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* renderProgress({ current: 50, total: 100 });
|
|
49
|
-
* // [##########..........]
|
|
50
|
-
*
|
|
51
|
-
* renderProgress({ current: 75, total: 100, showPercent: true });
|
|
52
|
-
* // [###############.....] 75%
|
|
53
|
-
*
|
|
54
|
-
* renderProgress({ current: 30, total: 100, width: 10 });
|
|
55
|
-
* // [###.......]
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
declare function renderProgress(options: ProgressOptions): string;
|
|
59
|
-
export { ProgressOptions, renderProgress };
|