@hypercli/ui 0.1.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 (267) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/capabilities/index.d.ts +62 -0
  4. package/dist/capabilities/index.d.ts.map +1 -0
  5. package/dist/capabilities/index.js +182 -0
  6. package/dist/capabilities/index.js.map +1 -0
  7. package/dist/colors.d.ts +32 -0
  8. package/dist/colors.d.ts.map +1 -0
  9. package/dist/colors.js +40 -0
  10. package/dist/colors.js.map +1 -0
  11. package/dist/components/columns.d.ts +28 -0
  12. package/dist/components/columns.d.ts.map +1 -0
  13. package/dist/components/columns.js +70 -0
  14. package/dist/components/columns.js.map +1 -0
  15. package/dist/components/confirmPrompt.d.ts +38 -0
  16. package/dist/components/confirmPrompt.d.ts.map +1 -0
  17. package/dist/components/confirmPrompt.js +109 -0
  18. package/dist/components/confirmPrompt.js.map +1 -0
  19. package/dist/components/diff.d.ts +37 -0
  20. package/dist/components/diff.d.ts.map +1 -0
  21. package/dist/components/diff.js +36 -0
  22. package/dist/components/diff.js.map +1 -0
  23. package/dist/components/helpLayout.d.ts +59 -0
  24. package/dist/components/helpLayout.d.ts.map +1 -0
  25. package/dist/components/helpLayout.js +103 -0
  26. package/dist/components/helpLayout.js.map +1 -0
  27. package/dist/components/index.d.ts +38 -0
  28. package/dist/components/index.d.ts.map +1 -0
  29. package/dist/components/index.js +23 -0
  30. package/dist/components/index.js.map +1 -0
  31. package/dist/components/keyValue.d.ts +31 -0
  32. package/dist/components/keyValue.d.ts.map +1 -0
  33. package/dist/components/keyValue.js +36 -0
  34. package/dist/components/keyValue.js.map +1 -0
  35. package/dist/components/list.d.ts +30 -0
  36. package/dist/components/list.d.ts.map +1 -0
  37. package/dist/components/list.js +80 -0
  38. package/dist/components/list.js.map +1 -0
  39. package/dist/components/message.d.ts +33 -0
  40. package/dist/components/message.d.ts.map +1 -0
  41. package/dist/components/message.js +86 -0
  42. package/dist/components/message.js.map +1 -0
  43. package/dist/components/panel.d.ts +28 -0
  44. package/dist/components/panel.d.ts.map +1 -0
  45. package/dist/components/panel.js +30 -0
  46. package/dist/components/panel.js.map +1 -0
  47. package/dist/components/progressBar.d.ts +44 -0
  48. package/dist/components/progressBar.d.ts.map +1 -0
  49. package/dist/components/progressBar.js +154 -0
  50. package/dist/components/progressBar.js.map +1 -0
  51. package/dist/components/section.d.ts +22 -0
  52. package/dist/components/section.d.ts.map +1 -0
  53. package/dist/components/section.js +48 -0
  54. package/dist/components/section.js.map +1 -0
  55. package/dist/components/selectPrompt.d.ts +58 -0
  56. package/dist/components/selectPrompt.d.ts.map +1 -0
  57. package/dist/components/selectPrompt.js +206 -0
  58. package/dist/components/selectPrompt.js.map +1 -0
  59. package/dist/components/spinner.d.ts +38 -0
  60. package/dist/components/spinner.d.ts.map +1 -0
  61. package/dist/components/spinner.js +125 -0
  62. package/dist/components/spinner.js.map +1 -0
  63. package/dist/components/statusList.d.ts +22 -0
  64. package/dist/components/statusList.d.ts.map +1 -0
  65. package/dist/components/statusList.js +43 -0
  66. package/dist/components/statusList.js.map +1 -0
  67. package/dist/components/table.d.ts +39 -0
  68. package/dist/components/table.d.ts.map +1 -0
  69. package/dist/components/table.js +132 -0
  70. package/dist/components/table.js.map +1 -0
  71. package/dist/components/textPrompt.d.ts +43 -0
  72. package/dist/components/textPrompt.d.ts.map +1 -0
  73. package/dist/components/textPrompt.js +123 -0
  74. package/dist/components/textPrompt.js.map +1 -0
  75. package/dist/components/tree.d.ts +30 -0
  76. package/dist/components/tree.d.ts.map +1 -0
  77. package/dist/components/tree.js +49 -0
  78. package/dist/components/tree.js.map +1 -0
  79. package/dist/ds-index.d.ts +113 -0
  80. package/dist/ds-index.d.ts.map +1 -0
  81. package/dist/ds-index.js +112 -0
  82. package/dist/ds-index.js.map +1 -0
  83. package/dist/help.d.ts +32 -0
  84. package/dist/help.d.ts.map +1 -0
  85. package/dist/help.js +34 -0
  86. package/dist/help.js.map +1 -0
  87. package/dist/hyper-theme.d.ts +8 -0
  88. package/dist/hyper-theme.d.ts.map +1 -0
  89. package/dist/hyper-theme.js +30 -0
  90. package/dist/hyper-theme.js.map +1 -0
  91. package/dist/index.d.ts +50 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +39 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/md.d.ts +12 -0
  96. package/dist/md.d.ts.map +1 -0
  97. package/dist/md.js +19 -0
  98. package/dist/md.js.map +1 -0
  99. package/dist/messages.d.ts +20 -0
  100. package/dist/messages.d.ts.map +1 -0
  101. package/dist/messages.js +65 -0
  102. package/dist/messages.js.map +1 -0
  103. package/dist/palette.d.ts +20 -0
  104. package/dist/palette.d.ts.map +1 -0
  105. package/dist/palette.js +22 -0
  106. package/dist/palette.js.map +1 -0
  107. package/dist/primitives/align.d.ts +23 -0
  108. package/dist/primitives/align.d.ts.map +1 -0
  109. package/dist/primitives/align.js +40 -0
  110. package/dist/primitives/align.js.map +1 -0
  111. package/dist/primitives/badge.d.ts +24 -0
  112. package/dist/primitives/badge.d.ts.map +1 -0
  113. package/dist/primitives/badge.js +40 -0
  114. package/dist/primitives/badge.js.map +1 -0
  115. package/dist/primitives/border.d.ts +29 -0
  116. package/dist/primitives/border.d.ts.map +1 -0
  117. package/dist/primitives/border.js +100 -0
  118. package/dist/primitives/border.js.map +1 -0
  119. package/dist/primitives/context.d.ts +48 -0
  120. package/dist/primitives/context.d.ts.map +1 -0
  121. package/dist/primitives/context.js +64 -0
  122. package/dist/primitives/context.js.map +1 -0
  123. package/dist/primitives/divider.d.ts +25 -0
  124. package/dist/primitives/divider.d.ts.map +1 -0
  125. package/dist/primitives/divider.js +56 -0
  126. package/dist/primitives/divider.js.map +1 -0
  127. package/dist/primitives/indent.d.ts +16 -0
  128. package/dist/primitives/indent.d.ts.map +1 -0
  129. package/dist/primitives/indent.js +25 -0
  130. package/dist/primitives/indent.js.map +1 -0
  131. package/dist/primitives/index.d.ts +32 -0
  132. package/dist/primitives/index.d.ts.map +1 -0
  133. package/dist/primitives/index.js +22 -0
  134. package/dist/primitives/index.js.map +1 -0
  135. package/dist/primitives/line.d.ts +21 -0
  136. package/dist/primitives/line.d.ts.map +1 -0
  137. package/dist/primitives/line.js +29 -0
  138. package/dist/primitives/line.js.map +1 -0
  139. package/dist/primitives/markdown.d.ts +91 -0
  140. package/dist/primitives/markdown.d.ts.map +1 -0
  141. package/dist/primitives/markdown.js +62 -0
  142. package/dist/primitives/markdown.js.map +1 -0
  143. package/dist/primitives/pad.d.ts +24 -0
  144. package/dist/primitives/pad.d.ts.map +1 -0
  145. package/dist/primitives/pad.js +20 -0
  146. package/dist/primitives/pad.js.map +1 -0
  147. package/dist/primitives/stack.d.ts +22 -0
  148. package/dist/primitives/stack.d.ts.map +1 -0
  149. package/dist/primitives/stack.js +21 -0
  150. package/dist/primitives/stack.js.map +1 -0
  151. package/dist/primitives/styledText.d.ts +36 -0
  152. package/dist/primitives/styledText.d.ts.map +1 -0
  153. package/dist/primitives/styledText.js +42 -0
  154. package/dist/primitives/styledText.js.map +1 -0
  155. package/dist/primitives/symbol.d.ts +15 -0
  156. package/dist/primitives/symbol.d.ts.map +1 -0
  157. package/dist/primitives/symbol.js +18 -0
  158. package/dist/primitives/symbol.js.map +1 -0
  159. package/dist/primitives/truncate.d.ts +23 -0
  160. package/dist/primitives/truncate.d.ts.map +1 -0
  161. package/dist/primitives/truncate.js +99 -0
  162. package/dist/primitives/truncate.js.map +1 -0
  163. package/dist/primitives/wrap.d.ts +23 -0
  164. package/dist/primitives/wrap.d.ts.map +1 -0
  165. package/dist/primitives/wrap.js +30 -0
  166. package/dist/primitives/wrap.js.map +1 -0
  167. package/dist/render/ansi-utils.d.ts +49 -0
  168. package/dist/render/ansi-utils.d.ts.map +1 -0
  169. package/dist/render/ansi-utils.js +405 -0
  170. package/dist/render/ansi-utils.js.map +1 -0
  171. package/dist/render/index.d.ts +11 -0
  172. package/dist/render/index.d.ts.map +1 -0
  173. package/dist/render/index.js +11 -0
  174. package/dist/render/index.js.map +1 -0
  175. package/dist/render/sgr.d.ts +60 -0
  176. package/dist/render/sgr.d.ts.map +1 -0
  177. package/dist/render/sgr.js +191 -0
  178. package/dist/render/sgr.js.map +1 -0
  179. package/dist/render/strip.d.ts +24 -0
  180. package/dist/render/strip.d.ts.map +1 -0
  181. package/dist/render/strip.js +81 -0
  182. package/dist/render/strip.js.map +1 -0
  183. package/dist/render/width.d.ts +30 -0
  184. package/dist/render/width.d.ts.map +1 -0
  185. package/dist/render/width.js +149 -0
  186. package/dist/render/width.js.map +1 -0
  187. package/dist/shortcuts.d.ts +76 -0
  188. package/dist/shortcuts.d.ts.map +1 -0
  189. package/dist/shortcuts.js +117 -0
  190. package/dist/shortcuts.js.map +1 -0
  191. package/dist/styles.d.ts +43 -0
  192. package/dist/styles.d.ts.map +1 -0
  193. package/dist/styles.js +44 -0
  194. package/dist/styles.js.map +1 -0
  195. package/dist/symbols.d.ts +19 -0
  196. package/dist/symbols.d.ts.map +1 -0
  197. package/dist/symbols.js +21 -0
  198. package/dist/symbols.js.map +1 -0
  199. package/dist/test/compare.d.ts +28 -0
  200. package/dist/test/compare.d.ts.map +1 -0
  201. package/dist/test/compare.js +37 -0
  202. package/dist/test/compare.js.map +1 -0
  203. package/dist/test/index.d.ts +16 -0
  204. package/dist/test/index.d.ts.map +1 -0
  205. package/dist/test/index.js +14 -0
  206. package/dist/test/index.js.map +1 -0
  207. package/dist/test/mock.d.ts +50 -0
  208. package/dist/test/mock.d.ts.map +1 -0
  209. package/dist/test/mock.js +135 -0
  210. package/dist/test/mock.js.map +1 -0
  211. package/dist/test/render.d.ts +29 -0
  212. package/dist/test/render.d.ts.map +1 -0
  213. package/dist/test/render.js +87 -0
  214. package/dist/test/render.js.map +1 -0
  215. package/dist/test/snapshot.d.ts +16 -0
  216. package/dist/test/snapshot.d.ts.map +1 -0
  217. package/dist/test/snapshot.js +216 -0
  218. package/dist/test/snapshot.js.map +1 -0
  219. package/dist/theme/builtins.d.ts +10 -0
  220. package/dist/theme/builtins.d.ts.map +1 -0
  221. package/dist/theme/builtins.js +102 -0
  222. package/dist/theme/builtins.js.map +1 -0
  223. package/dist/theme/engine.d.ts +51 -0
  224. package/dist/theme/engine.d.ts.map +1 -0
  225. package/dist/theme/engine.js +123 -0
  226. package/dist/theme/engine.js.map +1 -0
  227. package/dist/theme/index.d.ts +10 -0
  228. package/dist/theme/index.d.ts.map +1 -0
  229. package/dist/theme/index.js +12 -0
  230. package/dist/theme/index.js.map +1 -0
  231. package/dist/theme/merge.d.ts +24 -0
  232. package/dist/theme/merge.d.ts.map +1 -0
  233. package/dist/theme/merge.js +66 -0
  234. package/dist/theme/merge.js.map +1 -0
  235. package/dist/theme/types.d.ts +44 -0
  236. package/dist/theme/types.d.ts.map +1 -0
  237. package/dist/theme/types.js +8 -0
  238. package/dist/theme/types.js.map +1 -0
  239. package/dist/theme.d.ts +9 -0
  240. package/dist/theme.d.ts.map +1 -0
  241. package/dist/theme.js +53 -0
  242. package/dist/theme.js.map +1 -0
  243. package/dist/tokens/defaults.d.ts +13 -0
  244. package/dist/tokens/defaults.d.ts.map +1 -0
  245. package/dist/tokens/defaults.js +248 -0
  246. package/dist/tokens/defaults.js.map +1 -0
  247. package/dist/tokens/index.d.ts +10 -0
  248. package/dist/tokens/index.d.ts.map +1 -0
  249. package/dist/tokens/index.js +10 -0
  250. package/dist/tokens/index.js.map +1 -0
  251. package/dist/tokens/resolver.d.ts +100 -0
  252. package/dist/tokens/resolver.d.ts.map +1 -0
  253. package/dist/tokens/resolver.js +138 -0
  254. package/dist/tokens/resolver.js.map +1 -0
  255. package/dist/tokens/types.d.ts +265 -0
  256. package/dist/tokens/types.d.ts.map +1 -0
  257. package/dist/tokens/types.js +10 -0
  258. package/dist/tokens/types.js.map +1 -0
  259. package/dist/tokens.d.ts +26 -0
  260. package/dist/tokens.d.ts.map +1 -0
  261. package/dist/tokens.js +30 -0
  262. package/dist/tokens.js.map +1 -0
  263. package/dist/types.d.ts +38 -0
  264. package/dist/types.d.ts.map +1 -0
  265. package/dist/types.js +11 -0
  266. package/dist/types.js.map +1 -0
  267. package/package.json +78 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * diff Component
3
+ *
4
+ * Renders a unified diff with file headers, hunk headers, and colored lines.
5
+ */
6
+ /** A single line in a diff hunk. */
7
+ export type DiffLine = {
8
+ /** Line change type: `'add'`, `'remove'`, or `'context'`. */
9
+ type: "add" | "remove" | "context";
10
+ /** Line content (without the leading +/-/space prefix). */
11
+ content: string;
12
+ };
13
+ /** A diff hunk containing a header and a set of lines. */
14
+ export type DiffHunk = {
15
+ /** Hunk header (e.g. `'@@ -1,5 +1,7 @@'`). */
16
+ header: string;
17
+ /** Lines within this hunk. */
18
+ lines: DiffLine[];
19
+ };
20
+ /** Options for rendering a unified diff. */
21
+ export type DiffOptions = {
22
+ /** Diff hunks to render. */
23
+ hunks: DiffHunk[];
24
+ /** Optional file header showing old and new file names. */
25
+ fileHeader?: {
26
+ old: string;
27
+ new: string;
28
+ };
29
+ };
30
+ /**
31
+ * Renders a unified diff with file headers, hunk headers, and colored change lines.
32
+ *
33
+ * @param options - Diff configuration.
34
+ * @returns The formatted diff as a multi-line string.
35
+ */
36
+ export declare function diff(options: DiffOptions): string;
37
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/components/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oCAAoC;AACpC,MAAM,MAAM,QAAQ,GAAG;IACtB,6DAA6D;IAC7D,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnC,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,QAAQ,GAAG;IACtB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,KAAK,EAAE,QAAQ,EAAE,CAAC;CAClB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG;IACzB,4BAA4B;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA0BjD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * diff Component
3
+ *
4
+ * Renders a unified diff with file headers, hunk headers, and colored lines.
5
+ */
6
+ import { divider, styledText } from "../primitives/index.js";
7
+ /**
8
+ * Renders a unified diff with file headers, hunk headers, and colored change lines.
9
+ *
10
+ * @param options - Diff configuration.
11
+ * @returns The formatted diff as a multi-line string.
12
+ */
13
+ export function diff(options) {
14
+ const parts = [];
15
+ if (options.fileHeader) {
16
+ parts.push(divider({ title: `${options.fileHeader.old} → ${options.fileHeader.new}` }));
17
+ }
18
+ for (const hunk of options.hunks) {
19
+ parts.push(styledText(hunk.header, { color: "diffHunk" }));
20
+ for (const line of hunk.lines) {
21
+ switch (line.type) {
22
+ case "add":
23
+ parts.push(styledText(`+${line.content}`, { color: "diffAdded" }));
24
+ break;
25
+ case "remove":
26
+ parts.push(styledText(`-${line.content}`, { color: "diffRemoved" }));
27
+ break;
28
+ case "context":
29
+ parts.push(styledText(` ${line.content}`, { color: "diffContext", dim: true }));
30
+ break;
31
+ }
32
+ }
33
+ }
34
+ return parts.join("\n");
35
+ }
36
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/components/diff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA0B7D;;;;;GAK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a full CLI help screen with usage, description, commands,
5
+ * flag groups, examples, and footer.
6
+ */
7
+ /** Options for rendering a CLI help screen. */
8
+ export type HelpLayoutOptions = {
9
+ /** Usage synopsis line (e.g. `'my-cli <command> [options]'`). */
10
+ usage: string;
11
+ /** Short description paragraph shown below usage. */
12
+ description?: string;
13
+ /** Available commands with optional aliases. */
14
+ commands?: Array<{
15
+ /** Command name. */
16
+ name: string;
17
+ /** Brief description of the command. */
18
+ description: string;
19
+ /** Short alias (e.g. `'i'` for `install`). */
20
+ alias?: string;
21
+ }>;
22
+ /** Groups of flags/options. */
23
+ flagGroups?: Array<{
24
+ /** Section title (e.g. `'Global Options'`). */
25
+ title: string;
26
+ /** Flags within this group. */
27
+ flags: Array<{
28
+ /** Short flag character (e.g. `'v'`). */
29
+ short?: string;
30
+ /** Long flag name (e.g. `'verbose'`). */
31
+ long: string;
32
+ /** Brief description of the flag. */
33
+ description: string;
34
+ /** Value type hint shown in brackets (e.g. `'string'`). */
35
+ type?: string;
36
+ /** Default value shown in brackets. */
37
+ default?: string;
38
+ /** Whether this flag is required. */
39
+ required?: boolean;
40
+ }>;
41
+ }>;
42
+ /** Example commands with descriptions. */
43
+ examples?: Array<{
44
+ /** The example command string. */
45
+ command: string;
46
+ /** Explanation of what the example does. */
47
+ description: string;
48
+ }>;
49
+ /** Footer text shown at the bottom in dim style. */
50
+ footer?: string;
51
+ };
52
+ /**
53
+ * Renders a full CLI help screen with usage, description, commands, flags, examples, and footer.
54
+ *
55
+ * @param options - Help layout configuration.
56
+ * @returns The formatted help screen as a multi-line string.
57
+ */
58
+ export declare function helpLayout(options: HelpLayoutOptions): string;
59
+ //# sourceMappingURL=helpLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpLayout.d.ts","sourceRoot":"","sources":["../../src/components/helpLayout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,+CAA+C;AAC/C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC;QAChB,oBAAoB;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,wCAAwC;QACxC,WAAW,EAAE,MAAM,CAAC;QACpB,8CAA8C;QAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,+BAA+B;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC;QAClB,+CAA+C;QAC/C,KAAK,EAAE,MAAM,CAAC;QACd,+BAA+B;QAC/B,KAAK,EAAE,KAAK,CAAC;YACZ,yCAAyC;YACzC,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,yCAAyC;YACzC,IAAI,EAAE,MAAM,CAAC;YACb,qCAAqC;YACrC,WAAW,EAAE,MAAM,CAAC;YACpB,2DAA2D;YAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,uCAAuC;YACvC,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,qCAAqC;YACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;KACH,CAAC,CAAC;IACH,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC;QAChB,kCAAkC;QAClC,OAAO,EAAE,MAAM,CAAC;QAChB,4CAA4C;QAC5C,WAAW,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAgG7D"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * helpLayout Component
3
+ *
4
+ * Renders a full CLI help screen with usage, description, commands,
5
+ * flag groups, examples, and footer.
6
+ */
7
+ import { getContext, indent, stack, styledText, wrap } from "../primitives/index.js";
8
+ import { ansiPad, stringWidth } from "../render/index.js";
9
+ /**
10
+ * Renders a full CLI help screen with usage, description, commands, flags, examples, and footer.
11
+ *
12
+ * @param options - Help layout configuration.
13
+ * @returns The formatted help screen as a multi-line string.
14
+ */
15
+ export function helpLayout(options) {
16
+ const ctx = getContext();
17
+ const gutter = ctx.tokens.space.gutter;
18
+ const sections = [];
19
+ // Usage line
20
+ sections.push(`Usage: ${styledText(options.usage, { bold: true })}`);
21
+ // Description
22
+ if (options.description) {
23
+ sections.push("");
24
+ sections.push(wrap(options.description));
25
+ }
26
+ // Commands section
27
+ if (options.commands && options.commands.length > 0) {
28
+ sections.push("");
29
+ sections.push(styledText("Commands:", { bold: true }));
30
+ // Calculate max name width
31
+ let maxNameWidth = 0;
32
+ const nameStrs = [];
33
+ for (const cmd of options.commands) {
34
+ const nameStr = cmd.alias ? `${cmd.name}, ${cmd.alias}` : cmd.name;
35
+ nameStrs.push(nameStr);
36
+ const w = stringWidth(nameStr);
37
+ if (w > maxNameWidth)
38
+ maxNameWidth = w;
39
+ }
40
+ for (let i = 0; i < options.commands.length; i++) {
41
+ const cmd = options.commands[i];
42
+ const name = nameStrs[i];
43
+ const padded = ansiPad(name, maxNameWidth);
44
+ sections.push(indent(padded + " ".repeat(gutter) + cmd.description, 1));
45
+ }
46
+ }
47
+ // Flag groups
48
+ if (options.flagGroups) {
49
+ for (const group of options.flagGroups) {
50
+ sections.push("");
51
+ sections.push(styledText(`${group.title}:`, { bold: true }));
52
+ // Build flag name strings and find max width
53
+ let maxFlagWidth = 0;
54
+ const flagStrs = [];
55
+ for (const flag of group.flags) {
56
+ let flagStr = "";
57
+ if (flag.short) {
58
+ flagStr = `-${flag.short}, --${flag.long}`;
59
+ }
60
+ else {
61
+ flagStr = ` --${flag.long}`;
62
+ }
63
+ flagStrs.push(flagStr);
64
+ const w = stringWidth(flagStr);
65
+ if (w > maxFlagWidth)
66
+ maxFlagWidth = w;
67
+ }
68
+ for (let i = 0; i < group.flags.length; i++) {
69
+ const flag = group.flags[i];
70
+ const flagStr = flagStrs[i];
71
+ const padded = ansiPad(flagStr, maxFlagWidth);
72
+ let desc = flag.description;
73
+ const meta = [];
74
+ if (flag.type)
75
+ meta.push(flag.type);
76
+ if (flag.default !== undefined)
77
+ meta.push(`default: ${flag.default}`);
78
+ if (flag.required)
79
+ meta.push("required");
80
+ if (meta.length > 0) {
81
+ desc += ` ${styledText(`[${meta.join(", ")}]`, { dim: true })}`;
82
+ }
83
+ sections.push(indent(padded + " ".repeat(gutter) + desc, 1));
84
+ }
85
+ }
86
+ }
87
+ // Examples
88
+ if (options.examples && options.examples.length > 0) {
89
+ sections.push("");
90
+ sections.push(styledText("Examples:", { bold: true }));
91
+ for (const example of options.examples) {
92
+ sections.push(indent(styledText(example.command, { color: "code" }), 1));
93
+ sections.push(indent(styledText(example.description, { dim: true }), 2));
94
+ }
95
+ }
96
+ // Footer
97
+ if (options.footer) {
98
+ sections.push("");
99
+ sections.push(styledText(options.footer, { dim: true }));
100
+ }
101
+ return sections.join("\n");
102
+ }
103
+ //# sourceMappingURL=helpLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpLayout.js","sourceRoot":"","sources":["../../src/components/helpLayout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgD1D;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAA0B;IACpD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;IACvC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,I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,EAAE,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACzE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,CAAC;IACF,CAAC;IAED,SAAS;IACT,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClB,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Components — Barrel Export
3
+ *
4
+ * Static UI components built on top of the primitives layer.
5
+ */
6
+ export { message } from "./message.ts";
7
+ export type { MessageOptions } from "./message.ts";
8
+ export { statusList } from "./statusList.ts";
9
+ export type { StatusListItem } from "./statusList.ts";
10
+ export { table } from "./table.ts";
11
+ export type { TableColumn, TableOptions } from "./table.ts";
12
+ export { list } from "./list.ts";
13
+ export type { ListItem, ListOptions } from "./list.ts";
14
+ export { tree } from "./tree.ts";
15
+ export type { TreeNode, TreeOptions } from "./tree.ts";
16
+ export { keyValue } from "./keyValue.ts";
17
+ export type { KeyValueEntry, KeyValueOptions } from "./keyValue.ts";
18
+ export { diff } from "./diff.ts";
19
+ export type { DiffLine, DiffHunk, DiffOptions } from "./diff.ts";
20
+ export { panel } from "./panel.ts";
21
+ export type { PanelOptions } from "./panel.ts";
22
+ export { columns } from "./columns.ts";
23
+ export type { ColumnDef, ColumnsOptions } from "./columns.ts";
24
+ export { section } from "./section.ts";
25
+ export type { SectionOptions } from "./section.ts";
26
+ export { helpLayout } from "./helpLayout.ts";
27
+ export type { HelpLayoutOptions } from "./helpLayout.ts";
28
+ export { spinner } from "./spinner.ts";
29
+ export type { SpinnerOptions, SpinnerHandle } from "./spinner.ts";
30
+ export { progressBar } from "./progressBar.ts";
31
+ export type { ProgressBarOptions, ProgressBarHandle } from "./progressBar.ts";
32
+ export { textPrompt } from "./textPrompt.ts";
33
+ export type { TextPromptOptions } from "./textPrompt.ts";
34
+ export { confirmPrompt } from "./confirmPrompt.ts";
35
+ export type { ConfirmPromptOptions } from "./confirmPrompt.ts";
36
+ export { selectPrompt } from "./selectPrompt.ts";
37
+ export type { SelectOption, SelectPromptOptions } from "./selectPrompt.ts";
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Components — Barrel Export
3
+ *
4
+ * Static UI components built on top of the primitives layer.
5
+ */
6
+ export { message } from "./message.js";
7
+ export { statusList } from "./statusList.js";
8
+ export { table } from "./table.js";
9
+ export { list } from "./list.js";
10
+ export { tree } from "./tree.js";
11
+ export { keyValue } from "./keyValue.js";
12
+ export { diff } from "./diff.js";
13
+ export { panel } from "./panel.js";
14
+ export { columns } from "./columns.js";
15
+ export { section } from "./section.js";
16
+ export { helpLayout } from "./helpLayout.js";
17
+ // Interactive components
18
+ export { spinner } from "./spinner.js";
19
+ export { progressBar } from "./progressBar.js";
20
+ export { textPrompt } from "./textPrompt.js";
21
+ export { confirmPrompt } from "./confirmPrompt.js";
22
+ export { selectPrompt } from "./selectPrompt.js";
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,yBAAyB;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * keyValue Component
3
+ *
4
+ * Renders aligned key-value pairs with configurable styling and separators.
5
+ */
6
+ import type { StyledTextOptions } from "../primitives/index.ts";
7
+ /** A single key-value pair to display. */
8
+ export type KeyValueEntry = {
9
+ /** The label text. */
10
+ key: string;
11
+ /** The value text. Displays `nullDisplay` when `undefined`. */
12
+ value: string | undefined;
13
+ };
14
+ /** Options for rendering key-value pairs. */
15
+ export type KeyValueOptions = {
16
+ /** String inserted between the key column and the value column. Defaults to `' '`. */
17
+ separator?: string;
18
+ /** Styling applied to key labels. Defaults to `{ bold: true }`. */
19
+ keyStyle?: StyledTextOptions;
20
+ /** Text shown in place of `undefined` values. Defaults to `'-'`. */
21
+ nullDisplay?: string;
22
+ };
23
+ /**
24
+ * Renders aligned key-value pairs with configurable styling and separators.
25
+ *
26
+ * @param entries - The key-value pairs to display.
27
+ * @param options - Rendering configuration.
28
+ * @returns The formatted key-value output as a multi-line string.
29
+ */
30
+ export declare function keyValue(entries: KeyValueEntry[], options?: KeyValueOptions): string;
31
+ //# sourceMappingURL=keyValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyValue.d.ts","sourceRoot":"","sources":["../../src/components/keyValue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,0CAA0C;AAC1C,MAAM,MAAM,aAAa,GAAG;IAC3B,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG;IAC7B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,MAAM,CAwBpF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * keyValue Component
3
+ *
4
+ * Renders aligned key-value pairs with configurable styling and separators.
5
+ */
6
+ import { styledText } from "../primitives/index.js";
7
+ import { stringWidth } from "../render/index.js";
8
+ /**
9
+ * Renders aligned key-value pairs with configurable styling and separators.
10
+ *
11
+ * @param entries - The key-value pairs to display.
12
+ * @param options - Rendering configuration.
13
+ * @returns The formatted key-value output as a multi-line string.
14
+ */
15
+ export function keyValue(entries, options) {
16
+ const separator = options?.separator ?? " ";
17
+ const nullDisplay = options?.nullDisplay ?? "-";
18
+ const keyStyle = options?.keyStyle ?? { bold: true };
19
+ // Calculate max key width
20
+ let maxKeyWidth = 0;
21
+ for (const entry of entries) {
22
+ const w = stringWidth(entry.key);
23
+ if (w > maxKeyWidth)
24
+ maxKeyWidth = w;
25
+ }
26
+ const lines = [];
27
+ for (const entry of entries) {
28
+ const styledKey = styledText(entry.key, keyStyle);
29
+ const keyWidth = stringWidth(entry.key);
30
+ const padding = " ".repeat(maxKeyWidth - keyWidth);
31
+ const value = entry.value ?? nullDisplay;
32
+ lines.push(styledKey + padding + separator + value);
33
+ }
34
+ return lines.join("\n");
35
+ }
36
+ //# sourceMappingURL=keyValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyValue.js","sourceRoot":"","sources":["../../src/components/keyValue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAoBjD;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAwB,EAAE,OAAyB;IAC3E,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,GAAG,CAAC;IAChD,MAAM,QAAQ,GAAsB,OAAO,EAAE,QAAQ,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAExE,0BAA0B;IAC1B,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,WAAW;YAAE,WAAW,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,WAAW,CAAC;QAEzC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * list Component
3
+ *
4
+ * Renders ordered and unordered lists with nesting support.
5
+ */
6
+ /** A list item: either a plain string or an object with optional nested children. */
7
+ export type ListItem = string | {
8
+ text: string;
9
+ children?: ListItem[];
10
+ };
11
+ /** Options for rendering a list. */
12
+ export type ListOptions = {
13
+ /** Render as an ordered (numbered/lettered) list instead of bulleted. Defaults to `false`. */
14
+ ordered?: boolean;
15
+ /** Number of blank lines between items. Defaults to `1`. Set to `0` for compact lists. */
16
+ gap?: number;
17
+ /** Extra spaces added to body lines (continuation lines) beyond the prefix column. Defaults to `2`. Set to `0` to align body with title. */
18
+ bodyIndent?: number;
19
+ /** Bullet character style for unordered lists. Defaults to `'bullet'`. */
20
+ bulletStyle?: "bullet" | "dash" | "arrow";
21
+ };
22
+ /**
23
+ * Renders ordered or unordered lists with nesting support.
24
+ *
25
+ * @param items - List items to render, supporting nested children.
26
+ * @param options - List rendering configuration.
27
+ * @returns The formatted list as a multi-line string.
28
+ */
29
+ export declare function list(items: ListItem[], options?: ListOptions): string;
30
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,qFAAqF;AACrF,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAExE,oCAAoC;AACpC,MAAM,MAAM,WAAW,GAAG;IACzB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4IAA4I;IAC5I,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CAC1C,CAAC;AA4DF;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAUrE"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * list Component
3
+ *
4
+ * Renders ordered and unordered lists with nesting support.
5
+ */
6
+ import { getContext, indent as indentPrimitive, stack, symbol } from "../primitives/index.js";
7
+ import { stripAnsi } from "../render/index.js";
8
+ const BULLET_SYMBOL_MAP = {
9
+ bullet: "bullet",
10
+ dash: "dash",
11
+ arrow: "pointer",
12
+ };
13
+ function renderItems(items, options, depth) {
14
+ const ctx = getContext();
15
+ const iconGap = " ".repeat(ctx.tokens.space.iconGap);
16
+ const lines = [];
17
+ for (let i = 0; i < items.length; i++) {
18
+ const item = items[i];
19
+ const text = typeof item === "string" ? item : item.text;
20
+ const children = typeof item === "string" ? undefined : item.children;
21
+ let prefix;
22
+ if (options.ordered) {
23
+ if (depth === 0) {
24
+ prefix = `${i + 1}.`;
25
+ }
26
+ else {
27
+ // Nested ordered: a., b., c., ...
28
+ prefix = `${String.fromCharCode(97 + (i % 26))}.`;
29
+ }
30
+ }
31
+ else {
32
+ const bulletName = BULLET_SYMBOL_MAP[options.bulletStyle ?? "bullet"];
33
+ prefix = symbol(bulletName);
34
+ }
35
+ const fullPrefix = prefix + iconGap;
36
+ // Indent continuation lines relative to prefix column + bodyIndent
37
+ // Use visual width (strip ANSI codes) for consistent alignment
38
+ const visualWidth = stripAnsi(fullPrefix).length;
39
+ const bodyIndent = " ".repeat(visualWidth + (options.bodyIndent ?? 2));
40
+ const textLines = text.split("\n");
41
+ const formattedText = textLines
42
+ .map((line, idx) => {
43
+ if (idx === 0)
44
+ return fullPrefix + line;
45
+ if (line === "")
46
+ return "";
47
+ return bodyIndent + line;
48
+ })
49
+ .join("\n");
50
+ if (depth > 0) {
51
+ lines.push(indentPrimitive(formattedText, depth));
52
+ }
53
+ else {
54
+ lines.push(formattedText);
55
+ }
56
+ if (children && children.length > 0) {
57
+ const childLines = renderItems(children, options, depth + 1);
58
+ lines.push(...childLines);
59
+ }
60
+ }
61
+ return lines;
62
+ }
63
+ /**
64
+ * Renders ordered or unordered lists with nesting support.
65
+ *
66
+ * @param items - List items to render, supporting nested children.
67
+ * @param options - List rendering configuration.
68
+ * @returns The formatted list as a multi-line string.
69
+ */
70
+ export function list(items, options) {
71
+ const opts = {
72
+ ordered: false,
73
+ gap: 1,
74
+ bulletStyle: "bullet",
75
+ ...options,
76
+ };
77
+ const lines = renderItems(items, opts, 0);
78
+ return stack(lines, { spacing: opts.gap });
79
+ }
80
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/components/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAiB/C,MAAM,iBAAiB,GAAG;IACzB,MAAM,EAAE,QAAiB;IACzB,IAAI,EAAE,MAAe;IACrB,KAAK,EAAE,SAAkB;CACzB,CAAC;AAEF,SAAS,WAAW,CAAC,KAAiB,EAAE,OAAoB,EAAE,KAAa;IAC1E,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACvB,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACzD,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAEtE,IAAI,MAAc,CAAC;QACnB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,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AC3B,CAAC;QAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC7D,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,KAAiB,EAAE,OAAqB;IAC5D,MAAM,IAAI,GAAgB;QACzB,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,CAAC;QACN,WAAW,EAAE,QAAQ;QACrB,GAAG,OAAO;KACV,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * message Component
3
+ *
4
+ * Renders a styled message with an icon, text, optional title, details/body,
5
+ * and hint. Supports error, warning, success, info, and tip levels.
6
+ *
7
+ * Produces rich output matching HyperDev's visual language:
8
+ * - Title line with prefix label
9
+ * - Icon + summary with gap
10
+ * - Vertical bar connectors for body content
11
+ * - Trailing blank line
12
+ */
13
+ /** Options for rendering a status message. */
14
+ export type MessageOptions = {
15
+ /** Semantic level determining the icon and color. */
16
+ level: "error" | "warning" | "success" | "info" | "tip";
17
+ /** Primary message text (the summary line). */
18
+ text: string;
19
+ /** Optional title shown as a prefix label above the summary (e.g. "Error: Connection refused"). */
20
+ title?: string;
21
+ /** Additional detail lines displayed below with vertical bar connectors. */
22
+ details?: string | string[];
23
+ /** Hint text shown below details in dim style. */
24
+ hint?: string;
25
+ };
26
+ /**
27
+ * Renders a styled message with an icon, text, optional title, body, and hint.
28
+ *
29
+ * @param options - Message configuration.
30
+ * @returns The formatted message as a multi-line string.
31
+ */
32
+ export declare function message(options: MessageOptions): string;
33
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/components/message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG;IAC5B,qDAAqD;IACrD,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IACxD,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAWF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAgEvD"}