@outfitter/tui 0.2.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 +250 -0
- 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 +10 -0
- package/dist/confirm.d.ts +37 -0
- package/dist/confirm.js +36 -0
- package/dist/demo/index.d.ts +77 -0
- package/dist/demo/index.js +142 -0
- package/dist/demo/registry.d.ts +6 -0
- package/dist/demo/registry.js +28 -0
- package/dist/demo/renderers/borders.d.ts +7 -0
- package/dist/demo/renderers/borders.js +14 -0
- package/dist/demo/renderers/box.d.ts +7 -0
- package/dist/demo/renderers/box.js +15 -0
- package/dist/demo/renderers/colors.d.ts +7 -0
- package/dist/demo/renderers/colors.js +15 -0
- package/dist/demo/renderers/indicators.d.ts +7 -0
- package/dist/demo/renderers/indicators.js +14 -0
- package/dist/demo/renderers/list.d.ts +7 -0
- package/dist/demo/renderers/list.js +16 -0
- package/dist/demo/renderers/markdown.d.ts +7 -0
- package/dist/demo/renderers/markdown.js +15 -0
- package/dist/demo/renderers/progress.d.ts +7 -0
- package/dist/demo/renderers/progress.js +14 -0
- package/dist/demo/renderers/spinner.d.ts +7 -0
- package/dist/demo/renderers/spinner.js +16 -0
- package/dist/demo/renderers/table.d.ts +7 -0
- package/dist/demo/renderers/table.js +16 -0
- package/dist/demo/renderers/text.d.ts +7 -0
- package/dist/demo/renderers/text.js +13 -0
- package/dist/demo/renderers/tree.d.ts +7 -0
- package/dist/demo/renderers/tree.js +15 -0
- package/dist/demo/section.d.ts +4 -0
- package/dist/demo/section.js +20 -0
- package/dist/demo/templates.d.ts +3 -0
- package/dist/demo/templates.js +10 -0
- package/dist/demo/types.d.ts +2 -0
- package/dist/demo/types.js +8 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +77 -0
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +9 -0
- package/dist/preset/full.d.ts +12 -0
- package/dist/preset/full.js +37 -0
- package/dist/preset/standard.d.ts +9 -0
- package/dist/preset/standard.js +26 -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 +20 -0
- package/dist/render/date.d.ts +2 -0
- package/dist/render/date.js +12 -0
- package/dist/render/format-relative.d.ts +2 -0
- package/dist/render/format-relative.js +8 -0
- package/dist/render/format.d.ts +2 -0
- package/dist/render/format.js +10 -0
- package/dist/render/heading.d.ts +3 -0
- package/dist/render/heading.js +11 -0
- package/dist/render/index.d.ts +31 -0
- package/dist/render/index.js +222 -0
- package/dist/render/indicators.d.ts +2 -0
- package/dist/render/indicators.js +16 -0
- package/dist/render/json.d.ts +2 -0
- package/dist/render/json.js +10 -0
- package/dist/render/layout.d.ts +5 -0
- package/dist/render/layout.js +22 -0
- package/dist/render/list.d.ts +2 -0
- package/dist/render/list.js +8 -0
- package/dist/render/markdown.d.ts +2 -0
- package/dist/render/markdown.js +8 -0
- package/dist/render/progress.d.ts +2 -0
- package/dist/render/progress.js +8 -0
- package/dist/render/separator.d.ts +3 -0
- package/dist/render/separator.js +11 -0
- package/dist/render/shapes.d.ts +2 -0
- package/dist/render/shapes.js +32 -0
- 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 +35 -0
- package/dist/render/table.d.ts +3 -0
- package/dist/render/table.js +9 -0
- package/dist/render/tree.d.ts +2 -0
- package/dist/render/tree.js +10 -0
- package/dist/render/types.d.ts +2 -0
- package/dist/render/types.js +1 -0
- package/dist/shared/@outfitter/tui-011579t8.d.ts +24 -0
- package/dist/shared/@outfitter/tui-06dntkse.js +146 -0
- package/dist/shared/@outfitter/tui-0awf316b.js +71 -0
- package/dist/shared/@outfitter/tui-0b85rht7.js +1 -0
- package/dist/shared/@outfitter/tui-0mpqnyc1.js +55 -0
- package/dist/shared/@outfitter/tui-1qh888th.d.ts +106 -0
- package/dist/shared/@outfitter/tui-1tk0kxa6.js +94 -0
- package/dist/shared/@outfitter/tui-1wggw2zj.d.ts +56 -0
- package/dist/shared/@outfitter/tui-2pwhzg55.js +123 -0
- package/dist/shared/@outfitter/tui-2tkva96b.d.ts +20 -0
- package/dist/shared/@outfitter/tui-2wfat6jb.js +22 -0
- package/dist/shared/@outfitter/tui-34q2aenf.d.ts +24 -0
- package/dist/shared/@outfitter/tui-37hjcqhb.d.ts +3 -0
- package/dist/shared/@outfitter/tui-3dyxg62j.d.ts +97 -0
- package/dist/shared/@outfitter/tui-3kza6p9k.d.ts +132 -0
- package/dist/shared/@outfitter/tui-43bnfxv9.js +30 -0
- package/dist/shared/@outfitter/tui-4yz7jcyq.js +214 -0
- package/dist/shared/@outfitter/tui-52ndmswq.js +23 -0
- package/dist/shared/@outfitter/tui-53ms1ba4.d.ts +41 -0
- package/dist/shared/@outfitter/tui-5dsn6d6d.js +86 -0
- package/dist/shared/@outfitter/tui-5pb72vf9.js +51 -0
- package/dist/shared/@outfitter/tui-6605wa2j.js +127 -0
- package/dist/shared/@outfitter/tui-6ptks7jj.js +19 -0
- package/dist/shared/@outfitter/tui-6svngg69.js +126 -0
- package/dist/shared/@outfitter/tui-733asbd8.js +37 -0
- package/dist/shared/@outfitter/tui-75bztyfp.d.ts +50 -0
- package/dist/shared/@outfitter/tui-83zaah9b.d.ts +17 -0
- package/dist/shared/@outfitter/tui-8ejx8gq5.d.ts +71 -0
- package/dist/shared/@outfitter/tui-8j1gbehy.d.ts +164 -0
- package/dist/shared/@outfitter/tui-8mypsnva.d.ts +74 -0
- package/dist/shared/@outfitter/tui-997aapz0.js +61 -0
- package/dist/shared/@outfitter/tui-9dbykt4g.d.ts +42 -0
- package/dist/shared/@outfitter/tui-9h1kdd98.d.ts +119 -0
- package/dist/shared/@outfitter/tui-9rj9yesd.js +118 -0
- package/dist/shared/@outfitter/tui-a65efhsk.d.ts +23 -0
- package/dist/shared/@outfitter/tui-a8nkrbds.js +1 -0
- package/dist/shared/@outfitter/tui-ajp1153q.d.ts +59 -0
- package/dist/shared/@outfitter/tui-ay1fv41j.d.ts +30 -0
- package/dist/shared/@outfitter/tui-azh1w4ak.js +67 -0
- package/dist/shared/@outfitter/tui-b14ry1j1.d.ts +53 -0
- package/dist/shared/@outfitter/tui-c56sxcm8.d.ts +87 -0
- package/dist/shared/@outfitter/tui-c6ft5w6q.d.ts +91 -0
- package/dist/shared/@outfitter/tui-cq7za0cz.js +62 -0
- package/dist/shared/@outfitter/tui-dh15zwg0.js +95 -0
- package/dist/shared/@outfitter/tui-esc46z2v.js +20 -0
- package/dist/shared/@outfitter/tui-f1mj6h6p.d.ts +2 -0
- package/dist/shared/@outfitter/tui-gcpz529w.js +122 -0
- package/dist/shared/@outfitter/tui-gqsdhmk9.d.ts +42 -0
- package/dist/shared/@outfitter/tui-hescagw2.js +32 -0
- package/dist/shared/@outfitter/tui-j2kd7eej.js +126 -0
- package/dist/shared/@outfitter/tui-j3bkjt2g.js +7 -0
- package/dist/shared/@outfitter/tui-jnn9d8cd.js +8 -0
- package/dist/shared/@outfitter/tui-jz5nws55.d.ts +51 -0
- package/dist/shared/@outfitter/tui-k3mby2kk.js +70 -0
- package/dist/shared/@outfitter/tui-kc4nxak0.js +20 -0
- package/dist/shared/@outfitter/tui-kcxv8txp.js +7 -0
- package/dist/shared/@outfitter/tui-kydbggmj.js +39 -0
- package/dist/shared/@outfitter/tui-mch672g9.js +30 -0
- package/dist/shared/@outfitter/tui-n9kxkdrh.js +82 -0
- package/dist/shared/@outfitter/tui-na4dnjpw.js +348 -0
- package/dist/shared/@outfitter/tui-ncaatp4j.js +25 -0
- package/dist/shared/@outfitter/tui-nce7fgtf.js +48 -0
- package/dist/shared/@outfitter/tui-ngz2fbdw.js +144 -0
- package/dist/shared/@outfitter/tui-nprd7g0d.js +52 -0
- package/dist/shared/@outfitter/tui-nr580mbv.js +272 -0
- package/dist/shared/@outfitter/tui-nr93tf31.d.ts +64 -0
- package/dist/shared/@outfitter/tui-pdwbbzwr.js +179 -0
- package/dist/shared/@outfitter/tui-qb07rtct.js +19 -0
- package/dist/shared/@outfitter/tui-qkyazctw.d.ts +36 -0
- package/dist/shared/@outfitter/tui-qn1rgz9v.d.ts +93 -0
- package/dist/shared/@outfitter/tui-qs3fhwp8.js +43 -0
- package/dist/shared/@outfitter/tui-r8hywf9m.d.ts +48 -0
- package/dist/shared/@outfitter/tui-rbbcc034.js +20 -0
- package/dist/shared/@outfitter/tui-rgkerz72.js +85 -0
- package/dist/shared/@outfitter/tui-rh52sycm.d.ts +45 -0
- package/dist/shared/@outfitter/tui-rr924x4z.d.ts +59 -0
- package/dist/shared/@outfitter/tui-rwpdjrt3.js +20 -0
- package/dist/shared/@outfitter/tui-rx9xq9s7.d.ts +26 -0
- package/dist/shared/@outfitter/tui-sk05ye6g.js +1 -0
- package/dist/shared/@outfitter/tui-sv2xmh3w.d.ts +26 -0
- package/dist/shared/@outfitter/tui-t1a9xgbd.js +111 -0
- package/dist/shared/@outfitter/tui-t9vd88jr.js +273 -0
- package/dist/shared/@outfitter/tui-tq1z78x0.js +11 -0
- package/dist/shared/@outfitter/tui-ts1f957s.d.ts +128 -0
- package/dist/shared/@outfitter/tui-ve0083wa.d.ts +61 -0
- package/dist/shared/@outfitter/tui-vt0wg6c4.js +54 -0
- package/dist/shared/@outfitter/tui-wfnnq0zq.d.ts +328 -0
- package/dist/shared/@outfitter/tui-x3yg0887.d.ts +223 -0
- package/dist/shared/@outfitter/tui-x9vvtfkk.js +20 -0
- package/dist/shared/@outfitter/tui-xbvz707j.js +20 -0
- package/dist/shared/@outfitter/tui-xbx6d4t7.js +1 -0
- package/dist/shared/@outfitter/tui-xph95b7h.js +67 -0
- package/dist/shared/@outfitter/tui-xqjx7d1f.js +135 -0
- package/dist/shared/@outfitter/tui-xrgrp99k.d.ts +112 -0
- package/dist/shared/@outfitter/tui-xzjv96ps.d.ts +300 -0
- package/dist/shared/@outfitter/tui-ykzs6v4v.d.ts +66 -0
- package/dist/shared/@outfitter/tui-yw9n5h6q.d.ts +54 -0
- package/dist/shared/@outfitter/tui-ywmakc6b.js +30 -0
- package/dist/shared/@outfitter/tui-z6nf9b9h.js +7 -0
- package/dist/shared/@outfitter/tui-zcspg6z6.d.ts +190 -0
- package/dist/shared/@outfitter/tui-zhbsnj7w.js +1 -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 +10 -0
- package/dist/theme/context.d.ts +9 -0
- package/dist/theme/context.js +12 -0
- package/dist/theme/create.d.ts +8 -0
- package/dist/theme/create.js +10 -0
- package/dist/theme/index.d.ts +17 -0
- package/dist/theme/index.js +40 -0
- package/dist/theme/presets/bold.d.ts +8 -0
- package/dist/theme/presets/bold.js +10 -0
- package/dist/theme/presets/default.d.ts +8 -0
- package/dist/theme/presets/default.js +9 -0
- package/dist/theme/presets/index.d.ts +12 -0
- package/dist/theme/presets/index.js +22 -0
- package/dist/theme/presets/minimal.d.ts +8 -0
- package/dist/theme/presets/minimal.js +10 -0
- package/dist/theme/presets/rounded.d.ts +8 -0
- package/dist/theme/presets/rounded.js +10 -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/package.json +263 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/tui/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 };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/tui/src/render/progress.ts
|
|
3
|
+
function renderProgress(options) {
|
|
4
|
+
const { current, total, width = 20, showPercent = false } = options;
|
|
5
|
+
if (total <= 0) {
|
|
6
|
+
const bar2 = "\u2591".repeat(width);
|
|
7
|
+
return showPercent ? `[${bar2}] 0%` : `[${bar2}]`;
|
|
8
|
+
}
|
|
9
|
+
const percent = Math.min(100, Math.max(0, current / total * 100));
|
|
10
|
+
const filled = Math.round(percent / 100 * width);
|
|
11
|
+
const empty = width - filled;
|
|
12
|
+
const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
13
|
+
if (showPercent) {
|
|
14
|
+
return `[${bar}] ${Math.round(percent)}%`;
|
|
15
|
+
}
|
|
16
|
+
return `[${bar}]`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { renderProgress };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CancelledError, PromptResult } from "./tui-c56sxcm8";
|
|
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/tui/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 };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { LayoutContext } from "./tui-75bztyfp";
|
|
2
|
+
import { VisualTheme } from "./tui-8j1gbehy";
|
|
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/tui/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 };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
createCancelledError
|
|
4
|
+
} from "./tui-kcxv8txp.js";
|
|
5
|
+
|
|
6
|
+
// packages/tui/src/prompt/text.ts
|
|
7
|
+
import { isCancel, password, text } from "@clack/prompts";
|
|
8
|
+
import { Result } from "better-result";
|
|
9
|
+
async function promptText(options) {
|
|
10
|
+
const textOptions = {
|
|
11
|
+
message: options.message
|
|
12
|
+
};
|
|
13
|
+
if (options.placeholder !== undefined) {
|
|
14
|
+
textOptions.placeholder = options.placeholder;
|
|
15
|
+
}
|
|
16
|
+
if (options.defaultValue !== undefined) {
|
|
17
|
+
textOptions.defaultValue = options.defaultValue;
|
|
18
|
+
}
|
|
19
|
+
if (options.validate !== undefined) {
|
|
20
|
+
textOptions.validate = options.validate;
|
|
21
|
+
}
|
|
22
|
+
const result = await text(textOptions);
|
|
23
|
+
if (isCancel(result)) {
|
|
24
|
+
return Result.err(createCancelledError());
|
|
25
|
+
}
|
|
26
|
+
return Result.ok(result);
|
|
27
|
+
}
|
|
28
|
+
async function promptPassword(options) {
|
|
29
|
+
const passwordOptions = {
|
|
30
|
+
message: options.message,
|
|
31
|
+
mask: options.mask ?? "\u2022"
|
|
32
|
+
};
|
|
33
|
+
if (options.validate !== undefined) {
|
|
34
|
+
passwordOptions.validate = options.validate;
|
|
35
|
+
}
|
|
36
|
+
const result = await password(passwordOptions);
|
|
37
|
+
if (isCancel(result)) {
|
|
38
|
+
return Result.err(createCancelledError());
|
|
39
|
+
}
|
|
40
|
+
return Result.ok(result);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { promptText, promptPassword };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MultiSelectPromptOptions, PromptResult, SelectPromptOptions } from "./tui-c56sxcm8";
|
|
2
|
+
/**
|
|
3
|
+
* Prompts for single selection with Result wrapping.
|
|
4
|
+
*
|
|
5
|
+
* @param options - Select prompt options
|
|
6
|
+
* @returns Ok with selected value or Err with CancelledError
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { promptSelect } from "@outfitter/tui/prompt";
|
|
11
|
+
*
|
|
12
|
+
* const result = await promptSelect({
|
|
13
|
+
* message: "Pick a color:",
|
|
14
|
+
* options: [
|
|
15
|
+
* { value: "red", label: "Red", hint: "A warm color" },
|
|
16
|
+
* { value: "blue", label: "Blue", hint: "A cool color" },
|
|
17
|
+
* ],
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* if (result.isOk()) {
|
|
21
|
+
* console.log(`You picked: ${result.value}`);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function promptSelect<T>(options: SelectPromptOptions<T>): PromptResult<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Prompts for multiple selections with Result wrapping.
|
|
28
|
+
*
|
|
29
|
+
* @param options - Multi-select prompt options
|
|
30
|
+
* @returns Ok with array of selected values or Err with CancelledError
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { promptMultiSelect } from "@outfitter/tui/prompt";
|
|
35
|
+
*
|
|
36
|
+
* const result = await promptMultiSelect({
|
|
37
|
+
* message: "Select toppings:",
|
|
38
|
+
* options: [
|
|
39
|
+
* { value: "cheese", label: "Cheese" },
|
|
40
|
+
* { value: "pepperoni", label: "Pepperoni" },
|
|
41
|
+
* { value: "mushrooms", label: "Mushrooms" },
|
|
42
|
+
* ],
|
|
43
|
+
* required: true,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function promptMultiSelect<T>(options: MultiSelectPromptOptions<T>): PromptResult<T[]>;
|
|
48
|
+
export { promptSelect, promptMultiSelect };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/tui/src/demo/types.ts
|
|
3
|
+
function isPrimitiveId(value) {
|
|
4
|
+
const validIds = [
|
|
5
|
+
"colors",
|
|
6
|
+
"borders",
|
|
7
|
+
"spinner",
|
|
8
|
+
"list",
|
|
9
|
+
"box",
|
|
10
|
+
"table",
|
|
11
|
+
"progress",
|
|
12
|
+
"tree",
|
|
13
|
+
"text",
|
|
14
|
+
"markdown",
|
|
15
|
+
"indicators"
|
|
16
|
+
];
|
|
17
|
+
return validIds.includes(value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { isPrimitiveId };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ANSI
|
|
4
|
+
} from "./tui-2wfat6jb.js";
|
|
5
|
+
|
|
6
|
+
// packages/tui/src/streaming/writer.ts
|
|
7
|
+
function createStreamWriter(options = {}) {
|
|
8
|
+
const stream = options.stream ?? process.stdout;
|
|
9
|
+
const isTTY = stream.isTTY ?? false;
|
|
10
|
+
let currentLineCount = 0;
|
|
11
|
+
let hasContent = false;
|
|
12
|
+
const write = (content) => {
|
|
13
|
+
if (!isTTY) {
|
|
14
|
+
stream.write(content);
|
|
15
|
+
hasContent = true;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (hasContent) {
|
|
19
|
+
clear();
|
|
20
|
+
}
|
|
21
|
+
stream.write(content);
|
|
22
|
+
currentLineCount = content.split(`
|
|
23
|
+
`).length;
|
|
24
|
+
hasContent = true;
|
|
25
|
+
};
|
|
26
|
+
const update = (content) => {
|
|
27
|
+
if (!isTTY) {
|
|
28
|
+
stream.write(`
|
|
29
|
+
${content}`);
|
|
30
|
+
hasContent = true;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (currentLineCount > 0) {
|
|
34
|
+
stream.write(ANSI.carriageReturn);
|
|
35
|
+
if (currentLineCount > 1) {
|
|
36
|
+
stream.write(ANSI.cursorUp(currentLineCount - 1));
|
|
37
|
+
}
|
|
38
|
+
for (let i = 0;i < currentLineCount; i++) {
|
|
39
|
+
stream.write(ANSI.clearLine);
|
|
40
|
+
if (i < currentLineCount - 1) {
|
|
41
|
+
stream.write(ANSI.cursorDown(1));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (currentLineCount > 1) {
|
|
45
|
+
stream.write(ANSI.cursorUp(currentLineCount - 1));
|
|
46
|
+
}
|
|
47
|
+
stream.write(ANSI.carriageReturn);
|
|
48
|
+
}
|
|
49
|
+
stream.write(content);
|
|
50
|
+
currentLineCount = content.split(`
|
|
51
|
+
`).length;
|
|
52
|
+
hasContent = true;
|
|
53
|
+
};
|
|
54
|
+
const persist = () => {
|
|
55
|
+
if (!hasContent)
|
|
56
|
+
return;
|
|
57
|
+
stream.write(`
|
|
58
|
+
`);
|
|
59
|
+
currentLineCount = 0;
|
|
60
|
+
hasContent = false;
|
|
61
|
+
};
|
|
62
|
+
const clear = () => {
|
|
63
|
+
if (!(isTTY && hasContent)) {
|
|
64
|
+
hasContent = false;
|
|
65
|
+
currentLineCount = 0;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
stream.write(ANSI.carriageReturn);
|
|
69
|
+
if (currentLineCount > 1) {
|
|
70
|
+
stream.write(ANSI.cursorUp(currentLineCount - 1));
|
|
71
|
+
}
|
|
72
|
+
stream.write(ANSI.clearLine);
|
|
73
|
+
for (let i = 1;i < currentLineCount; i++) {
|
|
74
|
+
stream.write(ANSI.cursorDown(1) + ANSI.clearLine);
|
|
75
|
+
}
|
|
76
|
+
if (currentLineCount > 1) {
|
|
77
|
+
stream.write(ANSI.cursorUp(currentLineCount - 1));
|
|
78
|
+
}
|
|
79
|
+
currentLineCount = 0;
|
|
80
|
+
hasContent = false;
|
|
81
|
+
};
|
|
82
|
+
return { write, update, persist, clear };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { createStreamWriter };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { WidthMode } from "./tui-75bztyfp";
|
|
2
|
+
/**
|
|
3
|
+
* Width mode for separators.
|
|
4
|
+
*
|
|
5
|
+
* Separators only support "text", "full", and numeric widths.
|
|
6
|
+
* Container-relative modes require context, which separators don't use.
|
|
7
|
+
*/
|
|
8
|
+
type SeparatorWidthMode = Extract<WidthMode, "text" | "full" | number>;
|
|
9
|
+
/**
|
|
10
|
+
* Separator style for dividers.
|
|
11
|
+
* Single characters repeat to fill width.
|
|
12
|
+
* Two-character patterns (like "- ") alternate to create dashed effect.
|
|
13
|
+
*/
|
|
14
|
+
type DividerStyle = "─" | "━" | "═" | "- " | "· ";
|
|
15
|
+
/**
|
|
16
|
+
* Options for rendering a separator.
|
|
17
|
+
*/
|
|
18
|
+
interface SeparatorOptions {
|
|
19
|
+
/** Separator style (default: "─") */
|
|
20
|
+
style?: DividerStyle;
|
|
21
|
+
/** Width mode (default: 40) */
|
|
22
|
+
width?: SeparatorWidthMode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders a horizontal separator line.
|
|
26
|
+
*
|
|
27
|
+
* @param options - Rendering options
|
|
28
|
+
* @returns Formatted separator string
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { renderSeparator } from "@outfitter/tui/render";
|
|
33
|
+
*
|
|
34
|
+
* console.log(renderSeparator());
|
|
35
|
+
* // ────────────────────────────────────────
|
|
36
|
+
*
|
|
37
|
+
* console.log(renderSeparator({ style: "━", width: 20 }));
|
|
38
|
+
* // ━━━━━━━━━━━━━━━━━━━━
|
|
39
|
+
*
|
|
40
|
+
* console.log(renderSeparator({ style: "- ", width: 20 }));
|
|
41
|
+
* // - - - - - - - - - -
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare function renderSeparator(options?: SeparatorOptions): string;
|
|
45
|
+
export { DividerStyle, SeparatorOptions, renderSeparator };
|
|
@@ -0,0 +1,59 @@
|
|
|
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 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
defaultTheme
|
|
4
|
+
} from "./tui-0mpqnyc1.js";
|
|
5
|
+
import {
|
|
6
|
+
BORDERS,
|
|
7
|
+
init_borders
|
|
8
|
+
} from "./tui-2pwhzg55.js";
|
|
9
|
+
|
|
10
|
+
// packages/tui/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 };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date and time formatting utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides human-friendly relative time formatting.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Formats a date as a human-friendly relative time string.
|
|
10
|
+
*
|
|
11
|
+
* Converts timestamps to natural language like "just now", "5 minutes ago",
|
|
12
|
+
* "yesterday", or "in 3 hours". Handles both past and future dates.
|
|
13
|
+
*
|
|
14
|
+
* @param date - Date to format (Date object, timestamp number, or ISO string)
|
|
15
|
+
* @returns Human-friendly relative time string
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* formatRelative(new Date()) // "just now"
|
|
20
|
+
* formatRelative(Date.now() - 30000) // "30 seconds ago"
|
|
21
|
+
* formatRelative(Date.now() - 3600000) // "1 hour ago"
|
|
22
|
+
* formatRelative(Date.now() + 300000) // "in 5 minutes"
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function formatRelative(date: Date | number | string): string;
|
|
26
|
+
export { formatRelative };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|