@outfitter/cli 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +48 -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 +2 -2
  10. package/dist/command.js +11 -2
  11. package/dist/completion.d.ts +36 -0
  12. package/dist/completion.js +91 -0
  13. package/dist/flags.d.ts +167 -0
  14. package/dist/flags.js +31 -0
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +5 -4
  17. package/dist/input.d.ts +3 -26
  18. package/dist/input.js +1 -31
  19. package/dist/output.d.ts +2 -2
  20. package/dist/output.js +0 -1
  21. package/dist/pagination.d.ts +1 -1
  22. package/dist/pagination.js +0 -2
  23. package/dist/query.d.ts +50 -0
  24. package/dist/query.js +51 -0
  25. package/dist/shared/@outfitter/cli-b2zk8fb3.js +357 -0
  26. package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
  27. package/dist/shared/@outfitter/{cli-e6yv2764.d.ts → cli-k0yvzn6d.d.ts} +1 -1
  28. package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-md9347gn.d.ts} +155 -13
  29. package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
  30. package/dist/shared/@outfitter/{cli-4h4rpdra.js → cli-zahqsaby.js} +32 -10
  31. package/dist/terminal/detection.js +1 -5
  32. package/dist/terminal/index.js +1 -6
  33. package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
  34. package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
  35. package/dist/types.d.ts +2 -2
  36. package/dist/types.js +0 -2
  37. package/dist/verbs.d.ts +50 -0
  38. package/dist/verbs.js +61 -0
  39. package/package.json +50 -204
  40. package/dist/borders/index.d.ts +0 -3
  41. package/dist/borders/index.js +0 -13
  42. package/dist/box/index.d.ts +0 -4
  43. package/dist/box/index.js +0 -13
  44. package/dist/demo/index.d.ts +0 -78
  45. package/dist/demo/index.js +0 -148
  46. package/dist/demo/registry.d.ts +0 -7
  47. package/dist/demo/registry.js +0 -28
  48. package/dist/demo/renderers/borders.d.ts +0 -7
  49. package/dist/demo/renderers/borders.js +0 -17
  50. package/dist/demo/renderers/box.d.ts +0 -7
  51. package/dist/demo/renderers/box.js +0 -18
  52. package/dist/demo/renderers/colors.d.ts +0 -7
  53. package/dist/demo/renderers/colors.js +0 -18
  54. package/dist/demo/renderers/indicators.d.ts +0 -7
  55. package/dist/demo/renderers/indicators.js +0 -17
  56. package/dist/demo/renderers/list.d.ts +0 -7
  57. package/dist/demo/renderers/list.js +0 -19
  58. package/dist/demo/renderers/markdown.d.ts +0 -7
  59. package/dist/demo/renderers/markdown.js +0 -18
  60. package/dist/demo/renderers/progress.d.ts +0 -7
  61. package/dist/demo/renderers/progress.js +0 -17
  62. package/dist/demo/renderers/spinner.d.ts +0 -7
  63. package/dist/demo/renderers/spinner.js +0 -19
  64. package/dist/demo/renderers/table.d.ts +0 -7
  65. package/dist/demo/renderers/table.js +0 -19
  66. package/dist/demo/renderers/text.d.ts +0 -7
  67. package/dist/demo/renderers/text.js +0 -16
  68. package/dist/demo/renderers/tree.d.ts +0 -7
  69. package/dist/demo/renderers/tree.js +0 -18
  70. package/dist/demo/section.d.ts +0 -5
  71. package/dist/demo/section.js +0 -23
  72. package/dist/demo/templates.d.ts +0 -4
  73. package/dist/demo/templates.js +0 -10
  74. package/dist/demo/types.d.ts +0 -3
  75. package/dist/demo/types.js +0 -8
  76. package/dist/list/index.d.ts +0 -3
  77. package/dist/list/index.js +0 -9
  78. package/dist/preset/full.d.ts +0 -14
  79. package/dist/preset/full.js +0 -41
  80. package/dist/preset/standard.d.ts +0 -11
  81. package/dist/preset/standard.js +0 -30
  82. package/dist/prompt/confirm.d.ts +0 -4
  83. package/dist/prompt/confirm.js +0 -9
  84. package/dist/prompt/group.d.ts +0 -4
  85. package/dist/prompt/group.js +0 -9
  86. package/dist/prompt/index.d.ts +0 -7
  87. package/dist/prompt/index.js +0 -32
  88. package/dist/prompt/select.d.ts +0 -4
  89. package/dist/prompt/select.js +0 -11
  90. package/dist/prompt/text.d.ts +0 -4
  91. package/dist/prompt/text.js +0 -11
  92. package/dist/prompt/types.d.ts +0 -3
  93. package/dist/prompt/types.js +0 -8
  94. package/dist/prompt/validators.d.ts +0 -2
  95. package/dist/prompt/validators.js +0 -8
  96. package/dist/render/borders.d.ts +0 -2
  97. package/dist/render/borders.js +0 -15
  98. package/dist/render/box.d.ts +0 -3
  99. package/dist/render/box.js +0 -23
  100. package/dist/render/date.d.ts +0 -2
  101. package/dist/render/date.js +0 -12
  102. package/dist/render/format-relative.d.ts +0 -2
  103. package/dist/render/format-relative.js +0 -8
  104. package/dist/render/format.d.ts +0 -2
  105. package/dist/render/format.js +0 -10
  106. package/dist/render/heading.d.ts +0 -3
  107. package/dist/render/heading.js +0 -14
  108. package/dist/render/index.d.ts +0 -32
  109. package/dist/render/index.js +0 -235
  110. package/dist/render/indicators.d.ts +0 -2
  111. package/dist/render/indicators.js +0 -16
  112. package/dist/render/json.d.ts +0 -2
  113. package/dist/render/json.js +0 -10
  114. package/dist/render/layout.d.ts +0 -5
  115. package/dist/render/layout.js +0 -25
  116. package/dist/render/list.d.ts +0 -2
  117. package/dist/render/list.js +0 -8
  118. package/dist/render/markdown.d.ts +0 -2
  119. package/dist/render/markdown.js +0 -10
  120. package/dist/render/progress.d.ts +0 -2
  121. package/dist/render/progress.js +0 -8
  122. package/dist/render/separator.d.ts +0 -3
  123. package/dist/render/separator.js +0 -14
  124. package/dist/render/shapes.d.ts +0 -2
  125. package/dist/render/shapes.js +0 -35
  126. package/dist/render/spinner.d.ts +0 -2
  127. package/dist/render/spinner.js +0 -12
  128. package/dist/render/stack.d.ts +0 -3
  129. package/dist/render/stack.js +0 -38
  130. package/dist/render/table.d.ts +0 -3
  131. package/dist/render/table.js +0 -12
  132. package/dist/render/text.d.ts +0 -2
  133. package/dist/render/text.js +0 -27
  134. package/dist/render/tree.d.ts +0 -2
  135. package/dist/render/tree.js +0 -10
  136. package/dist/render/types.d.ts +0 -2
  137. package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
  138. package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
  139. package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
  140. package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
  141. package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
  142. package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
  143. package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
  144. package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
  145. package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
  146. package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
  147. package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
  148. package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
  149. package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
  150. package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
  151. package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
  152. package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
  153. package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
  154. package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
  155. package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
  156. package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
  157. package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
  158. package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
  159. package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
  160. package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
  161. package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
  162. package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
  163. package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
  164. package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
  165. package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
  166. package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
  167. package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
  168. package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
  169. package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
  170. package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
  171. package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
  172. package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
  173. package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
  174. package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
  175. package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
  176. package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
  177. package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
  178. package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
  179. package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
  180. package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
  181. package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
  182. package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
  183. package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
  184. package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
  185. package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
  186. package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
  187. package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
  188. package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
  189. package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
  190. package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
  191. package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
  192. package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
  193. package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
  194. package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
  195. package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
  196. package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
  197. package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
  198. package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
  199. package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
  200. package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
  201. package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
  202. package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
  203. package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
  204. package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
  205. package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
  206. package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
  207. package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
  208. package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
  209. package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
  210. package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
  211. package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
  212. package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
  213. package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
  214. package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
  215. package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
  216. package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
  217. package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
  218. package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
  219. package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
  220. package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
  221. package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
  222. package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
  223. package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
  224. package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
  225. package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
  226. package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
  227. package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
  228. package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
  229. package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
  230. package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
  231. package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
  232. package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
  233. package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
  234. package/dist/shared/@outfitter/cli-znc47004.js +0 -134
  235. package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
  236. package/dist/streaming/ansi.d.ts +0 -2
  237. package/dist/streaming/ansi.js +0 -8
  238. package/dist/streaming/index.d.ts +0 -4
  239. package/dist/streaming/index.js +0 -17
  240. package/dist/streaming/spinner.d.ts +0 -3
  241. package/dist/streaming/spinner.js +0 -10
  242. package/dist/streaming/writer.d.ts +0 -2
  243. package/dist/streaming/writer.js +0 -9
  244. package/dist/table/index.d.ts +0 -4
  245. package/dist/table/index.js +0 -13
  246. package/dist/theme/context.d.ts +0 -9
  247. package/dist/theme/context.js +0 -14
  248. package/dist/theme/create.d.ts +0 -8
  249. package/dist/theme/create.js +0 -12
  250. package/dist/theme/index.d.ts +0 -17
  251. package/dist/theme/index.js +0 -42
  252. package/dist/theme/presets/bold.d.ts +0 -8
  253. package/dist/theme/presets/bold.js +0 -12
  254. package/dist/theme/presets/default.d.ts +0 -8
  255. package/dist/theme/presets/default.js +0 -11
  256. package/dist/theme/presets/index.d.ts +0 -12
  257. package/dist/theme/presets/index.js +0 -24
  258. package/dist/theme/presets/minimal.d.ts +0 -8
  259. package/dist/theme/presets/minimal.js +0 -12
  260. package/dist/theme/presets/rounded.d.ts +0 -8
  261. package/dist/theme/presets/rounded.js +0 -12
  262. package/dist/theme/resolve.d.ts +0 -8
  263. package/dist/theme/resolve.js +0 -11
  264. package/dist/theme/types.d.ts +0 -7
  265. package/dist/theme/types.js +0 -1
  266. package/dist/tree/index.d.ts +0 -3
  267. package/dist/tree/index.js +0 -11
  268. /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
  269. /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
@@ -1,17 +0,0 @@
1
- import { ExampleTexts } from "./cli-c6pbxpw0";
2
- /**
3
- * Default example texts used when no custom examples are provided.
4
- *
5
- * These defaults are generic enough to work for any CLI while still
6
- * being meaningful and demonstrative.
7
- */
8
- declare const DEFAULT_EXAMPLES: ExampleTexts;
9
- /**
10
- * Resolves example text with custom overrides.
11
- *
12
- * @param key - The example text key
13
- * @param custom - Optional custom examples
14
- * @returns The example text (custom if provided, default otherwise)
15
- */
16
- declare function getExample<K extends keyof ExampleTexts>(key: K, custom?: Partial<ExampleTexts>): ExampleTexts[K];
17
- export { DEFAULT_EXAMPLES, getExample };
@@ -1,123 +0,0 @@
1
- // @bun
2
- import {
3
- __esm
4
- } from "./cli-v1tzwxkt.js";
5
-
6
- // packages/cli/src/render/borders.ts
7
- function getBorderCharacters(style) {
8
- return BORDERS[style];
9
- }
10
- function drawHorizontalLine(width, chars, position, columnWidths) {
11
- if (!chars.horizontal) {
12
- return "";
13
- }
14
- const positionChars = {
15
- top: { left: chars.topLeft, right: chars.topRight, cross: chars.topT },
16
- middle: { left: chars.leftT, right: chars.rightT, cross: chars.cross },
17
- bottom: {
18
- left: chars.bottomLeft,
19
- right: chars.bottomRight,
20
- cross: chars.bottomT
21
- }
22
- };
23
- const { left, right, cross: intersection } = positionChars[position];
24
- if (!columnWidths || columnWidths.length <= 1) {
25
- return `${left}${chars.horizontal.repeat(width)}${right}`;
26
- }
27
- const columnsWidth = columnWidths.reduce((sum, w) => sum + w, 0);
28
- const intersectionsWidth = columnWidths.length - 1;
29
- const actualWidth = columnsWidth + intersectionsWidth;
30
- const adjustedWidths = [...columnWidths];
31
- if (actualWidth !== width && adjustedWidths.length > 0) {
32
- const lastIndex = adjustedWidths.length - 1;
33
- const lastWidth = adjustedWidths[lastIndex] ?? 0;
34
- adjustedWidths[lastIndex] = Math.max(0, lastWidth + (width - actualWidth));
35
- }
36
- const segments = adjustedWidths.map((colWidth) => chars.horizontal.repeat(colWidth));
37
- return `${left}${segments.join(intersection)}${right}`;
38
- }
39
- var BORDERS;
40
- var init_borders = __esm(() => {
41
- BORDERS = {
42
- single: {
43
- topLeft: "\u250C",
44
- topRight: "\u2510",
45
- bottomLeft: "\u2514",
46
- bottomRight: "\u2518",
47
- horizontal: "\u2500",
48
- vertical: "\u2502",
49
- topT: "\u252C",
50
- bottomT: "\u2534",
51
- leftT: "\u251C",
52
- rightT: "\u2524",
53
- cross: "\u253C"
54
- },
55
- double: {
56
- topLeft: "\u2554",
57
- topRight: "\u2557",
58
- bottomLeft: "\u255A",
59
- bottomRight: "\u255D",
60
- horizontal: "\u2550",
61
- vertical: "\u2551",
62
- topT: "\u2566",
63
- bottomT: "\u2569",
64
- leftT: "\u2560",
65
- rightT: "\u2563",
66
- cross: "\u256C"
67
- },
68
- rounded: {
69
- topLeft: "\u256D",
70
- topRight: "\u256E",
71
- bottomLeft: "\u2570",
72
- bottomRight: "\u256F",
73
- horizontal: "\u2500",
74
- vertical: "\u2502",
75
- topT: "\u252C",
76
- bottomT: "\u2534",
77
- leftT: "\u251C",
78
- rightT: "\u2524",
79
- cross: "\u253C"
80
- },
81
- heavy: {
82
- topLeft: "\u250F",
83
- topRight: "\u2513",
84
- bottomLeft: "\u2517",
85
- bottomRight: "\u251B",
86
- horizontal: "\u2501",
87
- vertical: "\u2503",
88
- topT: "\u2533",
89
- bottomT: "\u253B",
90
- leftT: "\u2523",
91
- rightT: "\u252B",
92
- cross: "\u254B"
93
- },
94
- ascii: {
95
- topLeft: "+",
96
- topRight: "+",
97
- bottomLeft: "+",
98
- bottomRight: "+",
99
- horizontal: "-",
100
- vertical: "|",
101
- topT: "+",
102
- bottomT: "+",
103
- leftT: "+",
104
- rightT: "+",
105
- cross: "+"
106
- },
107
- none: {
108
- topLeft: "",
109
- topRight: "",
110
- bottomLeft: "",
111
- bottomRight: "",
112
- horizontal: "",
113
- vertical: "",
114
- topT: "",
115
- bottomT: "",
116
- leftT: "",
117
- rightT: "",
118
- cross: ""
119
- }
120
- };
121
- });
122
-
123
- export { BORDERS, getBorderCharacters, drawHorizontalLine, init_borders };
@@ -1,7 +0,0 @@
1
- // @bun
2
- // packages/cli/src/prompt/types.ts
3
- function createCancelledError(message = "User cancelled") {
4
- return { type: "cancelled", message };
5
- }
6
-
7
- export { createCancelledError };
@@ -1,164 +0,0 @@
1
- import { IndicatorCategory } from "./cli-1g8tt31a";
2
- import { DelimiterName } from "./cli-hnpbqmc8";
3
- import { TreeGuideStyle } from "./cli-3b7ed3rm";
4
- import { SpinnerStyle } from "./cli-e5ms1y0x";
5
- import { BorderCharacters, BorderStyle } from "./cli-fakncnjp";
6
- /**
7
- * A glyph with unicode and ASCII fallback representations.
8
- *
9
- * Used for characters that may not be available in all terminals.
10
- * The appropriate character is selected at runtime based on terminal capability.
11
- *
12
- * @example
13
- * ```typescript
14
- * const bullet: GlyphPair = { unicode: "•", fallback: "*" };
15
- * const checkbox: GlyphPair = { unicode: "☑", fallback: "[x]" };
16
- * ```
17
- */
18
- interface GlyphPair {
19
- /** Unicode character for modern terminals */
20
- unicode: string;
21
- /** ASCII fallback for limited terminals */
22
- fallback: string;
23
- }
24
- /**
25
- * Semantic states that can be mapped to visual markers.
26
- *
27
- * These represent the logical state of an item, which themes translate
28
- * to specific visual representations.
29
- */
30
- type SemanticState = "default" | "current" | "focused" | "checked" | "disabled" | "success" | "warning" | "error" | "info";
31
- /**
32
- * Specification for how to render a semantic state marker.
33
- *
34
- * Can either reference an existing indicator from the INDICATORS registry,
35
- * or provide a custom glyph pair.
36
- *
37
- * @example
38
- * ```typescript
39
- * // Reference existing indicator
40
- * const successMarker: MarkerSpec = {
41
- * type: "indicator",
42
- * category: "status",
43
- * name: "success"
44
- * };
45
- *
46
- * // Custom glyph
47
- * const starMarker: MarkerSpec = {
48
- * type: "custom",
49
- * glyph: { unicode: "★", fallback: "*" }
50
- * };
51
- * ```
52
- */
53
- type MarkerSpec = {
54
- type: "indicator";
55
- category: IndicatorCategory;
56
- name: string;
57
- } | {
58
- type: "custom";
59
- glyph: GlyphPair;
60
- };
61
- /**
62
- * Semantic color tokens as ANSI escape codes.
63
- *
64
- * Colors are stored as raw ANSI codes and can be empty strings
65
- * when colors are disabled.
66
- */
67
- interface ThemeColors {
68
- /** Green - success messages, completed items */
69
- success: string;
70
- /** Yellow - warnings, caution */
71
- warning: string;
72
- /** Red - errors, failures */
73
- error: string;
74
- /** Blue - informational messages */
75
- info: string;
76
- /** Default text color (typically empty string) */
77
- primary: string;
78
- /** Gray - secondary text */
79
- secondary: string;
80
- /** Dim - de-emphasized text */
81
- muted: string;
82
- /** Cyan - interactive elements, highlights */
83
- accent: string;
84
- /** Bold - strong emphasis */
85
- highlight: string;
86
- /** Cyan + underline - URLs, clickable references */
87
- link: string;
88
- /** Bright red - dangerous actions */
89
- destructive: string;
90
- /** Dim gray - less prominent than muted */
91
- subtle: string;
92
- }
93
- /**
94
- * Default spacing values for various components.
95
- */
96
- interface ThemeSpacing {
97
- /** Default padding inside boxes (characters) */
98
- boxPadding: number;
99
- /** Indentation for nested list items (characters) */
100
- listIndent: number;
101
- /** Gap between items in vertical stacks (lines) */
102
- stackGap: number;
103
- /** Gap between items in horizontal stacks (characters) */
104
- horizontalGap: number;
105
- }
106
- /**
107
- * Complete visual theme configuration.
108
- *
109
- * Consolidates all visual primitives (borders, delimiters, markers, guides,
110
- * colors) into a cohesive design system. Themes can be used as-is (presets)
111
- * or customized via {@link createVisualTheme}.
112
- *
113
- * @example
114
- * ```typescript
115
- * import { defaultTheme, roundedTheme, createVisualTheme } from "@outfitter/cli/theme";
116
- *
117
- * // Use a preset
118
- * const box = renderBox("Hello", { theme: roundedTheme });
119
- *
120
- * // Create a custom theme
121
- * const brandTheme = createVisualTheme({
122
- * extends: roundedTheme,
123
- * overrides: {
124
- * colors: { accent: "\x1b[38;5;39m" },
125
- * spacing: { boxPadding: 2 }
126
- * }
127
- * });
128
- * ```
129
- */
130
- interface VisualTheme {
131
- /** Theme identifier */
132
- name: string;
133
- /** Border style preset name */
134
- border: BorderStyle;
135
- /** Derived border characters for the border style */
136
- borderChars: BorderCharacters;
137
- /** Tree guide style for hierarchical displays */
138
- treeGuide: TreeGuideStyle;
139
- /** Default delimiter for inline separators */
140
- delimiter: DelimiterName;
141
- /** Map of semantic states to marker specifications */
142
- markers: Record<SemanticState, MarkerSpec>;
143
- /** Default list bullet glyph */
144
- listBullet: GlyphPair;
145
- /** Checkbox glyphs for checked/unchecked states */
146
- checkbox: {
147
- checked: GlyphPair;
148
- unchecked: GlyphPair;
149
- };
150
- /** Semantic color tokens */
151
- colors: ThemeColors;
152
- /** Default spacing values */
153
- spacing: ThemeSpacing;
154
- /** Default spinner animation style */
155
- spinner: SpinnerStyle;
156
- }
157
- /**
158
- * Partial theme for overriding specific properties.
159
- *
160
- * Used by {@link createVisualTheme} to allow partial customization
161
- * while inheriting defaults.
162
- */
163
- type PartialVisualTheme = { [K in keyof VisualTheme]? : K extends "colors" ? Partial<ThemeColors> : K extends "spacing" ? Partial<ThemeSpacing> : K extends "markers" ? Partial<Record<SemanticState, MarkerSpec>> : K extends "checkbox" ? Partial<VisualTheme["checkbox"]> : VisualTheme[K] };
164
- export { GlyphPair, SemanticState, MarkerSpec, ThemeColors, ThemeSpacing, VisualTheme, PartialVisualTheme };
@@ -1,71 +0,0 @@
1
- // @bun
2
- // packages/cli/src/render/format-relative.ts
3
- function formatRelative(date) {
4
- let timestamp;
5
- if (date instanceof Date) {
6
- timestamp = date.getTime();
7
- } else if (typeof date === "number") {
8
- timestamp = date;
9
- } else {
10
- const parsed = Date.parse(date);
11
- if (Number.isNaN(parsed)) {
12
- return "invalid date";
13
- }
14
- timestamp = parsed;
15
- }
16
- if (!Number.isFinite(timestamp)) {
17
- return "invalid date";
18
- }
19
- const now = Date.now();
20
- const diffMs = now - timestamp;
21
- const absDiffMs = Math.abs(diffMs);
22
- const isFuture = diffMs < 0;
23
- const SECOND = 1000;
24
- const MINUTE = 60 * SECOND;
25
- const HOUR = 60 * MINUTE;
26
- const DAY = 24 * HOUR;
27
- const MONTH = 30 * DAY;
28
- const YEAR = 365 * DAY;
29
- if (absDiffMs < 10 * SECOND) {
30
- return "just now";
31
- }
32
- if (absDiffMs < MINUTE) {
33
- const seconds = Math.floor(absDiffMs / SECOND);
34
- return isFuture ? `in ${seconds} seconds` : `${seconds} seconds ago`;
35
- }
36
- if (absDiffMs < HOUR) {
37
- const minutes = Math.floor(absDiffMs / MINUTE);
38
- if (minutes === 1) {
39
- return isFuture ? "in 1 minute" : "1 minute ago";
40
- }
41
- return isFuture ? `in ${minutes} minutes` : `${minutes} minutes ago`;
42
- }
43
- if (absDiffMs < DAY) {
44
- const hours = Math.floor(absDiffMs / HOUR);
45
- if (hours === 1) {
46
- return isFuture ? "in 1 hour" : "1 hour ago";
47
- }
48
- return isFuture ? `in ${hours} hours` : `${hours} hours ago`;
49
- }
50
- if (absDiffMs < 2 * DAY) {
51
- return isFuture ? "tomorrow" : "yesterday";
52
- }
53
- if (absDiffMs < MONTH) {
54
- const days = Math.floor(absDiffMs / DAY);
55
- return isFuture ? `in ${days} days` : `${days} days ago`;
56
- }
57
- if (absDiffMs < YEAR) {
58
- const months = Math.floor(absDiffMs / MONTH);
59
- if (months === 1) {
60
- return isFuture ? "in 1 month" : "1 month ago";
61
- }
62
- return isFuture ? `in ${months} months` : `${months} months ago`;
63
- }
64
- const years = Math.floor(absDiffMs / YEAR);
65
- if (years === 1) {
66
- return isFuture ? "in 1 year" : "1 year ago";
67
- }
68
- return isFuture ? `in ${years} years` : `${years} years ago`;
69
- }
70
-
71
- export { formatRelative };
@@ -1,223 +0,0 @@
1
- import { BorderStyle } from "./cli-fakncnjp";
2
- /**
3
- * Text alignment options for box content.
4
- */
5
- type BoxAlign = "left" | "center" | "right";
6
- /**
7
- * Options for customizing box rendering.
8
- *
9
- * @example
10
- * ```typescript
11
- * // Box with title and rounded corners
12
- * renderBox("Content", {
13
- * title: "Status",
14
- * border: "rounded",
15
- * padding: 1,
16
- * });
17
- *
18
- * // Fixed-width centered box
19
- * renderBox("Centered", {
20
- * width: 40,
21
- * align: "center",
22
- * });
23
- * ```
24
- */
25
- /**
26
- * Spacing configuration for individual sides.
27
- */
28
- interface BoxSpacing {
29
- top?: number;
30
- right?: number;
31
- bottom?: number;
32
- left?: number;
33
- }
34
- /**
35
- * Border visibility configuration for individual sides.
36
- */
37
- interface BoxBorders {
38
- top?: boolean;
39
- right?: boolean;
40
- bottom?: boolean;
41
- left?: boolean;
42
- }
43
- interface BoxOptions {
44
- /**
45
- * Border style to use.
46
- * @default "single"
47
- */
48
- border?: BorderStyle;
49
- /**
50
- * Control which borders to render.
51
- * @default { top: true, right: true, bottom: true, left: true }
52
- */
53
- borders?: BoxBorders;
54
- /**
55
- * Internal padding (spaces between border and content).
56
- * Can be a single number for all sides or an object for individual sides.
57
- * @default 1
58
- */
59
- padding?: number | BoxSpacing;
60
- /**
61
- * External margin (spacing outside the box).
62
- * Can be a single number for all sides or an object for individual sides.
63
- */
64
- margin?: number | BoxSpacing;
65
- /**
66
- * Fixed width for the box. If not specified, auto-fits to content.
67
- */
68
- width?: number;
69
- /**
70
- * Optional title to display in the top border.
71
- */
72
- title?: string;
73
- /**
74
- * Content alignment within the box.
75
- * @default "left"
76
- */
77
- align?: BoxAlign;
78
- /**
79
- * Content sections separated by internal dividers.
80
- * Each section can be a string or string[].
81
- * When provided, takes precedence over the content parameter.
82
- *
83
- * @example
84
- * ```typescript
85
- * renderBox("", {
86
- * sections: [
87
- * "Header",
88
- * ["Line 1", "Line 2"],
89
- * "Footer"
90
- * ],
91
- * border: "single"
92
- * });
93
- * // ┌─────────────────┐
94
- * // │ Header │
95
- * // ├─────────────────┤
96
- * // │ Line 1 │
97
- * // │ Line 2 │
98
- * // ├─────────────────┤
99
- * // │ Footer │
100
- * // └─────────────────┘
101
- * ```
102
- */
103
- sections?: Array<string | string[]>;
104
- }
105
- /**
106
- * A rendered box with metadata for composition.
107
- */
108
- interface Box {
109
- /** Rendered string representation */
110
- readonly output: string;
111
- /** Width in characters */
112
- readonly width: number;
113
- /** Height in lines */
114
- readonly height: number;
115
- }
116
- /**
117
- * Content that can be rendered inside a box.
118
- * - string: Plain text content
119
- * - string[]: Multi-line content
120
- * - Box: Nested box (rendered string with metadata)
121
- */
122
- type BoxContent = string | string[] | Box;
123
- /**
124
- * Normalized spacing with all four sides defined.
125
- */
126
- interface NormalizedSpacing {
127
- top: number;
128
- right: number;
129
- bottom: number;
130
- left: number;
131
- }
132
- /**
133
- * Normalized borders with all four sides defined.
134
- */
135
- interface NormalizedBorders {
136
- top: boolean;
137
- right: boolean;
138
- bottom: boolean;
139
- left: boolean;
140
- }
141
- /**
142
- * Normalizes padding input to have all four sides.
143
- * For backward compatibility, when padding is a number it only applies to horizontal (left/right).
144
- * When padding is an object, all sides can be specified.
145
- */
146
- declare function normalizePadding(padding: number | BoxSpacing | undefined, defaultValue: number): NormalizedSpacing;
147
- /**
148
- * Normalizes margin input to have all four sides.
149
- * When margin is a number, it applies to all sides.
150
- */
151
- declare function normalizeMargin(margin: number | BoxSpacing | undefined, defaultValue: number): NormalizedSpacing;
152
- /**
153
- * Normalizes borders input to have all four sides.
154
- */
155
- declare function normalizeBorders(borders: BoxBorders | undefined): NormalizedBorders;
156
- /**
157
- * Renders content within a bordered panel.
158
- *
159
- * Creates a box with Unicode borders around the content. Supports multiple
160
- * border styles, titles, padding, and alignment options.
161
- *
162
- * @param content - The content to render (string or array of strings)
163
- * @param options - Optional configuration for border style, padding, etc.
164
- * @returns Formatted box string
165
- *
166
- * @example
167
- * ```typescript
168
- * // Simple box
169
- * console.log(renderBox("Hello, world!"));
170
- * // ┌───────────────┐
171
- * // │ Hello, world! │
172
- * // └───────────────┘
173
- *
174
- * // Box with title
175
- * console.log(renderBox("All systems go", { title: "Status" }));
176
- * // ┌─ Status ──────┐
177
- * // │ All systems go │
178
- * // └────────────────┘
179
- *
180
- * // Rounded box with padding
181
- * console.log(renderBox(["Line 1", "Line 2"], {
182
- * border: "rounded",
183
- * padding: 2,
184
- * }));
185
- * // ╭──────────────╮
186
- * // │ │
187
- * // │ Line 1 │
188
- * // │ Line 2 │
189
- * // │ │
190
- * // ╰──────────────╯
191
- * ```
192
- */
193
- declare function renderBox(content: string | string[], options?: BoxOptions): string;
194
- /**
195
- * Creates a Box object that can be composed with other boxes.
196
- *
197
- * Unlike `renderBox` which returns a string, `createBox` returns a Box object
198
- * with metadata (width, height) that enables nested composition.
199
- *
200
- * @param content - The content to render (string, string[], Box, or array of mixed)
201
- * @param options - Optional configuration for border style, padding, etc.
202
- * @returns Box object with output, width, and height
203
- *
204
- * @example
205
- * ```typescript
206
- * // Simple box
207
- * const box = createBox("Hello");
208
- * console.log(box.output);
209
- * console.log(`Width: ${box.width}, Height: ${box.height}`);
210
- *
211
- * // Nested boxes
212
- * const inner = createBox("Inner", { border: "rounded" });
213
- * const outer = createBox(inner, { border: "double", title: "Container" });
214
- * console.log(outer.output);
215
- * // ╔═ Container ═══════════════╗
216
- * // ║ ╭───────────────────────╮ ║
217
- * // ║ │ Inner │ ║
218
- * // ║ ╰───────────────────────╯ ║
219
- * // ╚═══════════════════════════╝
220
- * ```
221
- */
222
- declare function createBox(content: BoxContent | BoxContent[], options?: BoxOptions): Box;
223
- export { BoxAlign, BoxSpacing, BoxBorders, BoxOptions, Box, BoxContent, NormalizedSpacing, NormalizedBorders, normalizePadding, normalizeMargin, normalizeBorders, renderBox, createBox };
@@ -1,20 +0,0 @@
1
- // @bun
2
- import {
3
- defaultTheme
4
- } from "./cli-z78mkrc7.js";
5
- import {
6
- BORDERS,
7
- init_borders
8
- } from "./cli-85fg2vr5.js";
9
-
10
- // packages/cli/src/theme/presets/rounded.ts
11
- init_borders();
12
- var roundedTheme = {
13
- ...defaultTheme,
14
- name: "rounded",
15
- border: "rounded",
16
- borderChars: BORDERS.rounded,
17
- treeGuide: "rounded"
18
- };
19
-
20
- export { roundedTheme };