@outfitter/cli 0.1.0-rc.2 → 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/README.md +21 -32
- package/dist/actions.d.ts +12 -1
- package/dist/actions.js +170 -3
- package/dist/borders/index.d.ts +3 -0
- package/dist/borders/index.js +13 -0
- package/dist/box/index.d.ts +4 -0
- package/dist/box/index.js +13 -0
- package/dist/cli.js +1 -1
- package/dist/colors/index.d.ts +3 -0
- package/dist/colors/index.js +18 -0
- package/dist/command.d.ts +40 -3
- package/dist/command.js +45 -3
- package/dist/demo/index.d.ts +78 -0
- package/dist/demo/index.js +148 -0
- package/dist/demo/registry.d.ts +7 -0
- package/dist/demo/registry.js +28 -0
- package/dist/demo/renderers/borders.d.ts +7 -0
- package/dist/demo/renderers/borders.js +17 -0
- package/dist/demo/renderers/box.d.ts +7 -0
- package/dist/demo/renderers/box.js +18 -0
- package/dist/demo/renderers/colors.d.ts +7 -0
- package/dist/demo/renderers/colors.js +18 -0
- package/dist/demo/renderers/indicators.d.ts +7 -0
- package/dist/demo/renderers/indicators.js +17 -0
- package/dist/demo/renderers/list.d.ts +7 -0
- package/dist/demo/renderers/list.js +19 -0
- package/dist/demo/renderers/markdown.d.ts +7 -0
- package/dist/demo/renderers/markdown.js +18 -0
- package/dist/demo/renderers/progress.d.ts +7 -0
- package/dist/demo/renderers/progress.js +17 -0
- package/dist/demo/renderers/spinner.d.ts +7 -0
- package/dist/demo/renderers/spinner.js +19 -0
- package/dist/demo/renderers/table.d.ts +7 -0
- package/dist/demo/renderers/table.js +19 -0
- package/dist/demo/renderers/text.d.ts +7 -0
- package/dist/demo/renderers/text.js +16 -0
- package/dist/demo/renderers/tree.d.ts +7 -0
- package/dist/demo/renderers/tree.js +18 -0
- package/dist/demo/section.d.ts +5 -0
- package/dist/demo/section.js +23 -0
- package/dist/demo/templates.d.ts +4 -0
- package/dist/demo/templates.js +10 -0
- package/dist/demo/types.d.ts +3 -0
- package/dist/demo/types.js +8 -0
- package/dist/index.d.ts +5 -8
- package/dist/index.js +9 -43
- package/dist/input.d.ts +163 -2
- package/dist/input.js +425 -11
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +9 -0
- package/dist/output.js +1 -1
- package/dist/pagination.d.ts +62 -2
- package/dist/pagination.js +84 -6
- package/dist/preset/full.d.ts +14 -0
- package/dist/preset/full.js +41 -0
- package/dist/preset/standard.d.ts +11 -0
- package/dist/preset/standard.js +30 -0
- package/dist/prompt/confirm.d.ts +4 -0
- package/dist/prompt/confirm.js +9 -0
- package/dist/prompt/group.d.ts +4 -0
- package/dist/prompt/group.js +9 -0
- package/dist/prompt/index.d.ts +7 -0
- package/dist/prompt/index.js +32 -0
- package/dist/prompt/select.d.ts +4 -0
- package/dist/prompt/select.js +11 -0
- package/dist/prompt/text.d.ts +4 -0
- package/dist/prompt/text.js +11 -0
- package/dist/prompt/types.d.ts +3 -0
- package/dist/prompt/types.js +8 -0
- package/dist/prompt/validators.d.ts +2 -0
- package/dist/prompt/validators.js +8 -0
- package/dist/render/borders.d.ts +2 -0
- package/dist/render/borders.js +15 -0
- package/dist/render/box.d.ts +3 -0
- package/dist/render/box.js +23 -0
- package/dist/render/colors.d.ts +1 -1
- package/dist/render/colors.js +6 -3
- package/dist/render/date.js +1 -1
- package/dist/render/format-relative.js +1 -1
- package/dist/render/format.js +1 -1
- package/dist/render/heading.d.ts +3 -0
- package/dist/render/heading.js +14 -0
- package/dist/render/index.d.ts +26 -7
- package/dist/render/index.js +160 -26
- package/dist/render/indicators.d.ts +2 -0
- package/dist/render/indicators.js +14 -0
- package/dist/render/json.js +1 -1
- package/dist/render/layout.d.ts +5 -0
- package/dist/render/layout.js +25 -0
- package/dist/render/list.d.ts +2 -2
- package/dist/render/list.js +2 -2
- package/dist/render/markdown.js +4 -4
- package/dist/render/progress.js +1 -1
- package/dist/render/separator.d.ts +3 -0
- package/dist/render/separator.js +14 -0
- package/dist/render/shapes.js +10 -9
- package/dist/render/spinner.d.ts +2 -0
- package/dist/render/spinner.js +12 -0
- package/dist/render/stack.d.ts +3 -0
- package/dist/render/stack.js +38 -0
- package/dist/render/table.d.ts +2 -1
- package/dist/render/table.js +6 -5
- package/dist/render/text.d.ts +1 -1
- package/dist/render/text.js +7 -4
- package/dist/render/tree.d.ts +2 -2
- package/dist/render/tree.js +5 -3
- package/dist/render/types.d.ts +2 -0
- package/dist/render/types.js +1 -0
- package/dist/shared/@outfitter/cli-0ggcy7fa.js +20 -0
- package/dist/shared/@outfitter/cli-0psys2vm.js +7 -0
- package/dist/shared/@outfitter/cli-1bghjef6.js +352 -0
- package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +45 -0
- package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +50 -0
- package/dist/shared/@outfitter/cli-34fqr7bp.js +37 -0
- package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +97 -0
- package/dist/shared/@outfitter/cli-3dxmmy4c.d.ts +20 -0
- package/dist/shared/@outfitter/cli-3f12z5kf.d.ts +83 -0
- package/dist/shared/@outfitter/cli-3t2zaenc.d.ts +59 -0
- package/dist/shared/@outfitter/{cli-dds0qqvm.d.ts → cli-4cb5g831.d.ts} +2 -0
- package/dist/shared/@outfitter/cli-4w2a1rfy.d.ts +23 -0
- package/dist/shared/@outfitter/cli-4x6pqnez.js +20 -0
- package/dist/shared/@outfitter/cli-671sxkhj.js +146 -0
- package/dist/shared/@outfitter/cli-6bztk73z.d.ts +51 -0
- package/dist/shared/@outfitter/cli-6fxffp8k.js +1 -0
- package/dist/shared/@outfitter/cli-6j9qynm8.js +118 -0
- package/dist/shared/@outfitter/cli-6m988kh0.d.ts +61 -0
- package/dist/shared/@outfitter/cli-74ba31gz.js +134 -0
- package/dist/shared/@outfitter/cli-7gnrb8cr.js +214 -0
- package/dist/shared/@outfitter/cli-7nm6edvh.d.ts +17 -0
- package/dist/shared/@outfitter/cli-85fg2vr5.js +123 -0
- package/dist/shared/@outfitter/cli-8a8xrzhy.js +20 -0
- package/dist/shared/@outfitter/cli-8bwaw3pz.js +7 -0
- package/dist/shared/@outfitter/cli-8rx4g3s5.d.ts +41 -0
- package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +223 -0
- package/dist/shared/@outfitter/cli-96b2p4td.d.ts +56 -0
- package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +190 -0
- package/dist/shared/@outfitter/cli-9mtjjykw.js +67 -0
- package/dist/shared/@outfitter/{cli-ag0w4pk0.js → cli-9nbyj2bt.js} +60 -21
- package/dist/shared/@outfitter/{cli-azzk8a1d.js → cli-afhjqmg3.js} +7 -3
- package/dist/shared/@outfitter/cli-an9j0h80.js +117 -0
- package/dist/shared/@outfitter/cli-ay411nbr.js +122 -0
- package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +132 -0
- package/dist/shared/@outfitter/cli-b5c2k0d7.js +39 -0
- package/dist/shared/@outfitter/cli-b5epywry.js +1 -0
- package/dist/shared/@outfitter/cli-bcmcaz1b.js +23 -0
- package/dist/shared/@outfitter/cli-bf3vma4q.js +61 -0
- package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +53 -0
- package/dist/shared/@outfitter/cli-cs45xd6q.js +59 -0
- package/dist/shared/@outfitter/cli-d7jpshq5.d.ts +128 -0
- package/dist/shared/@outfitter/{cli-jbj78ac5.js → cli-d9ad0rqj.js} +6 -1
- package/dist/shared/@outfitter/cli-daw296mv.js +61 -0
- package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +91 -0
- package/dist/shared/@outfitter/cli-e73v3qqy.d.ts +93 -0
- package/dist/shared/@outfitter/cli-en6zn6sj.js +1 -0
- package/dist/shared/@outfitter/cli-ep2cvtk8.js +48 -0
- package/dist/shared/@outfitter/cli-f75h8e94.js +7 -0
- package/dist/shared/@outfitter/cli-fakncnjp.d.ts +106 -0
- package/dist/shared/@outfitter/cli-feb5j90n.js +94 -0
- package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +66 -0
- package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +328 -0
- package/dist/shared/@outfitter/cli-j4n8gaf3.js +95 -0
- package/dist/shared/@outfitter/cli-jejfypgf.js +85 -0
- package/dist/shared/@outfitter/{cli-wqc652mx.js → cli-jhcdwvpn.js} +8 -8
- package/dist/shared/@outfitter/{cli-v9mjsvjh.js → cli-jjemfdta.js} +13 -46
- package/dist/shared/@outfitter/cli-kc84wmch.js +267 -0
- package/dist/shared/@outfitter/cli-ktqme80d.js +7 -0
- package/dist/shared/@outfitter/cli-mq0jp15z.js +1 -0
- package/dist/shared/@outfitter/cli-mymyavvj.d.ts +26 -0
- package/dist/shared/@outfitter/cli-n17gt1dz.js +19 -0
- package/dist/shared/@outfitter/cli-n9dbh0hp.js +51 -0
- package/dist/shared/@outfitter/cli-nvvc92c8.js +128 -0
- package/dist/shared/@outfitter/cli-p1m5dhrs.js +169 -0
- package/dist/shared/@outfitter/cli-p38sfxyk.js +25 -0
- package/dist/shared/@outfitter/cli-p3dqm1vd.js +22 -0
- package/dist/shared/@outfitter/cli-p9j1phge.js +20 -0
- package/dist/shared/@outfitter/cli-pkxmzavm.js +62 -0
- package/dist/shared/@outfitter/cli-q8r6jarq.d.ts +24 -0
- package/dist/shared/@outfitter/{cli-2y3kxew8.d.ts → cli-qj83y5wj.d.ts} +22 -9
- package/dist/shared/@outfitter/cli-qjfc3j11.d.ts +112 -0
- package/dist/shared/@outfitter/cli-qp4cbhqr.js +70 -0
- package/dist/shared/@outfitter/cli-s0kkx9m1.d.ts +164 -0
- package/dist/shared/@outfitter/cli-snxj55n6.js +43 -0
- package/dist/shared/@outfitter/cli-swwxvjvm.d.ts +24 -0
- package/dist/shared/@outfitter/cli-sx67mmfx.d.ts +98 -0
- package/dist/shared/@outfitter/cli-tarpsa8a.js +30 -0
- package/dist/shared/@outfitter/cli-thvzhjd1.js +126 -0
- package/dist/shared/@outfitter/cli-tqewy503.d.ts +36 -0
- package/dist/shared/@outfitter/cli-tvw1xrdj.js +20 -0
- package/dist/shared/@outfitter/cli-v1tzwxkt.js +32 -0
- package/dist/shared/@outfitter/cli-vd60dj65.js +1 -0
- package/dist/shared/@outfitter/cli-vp88gxev.js +279 -0
- package/dist/shared/@outfitter/cli-vstbkzky.d.ts +74 -0
- package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +54 -0
- package/dist/shared/@outfitter/cli-w5y3xepp.js +20 -0
- package/dist/shared/@outfitter/cli-x4cavvc0.js +1 -0
- package/dist/shared/@outfitter/cli-xep6v2c0.js +52 -0
- package/dist/shared/@outfitter/cli-xg5y5fhk.js +86 -0
- package/dist/shared/@outfitter/{cli-n51t773m.d.ts → cli-xsaheemc.d.ts} +44 -4
- package/dist/shared/@outfitter/cli-xvqtqjxk.js +82 -0
- package/dist/shared/@outfitter/cli-y25tt8nc.d.ts +48 -0
- package/dist/streaming/ansi.d.ts +2 -0
- package/dist/streaming/ansi.js +8 -0
- package/dist/streaming/index.d.ts +4 -0
- package/dist/streaming/index.js +17 -0
- package/dist/streaming/spinner.d.ts +3 -0
- package/dist/streaming/spinner.js +10 -0
- package/dist/streaming/writer.d.ts +2 -0
- package/dist/streaming/writer.js +9 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +13 -0
- package/dist/terminal/detection.js +5 -2
- package/dist/terminal/index.js +6 -2
- package/dist/theme/context.d.ts +9 -0
- package/dist/theme/context.js +14 -0
- package/dist/theme/create.d.ts +8 -0
- package/dist/theme/create.js +12 -0
- package/dist/theme/index.d.ts +17 -0
- package/dist/theme/index.js +42 -0
- package/dist/theme/presets/bold.d.ts +8 -0
- package/dist/theme/presets/bold.js +12 -0
- package/dist/theme/presets/default.d.ts +8 -0
- package/dist/theme/presets/default.js +11 -0
- package/dist/theme/presets/index.d.ts +12 -0
- package/dist/theme/presets/index.js +24 -0
- package/dist/theme/presets/minimal.d.ts +8 -0
- package/dist/theme/presets/minimal.js +12 -0
- package/dist/theme/presets/rounded.d.ts +8 -0
- package/dist/theme/presets/rounded.js +12 -0
- package/dist/theme/resolve.d.ts +8 -0
- package/dist/theme/resolve.js +11 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/types.js +1 -0
- package/dist/tree/index.d.ts +3 -0
- package/dist/tree/index.js +11 -0
- package/dist/types.js +1 -1
- package/package.json +168 -54
- package/dist/shared/@outfitter/cli-2vs2gxa8.js +0 -429
- package/dist/shared/@outfitter/cli-2yq94zst.d.ts +0 -39
- package/dist/shared/@outfitter/cli-6xc869x1.js +0 -26
- package/dist/shared/@outfitter/cli-7km1e58p.js +0 -85
- package/dist/shared/@outfitter/cli-8r0bnyyx.js +0 -43
- package/dist/shared/@outfitter/cli-afecwfrn.d.ts +0 -13
- package/dist/shared/@outfitter/cli-bt423m6y.js +0 -4
- package/dist/shared/@outfitter/cli-d4fegbad.d.ts +0 -66
- package/dist/shared/@outfitter/cli-e0ecw3x1.js +0 -64
- package/dist/shared/@outfitter/cli-fheaaa6b.js +0 -25
- package/dist/shared/@outfitter/cli-j361wp3g.d.ts +0 -41
- package/dist/shared/@outfitter/cli-p0m2fc51.js +0 -172
- package/dist/shared/@outfitter/cli-tyajr8qa.d.ts +0 -63
- package/dist/shared/@outfitter/cli-zs6jy1am.d.ts +0 -164
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/demo/registry.ts
|
|
3
|
+
var THEME_METHOD_META = {
|
|
4
|
+
success: {
|
|
5
|
+
category: "semantic",
|
|
6
|
+
description: "Green for success messages",
|
|
7
|
+
defaultExample: "Operation completed"
|
|
8
|
+
},
|
|
9
|
+
warning: {
|
|
10
|
+
category: "semantic",
|
|
11
|
+
description: "Yellow for warnings",
|
|
12
|
+
defaultExample: "Proceed with caution"
|
|
13
|
+
},
|
|
14
|
+
error: {
|
|
15
|
+
category: "semantic",
|
|
16
|
+
description: "Red for errors",
|
|
17
|
+
defaultExample: "Something went wrong"
|
|
18
|
+
},
|
|
19
|
+
info: {
|
|
20
|
+
category: "semantic",
|
|
21
|
+
description: "Blue for information",
|
|
22
|
+
defaultExample: "For your information"
|
|
23
|
+
},
|
|
24
|
+
primary: {
|
|
25
|
+
category: "semantic",
|
|
26
|
+
description: "Default text (no color)",
|
|
27
|
+
defaultExample: "Main content"
|
|
28
|
+
},
|
|
29
|
+
secondary: {
|
|
30
|
+
category: "semantic",
|
|
31
|
+
description: "Gray for secondary text",
|
|
32
|
+
defaultExample: "Supporting text"
|
|
33
|
+
},
|
|
34
|
+
muted: {
|
|
35
|
+
category: "semantic",
|
|
36
|
+
description: "Dim for de-emphasized text",
|
|
37
|
+
defaultExample: "(optional)"
|
|
38
|
+
},
|
|
39
|
+
accent: {
|
|
40
|
+
category: "semantic",
|
|
41
|
+
description: "Cyan for highlights",
|
|
42
|
+
defaultExample: "Highlighted item"
|
|
43
|
+
},
|
|
44
|
+
highlight: {
|
|
45
|
+
category: "semantic",
|
|
46
|
+
description: "Bold for emphasis",
|
|
47
|
+
defaultExample: "Important"
|
|
48
|
+
},
|
|
49
|
+
link: {
|
|
50
|
+
category: "semantic",
|
|
51
|
+
description: "Cyan + underline for URLs",
|
|
52
|
+
defaultExample: "https://example.com"
|
|
53
|
+
},
|
|
54
|
+
destructive: {
|
|
55
|
+
category: "semantic",
|
|
56
|
+
description: "Bright red for dangerous actions",
|
|
57
|
+
defaultExample: "Delete forever"
|
|
58
|
+
},
|
|
59
|
+
subtle: {
|
|
60
|
+
category: "semantic",
|
|
61
|
+
description: "Dim gray for fine print",
|
|
62
|
+
defaultExample: "Fine print"
|
|
63
|
+
},
|
|
64
|
+
bold: {
|
|
65
|
+
category: "utility",
|
|
66
|
+
description: "Bold styling",
|
|
67
|
+
defaultExample: "Strong emphasis"
|
|
68
|
+
},
|
|
69
|
+
italic: {
|
|
70
|
+
category: "utility",
|
|
71
|
+
description: "Italic styling",
|
|
72
|
+
defaultExample: "Subtle emphasis"
|
|
73
|
+
},
|
|
74
|
+
underline: {
|
|
75
|
+
category: "utility",
|
|
76
|
+
description: "Underline styling",
|
|
77
|
+
defaultExample: "Underlined text"
|
|
78
|
+
},
|
|
79
|
+
dim: {
|
|
80
|
+
category: "utility",
|
|
81
|
+
description: "Dim styling",
|
|
82
|
+
defaultExample: "De-emphasized"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function getThemeMethodsByCategory() {
|
|
86
|
+
const semantic = [];
|
|
87
|
+
const utility = [];
|
|
88
|
+
for (const [key, meta] of Object.entries(THEME_METHOD_META)) {
|
|
89
|
+
if (meta.category === "semantic") {
|
|
90
|
+
semantic.push(key);
|
|
91
|
+
} else {
|
|
92
|
+
utility.push(key);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { semantic, utility };
|
|
96
|
+
}
|
|
97
|
+
var BORDER_STYLE_META = {
|
|
98
|
+
single: {
|
|
99
|
+
value: "single",
|
|
100
|
+
label: "Single",
|
|
101
|
+
description: "Standard Unicode single-line borders (\u250C\u2500\u2510)"
|
|
102
|
+
},
|
|
103
|
+
double: {
|
|
104
|
+
value: "double",
|
|
105
|
+
label: "Double",
|
|
106
|
+
description: "Double-line borders (\u2554\u2550\u2557)"
|
|
107
|
+
},
|
|
108
|
+
rounded: {
|
|
109
|
+
value: "rounded",
|
|
110
|
+
label: "Rounded",
|
|
111
|
+
description: "Rounded corners with single lines (\u256D\u2500\u256E)"
|
|
112
|
+
},
|
|
113
|
+
heavy: {
|
|
114
|
+
value: "heavy",
|
|
115
|
+
label: "Heavy",
|
|
116
|
+
description: "Thick/heavy borders (\u250F\u2501\u2513)"
|
|
117
|
+
},
|
|
118
|
+
ascii: {
|
|
119
|
+
value: "ascii",
|
|
120
|
+
label: "ASCII",
|
|
121
|
+
description: "ASCII-only fallback (+, -, |)"
|
|
122
|
+
},
|
|
123
|
+
none: {
|
|
124
|
+
value: "none",
|
|
125
|
+
label: "None",
|
|
126
|
+
description: "No borders (empty strings)"
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
function getBorderStyles() {
|
|
130
|
+
return Object.keys(BORDER_STYLE_META);
|
|
131
|
+
}
|
|
132
|
+
var SPINNER_STYLE_META = {
|
|
133
|
+
dots: {
|
|
134
|
+
value: "dots",
|
|
135
|
+
label: "Dots",
|
|
136
|
+
description: "Braille dots animation (default, smooth)"
|
|
137
|
+
},
|
|
138
|
+
line: {
|
|
139
|
+
value: "line",
|
|
140
|
+
label: "Line",
|
|
141
|
+
description: "Classic ASCII spinner (-\\|/)"
|
|
142
|
+
},
|
|
143
|
+
arc: {
|
|
144
|
+
value: "arc",
|
|
145
|
+
label: "Arc",
|
|
146
|
+
description: "Corner arc rotation"
|
|
147
|
+
},
|
|
148
|
+
circle: {
|
|
149
|
+
value: "circle",
|
|
150
|
+
label: "Circle",
|
|
151
|
+
description: "Half-filled circle rotation"
|
|
152
|
+
},
|
|
153
|
+
bounce: {
|
|
154
|
+
value: "bounce",
|
|
155
|
+
label: "Bounce",
|
|
156
|
+
description: "Bouncing dot (vertical)"
|
|
157
|
+
},
|
|
158
|
+
ping: {
|
|
159
|
+
value: "ping",
|
|
160
|
+
label: "Ping",
|
|
161
|
+
description: "Bouncing dot in brackets (horizontal)"
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function getSpinnerStyles() {
|
|
165
|
+
return Object.keys(SPINNER_STYLE_META);
|
|
166
|
+
}
|
|
167
|
+
var LIST_STYLE_META = {
|
|
168
|
+
dash: {
|
|
169
|
+
value: "dash",
|
|
170
|
+
label: "Dash",
|
|
171
|
+
description: "Uses - character (default)"
|
|
172
|
+
},
|
|
173
|
+
bullet: {
|
|
174
|
+
value: "bullet",
|
|
175
|
+
label: "Bullet",
|
|
176
|
+
description: "Uses \u2022 character"
|
|
177
|
+
},
|
|
178
|
+
number: {
|
|
179
|
+
value: "number",
|
|
180
|
+
label: "Number",
|
|
181
|
+
description: "Uses 1. for top-level, a. for nested, i. for deeply nested"
|
|
182
|
+
},
|
|
183
|
+
checkbox: {
|
|
184
|
+
value: "checkbox",
|
|
185
|
+
label: "Checkbox",
|
|
186
|
+
description: "Uses \u2610 for unchecked, \u2611 for checked"
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
function getListStyles() {
|
|
190
|
+
return Object.keys(LIST_STYLE_META);
|
|
191
|
+
}
|
|
192
|
+
var PRIMITIVE_META = {
|
|
193
|
+
colors: {
|
|
194
|
+
id: "colors",
|
|
195
|
+
name: "Colors",
|
|
196
|
+
description: "Semantic color theme with ANSI support",
|
|
197
|
+
importExample: 'import { createTheme } from "@outfitter/cli/render";'
|
|
198
|
+
},
|
|
199
|
+
borders: {
|
|
200
|
+
id: "borders",
|
|
201
|
+
name: "Borders",
|
|
202
|
+
description: "Box-drawing character sets",
|
|
203
|
+
importExample: 'import { BORDERS, getBorderCharacters } from "@outfitter/cli/render";'
|
|
204
|
+
},
|
|
205
|
+
spinner: {
|
|
206
|
+
id: "spinner",
|
|
207
|
+
name: "Spinner",
|
|
208
|
+
description: "Animated spinners for async operations",
|
|
209
|
+
importExample: 'import { renderSpinner, SPINNERS } from "@outfitter/cli/render";'
|
|
210
|
+
},
|
|
211
|
+
list: {
|
|
212
|
+
id: "list",
|
|
213
|
+
name: "List",
|
|
214
|
+
description: "Bullet, numbered, and checkbox lists",
|
|
215
|
+
importExample: 'import { renderList } from "@outfitter/cli/render";'
|
|
216
|
+
},
|
|
217
|
+
box: {
|
|
218
|
+
id: "box",
|
|
219
|
+
name: "Box",
|
|
220
|
+
description: "Bordered panels with optional titles",
|
|
221
|
+
importExample: 'import { renderBox } from "@outfitter/cli/render";'
|
|
222
|
+
},
|
|
223
|
+
table: {
|
|
224
|
+
id: "table",
|
|
225
|
+
name: "Table",
|
|
226
|
+
description: "Unicode tables with multiple border styles",
|
|
227
|
+
importExample: 'import { renderTable } from "@outfitter/cli/render";'
|
|
228
|
+
},
|
|
229
|
+
progress: {
|
|
230
|
+
id: "progress",
|
|
231
|
+
name: "Progress",
|
|
232
|
+
description: "Progress bars with filled/empty segments",
|
|
233
|
+
importExample: 'import { renderProgress } from "@outfitter/cli/render";'
|
|
234
|
+
},
|
|
235
|
+
tree: {
|
|
236
|
+
id: "tree",
|
|
237
|
+
name: "Tree",
|
|
238
|
+
description: "Hierarchical tree rendering",
|
|
239
|
+
importExample: 'import { renderTree } from "@outfitter/cli/render";'
|
|
240
|
+
},
|
|
241
|
+
text: {
|
|
242
|
+
id: "text",
|
|
243
|
+
name: "Text",
|
|
244
|
+
description: "Text utilities (width, wrap, truncate, pad)",
|
|
245
|
+
importExample: 'import { getStringWidth, wrapText, truncateText, padText } from "@outfitter/cli/render";'
|
|
246
|
+
},
|
|
247
|
+
markdown: {
|
|
248
|
+
id: "markdown",
|
|
249
|
+
name: "Markdown",
|
|
250
|
+
description: "Markdown to terminal ANSI rendering",
|
|
251
|
+
importExample: 'import { renderMarkdown } from "@outfitter/cli/render";'
|
|
252
|
+
},
|
|
253
|
+
indicators: {
|
|
254
|
+
id: "indicators",
|
|
255
|
+
name: "Indicators",
|
|
256
|
+
description: "Status symbols, selection markers, and progress indicators",
|
|
257
|
+
importExample: 'import { getIndicator, INDICATORS } from "@outfitter/cli/render";'
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
function getPrimitiveIds() {
|
|
261
|
+
return Object.keys(PRIMITIVE_META);
|
|
262
|
+
}
|
|
263
|
+
function getPrimitiveMeta(id) {
|
|
264
|
+
return PRIMITIVE_META[id];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export { THEME_METHOD_META, getThemeMethodsByCategory, BORDER_STYLE_META, getBorderStyles, SPINNER_STYLE_META, getSpinnerStyles, LIST_STYLE_META, getListStyles, PRIMITIVE_META, getPrimitiveIds, getPrimitiveMeta };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { VisualTheme } from "./cli-s0kkx9m1";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal visual theme.
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - ASCII-only borders (+, -, |)
|
|
7
|
+
* - ASCII-safe list bullets and checkboxes
|
|
8
|
+
* - Line spinner (ASCII-compatible)
|
|
9
|
+
* - No unicode characters anywhere
|
|
10
|
+
*
|
|
11
|
+
* Use this theme when targeting terminals without unicode support
|
|
12
|
+
* or when running in CI/log environments.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { minimalTheme } from "@outfitter/cli/theme/presets";
|
|
17
|
+
*
|
|
18
|
+
* // Use ASCII-safe styling
|
|
19
|
+
* const box = renderBox("Hello", { border: minimalTheme.border });
|
|
20
|
+
* // +-------+
|
|
21
|
+
* // | Hello |
|
|
22
|
+
* // +-------+
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const minimalTheme: VisualTheme;
|
|
26
|
+
export { minimalTheme };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/prompt/validators.ts
|
|
3
|
+
var validators = {
|
|
4
|
+
required: (message = "Required") => (value) => value.length > 0 ? undefined : message,
|
|
5
|
+
minLength: (length, message) => (value) => value.length >= length ? undefined : message ?? `Minimum ${length} characters`,
|
|
6
|
+
maxLength: (length, message) => (value) => value.length <= length ? undefined : message ?? `Maximum ${length} characters`,
|
|
7
|
+
pattern: (regex, message) => (value) => regex.test(value) ? undefined : message,
|
|
8
|
+
email: (message = "Invalid email") => validators.pattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/, message),
|
|
9
|
+
compose: (...fns) => (value) => {
|
|
10
|
+
for (const fn of fns) {
|
|
11
|
+
const error = fn(value);
|
|
12
|
+
if (error)
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { validators };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/render/spinner.ts
|
|
3
|
+
var SPINNERS = {
|
|
4
|
+
dots: {
|
|
5
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
6
|
+
interval: 80
|
|
7
|
+
},
|
|
8
|
+
line: {
|
|
9
|
+
frames: ["-", "\\", "|", "/"],
|
|
10
|
+
interval: 100
|
|
11
|
+
},
|
|
12
|
+
arc: {
|
|
13
|
+
frames: ["\u25DC", "\u25DD", "\u25DE", "\u25DF"],
|
|
14
|
+
interval: 100
|
|
15
|
+
},
|
|
16
|
+
circle: {
|
|
17
|
+
frames: ["\u25D0", "\u25D3", "\u25D1", "\u25D2"],
|
|
18
|
+
interval: 100
|
|
19
|
+
},
|
|
20
|
+
bounce: {
|
|
21
|
+
frames: ["\u2801", "\u2802", "\u2804", "\u2802"],
|
|
22
|
+
interval: 120
|
|
23
|
+
},
|
|
24
|
+
ping: {
|
|
25
|
+
frames: [
|
|
26
|
+
"(\u25CF )",
|
|
27
|
+
"( \u25CF )",
|
|
28
|
+
"( \u25CF )",
|
|
29
|
+
"( \u25CF )",
|
|
30
|
+
"( \u25CF)",
|
|
31
|
+
"( \u25CF )",
|
|
32
|
+
"( \u25CF )",
|
|
33
|
+
"( \u25CF )"
|
|
34
|
+
],
|
|
35
|
+
interval: 80
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function getSpinnerFrame(style, elapsed) {
|
|
39
|
+
const spinner = SPINNERS[style];
|
|
40
|
+
const frameIndex = Math.floor(elapsed / spinner.interval) % spinner.frames.length;
|
|
41
|
+
return spinner.frames[frameIndex] ?? spinner.frames[0] ?? "...";
|
|
42
|
+
}
|
|
43
|
+
function renderSpinner(style, message) {
|
|
44
|
+
const frame = getSpinnerFrame(style, 0);
|
|
45
|
+
if (message && message.length > 0) {
|
|
46
|
+
return `${frame} ${message}`;
|
|
47
|
+
}
|
|
48
|
+
return frame;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { SPINNERS, getSpinnerFrame, renderSpinner };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
demoSection
|
|
4
|
+
} from "./cli-34fqr7bp.js";
|
|
5
|
+
import {
|
|
6
|
+
getStringWidth,
|
|
7
|
+
init_text,
|
|
8
|
+
padText,
|
|
9
|
+
pluralize,
|
|
10
|
+
slugify,
|
|
11
|
+
truncateText,
|
|
12
|
+
wrapText
|
|
13
|
+
} from "./cli-jjemfdta.js";
|
|
14
|
+
|
|
15
|
+
// packages/cli/src/demo/renderers/text.ts
|
|
16
|
+
init_text();
|
|
17
|
+
function renderTextDemo(config, theme) {
|
|
18
|
+
const showCode = config.showCode ?? true;
|
|
19
|
+
const lines = [];
|
|
20
|
+
lines.push(demoSection("String Width"));
|
|
21
|
+
lines.push("");
|
|
22
|
+
if (showCode) {
|
|
23
|
+
lines.push('import { getStringWidth } from "@outfitter/cli/render";');
|
|
24
|
+
lines.push("");
|
|
25
|
+
}
|
|
26
|
+
const widthExamples = [
|
|
27
|
+
{ text: "Hello", expected: 5 },
|
|
28
|
+
{ text: "\u4F60\u597D", expected: 4 },
|
|
29
|
+
{ text: "\uD83C\uDF89", expected: 2 },
|
|
30
|
+
{ text: "\x1B[32mGreen\x1B[0m", expected: 5 }
|
|
31
|
+
];
|
|
32
|
+
for (const ex of widthExamples) {
|
|
33
|
+
const width = getStringWidth(ex.text);
|
|
34
|
+
const display = ex.text.includes("\x1B") ? '"\\x1b[32mGreen\\x1b[0m"' : `"${ex.text}"`;
|
|
35
|
+
lines.push(`getStringWidth(${display.padEnd(24)}) \u2192 ${width}`);
|
|
36
|
+
}
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push(theme.muted("Correctly handles CJK, emoji, and ANSI codes."));
|
|
39
|
+
lines.push("");
|
|
40
|
+
lines.push(demoSection("Text Wrapping"));
|
|
41
|
+
lines.push("");
|
|
42
|
+
if (showCode) {
|
|
43
|
+
lines.push('import { wrapText } from "@outfitter/cli/render";');
|
|
44
|
+
lines.push("");
|
|
45
|
+
}
|
|
46
|
+
const longText = "This is a long sentence that should be wrapped at the specified width.";
|
|
47
|
+
if (showCode) {
|
|
48
|
+
lines.push(`wrapText("${longText}", 30)`);
|
|
49
|
+
lines.push("");
|
|
50
|
+
}
|
|
51
|
+
lines.push("Result:");
|
|
52
|
+
const wrapped = wrapText(longText, 30);
|
|
53
|
+
for (const line of wrapped.split(`
|
|
54
|
+
`)) {
|
|
55
|
+
lines.push(` \u2502${line}\u2502`);
|
|
56
|
+
}
|
|
57
|
+
lines.push("");
|
|
58
|
+
lines.push(demoSection("Truncation"));
|
|
59
|
+
lines.push("");
|
|
60
|
+
if (showCode) {
|
|
61
|
+
lines.push('import { truncateText } from "@outfitter/cli/render";');
|
|
62
|
+
lines.push("");
|
|
63
|
+
}
|
|
64
|
+
const truncExamples = [
|
|
65
|
+
{ text: "Hello World", width: 8 },
|
|
66
|
+
{ text: "Short", width: 10 },
|
|
67
|
+
{ text: "Very long text that will be truncated", width: 15 }
|
|
68
|
+
];
|
|
69
|
+
for (const ex of truncExamples) {
|
|
70
|
+
const result = truncateText(ex.text, ex.width);
|
|
71
|
+
lines.push(`truncateText("${ex.text}", ${ex.width})`);
|
|
72
|
+
lines.push(` \u2192 "${result}"`);
|
|
73
|
+
lines.push("");
|
|
74
|
+
}
|
|
75
|
+
lines.push(demoSection("Padding"));
|
|
76
|
+
lines.push("");
|
|
77
|
+
if (showCode) {
|
|
78
|
+
lines.push('import { padText } from "@outfitter/cli/render";');
|
|
79
|
+
lines.push("");
|
|
80
|
+
}
|
|
81
|
+
const padExamples = ["Hi", "Hello", "Greetings"];
|
|
82
|
+
for (const text of padExamples) {
|
|
83
|
+
const padded = padText(text, 15);
|
|
84
|
+
lines.push(`padText("${text}", 15) \u2192 "${padded}"`);
|
|
85
|
+
}
|
|
86
|
+
lines.push("");
|
|
87
|
+
lines.push(demoSection("Pluralize"));
|
|
88
|
+
lines.push("");
|
|
89
|
+
if (showCode) {
|
|
90
|
+
lines.push('import { pluralize } from "@outfitter/cli/render";');
|
|
91
|
+
lines.push("");
|
|
92
|
+
}
|
|
93
|
+
const pluralExamples = [
|
|
94
|
+
{ count: 0, word: "item" },
|
|
95
|
+
{ count: 1, word: "item" },
|
|
96
|
+
{ count: 5, word: "item" },
|
|
97
|
+
{ count: 1, word: "child", plural: "children" },
|
|
98
|
+
{ count: 3, word: "child", plural: "children" }
|
|
99
|
+
];
|
|
100
|
+
for (const ex of pluralExamples) {
|
|
101
|
+
const result = pluralize(ex.count, ex.word, ex.plural);
|
|
102
|
+
const code = ex.plural ? `pluralize(${ex.count}, "${ex.word}", "${ex.plural}")` : `pluralize(${ex.count}, "${ex.word}")`;
|
|
103
|
+
lines.push(`${code.padEnd(40)} \u2192 "${result}"`);
|
|
104
|
+
}
|
|
105
|
+
lines.push("");
|
|
106
|
+
lines.push(demoSection("Slugify"));
|
|
107
|
+
lines.push("");
|
|
108
|
+
if (showCode) {
|
|
109
|
+
lines.push('import { slugify } from "@outfitter/cli/render";');
|
|
110
|
+
lines.push("");
|
|
111
|
+
}
|
|
112
|
+
const slugExamples = [
|
|
113
|
+
"Hello World!",
|
|
114
|
+
"This & That",
|
|
115
|
+
" Multiple Spaces ",
|
|
116
|
+
"CamelCase"
|
|
117
|
+
];
|
|
118
|
+
for (const text of slugExamples) {
|
|
119
|
+
const result = slugify(text);
|
|
120
|
+
lines.push(`slugify("${text}")`);
|
|
121
|
+
lines.push(` \u2192 "${result}"`);
|
|
122
|
+
lines.push("");
|
|
123
|
+
}
|
|
124
|
+
return lines.join(`
|
|
125
|
+
`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { renderTextDemo };
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
dash: { unicode: "\u2013", fallback: "-" },
|
|
24
|
+
pointer: { unicode: "\u276F", fallback: ">" },
|
|
25
|
+
pointerSmall: { unicode: "\u203A", fallback: ">" },
|
|
26
|
+
checkbox: { unicode: "\u2610", fallback: "[ ]" },
|
|
27
|
+
checkboxChecked: { unicode: "\u2611", fallback: "[x]" },
|
|
28
|
+
checkboxCross: { unicode: "\u2612", fallback: "[X]" }
|
|
29
|
+
},
|
|
30
|
+
progress: {
|
|
31
|
+
circleEmpty: { unicode: "\u25CB", fallback: "." },
|
|
32
|
+
circleQuarter: { unicode: "\u25D4", fallback: "o" },
|
|
33
|
+
circleHalf: { unicode: "\u25D1", fallback: "O" },
|
|
34
|
+
circleThree: { unicode: "\u25D5", fallback: "0" },
|
|
35
|
+
circleFull: { unicode: "\u25CF", fallback: "@" },
|
|
36
|
+
vertical1: { unicode: "\u2581", fallback: "_" },
|
|
37
|
+
vertical2: { unicode: "\u2582", fallback: "_" },
|
|
38
|
+
vertical3: { unicode: "\u2583", fallback: "=" },
|
|
39
|
+
vertical4: { unicode: "\u2584", fallback: "=" },
|
|
40
|
+
vertical5: { unicode: "\u2585", fallback: "#" },
|
|
41
|
+
vertical6: { unicode: "\u2586", fallback: "#" },
|
|
42
|
+
vertical7: { unicode: "\u2587", fallback: "#" },
|
|
43
|
+
verticalFull: { unicode: "\u2588", fallback: "#" },
|
|
44
|
+
horizontal1: { unicode: "\u258F", fallback: "|" },
|
|
45
|
+
horizontal2: { unicode: "\u258E", fallback: "|" },
|
|
46
|
+
horizontal3: { unicode: "\u258D", fallback: "|" },
|
|
47
|
+
horizontal4: { unicode: "\u258C", fallback: "|" },
|
|
48
|
+
horizontal5: { unicode: "\u258B", fallback: "|" },
|
|
49
|
+
horizontal6: { unicode: "\u258A", fallback: "|" },
|
|
50
|
+
horizontal7: { unicode: "\u2589", fallback: "|" },
|
|
51
|
+
horizontalFull: { unicode: "\u2588", fallback: "#" },
|
|
52
|
+
shadeLight: { unicode: "\u2591", fallback: "." },
|
|
53
|
+
shadeMedium: { unicode: "\u2592", fallback: ":" },
|
|
54
|
+
shadeDark: { unicode: "\u2593", fallback: "#" }
|
|
55
|
+
},
|
|
56
|
+
triangle: {
|
|
57
|
+
up: { unicode: "\u25B2", fallback: "^" },
|
|
58
|
+
upSmall: { unicode: "\u25B4", fallback: "^" },
|
|
59
|
+
upOutline: { unicode: "\u25B3", fallback: "^" },
|
|
60
|
+
down: { unicode: "\u25BC", fallback: "v" },
|
|
61
|
+
downSmall: { unicode: "\u25BE", fallback: "v" },
|
|
62
|
+
downOutline: { unicode: "\u25BD", fallback: "v" },
|
|
63
|
+
left: { unicode: "\u25C0", fallback: "<" },
|
|
64
|
+
leftSmall: { unicode: "\u25C2", fallback: "<" },
|
|
65
|
+
leftOutline: { unicode: "\u25C1", fallback: "<" },
|
|
66
|
+
right: { unicode: "\u25B6", fallback: ">" },
|
|
67
|
+
rightSmall: { unicode: "\u25B8", fallback: ">" },
|
|
68
|
+
rightOutline: { unicode: "\u25B7", fallback: ">" }
|
|
69
|
+
},
|
|
70
|
+
special: {
|
|
71
|
+
star: { unicode: "\u2605", fallback: "*" },
|
|
72
|
+
starOutline: { unicode: "\u2606", fallback: "*" },
|
|
73
|
+
heart: { unicode: "\u2665", fallback: "<3" },
|
|
74
|
+
heartOutline: { unicode: "\u2661", fallback: "<3" },
|
|
75
|
+
flag: { unicode: "\u2691", fallback: "[F]" },
|
|
76
|
+
flagOutline: { unicode: "\u2690", fallback: "[f]" },
|
|
77
|
+
gear: { unicode: "\u2699", fallback: "[*]" }
|
|
78
|
+
},
|
|
79
|
+
directional: {
|
|
80
|
+
arrowUp: { unicode: "\u2191", fallback: "^" },
|
|
81
|
+
arrowDown: { unicode: "\u2193", fallback: "v" },
|
|
82
|
+
arrowLeft: { unicode: "\u2190", fallback: "<-" },
|
|
83
|
+
arrowRight: { unicode: "\u2192", fallback: "->" },
|
|
84
|
+
arrowLeftRight: { unicode: "\u2194", fallback: "<->" },
|
|
85
|
+
arrowUpDown: { unicode: "\u2195", fallback: "^v" }
|
|
86
|
+
},
|
|
87
|
+
math: {
|
|
88
|
+
almostEqual: { unicode: "\u2248", fallback: "~=" },
|
|
89
|
+
notEqual: { unicode: "\u2260", fallback: "!=" },
|
|
90
|
+
lessOrEqual: { unicode: "\u2264", fallback: "<=" },
|
|
91
|
+
greaterOrEqual: { unicode: "\u2265", fallback: ">=" },
|
|
92
|
+
identical: { unicode: "\u2261", fallback: "===" },
|
|
93
|
+
infinity: { unicode: "\u221E", fallback: "inf" }
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function isUnicodeSupported() {
|
|
97
|
+
if (process.env["CI"]) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (process.env["WT_SESSION"]) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
if (process.env["ConEmuTask"]) {
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
const term = process.env["TERM"] ?? "";
|
|
107
|
+
if (term === "xterm-256color" || term === "xterm" || term.includes("256color") || term.includes("truecolor")) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
const lang = process.env["LANG"] ?? process.env["LC_ALL"] ?? "";
|
|
111
|
+
if (lang.toLowerCase().includes("utf-8") || lang.toLowerCase().includes("utf8")) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
if (process.platform !== "win32") {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
function getIndicator(category, name, forceUnicode) {
|
|
120
|
+
const indicator = INDICATORS[category][name];
|
|
121
|
+
if (!indicator) {
|
|
122
|
+
return "";
|
|
123
|
+
}
|
|
124
|
+
const useUnicode = forceUnicode ?? isUnicodeSupported();
|
|
125
|
+
return useUnicode ? indicator.unicode : indicator.fallback;
|
|
126
|
+
}
|
|
127
|
+
var PROGRESS_SEQUENCES = {
|
|
128
|
+
circle: [
|
|
129
|
+
"circleEmpty",
|
|
130
|
+
"circleQuarter",
|
|
131
|
+
"circleHalf",
|
|
132
|
+
"circleThree",
|
|
133
|
+
"circleFull"
|
|
134
|
+
],
|
|
135
|
+
vertical: [
|
|
136
|
+
"vertical1",
|
|
137
|
+
"vertical2",
|
|
138
|
+
"vertical3",
|
|
139
|
+
"vertical4",
|
|
140
|
+
"vertical5",
|
|
141
|
+
"vertical6",
|
|
142
|
+
"vertical7",
|
|
143
|
+
"verticalFull"
|
|
144
|
+
],
|
|
145
|
+
horizontal: [
|
|
146
|
+
"horizontal1",
|
|
147
|
+
"horizontal2",
|
|
148
|
+
"horizontal3",
|
|
149
|
+
"horizontal4",
|
|
150
|
+
"horizontal5",
|
|
151
|
+
"horizontal6",
|
|
152
|
+
"horizontal7",
|
|
153
|
+
"horizontalFull"
|
|
154
|
+
],
|
|
155
|
+
shade: ["shadeLight", "shadeMedium", "shadeDark"]
|
|
156
|
+
};
|
|
157
|
+
function getProgressIndicator(style, current, max, forceUnicode) {
|
|
158
|
+
const sequence = PROGRESS_SEQUENCES[style];
|
|
159
|
+
const steps = sequence.length;
|
|
160
|
+
const ratio = max <= 0 ? 0 : Math.max(0, Math.min(1, current / max));
|
|
161
|
+
const index = Math.round(ratio * (steps - 1));
|
|
162
|
+
const name = sequence[index];
|
|
163
|
+
if (name === undefined) {
|
|
164
|
+
return "";
|
|
165
|
+
}
|
|
166
|
+
return getIndicator("progress", name, forceUnicode);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export { INDICATORS, isUnicodeSupported, getIndicator, getProgressIndicator };
|