@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.
Files changed (260) hide show
  1. package/README.md +23 -4
  2. package/dist/actions.js +0 -2
  3. package/dist/cli.d.ts +1 -1
  4. package/dist/cli.js +1 -2
  5. package/dist/{render → colors}/colors.d.ts +1 -1
  6. package/dist/{render → colors}/colors.js +2 -6
  7. package/dist/colors/index.d.ts +1 -1
  8. package/dist/colors/index.js +3 -4
  9. package/dist/command.d.ts +1 -1
  10. package/dist/command.js +1 -2
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +3 -4
  13. package/dist/input.d.ts +3 -26
  14. package/dist/input.js +1 -31
  15. package/dist/output.d.ts +2 -2
  16. package/dist/output.js +0 -1
  17. package/dist/pagination.d.ts +1 -1
  18. package/dist/pagination.js +0 -2
  19. package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
  20. package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-f79bwzsp.d.ts} +1 -1
  21. package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
  22. package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
  23. package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
  24. package/dist/terminal/detection.js +1 -5
  25. package/dist/terminal/index.js +1 -6
  26. package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
  27. package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
  28. package/dist/types.d.ts +2 -2
  29. package/dist/types.js +0 -2
  30. package/package.json +35 -213
  31. package/dist/borders/index.d.ts +0 -3
  32. package/dist/borders/index.js +0 -13
  33. package/dist/box/index.d.ts +0 -4
  34. package/dist/box/index.js +0 -13
  35. package/dist/demo/index.d.ts +0 -78
  36. package/dist/demo/index.js +0 -148
  37. package/dist/demo/registry.d.ts +0 -7
  38. package/dist/demo/registry.js +0 -28
  39. package/dist/demo/renderers/borders.d.ts +0 -7
  40. package/dist/demo/renderers/borders.js +0 -17
  41. package/dist/demo/renderers/box.d.ts +0 -7
  42. package/dist/demo/renderers/box.js +0 -18
  43. package/dist/demo/renderers/colors.d.ts +0 -7
  44. package/dist/demo/renderers/colors.js +0 -18
  45. package/dist/demo/renderers/indicators.d.ts +0 -7
  46. package/dist/demo/renderers/indicators.js +0 -17
  47. package/dist/demo/renderers/list.d.ts +0 -7
  48. package/dist/demo/renderers/list.js +0 -19
  49. package/dist/demo/renderers/markdown.d.ts +0 -7
  50. package/dist/demo/renderers/markdown.js +0 -18
  51. package/dist/demo/renderers/progress.d.ts +0 -7
  52. package/dist/demo/renderers/progress.js +0 -17
  53. package/dist/demo/renderers/spinner.d.ts +0 -7
  54. package/dist/demo/renderers/spinner.js +0 -19
  55. package/dist/demo/renderers/table.d.ts +0 -7
  56. package/dist/demo/renderers/table.js +0 -19
  57. package/dist/demo/renderers/text.d.ts +0 -7
  58. package/dist/demo/renderers/text.js +0 -16
  59. package/dist/demo/renderers/tree.d.ts +0 -7
  60. package/dist/demo/renderers/tree.js +0 -18
  61. package/dist/demo/section.d.ts +0 -5
  62. package/dist/demo/section.js +0 -23
  63. package/dist/demo/templates.d.ts +0 -4
  64. package/dist/demo/templates.js +0 -10
  65. package/dist/demo/types.d.ts +0 -3
  66. package/dist/demo/types.js +0 -8
  67. package/dist/list/index.d.ts +0 -3
  68. package/dist/list/index.js +0 -9
  69. package/dist/preset/full.d.ts +0 -14
  70. package/dist/preset/full.js +0 -41
  71. package/dist/preset/standard.d.ts +0 -11
  72. package/dist/preset/standard.js +0 -30
  73. package/dist/prompt/confirm.d.ts +0 -4
  74. package/dist/prompt/confirm.js +0 -9
  75. package/dist/prompt/group.d.ts +0 -4
  76. package/dist/prompt/group.js +0 -9
  77. package/dist/prompt/index.d.ts +0 -7
  78. package/dist/prompt/index.js +0 -32
  79. package/dist/prompt/select.d.ts +0 -4
  80. package/dist/prompt/select.js +0 -11
  81. package/dist/prompt/text.d.ts +0 -4
  82. package/dist/prompt/text.js +0 -11
  83. package/dist/prompt/types.d.ts +0 -3
  84. package/dist/prompt/types.js +0 -8
  85. package/dist/prompt/validators.d.ts +0 -2
  86. package/dist/prompt/validators.js +0 -8
  87. package/dist/render/borders.d.ts +0 -2
  88. package/dist/render/borders.js +0 -15
  89. package/dist/render/box.d.ts +0 -3
  90. package/dist/render/box.js +0 -23
  91. package/dist/render/date.d.ts +0 -2
  92. package/dist/render/date.js +0 -12
  93. package/dist/render/format-relative.d.ts +0 -2
  94. package/dist/render/format-relative.js +0 -8
  95. package/dist/render/format.d.ts +0 -2
  96. package/dist/render/format.js +0 -10
  97. package/dist/render/heading.d.ts +0 -3
  98. package/dist/render/heading.js +0 -14
  99. package/dist/render/index.d.ts +0 -32
  100. package/dist/render/index.js +0 -235
  101. package/dist/render/indicators.d.ts +0 -2
  102. package/dist/render/indicators.js +0 -16
  103. package/dist/render/json.d.ts +0 -2
  104. package/dist/render/json.js +0 -10
  105. package/dist/render/layout.d.ts +0 -5
  106. package/dist/render/layout.js +0 -25
  107. package/dist/render/list.d.ts +0 -2
  108. package/dist/render/list.js +0 -8
  109. package/dist/render/markdown.d.ts +0 -2
  110. package/dist/render/markdown.js +0 -10
  111. package/dist/render/progress.d.ts +0 -2
  112. package/dist/render/progress.js +0 -8
  113. package/dist/render/separator.d.ts +0 -3
  114. package/dist/render/separator.js +0 -14
  115. package/dist/render/shapes.d.ts +0 -2
  116. package/dist/render/shapes.js +0 -35
  117. package/dist/render/spinner.d.ts +0 -2
  118. package/dist/render/spinner.js +0 -12
  119. package/dist/render/stack.d.ts +0 -3
  120. package/dist/render/stack.js +0 -38
  121. package/dist/render/table.d.ts +0 -3
  122. package/dist/render/table.js +0 -12
  123. package/dist/render/text.d.ts +0 -2
  124. package/dist/render/text.js +0 -27
  125. package/dist/render/tree.d.ts +0 -2
  126. package/dist/render/tree.js +0 -10
  127. package/dist/render/types.d.ts +0 -2
  128. package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
  129. package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
  130. package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
  131. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
  132. package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
  133. package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
  134. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
  135. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
  136. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
  137. package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
  138. package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
  139. package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
  140. package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
  141. package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
  142. package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
  143. package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
  144. package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
  145. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
  146. package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
  147. package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
  148. package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
  149. package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
  150. package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
  151. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
  152. package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
  153. package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
  154. package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
  155. package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
  156. package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
  157. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
  158. package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
  159. package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
  160. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
  161. package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
  162. package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
  163. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
  164. package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
  165. package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
  166. package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
  167. package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
  168. package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
  169. package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
  170. package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
  171. package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
  172. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
  173. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
  174. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
  175. package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
  176. package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
  177. package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
  178. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
  179. package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
  180. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
  181. package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
  182. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
  183. package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
  184. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
  185. package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
  186. package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
  187. package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
  188. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
  189. package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
  190. package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
  191. package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
  192. package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
  193. package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
  194. package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
  195. package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
  196. package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
  197. package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
  198. package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
  199. package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
  200. package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
  201. package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
  202. package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
  203. package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
  204. package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
  205. package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
  206. package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
  207. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
  208. package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
  209. package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
  210. package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
  211. package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
  212. package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
  213. package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
  214. package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
  215. package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
  216. package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
  217. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
  218. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
  219. package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
  220. package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
  221. package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
  222. package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
  223. package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
  224. package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
  225. package/dist/shared/@outfitter/cli-znc47004.js +0 -134
  226. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
  227. package/dist/streaming/ansi.d.ts +0 -2
  228. package/dist/streaming/ansi.js +0 -8
  229. package/dist/streaming/index.d.ts +0 -4
  230. package/dist/streaming/index.js +0 -17
  231. package/dist/streaming/spinner.d.ts +0 -3
  232. package/dist/streaming/spinner.js +0 -10
  233. package/dist/streaming/writer.d.ts +0 -2
  234. package/dist/streaming/writer.js +0 -9
  235. package/dist/table/index.d.ts +0 -4
  236. package/dist/table/index.js +0 -13
  237. package/dist/theme/context.d.ts +0 -9
  238. package/dist/theme/context.js +0 -14
  239. package/dist/theme/create.d.ts +0 -8
  240. package/dist/theme/create.js +0 -12
  241. package/dist/theme/index.d.ts +0 -17
  242. package/dist/theme/index.js +0 -42
  243. package/dist/theme/presets/bold.d.ts +0 -8
  244. package/dist/theme/presets/bold.js +0 -12
  245. package/dist/theme/presets/default.d.ts +0 -8
  246. package/dist/theme/presets/default.js +0 -11
  247. package/dist/theme/presets/index.d.ts +0 -12
  248. package/dist/theme/presets/index.js +0 -24
  249. package/dist/theme/presets/minimal.d.ts +0 -8
  250. package/dist/theme/presets/minimal.js +0 -12
  251. package/dist/theme/presets/rounded.d.ts +0 -8
  252. package/dist/theme/presets/rounded.js +0 -12
  253. package/dist/theme/resolve.d.ts +0 -8
  254. package/dist/theme/resolve.js +0 -11
  255. package/dist/theme/types.d.ts +0 -7
  256. package/dist/theme/types.js +0 -1
  257. package/dist/tree/index.d.ts +0 -3
  258. package/dist/tree/index.js +0 -11
  259. /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
  260. /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
@@ -1,94 +0,0 @@
1
- // @bun
2
- import {
3
- renderTable
4
- } from "./cli-c8fqdaes.js";
5
- import {
6
- BORDER_STYLE_META,
7
- getBorderStyles
8
- } from "./cli-d8ahdd9d.js";
9
- import {
10
- getExample
11
- } from "./cli-xep6v2c0.js";
12
- import {
13
- demoSection
14
- } from "./cli-sam2sq50.js";
15
-
16
- // packages/cli/src/demo/renderers/table.ts
17
- function renderTableDemo(config, theme) {
18
- const showCode = config.showCode ?? true;
19
- const showDescriptions = config.showDescriptions ?? true;
20
- const lines = [];
21
- lines.push(demoSection("Basic Table"));
22
- lines.push("");
23
- if (showCode) {
24
- lines.push('import { renderTable } from "@outfitter/cli/render";');
25
- lines.push("");
26
- lines.push("renderTable([");
27
- lines.push(' { id: 1, name: "Alice", status: "Active" },');
28
- lines.push(' { id: 2, name: "Bob", status: "Pending" },');
29
- lines.push("])");
30
- lines.push("");
31
- }
32
- const basicData = getExample("tableData", config.examples);
33
- lines.push(renderTable(basicData));
34
- lines.push("");
35
- lines.push(demoSection("Custom Headers"));
36
- lines.push("");
37
- if (showCode) {
38
- lines.push("renderTable(data, {");
39
- lines.push(' headers: { id: "Task ID", name: "Assignee" }');
40
- lines.push("})");
41
- lines.push("");
42
- }
43
- lines.push(renderTable(basicData, {
44
- headers: { id: "Task ID", name: "Assignee" }
45
- }));
46
- lines.push("");
47
- lines.push(demoSection("Border Styles"));
48
- lines.push("");
49
- const styles = getBorderStyles().filter((s) => s !== "none");
50
- const smallData = [
51
- { id: 1, name: "Alice" },
52
- { id: 2, name: "Bob" }
53
- ];
54
- for (const style of styles) {
55
- const meta = BORDER_STYLE_META[style];
56
- lines.push(`${meta.label.toUpperCase()} (border: "${style}")`);
57
- if (showDescriptions) {
58
- lines.push(theme.muted(meta.description));
59
- }
60
- lines.push("");
61
- lines.push(renderTable(smallData, { border: style }));
62
- lines.push("");
63
- }
64
- lines.push(demoSection("Compact Mode"));
65
- lines.push("");
66
- if (showCode) {
67
- lines.push("renderTable(data, { compact: true })");
68
- lines.push("");
69
- }
70
- lines.push(renderTable(smallData, { compact: true }));
71
- lines.push("");
72
- lines.push(theme.muted("Compact mode removes borders and uses space separators."));
73
- lines.push("");
74
- lines.push(demoSection("Wide Characters (CJK/Emoji)"));
75
- lines.push("");
76
- if (showCode) {
77
- lines.push("renderTable([");
78
- lines.push(' { id: 1, name: "\u5C71\u7530\u592A\u90CE", status: "\u5B8C\u4E86" },');
79
- lines.push(' { id: 2, name: "Party \uD83C\uDF89", status: "\uD83D\uDE80" },');
80
- lines.push("])");
81
- lines.push("");
82
- }
83
- const wideData = [
84
- { id: 1, name: "\u5C71\u7530\u592A\u90CE", status: "\u5B8C\u4E86" },
85
- { id: 2, name: "Party \uD83C\uDF89", status: "\uD83D\uDE80" }
86
- ];
87
- lines.push(renderTable(wideData));
88
- lines.push("");
89
- lines.push(theme.muted("Uses Bun.stringWidth() for correct column alignment."));
90
- return lines.join(`
91
- `);
92
- }
93
-
94
- export { renderTableDemo };
@@ -1,106 +0,0 @@
1
- /**
2
- * Box-drawing border utilities.
3
- *
4
- * Provides border character sets and line drawing functions for tables, boxes, and panels.
5
- *
6
- * @packageDocumentation
7
- */
8
- /**
9
- * Available border style presets.
10
- *
11
- * - `single`: Standard Unicode single-line borders (┌─┐)
12
- * - `double`: Double-line borders (╔═╗)
13
- * - `rounded`: Rounded corners with single lines (╭─╮)
14
- * - `heavy`: Thick/heavy borders (┏━┓)
15
- * - `ascii`: ASCII-only fallback (+, -, |)
16
- * - `none`: No borders (empty strings)
17
- */
18
- type BorderStyle = "single" | "double" | "rounded" | "heavy" | "ascii" | "none";
19
- /**
20
- * Complete set of box-drawing characters for a border style.
21
- *
22
- * Includes corners, edges, and intersection characters for building
23
- * tables, boxes, and other bordered elements.
24
- */
25
- interface BorderCharacters {
26
- /** Top-left corner (e.g., ┌ ╔ ╭ ┏) */
27
- topLeft: string;
28
- /** Top-right corner (e.g., ┐ ╗ ╮ ┓) */
29
- topRight: string;
30
- /** Bottom-left corner (e.g., └ ╚ ╰ ┗) */
31
- bottomLeft: string;
32
- /** Bottom-right corner (e.g., ┘ ╝ ╯ ┛) */
33
- bottomRight: string;
34
- /** Horizontal line (e.g., ─ ═ ━) */
35
- horizontal: string;
36
- /** Vertical line (e.g., │ ║ ┃) */
37
- vertical: string;
38
- /** Top T-intersection for column separators (e.g., ┬ ╦ ┳) */
39
- topT: string;
40
- /** Bottom T-intersection for column separators (e.g., ┴ ╩ ┻) */
41
- bottomT: string;
42
- /** Left T-intersection for row separators (e.g., ├ ╠ ┣) */
43
- leftT: string;
44
- /** Right T-intersection for row separators (e.g., ┤ ╣ ┫) */
45
- rightT: string;
46
- /** Cross intersection for table cells (e.g., ┼ ╬ ╋) */
47
- cross: string;
48
- }
49
- /**
50
- * Preset border character sets for each style.
51
- *
52
- * @example
53
- * ```typescript
54
- * import { BORDERS } from "@outfitter/cli";
55
- *
56
- * const single = BORDERS.single;
57
- * console.log(`${single.topLeft}${single.horizontal.repeat(10)}${single.topRight}`);
58
- * // Output: ┌──────────┐
59
- * ```
60
- */
61
- declare const BORDERS: Record<BorderStyle, BorderCharacters>;
62
- /**
63
- * Returns the border character set for the given style.
64
- *
65
- * @param style - The border style preset
66
- * @returns The complete set of border characters
67
- *
68
- * @example
69
- * ```typescript
70
- * const chars = getBorderCharacters("rounded");
71
- * console.log(chars.topLeft); // ╭
72
- * console.log(chars.topRight); // ╮
73
- * ```
74
- */
75
- declare function getBorderCharacters(style: BorderStyle): BorderCharacters;
76
- /**
77
- * Position of a horizontal line within a bordered element.
78
- */
79
- type LinePosition = "top" | "middle" | "bottom";
80
- /**
81
- * Draws a horizontal line with the appropriate corner/intersection characters.
82
- *
83
- * Used for building table borders and box edges. Handles column intersections
84
- * when column widths are provided.
85
- *
86
- * @param width - Total width of the line content (excluding corners)
87
- * @param chars - Border character set to use
88
- * @param position - Position of line: "top", "middle", or "bottom"
89
- * @param columnWidths - Optional array of column widths for intersection placement
90
- * @returns The formatted horizontal line string
91
- *
92
- * @example
93
- * ```typescript
94
- * const chars = getBorderCharacters("single");
95
- *
96
- * // Simple line (no columns)
97
- * drawHorizontalLine(10, chars, "top");
98
- * // Returns: ┌──────────┐
99
- *
100
- * // Line with column intersections
101
- * drawHorizontalLine(14, chars, "middle", [5, 7]);
102
- * // Returns: ├─────┼───────┤
103
- * ```
104
- */
105
- declare function drawHorizontalLine(width: number, chars: BorderCharacters, position: LinePosition, columnWidths?: number[]): string;
106
- export { BorderStyle, BorderCharacters, BORDERS, getBorderCharacters, LinePosition, drawHorizontalLine };
@@ -1,122 +0,0 @@
1
- // @bun
2
- import {
3
- TREE_GUIDES,
4
- renderTree
5
- } from "./cli-b5c2k0d7.js";
6
- import {
7
- getExample
8
- } from "./cli-xep6v2c0.js";
9
- import {
10
- demoSection
11
- } from "./cli-sam2sq50.js";
12
-
13
- // packages/cli/src/demo/renderers/tree.ts
14
- function renderTreeDemo(config, _theme) {
15
- const showCode = config.showCode ?? true;
16
- const lines = [];
17
- lines.push(demoSection("Basic Tree"));
18
- lines.push("");
19
- if (showCode) {
20
- lines.push('import { renderTree } from "@outfitter/cli/tree";');
21
- lines.push("");
22
- }
23
- const treeData = getExample("treeData", config.examples);
24
- if (showCode) {
25
- lines.push("renderTree({");
26
- lines.push(" src: {");
27
- lines.push(" components: { Button: null, Input: null },");
28
- lines.push(" utils: null,");
29
- lines.push(" },");
30
- lines.push(" tests: null,");
31
- lines.push("})");
32
- lines.push("");
33
- }
34
- lines.push(renderTree(treeData));
35
- lines.push("");
36
- lines.push(demoSection("Guide Styles"));
37
- lines.push("");
38
- const guideDemo = {
39
- root: {
40
- child1: {
41
- leaf: null
42
- },
43
- child2: null
44
- }
45
- };
46
- const guideStyles = [
47
- "single",
48
- "rounded",
49
- "heavy",
50
- "double"
51
- ];
52
- for (const style of guideStyles) {
53
- const guide = TREE_GUIDES[style];
54
- lines.push(`${style.toUpperCase()} (fork: "${guide.fork.trim()}", end: "${guide.end.trim()}")`);
55
- lines.push("");
56
- lines.push(renderTree(guideDemo, { guide: style }));
57
- lines.push("");
58
- }
59
- lines.push(demoSection("Max Depth"));
60
- lines.push("");
61
- const deepTree = {
62
- level1: {
63
- level2: {
64
- level3: {
65
- level4: null
66
- }
67
- }
68
- }
69
- };
70
- if (showCode) {
71
- lines.push("renderTree(tree, { maxDepth: 2 })");
72
- lines.push("");
73
- }
74
- lines.push("Full tree:");
75
- lines.push(renderTree(deepTree));
76
- lines.push("");
77
- lines.push("With maxDepth: 2:");
78
- lines.push(renderTree(deepTree, { maxDepth: 2 }));
79
- lines.push("");
80
- lines.push(demoSection("Custom Labels"));
81
- lines.push("");
82
- const fileTree = {
83
- src: {
84
- "index.ts": null,
85
- components: {
86
- "Button.tsx": null
87
- }
88
- },
89
- "package.json": null
90
- };
91
- if (showCode) {
92
- lines.push("renderTree(tree, {");
93
- lines.push(" renderLabel: (key, value) => {");
94
- lines.push(" if (value && typeof value === 'object') {");
95
- lines.push(" return `\uD83D\uDCC1 ${key}/`;");
96
- lines.push(" }");
97
- lines.push(" return `\uD83D\uDCC4 ${key}`;");
98
- lines.push(" }");
99
- lines.push("})");
100
- lines.push("");
101
- }
102
- lines.push(renderTree(fileTree, {
103
- renderLabel: (key, value) => {
104
- if (value && typeof value === "object") {
105
- return `\uD83D\uDCC1 ${key}/`;
106
- }
107
- return `\uD83D\uDCC4 ${key}`;
108
- }
109
- }));
110
- lines.push("");
111
- lines.push(demoSection("Usage Notes"));
112
- lines.push("");
113
- lines.push("\u2022 Objects become branches with children");
114
- lines.push("\u2022 null values become leaf nodes (terminal)");
115
- lines.push("\u2022 Use guide option to change visual style");
116
- lines.push("\u2022 Use maxDepth to limit rendering depth");
117
- lines.push("\u2022 Use renderLabel for custom node formatting");
118
- return lines.join(`
119
- `);
120
- }
121
-
122
- export { renderTreeDemo };
@@ -1,66 +0,0 @@
1
- import { WritableStream } from "./cli-cf1xexgn";
2
- /**
3
- * Spinner frame sets.
4
- */
5
- declare const SPINNER_FRAMES: {
6
- readonly dots: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
7
- readonly line: readonly ["-", "\\", "|", "/"];
8
- readonly simple: readonly ["◐", "◓", "◑", "◒"];
9
- };
10
- /**
11
- * Available spinner styles.
12
- */
13
- type SpinnerStyle = keyof typeof SPINNER_FRAMES;
14
- /**
15
- * Options for creating a spinner.
16
- */
17
- interface SpinnerOptions {
18
- /** Spinner style */
19
- style?: SpinnerStyle;
20
- /** Target stream */
21
- stream?: WritableStream;
22
- /** Frame interval in ms */
23
- interval?: number;
24
- }
25
- /**
26
- * Spinner interface for animated progress indication.
27
- */
28
- interface Spinner {
29
- /** Start the spinner */
30
- start(): void;
31
- /** Update the spinner message */
32
- update(message: string): void;
33
- /** Stop with success state */
34
- succeed(message?: string): void;
35
- /** Stop with failure state */
36
- fail(message?: string): void;
37
- /** Stop the spinner */
38
- stop(): void;
39
- }
40
- /**
41
- * Creates an animated spinner for indicating progress.
42
- *
43
- * In TTY mode, shows an animated spinner. In non-TTY mode,
44
- * falls back to static output.
45
- *
46
- * @param message - Initial spinner message
47
- * @param options - Spinner configuration
48
- * @returns Spinner instance
49
- *
50
- * @example
51
- * ```typescript
52
- * import { createSpinner } from "@outfitter/cli/streaming";
53
- *
54
- * const spinner = createSpinner("Installing dependencies");
55
- * spinner.start();
56
- *
57
- * try {
58
- * await install();
59
- * spinner.succeed("Dependencies installed");
60
- * } catch (error) {
61
- * spinner.fail("Installation failed");
62
- * }
63
- * ```
64
- */
65
- declare function createSpinner(message: string, options?: SpinnerOptions): Spinner;
66
- export { SpinnerStyle, SpinnerOptions, Spinner, createSpinner };
@@ -1,48 +0,0 @@
1
- // @bun
2
- import {
3
- defaultTheme
4
- } from "./cli-z78mkrc7.js";
5
- import {
6
- BORDERS,
7
- init_borders
8
- } from "./cli-85fg2vr5.js";
9
-
10
- // packages/cli/src/theme/create.ts
11
- init_borders();
12
- function createVisualTheme(options) {
13
- const base = options?.extends ?? defaultTheme;
14
- const overrides = options?.overrides ?? {};
15
- const border = overrides.border ?? base.border;
16
- const borderChars = overrides.borderChars ?? (overrides.border ? BORDERS[overrides.border] : base.borderChars);
17
- const colors = {
18
- ...base.colors,
19
- ...overrides.colors
20
- };
21
- const spacing = {
22
- ...base.spacing,
23
- ...overrides.spacing
24
- };
25
- const markers = {
26
- ...base.markers,
27
- ...overrides.markers
28
- };
29
- const checkbox = {
30
- checked: overrides.checkbox?.checked ?? base.checkbox.checked,
31
- unchecked: overrides.checkbox?.unchecked ?? base.checkbox.unchecked
32
- };
33
- return {
34
- name: overrides.name ?? base.name,
35
- border,
36
- borderChars,
37
- treeGuide: overrides.treeGuide ?? base.treeGuide,
38
- delimiter: overrides.delimiter ?? base.delimiter,
39
- markers,
40
- listBullet: overrides.listBullet ?? base.listBullet,
41
- checkbox,
42
- colors,
43
- spacing,
44
- spinner: overrides.spinner ?? base.spinner
45
- };
46
- }
47
-
48
- export { createVisualTheme };
@@ -1,67 +0,0 @@
1
- // @bun
2
- import {
3
- SPINNERS,
4
- getSpinnerFrame,
5
- renderSpinner
6
- } from "./cli-n9dbh0hp.js";
7
- import {
8
- SPINNER_STYLE_META,
9
- getSpinnerStyles
10
- } from "./cli-d8ahdd9d.js";
11
- import {
12
- getExample
13
- } from "./cli-xep6v2c0.js";
14
- import {
15
- demoSection
16
- } from "./cli-sam2sq50.js";
17
-
18
- // packages/cli/src/demo/renderers/spinner.ts
19
- function renderSpinnerDemo(config, theme) {
20
- const showCode = config.showCode ?? true;
21
- const showDescriptions = config.showDescriptions ?? true;
22
- const lines = [];
23
- lines.push(demoSection("Spinner Styles"));
24
- lines.push("");
25
- if (showCode) {
26
- lines.push('import { renderSpinner, SPINNERS } from "@outfitter/cli/render";');
27
- lines.push("");
28
- }
29
- const message = getExample("spinnerMessage", config.examples);
30
- const styles = getSpinnerStyles();
31
- for (const style of styles) {
32
- const meta = SPINNER_STYLE_META[style];
33
- const spinner = SPINNERS[style];
34
- lines.push(`${meta.label.toUpperCase()} (${style})`);
35
- if (showDescriptions) {
36
- lines.push(theme.muted(meta.description));
37
- }
38
- const frameDisplay = spinner.frames.join(" ");
39
- lines.push(` Frames: ${frameDisplay}`);
40
- lines.push(` Interval: ${spinner.interval}ms`);
41
- const output = renderSpinner(style, message);
42
- lines.push(` Example: ${output}`);
43
- lines.push("");
44
- }
45
- lines.push(demoSection("Usage"));
46
- lines.push("");
47
- if (showCode) {
48
- lines.push("// Static render (for logs/non-TTY)");
49
- lines.push(`renderSpinner("dots", "${message}");`);
50
- lines.push("");
51
- lines.push("// Get frame at specific time");
52
- lines.push('getSpinnerFrame("dots", 0); // First frame');
53
- lines.push('getSpinnerFrame("dots", 160); // Third frame');
54
- lines.push("");
55
- }
56
- lines.push("Frame progression (dots style):");
57
- const dotSpinner = SPINNERS.dots;
58
- for (let i = 0;i < Math.min(5, dotSpinner.frames.length); i++) {
59
- const elapsed = i * dotSpinner.interval;
60
- const frame = getSpinnerFrame("dots", elapsed);
61
- lines.push(` ${elapsed}ms \u2192 ${frame}`);
62
- }
63
- return lines.join(`
64
- `);
65
- }
66
-
67
- export { renderSpinnerDemo };
@@ -1,126 +0,0 @@
1
- // @bun
2
- import {
3
- renderList
4
- } from "./cli-xg5y5fhk.js";
5
- import {
6
- LIST_STYLE_META,
7
- getListStyles
8
- } from "./cli-d8ahdd9d.js";
9
- import {
10
- getExample
11
- } from "./cli-xep6v2c0.js";
12
- import {
13
- demoSection
14
- } from "./cli-sam2sq50.js";
15
-
16
- // packages/cli/src/demo/renderers/list.ts
17
- function renderListDemo(config, theme) {
18
- const showCode = config.showCode ?? true;
19
- const showDescriptions = config.showDescriptions ?? true;
20
- const lines = [];
21
- lines.push(demoSection("List Styles"));
22
- lines.push("");
23
- if (showCode) {
24
- lines.push('import { renderList } from "@outfitter/cli/render";');
25
- lines.push("");
26
- }
27
- const items = getExample("listItems", config.examples);
28
- const styles = getListStyles();
29
- for (const style of styles) {
30
- const meta = LIST_STYLE_META[style];
31
- lines.push(`${meta.label.toUpperCase()} STYLE`);
32
- if (showDescriptions) {
33
- lines.push(theme.muted(meta.description));
34
- }
35
- lines.push("");
36
- if (showCode) {
37
- lines.push(`renderList(items, { style: "${style}" })`);
38
- lines.push("");
39
- }
40
- if (style === "checkbox") {
41
- const output = renderList(items, {
42
- style,
43
- checked: new Set([1])
44
- });
45
- lines.push(output);
46
- } else {
47
- const output = renderList(items, { style });
48
- lines.push(output);
49
- }
50
- lines.push("");
51
- }
52
- lines.push(demoSection("Nested Lists"));
53
- lines.push("");
54
- const nestedItems = [
55
- "Top level item",
56
- {
57
- text: "Parent with children",
58
- children: ["Child one", "Child two"]
59
- },
60
- "Another top level"
61
- ];
62
- if (showCode) {
63
- lines.push("renderList([");
64
- lines.push(' "Top level item",');
65
- lines.push(' { text: "Parent with children", children: ["Child one", "Child two"] },');
66
- lines.push(' "Another top level",');
67
- lines.push("])");
68
- lines.push("");
69
- }
70
- lines.push(renderList(nestedItems));
71
- lines.push("");
72
- lines.push(demoSection("Numbered with Nesting"));
73
- lines.push("");
74
- const numberedNested = [
75
- {
76
- text: "First section",
77
- children: [
78
- {
79
- text: "Subsection A",
80
- children: ["Detail i", "Detail ii"]
81
- },
82
- "Subsection B"
83
- ]
84
- },
85
- "Second section"
86
- ];
87
- if (showCode) {
88
- lines.push('renderList(items, { style: "number" })');
89
- lines.push("");
90
- }
91
- lines.push(renderList(numberedNested, { style: "number" }));
92
- lines.push("");
93
- lines.push(demoSection("Mixed Styles"));
94
- lines.push("");
95
- if (showDescriptions) {
96
- lines.push(theme.muted("Use childStyle to override style for children"));
97
- lines.push("");
98
- }
99
- const mixedItems = [
100
- {
101
- text: "Requirements",
102
- childStyle: "bullet",
103
- children: ["Must be fast", "Must be reliable"]
104
- },
105
- {
106
- text: "Tasks",
107
- childStyle: "checkbox",
108
- children: [
109
- { text: "Write tests", checked: true },
110
- { text: "Deploy to prod", checked: false }
111
- ]
112
- }
113
- ];
114
- if (showCode) {
115
- lines.push("renderList([");
116
- lines.push(' { text: "Requirements", childStyle: "bullet", children: [...] },');
117
- lines.push(' { text: "Tasks", childStyle: "checkbox", children: [...] },');
118
- lines.push('], { style: "number" })');
119
- lines.push("");
120
- }
121
- lines.push(renderList(mixedItems, { style: "number" }));
122
- return lines.join(`
123
- `);
124
- }
125
-
126
- export { renderListDemo };