@outfitter/cli 0.3.0 → 0.4.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/README.md +23 -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 +1 -1
- package/dist/command.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -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/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
- package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-f79bwzsp.d.ts} +1 -1
- package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
- 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/package.json +35 -213
- 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,63 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
ANSI,
|
|
4
|
-
init_colors
|
|
5
|
-
} from "./cli-5g6rkv3d.js";
|
|
6
|
-
import {
|
|
7
|
-
init_detection,
|
|
8
|
-
supportsColor
|
|
9
|
-
} from "./cli-d9ad0rqj.js";
|
|
10
|
-
|
|
11
|
-
// packages/cli/src/render/markdown.ts
|
|
12
|
-
init_detection();
|
|
13
|
-
init_colors();
|
|
14
|
-
function renderMarkdown(markdown) {
|
|
15
|
-
const colorEnabled = supportsColor();
|
|
16
|
-
let result = markdown;
|
|
17
|
-
result = result.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, _lang, code) => {
|
|
18
|
-
const trimmed = code.trimEnd();
|
|
19
|
-
if (colorEnabled) {
|
|
20
|
-
return `${ANSI.dim}${trimmed}${ANSI.reset}`;
|
|
21
|
-
}
|
|
22
|
-
return trimmed;
|
|
23
|
-
});
|
|
24
|
-
result = result.replace(/^(#{1,6})\s+(.+)$/gm, (_match, _hashes, text) => {
|
|
25
|
-
if (colorEnabled) {
|
|
26
|
-
return `${ANSI.bold}${text}${ANSI.reset}`;
|
|
27
|
-
}
|
|
28
|
-
return text;
|
|
29
|
-
});
|
|
30
|
-
result = result.replace(/\*\*(.+?)\*\*/g, (_match, text) => {
|
|
31
|
-
if (colorEnabled) {
|
|
32
|
-
return `${ANSI.bold}${text}${ANSI.reset}`;
|
|
33
|
-
}
|
|
34
|
-
return text;
|
|
35
|
-
});
|
|
36
|
-
result = result.replace(/__(.+?)__/g, (_match, text) => {
|
|
37
|
-
if (colorEnabled) {
|
|
38
|
-
return `${ANSI.bold}${text}${ANSI.reset}`;
|
|
39
|
-
}
|
|
40
|
-
return text;
|
|
41
|
-
});
|
|
42
|
-
result = result.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_match, text) => {
|
|
43
|
-
if (colorEnabled) {
|
|
44
|
-
return `${ANSI.italic}${text}${ANSI.reset}`;
|
|
45
|
-
}
|
|
46
|
-
return text;
|
|
47
|
-
});
|
|
48
|
-
result = result.replace(/(?<!_)_([^_]+)_(?!_)/g, (_match, text) => {
|
|
49
|
-
if (colorEnabled) {
|
|
50
|
-
return `${ANSI.italic}${text}${ANSI.reset}`;
|
|
51
|
-
}
|
|
52
|
-
return text;
|
|
53
|
-
});
|
|
54
|
-
result = result.replace(/`([^`]+)`/g, (_match, text) => {
|
|
55
|
-
if (colorEnabled) {
|
|
56
|
-
return `${ANSI.cyan}${text}${ANSI.reset}`;
|
|
57
|
-
}
|
|
58
|
-
return text;
|
|
59
|
-
});
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { renderMarkdown };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { VisualTheme } from "./cli-8hngbjyr";
|
|
2
|
-
/**
|
|
3
|
-
* Bold visual theme.
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* - Heavy/thick box-drawing borders (┏━┓)
|
|
7
|
-
* - Heavy tree guide style
|
|
8
|
-
* - Strong visual weight
|
|
9
|
-
*
|
|
10
|
-
* Inherits all other properties from {@link defaultTheme}.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { boldTheme } from "@outfitter/cli/theme/presets";
|
|
15
|
-
*
|
|
16
|
-
* // Use bold styling
|
|
17
|
-
* const box = renderBox("Hello", { border: boldTheme.border });
|
|
18
|
-
* // ┏━━━━━━━┓
|
|
19
|
-
* // ┃ Hello ┃
|
|
20
|
-
* // ┗━━━━━━━┛
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare const boldTheme: VisualTheme;
|
|
24
|
-
export { boldTheme };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
renderProgress
|
|
4
|
-
} from "./cli-bc17qeh2.js";
|
|
5
|
-
import {
|
|
6
|
-
demoSection
|
|
7
|
-
} from "./cli-sam2sq50.js";
|
|
8
|
-
|
|
9
|
-
// packages/cli/src/demo/renderers/progress.ts
|
|
10
|
-
function renderProgressDemo(config, _theme) {
|
|
11
|
-
const showCode = config.showCode ?? true;
|
|
12
|
-
const lines = [];
|
|
13
|
-
lines.push(demoSection("Basic Progress Bar"));
|
|
14
|
-
lines.push("");
|
|
15
|
-
if (showCode) {
|
|
16
|
-
lines.push('import { renderProgress } from "@outfitter/cli/render";');
|
|
17
|
-
lines.push("");
|
|
18
|
-
}
|
|
19
|
-
const percentages = [0, 25, 50, 75, 100];
|
|
20
|
-
for (const pct of percentages) {
|
|
21
|
-
const bar = renderProgress({ current: pct, total: 100 });
|
|
22
|
-
lines.push(`${pct.toString().padStart(3)}% ${bar}`);
|
|
23
|
-
}
|
|
24
|
-
lines.push("");
|
|
25
|
-
lines.push(demoSection("With Percentage Display"));
|
|
26
|
-
lines.push("");
|
|
27
|
-
if (showCode) {
|
|
28
|
-
lines.push("renderProgress({ current: 75, total: 100, showPercent: true })");
|
|
29
|
-
lines.push("");
|
|
30
|
-
}
|
|
31
|
-
lines.push(renderProgress({ current: 75, total: 100, showPercent: true }));
|
|
32
|
-
lines.push("");
|
|
33
|
-
lines.push(demoSection("Custom Width"));
|
|
34
|
-
lines.push("");
|
|
35
|
-
const widths = [10, 20, 30, 40];
|
|
36
|
-
for (const width of widths) {
|
|
37
|
-
if (showCode) {
|
|
38
|
-
lines.push(`renderProgress({ current: 50, total: 100, width: ${width} })`);
|
|
39
|
-
}
|
|
40
|
-
const bar = renderProgress({ current: 50, total: 100, width });
|
|
41
|
-
lines.push(` ${bar}`);
|
|
42
|
-
lines.push("");
|
|
43
|
-
}
|
|
44
|
-
lines.push(demoSection("Edge Cases"));
|
|
45
|
-
lines.push("");
|
|
46
|
-
lines.push("Empty (0%):");
|
|
47
|
-
lines.push(` ${renderProgress({ current: 0, total: 100 })}`);
|
|
48
|
-
lines.push("");
|
|
49
|
-
lines.push("Full (100%):");
|
|
50
|
-
lines.push(` ${renderProgress({ current: 100, total: 100 })}`);
|
|
51
|
-
lines.push("");
|
|
52
|
-
lines.push("Over 100% (capped):");
|
|
53
|
-
lines.push(` ${renderProgress({ current: 150, total: 100, showPercent: true })}`);
|
|
54
|
-
lines.push("");
|
|
55
|
-
lines.push("Negative (floored to 0%):");
|
|
56
|
-
lines.push(` ${renderProgress({ current: -10, total: 100, showPercent: true })}`);
|
|
57
|
-
return lines.join(`
|
|
58
|
-
`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { renderProgressDemo };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/streaming/ansi.ts
|
|
3
|
-
var ANSI = {
|
|
4
|
-
cursorUp: (n) => `\x1B[${n}A`,
|
|
5
|
-
cursorDown: (n) => `\x1B[${n}B`,
|
|
6
|
-
cursorRight: (n) => `\x1B[${n}C`,
|
|
7
|
-
cursorLeft: (n) => `\x1B[${n}D`,
|
|
8
|
-
cursorToStart: "\x1B[G",
|
|
9
|
-
clearLine: "\x1B[2K",
|
|
10
|
-
clearToEnd: "\x1B[0J",
|
|
11
|
-
clearToStart: "\x1B[1J",
|
|
12
|
-
clearScreen: "\x1B[2J",
|
|
13
|
-
hideCursor: "\x1B[?25l",
|
|
14
|
-
showCursor: "\x1B[?25h",
|
|
15
|
-
saveCursor: "\x1B[s",
|
|
16
|
-
restoreCursor: "\x1B[u",
|
|
17
|
-
carriageReturn: "\r",
|
|
18
|
-
newLine: `
|
|
19
|
-
`
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { ANSI };
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
INDICATORS,
|
|
4
|
-
getIndicator,
|
|
5
|
-
getProgressIndicator
|
|
6
|
-
} from "./cli-6ty1nvws.js";
|
|
7
|
-
import {
|
|
8
|
-
demoSection,
|
|
9
|
-
demoSubsection
|
|
10
|
-
} from "./cli-sam2sq50.js";
|
|
11
|
-
|
|
12
|
-
// packages/cli/src/demo/renderers/indicators.ts
|
|
13
|
-
function renderIndicatorsDemo(config, _theme) {
|
|
14
|
-
const showCode = config.showCode ?? true;
|
|
15
|
-
const lines = [];
|
|
16
|
-
lines.push(demoSection("Indicators"));
|
|
17
|
-
lines.push("");
|
|
18
|
-
if (showCode) {
|
|
19
|
-
lines.push('import { getIndicator, getProgressIndicator, INDICATORS } from "@outfitter/cli/render";');
|
|
20
|
-
lines.push("");
|
|
21
|
-
}
|
|
22
|
-
lines.push("Semantic indicators with Unicode and ASCII fallback support.");
|
|
23
|
-
lines.push("");
|
|
24
|
-
lines.push(demoSubsection("Status"));
|
|
25
|
-
lines.push("");
|
|
26
|
-
for (const [name, indicator] of Object.entries(INDICATORS.status)) {
|
|
27
|
-
const colorInfo = indicator.color ? ` (${indicator.color})` : "";
|
|
28
|
-
lines.push(` ${indicator.unicode} ${name.padEnd(10)} \u2192 ${indicator.fallback}${colorInfo}`);
|
|
29
|
-
}
|
|
30
|
-
lines.push("");
|
|
31
|
-
if (showCode) {
|
|
32
|
-
lines.push('getIndicator("status", "success") // ' + getIndicator("status", "success", true));
|
|
33
|
-
lines.push('getIndicator("status", "error") // ' + getIndicator("status", "error", true));
|
|
34
|
-
lines.push("");
|
|
35
|
-
}
|
|
36
|
-
lines.push(demoSubsection("Markers"));
|
|
37
|
-
lines.push("");
|
|
38
|
-
const markerGroups = {
|
|
39
|
-
Circles: [
|
|
40
|
-
"circle",
|
|
41
|
-
"circleOutline",
|
|
42
|
-
"circleDotted",
|
|
43
|
-
"circleSmall",
|
|
44
|
-
"circleDot",
|
|
45
|
-
"circleDotOutline"
|
|
46
|
-
],
|
|
47
|
-
Squares: ["square", "squareOutline", "squareSmall", "squareSmallOutline"],
|
|
48
|
-
Lozenges: ["lozenge", "lozengeOutline"],
|
|
49
|
-
Checkboxes: ["checkbox", "checkboxChecked", "checkboxCross"],
|
|
50
|
-
Pointers: ["pointer", "pointerSmall", "dash"]
|
|
51
|
-
};
|
|
52
|
-
for (const [groupName, names] of Object.entries(markerGroups)) {
|
|
53
|
-
lines.push(` ${groupName}:`);
|
|
54
|
-
for (const name of names) {
|
|
55
|
-
const indicator = INDICATORS.marker[name];
|
|
56
|
-
if (indicator) {
|
|
57
|
-
lines.push(` ${indicator.unicode} ${name.padEnd(18)} \u2192 ${indicator.fallback}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
lines.push("");
|
|
61
|
-
}
|
|
62
|
-
lines.push(demoSubsection("Progress"));
|
|
63
|
-
lines.push("");
|
|
64
|
-
lines.push(" Circle: \u25CB \u25D4 \u25D1 \u25D5 \u25CF");
|
|
65
|
-
lines.push(" Vertical: \u2581 \u2582 \u2583 \u2584 \u2585 \u2586 \u2587 \u2588");
|
|
66
|
-
lines.push(" Horizontal: \u258F \u258E \u258D \u258C \u258B \u258A \u2589 \u2588");
|
|
67
|
-
lines.push(" Shade: \u2591 \u2592 \u2593");
|
|
68
|
-
lines.push("");
|
|
69
|
-
if (showCode) {
|
|
70
|
-
lines.push("// Get progress indicator by percentage:");
|
|
71
|
-
lines.push('getProgressIndicator("circle", 50, 100) // ' + getProgressIndicator("circle", 50, 100, true));
|
|
72
|
-
lines.push('getProgressIndicator("vertical", 6, 8) // ' + getProgressIndicator("vertical", 6, 8, true));
|
|
73
|
-
lines.push('getProgressIndicator("horizontal", 4, 8) // ' + getProgressIndicator("horizontal", 4, 8, true));
|
|
74
|
-
lines.push('getProgressIndicator("shade", 100, 100) // ' + getProgressIndicator("shade", 100, 100, true));
|
|
75
|
-
lines.push("");
|
|
76
|
-
}
|
|
77
|
-
lines.push(demoSubsection("Triangles"));
|
|
78
|
-
lines.push("");
|
|
79
|
-
const triangleGroups = {
|
|
80
|
-
Up: ["up", "upSmall", "upOutline"],
|
|
81
|
-
Down: ["down", "downSmall", "downOutline"],
|
|
82
|
-
Left: ["left", "leftSmall", "leftOutline"],
|
|
83
|
-
Right: ["right", "rightSmall", "rightOutline"]
|
|
84
|
-
};
|
|
85
|
-
for (const [groupName, names] of Object.entries(triangleGroups)) {
|
|
86
|
-
const indicators = names.map((n) => INDICATORS.triangle[n]?.unicode ?? "").join(" ");
|
|
87
|
-
lines.push(` ${groupName.padEnd(6)} ${indicators}`);
|
|
88
|
-
}
|
|
89
|
-
lines.push("");
|
|
90
|
-
lines.push(demoSubsection("Special"));
|
|
91
|
-
lines.push("");
|
|
92
|
-
for (const [name, indicator] of Object.entries(INDICATORS.special)) {
|
|
93
|
-
lines.push(` ${indicator.unicode} ${name.padEnd(14)} \u2192 ${indicator.fallback}`);
|
|
94
|
-
}
|
|
95
|
-
lines.push("");
|
|
96
|
-
lines.push(demoSubsection("Directional"));
|
|
97
|
-
lines.push("");
|
|
98
|
-
for (const [name, indicator] of Object.entries(INDICATORS.directional)) {
|
|
99
|
-
lines.push(` ${indicator.unicode} ${name.padEnd(16)} \u2192 ${indicator.fallback}`);
|
|
100
|
-
}
|
|
101
|
-
lines.push("");
|
|
102
|
-
lines.push(demoSubsection("Math"));
|
|
103
|
-
lines.push("");
|
|
104
|
-
for (const [name, indicator] of Object.entries(INDICATORS.math)) {
|
|
105
|
-
lines.push(` ${indicator.unicode} ${name.padEnd(16)} \u2192 ${indicator.fallback}`);
|
|
106
|
-
}
|
|
107
|
-
lines.push("");
|
|
108
|
-
lines.push(demoSubsection("Usage"));
|
|
109
|
-
lines.push("");
|
|
110
|
-
lines.push("\u2022 getIndicator(category, name) \u2014 auto-detects Unicode support");
|
|
111
|
-
lines.push("\u2022 getProgressIndicator(style, current, max) \u2014 maps value to step");
|
|
112
|
-
lines.push("\u2022 INDICATORS[category][name] \u2014 direct access to unicode/fallback");
|
|
113
|
-
lines.push("\u2022 Status indicators include semantic color hints");
|
|
114
|
-
return lines.join(`
|
|
115
|
-
`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { renderIndicatorsDemo };
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
TREE_GUIDES
|
|
4
|
-
} from "./cli-b5c2k0d7.js";
|
|
5
|
-
import {
|
|
6
|
-
getIndicator,
|
|
7
|
-
isUnicodeSupported
|
|
8
|
-
} from "./cli-6ty1nvws.js";
|
|
9
|
-
import {
|
|
10
|
-
joinHorizontal,
|
|
11
|
-
joinVertical
|
|
12
|
-
} from "./cli-aem6v4c8.js";
|
|
13
|
-
import {
|
|
14
|
-
exports_box,
|
|
15
|
-
init_box,
|
|
16
|
-
renderBox
|
|
17
|
-
} from "./cli-jp0k3qd9.js";
|
|
18
|
-
import {
|
|
19
|
-
getStringWidth,
|
|
20
|
-
init_text
|
|
21
|
-
} from "./cli-mwxsh3sr.js";
|
|
22
|
-
import {
|
|
23
|
-
__toCommonJS
|
|
24
|
-
} from "./cli-v1tzwxkt.js";
|
|
25
|
-
|
|
26
|
-
// packages/cli/src/render/stack.ts
|
|
27
|
-
init_box();
|
|
28
|
-
init_text();
|
|
29
|
-
var DELIMITERS = {
|
|
30
|
-
space: { unicode: " ", fallback: " " },
|
|
31
|
-
bullet: { unicode: "\u2022", fallback: "*" },
|
|
32
|
-
dot: { unicode: "\xB7", fallback: "." },
|
|
33
|
-
pipe: { unicode: "\u2502", fallback: "|" },
|
|
34
|
-
arrow: { unicode: "\u2192", fallback: "->" },
|
|
35
|
-
slash: { unicode: "/", fallback: "/" },
|
|
36
|
-
colon: { unicode: ":", fallback: ":" }
|
|
37
|
-
};
|
|
38
|
-
function getDelimiter(name, forceUnicode) {
|
|
39
|
-
const delimiter = DELIMITERS[name];
|
|
40
|
-
const useUnicode = forceUnicode ?? isUnicodeSupported();
|
|
41
|
-
return useUnicode ? delimiter.unicode : delimiter.fallback;
|
|
42
|
-
}
|
|
43
|
-
function getMarker(nameOrChar, forceUnicode) {
|
|
44
|
-
const knownMarkers = [
|
|
45
|
-
"circleDot",
|
|
46
|
-
"circleOutline",
|
|
47
|
-
"circle",
|
|
48
|
-
"checkbox",
|
|
49
|
-
"checkboxChecked",
|
|
50
|
-
"pointer",
|
|
51
|
-
"dash"
|
|
52
|
-
];
|
|
53
|
-
if (knownMarkers.includes(nameOrChar)) {
|
|
54
|
-
return getIndicator("marker", nameOrChar, forceUnicode);
|
|
55
|
-
}
|
|
56
|
-
return nameOrChar;
|
|
57
|
-
}
|
|
58
|
-
var DEFAULT_STACK_THEME = {
|
|
59
|
-
markers: {
|
|
60
|
-
default: "circleOutline",
|
|
61
|
-
current: "circleDot",
|
|
62
|
-
focused: "pointer",
|
|
63
|
-
checked: "checkboxChecked",
|
|
64
|
-
disabled: "dash"
|
|
65
|
-
},
|
|
66
|
-
delimiter: "bullet",
|
|
67
|
-
guide: "single"
|
|
68
|
-
};
|
|
69
|
-
function isRenderable(value) {
|
|
70
|
-
return typeof value === "object" && value !== null && "output" in value && "width" in value && "height" in value && typeof value.output === "string" && typeof value.width === "number" && typeof value.height === "number";
|
|
71
|
-
}
|
|
72
|
-
function isDelimiterName(value) {
|
|
73
|
-
return value in DELIMITERS;
|
|
74
|
-
}
|
|
75
|
-
function resolveDelimiter(delimiter) {
|
|
76
|
-
if (delimiter === undefined) {
|
|
77
|
-
return getDelimiter("space");
|
|
78
|
-
}
|
|
79
|
-
if (isDelimiterName(delimiter)) {
|
|
80
|
-
return getDelimiter(delimiter);
|
|
81
|
-
}
|
|
82
|
-
return delimiter;
|
|
83
|
-
}
|
|
84
|
-
function normalizeItem(item) {
|
|
85
|
-
if (typeof item === "string") {
|
|
86
|
-
return { content: item };
|
|
87
|
-
}
|
|
88
|
-
if (isRenderable(item)) {
|
|
89
|
-
return { content: item.output };
|
|
90
|
-
}
|
|
91
|
-
return item;
|
|
92
|
-
}
|
|
93
|
-
function shouldShowMarker(item) {
|
|
94
|
-
return item.state !== undefined || item.marker !== undefined;
|
|
95
|
-
}
|
|
96
|
-
function resolveMarker(item, theme) {
|
|
97
|
-
if (!shouldShowMarker(item)) {
|
|
98
|
-
return { marker: "", show: false };
|
|
99
|
-
}
|
|
100
|
-
if (item.marker !== undefined) {
|
|
101
|
-
return { marker: getMarker(item.marker), show: true };
|
|
102
|
-
}
|
|
103
|
-
const state = item.state ?? "default";
|
|
104
|
-
const markerName = theme.markers[state];
|
|
105
|
-
return { marker: getMarker(markerName), show: true };
|
|
106
|
-
}
|
|
107
|
-
function getContentLines(content) {
|
|
108
|
-
if (typeof content === "string") {
|
|
109
|
-
return content.split(`
|
|
110
|
-
`);
|
|
111
|
-
}
|
|
112
|
-
return content;
|
|
113
|
-
}
|
|
114
|
-
function applyStyle(content, style) {
|
|
115
|
-
return style ? style(content) : content;
|
|
116
|
-
}
|
|
117
|
-
function hstack(items, options) {
|
|
118
|
-
if (items.length === 0)
|
|
119
|
-
return "";
|
|
120
|
-
const normalizedItems = items.map(normalizeItem);
|
|
121
|
-
const delimiter = resolveDelimiter(options?.delimiter);
|
|
122
|
-
const gap = options?.gap ?? 0;
|
|
123
|
-
const align = options?.align ?? "top";
|
|
124
|
-
const gapStr = " ".repeat(gap);
|
|
125
|
-
const fullDelimiter = `${gapStr}${delimiter}${gapStr}`;
|
|
126
|
-
const contentStrings = normalizedItems.map((item) => {
|
|
127
|
-
const lines = getContentLines(item.content);
|
|
128
|
-
const styledLines = lines.map((line) => applyStyle(line, item.style));
|
|
129
|
-
return styledLines.join(`
|
|
130
|
-
`);
|
|
131
|
-
});
|
|
132
|
-
const isMultiLine = contentStrings.some((s) => s.includes(`
|
|
133
|
-
`));
|
|
134
|
-
if (!isMultiLine) {
|
|
135
|
-
return contentStrings.join(fullDelimiter);
|
|
136
|
-
}
|
|
137
|
-
const blocks = contentStrings.map((content, idx) => {
|
|
138
|
-
if (idx === contentStrings.length - 1) {
|
|
139
|
-
return content;
|
|
140
|
-
}
|
|
141
|
-
const lines = content.split(`
|
|
142
|
-
`);
|
|
143
|
-
return lines.map((line) => line + fullDelimiter).join(`
|
|
144
|
-
`);
|
|
145
|
-
});
|
|
146
|
-
return joinHorizontal(blocks, { gap: 0, align });
|
|
147
|
-
}
|
|
148
|
-
function createHStack(items, options) {
|
|
149
|
-
const output = hstack(items, options);
|
|
150
|
-
const lines = output.split(`
|
|
151
|
-
`);
|
|
152
|
-
const width = Math.max(...lines.map(getStringWidth));
|
|
153
|
-
return {
|
|
154
|
-
output,
|
|
155
|
-
width,
|
|
156
|
-
height: lines.length
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function vstackItem(header, body, options) {
|
|
160
|
-
const content = body && body.length > 0 ? [header, ...body] : [header];
|
|
161
|
-
const result = {
|
|
162
|
-
content,
|
|
163
|
-
state: options?.state ?? "default"
|
|
164
|
-
};
|
|
165
|
-
if (options?.marker !== undefined) {
|
|
166
|
-
result.marker = options.marker;
|
|
167
|
-
}
|
|
168
|
-
if (options?.compact !== undefined) {
|
|
169
|
-
result.compact = options.compact;
|
|
170
|
-
}
|
|
171
|
-
if (options?.style !== undefined) {
|
|
172
|
-
result.style = options.style;
|
|
173
|
-
}
|
|
174
|
-
return result;
|
|
175
|
-
}
|
|
176
|
-
var GUIDE_CHARS = {
|
|
177
|
-
single: "\u2502",
|
|
178
|
-
heavy: "\u2503",
|
|
179
|
-
double: "\u2551",
|
|
180
|
-
rounded: "\u2502"
|
|
181
|
-
};
|
|
182
|
-
function renderPlainMode(items, theme, gap) {
|
|
183
|
-
const lines = [];
|
|
184
|
-
for (const item of items) {
|
|
185
|
-
const { marker, show } = resolveMarker(item, theme);
|
|
186
|
-
const contentLines = getContentLines(item.content);
|
|
187
|
-
const prefix = show ? `${marker} ` : "";
|
|
188
|
-
const firstLine = contentLines[0];
|
|
189
|
-
if (firstLine !== undefined) {
|
|
190
|
-
const styled = applyStyle(firstLine, item.style);
|
|
191
|
-
lines.push(`${prefix}${styled}`);
|
|
192
|
-
}
|
|
193
|
-
const indent = show ? " " : "";
|
|
194
|
-
for (let i = 1;i < contentLines.length; i++) {
|
|
195
|
-
const line = contentLines[i];
|
|
196
|
-
if (line !== undefined) {
|
|
197
|
-
const styled = applyStyle(line, item.style);
|
|
198
|
-
lines.push(`${indent}${styled}`);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return joinVertical(lines, { gap });
|
|
203
|
-
}
|
|
204
|
-
function renderGuideMode(items, theme, guideStyle) {
|
|
205
|
-
const lines = [];
|
|
206
|
-
const guideChar = GUIDE_CHARS[guideStyle];
|
|
207
|
-
for (let itemIdx = 0;itemIdx < items.length; itemIdx++) {
|
|
208
|
-
const item = items[itemIdx];
|
|
209
|
-
if (!item)
|
|
210
|
-
continue;
|
|
211
|
-
const { marker, show } = resolveMarker(item, theme);
|
|
212
|
-
const contentLines = getContentLines(item.content);
|
|
213
|
-
const isLastItem = itemIdx === items.length - 1;
|
|
214
|
-
const displayMarker = show ? marker : getMarker(theme.markers.default);
|
|
215
|
-
const firstLine = contentLines[0];
|
|
216
|
-
if (firstLine !== undefined) {
|
|
217
|
-
const styled = applyStyle(firstLine, item.style);
|
|
218
|
-
lines.push(`${displayMarker} ${styled}`);
|
|
219
|
-
}
|
|
220
|
-
for (let i = 1;i < contentLines.length; i++) {
|
|
221
|
-
const line = contentLines[i];
|
|
222
|
-
if (line !== undefined) {
|
|
223
|
-
const styled = applyStyle(line, item.style);
|
|
224
|
-
lines.push(`${guideChar} ${styled}`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (!isLastItem) {
|
|
228
|
-
lines.push(guideChar);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return lines.join(`
|
|
232
|
-
`);
|
|
233
|
-
}
|
|
234
|
-
function renderTreeMode(items, guideStyle) {
|
|
235
|
-
const lines = [];
|
|
236
|
-
const guides = TREE_GUIDES[guideStyle];
|
|
237
|
-
for (let itemIdx = 0;itemIdx < items.length; itemIdx++) {
|
|
238
|
-
const item = items[itemIdx];
|
|
239
|
-
if (!item)
|
|
240
|
-
continue;
|
|
241
|
-
const contentLines = getContentLines(item.content);
|
|
242
|
-
const isLastItem = itemIdx === items.length - 1;
|
|
243
|
-
const connector = isLastItem ? guides.end : guides.fork;
|
|
244
|
-
const continuation = isLastItem ? " " : guides.vertical;
|
|
245
|
-
const firstLine = contentLines[0];
|
|
246
|
-
if (firstLine !== undefined) {
|
|
247
|
-
const styled = applyStyle(firstLine, item.style);
|
|
248
|
-
lines.push(`${connector}${styled}`);
|
|
249
|
-
}
|
|
250
|
-
for (let i = 1;i < contentLines.length; i++) {
|
|
251
|
-
const line = contentLines[i];
|
|
252
|
-
if (line !== undefined) {
|
|
253
|
-
const styled = applyStyle(line, item.style);
|
|
254
|
-
lines.push(`${continuation}${styled}`);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return lines.join(`
|
|
259
|
-
`);
|
|
260
|
-
}
|
|
261
|
-
function renderBoxedMode(items, gap) {
|
|
262
|
-
const boxes = [];
|
|
263
|
-
for (const item of items) {
|
|
264
|
-
const contentLines = getContentLines(item.content);
|
|
265
|
-
const styled = contentLines.map((line) => applyStyle(line, item.style));
|
|
266
|
-
boxes.push(renderBox(styled));
|
|
267
|
-
}
|
|
268
|
-
return joinVertical(boxes, { gap });
|
|
269
|
-
}
|
|
270
|
-
function renderCompactMode(items, theme) {
|
|
271
|
-
const lines = [];
|
|
272
|
-
for (const item of items) {
|
|
273
|
-
const { marker, show } = resolveMarker(item, theme);
|
|
274
|
-
const displayMarker = show ? marker : getMarker(theme.markers.default);
|
|
275
|
-
let displayText;
|
|
276
|
-
if (item.compact) {
|
|
277
|
-
displayText = item.compact;
|
|
278
|
-
} else {
|
|
279
|
-
const contentLines = getContentLines(item.content);
|
|
280
|
-
displayText = contentLines[0] ?? "";
|
|
281
|
-
}
|
|
282
|
-
const styled = applyStyle(displayText, item.style);
|
|
283
|
-
lines.push(`${displayMarker} ${styled}`);
|
|
284
|
-
}
|
|
285
|
-
return lines.join(`
|
|
286
|
-
`);
|
|
287
|
-
}
|
|
288
|
-
function vstack(items, options) {
|
|
289
|
-
if (items.length === 0)
|
|
290
|
-
return "";
|
|
291
|
-
const normalizedItems = items.map(normalizeItem);
|
|
292
|
-
const mode = options?.mode ?? "guide";
|
|
293
|
-
const gap = options?.gap ?? 0;
|
|
294
|
-
const theme = {
|
|
295
|
-
...DEFAULT_STACK_THEME,
|
|
296
|
-
...options?.theme,
|
|
297
|
-
markers: {
|
|
298
|
-
...DEFAULT_STACK_THEME.markers,
|
|
299
|
-
...options?.theme?.markers
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const guideStyle = options?.guide ?? theme.guide ?? "single";
|
|
303
|
-
switch (mode) {
|
|
304
|
-
case "plain":
|
|
305
|
-
return renderPlainMode(normalizedItems, theme, gap);
|
|
306
|
-
case "guide":
|
|
307
|
-
return renderGuideMode(normalizedItems, theme, guideStyle);
|
|
308
|
-
case "tree":
|
|
309
|
-
return renderTreeMode(normalizedItems, guideStyle);
|
|
310
|
-
case "boxed":
|
|
311
|
-
return renderBoxedMode(normalizedItems, gap);
|
|
312
|
-
case "compact":
|
|
313
|
-
return renderCompactMode(normalizedItems, theme);
|
|
314
|
-
default: {
|
|
315
|
-
const _exhaustive = mode;
|
|
316
|
-
return _exhaustive;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
function createVStack(items, options) {
|
|
321
|
-
const output = vstack(items, options);
|
|
322
|
-
const lines = output.split(`
|
|
323
|
-
`);
|
|
324
|
-
const width = Math.max(...lines.map(getStringWidth), 0);
|
|
325
|
-
return {
|
|
326
|
-
output,
|
|
327
|
-
width,
|
|
328
|
-
height: lines.length
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function boxify(content, options) {
|
|
332
|
-
const { createBox: makeBox } = (init_box(), __toCommonJS(exports_box));
|
|
333
|
-
const boxContent = isRenderable(content) ? content.output : content;
|
|
334
|
-
const boxOptions = {
|
|
335
|
-
border: options?.border ?? "single"
|
|
336
|
-
};
|
|
337
|
-
if (options?.title !== undefined) {
|
|
338
|
-
boxOptions.title = options.title;
|
|
339
|
-
}
|
|
340
|
-
if (options?.padding !== undefined) {
|
|
341
|
-
boxOptions.padding = options.padding;
|
|
342
|
-
}
|
|
343
|
-
return makeBox(boxContent, boxOptions);
|
|
344
|
-
}
|
|
345
|
-
function unbox(content) {
|
|
346
|
-
if (isRenderable(content)) {
|
|
347
|
-
return content.output;
|
|
348
|
-
}
|
|
349
|
-
return content;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export { DELIMITERS, getDelimiter, getMarker, DEFAULT_STACK_THEME, isRenderable, hstack, createHStack, vstackItem, vstack, createVStack, boxify, unbox };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { VisualTheme } from "./cli-8hngbjyr";
|
|
2
|
-
/**
|
|
3
|
-
* Default visual theme.
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* - Single-line box-drawing borders (┌─┐)
|
|
7
|
-
* - Standard status indicators
|
|
8
|
-
* - Bullet delimiters
|
|
9
|
-
* - Dots spinner
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { defaultTheme } from "@outfitter/cli/theme/presets";
|
|
14
|
-
*
|
|
15
|
-
* // Use default styling
|
|
16
|
-
* const box = renderBox("Hello", { border: defaultTheme.border });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare const defaultTheme: VisualTheme;
|
|
20
|
-
export { defaultTheme };
|