mepcli 1.3.2 → 2.0.0-beta.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 (291) hide show
  1. package/README.md +11 -2
  2. package/dist/{ansi.js → src/ansi.js} +17 -9
  3. package/dist/src/ansi.js.map +1 -0
  4. package/dist/{base.js → src/base.js} +82 -70
  5. package/dist/src/base.js.map +1 -0
  6. package/dist/{core.js → src/core.js} +266 -320
  7. package/dist/src/core.js.map +1 -0
  8. package/dist/src/data/countries.js +569 -0
  9. package/dist/src/data/countries.js.map +1 -0
  10. package/dist/src/data/licenses.js +480 -0
  11. package/dist/src/data/licenses.js.map +1 -0
  12. package/dist/{highlight.js → src/highlight.js} +77 -69
  13. package/dist/src/highlight.js.map +1 -0
  14. package/dist/src/index.js +66 -0
  15. package/dist/src/index.js.map +1 -0
  16. package/dist/{input.js → src/input.js} +47 -41
  17. package/dist/src/input.js.map +1 -0
  18. package/dist/src/pipeline.js +273 -0
  19. package/dist/src/pipeline.js.map +1 -0
  20. package/dist/{prompts → src/prompts}/autocomplete.js +58 -57
  21. package/dist/src/prompts/autocomplete.js.map +1 -0
  22. package/dist/{prompts → src/prompts}/box.js +86 -53
  23. package/dist/src/prompts/box.js.map +1 -0
  24. package/dist/{prompts → src/prompts}/breadcrumb-search.js +110 -98
  25. package/dist/src/prompts/breadcrumb-search.js.map +1 -0
  26. package/dist/{prompts → src/prompts}/breadcrumb.js +126 -121
  27. package/dist/src/prompts/breadcrumb.js.map +1 -0
  28. package/dist/{prompts → src/prompts}/byte.js +69 -52
  29. package/dist/src/prompts/byte.js.map +1 -0
  30. package/dist/{prompts → src/prompts}/calculator.js +79 -56
  31. package/dist/src/prompts/calculator.js.map +1 -0
  32. package/dist/{prompts → src/prompts}/calendar.js +167 -127
  33. package/dist/src/prompts/calendar.js.map +1 -0
  34. package/dist/{prompts → src/prompts}/checkbox.js +53 -49
  35. package/dist/src/prompts/checkbox.js.map +1 -0
  36. package/dist/{prompts → src/prompts}/code.js +88 -76
  37. package/dist/src/prompts/code.js.map +1 -0
  38. package/dist/{prompts → src/prompts}/color.js +68 -50
  39. package/dist/src/prompts/color.js.map +1 -0
  40. package/dist/{prompts → src/prompts}/confirm.js +22 -15
  41. package/dist/src/prompts/confirm.js.map +1 -0
  42. package/dist/{prompts → src/prompts}/connection-string.js +59 -36
  43. package/dist/src/prompts/connection-string.js.map +1 -0
  44. package/dist/{prompts → src/prompts}/cron.js +90 -59
  45. package/dist/src/prompts/cron.js.map +1 -0
  46. package/dist/src/prompts/curl-utils.js +71 -0
  47. package/dist/src/prompts/curl-utils.js.map +1 -0
  48. package/dist/{prompts → src/prompts}/curl.js +153 -132
  49. package/dist/src/prompts/curl.js.map +1 -0
  50. package/dist/{prompts → src/prompts}/data-inspector.js +96 -91
  51. package/dist/src/prompts/data-inspector.js.map +1 -0
  52. package/dist/{prompts → src/prompts}/date.js +64 -57
  53. package/dist/src/prompts/date.js.map +1 -0
  54. package/dist/{prompts → src/prompts}/dependency.js +84 -80
  55. package/dist/src/prompts/dependency.js.map +1 -0
  56. package/dist/{prompts → src/prompts}/dial.js +49 -35
  57. package/dist/src/prompts/dial.js.map +1 -0
  58. package/dist/src/prompts/diff.js +118 -0
  59. package/dist/src/prompts/diff.js.map +1 -0
  60. package/dist/{prompts → src/prompts}/draw.js +83 -80
  61. package/dist/src/prompts/draw.js.map +1 -0
  62. package/dist/src/prompts/editor.js +234 -0
  63. package/dist/src/prompts/editor.js.map +1 -0
  64. package/dist/{prompts → src/prompts}/emoji.js +80 -82
  65. package/dist/src/prompts/emoji.js.map +1 -0
  66. package/dist/{prompts → src/prompts}/exec.js +60 -46
  67. package/dist/src/prompts/exec.js.map +1 -0
  68. package/dist/src/prompts/file.js +217 -0
  69. package/dist/src/prompts/file.js.map +1 -0
  70. package/dist/{prompts → src/prompts}/form.js +63 -54
  71. package/dist/src/prompts/form.js.map +1 -0
  72. package/dist/{prompts → src/prompts}/fuzzy-multi-column.js +65 -53
  73. package/dist/src/prompts/fuzzy-multi-column.js.map +1 -0
  74. package/dist/{prompts → src/prompts}/fuzzy.js +66 -55
  75. package/dist/src/prompts/fuzzy.js.map +1 -0
  76. package/dist/src/prompts/gauge.js +137 -0
  77. package/dist/src/prompts/gauge.js.map +1 -0
  78. package/dist/{prompts → src/prompts}/grid.js +70 -57
  79. package/dist/src/prompts/grid.js.map +1 -0
  80. package/dist/{prompts → src/prompts}/heatmap.js +70 -64
  81. package/dist/src/prompts/heatmap.js.map +1 -0
  82. package/dist/{prompts → src/prompts}/ip.js +56 -36
  83. package/dist/src/prompts/ip.js.map +1 -0
  84. package/dist/{prompts → src/prompts}/kanban.js +63 -58
  85. package/dist/src/prompts/kanban.js.map +1 -0
  86. package/dist/src/prompts/keypress.js +54 -0
  87. package/dist/src/prompts/keypress.js.map +1 -0
  88. package/dist/src/prompts/license.js +144 -0
  89. package/dist/src/prompts/license.js.map +1 -0
  90. package/dist/{prompts → src/prompts}/list.js +46 -31
  91. package/dist/src/prompts/list.js.map +1 -0
  92. package/dist/{prompts → src/prompts}/map.js +93 -77
  93. package/dist/src/prompts/map.js.map +1 -0
  94. package/dist/{prompts → src/prompts}/match.js +91 -95
  95. package/dist/src/prompts/match.js.map +1 -0
  96. package/dist/{prompts → src/prompts}/miller.js +74 -67
  97. package/dist/src/prompts/miller.js.map +1 -0
  98. package/dist/{prompts → src/prompts}/multi-column-select.js +54 -44
  99. package/dist/src/prompts/multi-column-select.js.map +1 -0
  100. package/dist/{prompts → src/prompts}/multi-range.js +70 -52
  101. package/dist/src/prompts/multi-range.js.map +1 -0
  102. package/dist/{prompts → src/prompts}/multi-select.js +67 -58
  103. package/dist/src/prompts/multi-select.js.map +1 -0
  104. package/dist/{prompts → src/prompts}/number.js +51 -39
  105. package/dist/src/prompts/number.js.map +1 -0
  106. package/dist/{prompts → src/prompts}/otp.js +43 -27
  107. package/dist/src/prompts/otp.js.map +1 -0
  108. package/dist/{prompts → src/prompts}/pattern.js +74 -71
  109. package/dist/src/prompts/pattern.js.map +1 -0
  110. package/dist/{prompts → src/prompts}/phone.js +107 -118
  111. package/dist/src/prompts/phone.js.map +1 -0
  112. package/dist/src/prompts/quiz-select.js +114 -0
  113. package/dist/src/prompts/quiz-select.js.map +1 -0
  114. package/dist/src/prompts/quiz-text.js +98 -0
  115. package/dist/src/prompts/quiz-text.js.map +1 -0
  116. package/dist/{prompts → src/prompts}/range.js +85 -61
  117. package/dist/src/prompts/range.js.map +1 -0
  118. package/dist/{prompts → src/prompts}/rating.js +29 -24
  119. package/dist/src/prompts/rating.js.map +1 -0
  120. package/dist/{prompts → src/prompts}/regex.js +50 -36
  121. package/dist/src/prompts/regex.js.map +1 -0
  122. package/dist/{prompts → src/prompts}/region.js +62 -56
  123. package/dist/src/prompts/region.js.map +1 -0
  124. package/dist/{prompts → src/prompts}/schedule.js +82 -75
  125. package/dist/src/prompts/schedule.js.map +1 -0
  126. package/dist/{prompts → src/prompts}/scroll.js +61 -58
  127. package/dist/src/prompts/scroll.js.map +1 -0
  128. package/dist/src/prompts/seat.js +164 -0
  129. package/dist/src/prompts/seat.js.map +1 -0
  130. package/dist/{prompts → src/prompts}/select-range.js +58 -46
  131. package/dist/src/prompts/select-range.js.map +1 -0
  132. package/dist/{prompts → src/prompts}/select.js +65 -66
  133. package/dist/src/prompts/select.js.map +1 -0
  134. package/dist/{prompts → src/prompts}/semver.js +24 -13
  135. package/dist/src/prompts/semver.js.map +1 -0
  136. package/dist/src/prompts/shortcut.js +133 -0
  137. package/dist/src/prompts/shortcut.js.map +1 -0
  138. package/dist/{prompts → src/prompts}/slider.js +28 -23
  139. package/dist/src/prompts/slider.js.map +1 -0
  140. package/dist/src/prompts/slot.js +117 -0
  141. package/dist/src/prompts/slot.js.map +1 -0
  142. package/dist/{prompts → src/prompts}/snippet.js +82 -61
  143. package/dist/src/prompts/snippet.js.map +1 -0
  144. package/dist/{prompts → src/prompts}/sort-grid.js +64 -59
  145. package/dist/src/prompts/sort-grid.js.map +1 -0
  146. package/dist/{prompts → src/prompts}/sort.js +59 -49
  147. package/dist/src/prompts/sort.js.map +1 -0
  148. package/dist/src/prompts/spam.js +80 -0
  149. package/dist/src/prompts/spam.js.map +1 -0
  150. package/dist/{prompts → src/prompts}/spreadsheet.js +71 -70
  151. package/dist/src/prompts/spreadsheet.js.map +1 -0
  152. package/dist/{prompts → src/prompts}/table.js +52 -38
  153. package/dist/src/prompts/table.js.map +1 -0
  154. package/dist/{prompts → src/prompts}/text.js +74 -70
  155. package/dist/src/prompts/text.js.map +1 -0
  156. package/dist/{prompts → src/prompts}/time.js +105 -96
  157. package/dist/src/prompts/time.js.map +1 -0
  158. package/dist/src/prompts/toggle.js +53 -0
  159. package/dist/src/prompts/toggle.js.map +1 -0
  160. package/dist/{prompts → src/prompts}/transfer.js +71 -67
  161. package/dist/src/prompts/transfer.js.map +1 -0
  162. package/dist/{prompts → src/prompts}/tree-select.js +83 -86
  163. package/dist/src/prompts/tree-select.js.map +1 -0
  164. package/dist/{prompts → src/prompts}/tree.js +69 -67
  165. package/dist/src/prompts/tree.js.map +1 -0
  166. package/dist/src/prompts/wait.js +79 -0
  167. package/dist/src/prompts/wait.js.map +1 -0
  168. package/dist/src/spinner.js +105 -0
  169. package/dist/src/spinner.js.map +1 -0
  170. package/dist/{symbols.js → src/symbols.js} +32 -7
  171. package/dist/src/symbols.js.map +1 -0
  172. package/dist/{tasks.js → src/tasks.js} +104 -79
  173. package/dist/src/tasks.js.map +1 -0
  174. package/dist/src/theme.js +29 -0
  175. package/dist/src/theme.js.map +1 -0
  176. package/dist/src/types.js +8 -0
  177. package/dist/src/types.js.map +1 -0
  178. package/dist/{utils.js → src/utils.js} +196 -152
  179. package/dist/src/utils.js.map +1 -0
  180. package/package.json +16 -13
  181. package/dist/ansi.d.ts +0 -36
  182. package/dist/base.d.ts +0 -60
  183. package/dist/core.d.ts +0 -1072
  184. package/dist/data/countries.d.ts +0 -2
  185. package/dist/data/countries.js +0 -105
  186. package/dist/data/licenses.d.ts +0 -2
  187. package/dist/data/licenses.js +0 -109
  188. package/dist/highlight.d.ts +0 -7
  189. package/dist/index.d.ts +0 -48
  190. package/dist/index.js +0 -64
  191. package/dist/input.d.ts +0 -14
  192. package/dist/pipeline.d.ts +0 -39
  193. package/dist/pipeline.js +0 -54
  194. package/dist/prompts/autocomplete.d.ts +0 -22
  195. package/dist/prompts/box.d.ts +0 -21
  196. package/dist/prompts/breadcrumb-search.d.ts +0 -14
  197. package/dist/prompts/breadcrumb.d.ts +0 -32
  198. package/dist/prompts/byte.d.ts +0 -13
  199. package/dist/prompts/calculator.d.ts +0 -17
  200. package/dist/prompts/calendar.d.ts +0 -33
  201. package/dist/prompts/checkbox.d.ts +0 -13
  202. package/dist/prompts/code.d.ts +0 -19
  203. package/dist/prompts/color.d.ts +0 -14
  204. package/dist/prompts/confirm.d.ts +0 -8
  205. package/dist/prompts/connection-string.d.ts +0 -18
  206. package/dist/prompts/cron.d.ts +0 -13
  207. package/dist/prompts/curl-utils.d.ts +0 -25
  208. package/dist/prompts/curl-utils.js +0 -41
  209. package/dist/prompts/curl.d.ts +0 -41
  210. package/dist/prompts/data-inspector.d.ts +0 -22
  211. package/dist/prompts/date.d.ts +0 -12
  212. package/dist/prompts/dependency.d.ts +0 -16
  213. package/dist/prompts/dial.d.ts +0 -10
  214. package/dist/prompts/diff.d.ts +0 -10
  215. package/dist/prompts/diff.js +0 -101
  216. package/dist/prompts/draw.d.ts +0 -20
  217. package/dist/prompts/editor.d.ts +0 -14
  218. package/dist/prompts/editor.js +0 -203
  219. package/dist/prompts/emoji.d.ts +0 -18
  220. package/dist/prompts/exec.d.ts +0 -17
  221. package/dist/prompts/file.d.ts +0 -21
  222. package/dist/prompts/file.js +0 -210
  223. package/dist/prompts/form.d.ts +0 -18
  224. package/dist/prompts/fuzzy-multi-column.d.ts +0 -12
  225. package/dist/prompts/fuzzy.d.ts +0 -12
  226. package/dist/prompts/gauge.d.ts +0 -21
  227. package/dist/prompts/gauge.js +0 -130
  228. package/dist/prompts/grid.d.ts +0 -14
  229. package/dist/prompts/heatmap.d.ts +0 -13
  230. package/dist/prompts/ip.d.ts +0 -11
  231. package/dist/prompts/kanban.d.ts +0 -17
  232. package/dist/prompts/keypress.d.ts +0 -7
  233. package/dist/prompts/keypress.js +0 -55
  234. package/dist/prompts/license.d.ts +0 -9
  235. package/dist/prompts/license.js +0 -105
  236. package/dist/prompts/list.d.ts +0 -9
  237. package/dist/prompts/map.d.ts +0 -17
  238. package/dist/prompts/match.d.ts +0 -19
  239. package/dist/prompts/miller.d.ts +0 -15
  240. package/dist/prompts/multi-column-select.d.ts +0 -10
  241. package/dist/prompts/multi-range.d.ts +0 -9
  242. package/dist/prompts/multi-select.d.ts +0 -15
  243. package/dist/prompts/number.d.ts +0 -11
  244. package/dist/prompts/otp.d.ts +0 -10
  245. package/dist/prompts/pattern.d.ts +0 -22
  246. package/dist/prompts/phone.d.ts +0 -41
  247. package/dist/prompts/quiz-select.d.ts +0 -10
  248. package/dist/prompts/quiz-select.js +0 -104
  249. package/dist/prompts/quiz-text.d.ts +0 -11
  250. package/dist/prompts/quiz-text.js +0 -82
  251. package/dist/prompts/range.d.ts +0 -9
  252. package/dist/prompts/rating.d.ts +0 -8
  253. package/dist/prompts/regex.d.ts +0 -13
  254. package/dist/prompts/region.d.ts +0 -11
  255. package/dist/prompts/schedule.d.ts +0 -20
  256. package/dist/prompts/scroll.d.ts +0 -13
  257. package/dist/prompts/seat.d.ts +0 -17
  258. package/dist/prompts/seat.js +0 -165
  259. package/dist/prompts/select-range.d.ts +0 -8
  260. package/dist/prompts/select.d.ts +0 -15
  261. package/dist/prompts/semver.d.ts +0 -6
  262. package/dist/prompts/shortcut.d.ts +0 -9
  263. package/dist/prompts/shortcut.js +0 -135
  264. package/dist/prompts/slider.d.ts +0 -8
  265. package/dist/prompts/slot.d.ts +0 -16
  266. package/dist/prompts/slot.js +0 -107
  267. package/dist/prompts/snippet.d.ts +0 -19
  268. package/dist/prompts/sort-grid.d.ts +0 -16
  269. package/dist/prompts/sort.d.ts +0 -14
  270. package/dist/prompts/spam.d.ts +0 -17
  271. package/dist/prompts/spam.js +0 -62
  272. package/dist/prompts/spreadsheet.d.ts +0 -21
  273. package/dist/prompts/table.d.ts +0 -14
  274. package/dist/prompts/text.d.ts +0 -17
  275. package/dist/prompts/time.d.ts +0 -12
  276. package/dist/prompts/toggle.d.ts +0 -8
  277. package/dist/prompts/toggle.js +0 -47
  278. package/dist/prompts/transfer.d.ts +0 -18
  279. package/dist/prompts/tree-select.d.ts +0 -31
  280. package/dist/prompts/tree.d.ts +0 -20
  281. package/dist/prompts/wait.d.ts +0 -18
  282. package/dist/prompts/wait.js +0 -62
  283. package/dist/spinner.d.ts +0 -33
  284. package/dist/spinner.js +0 -89
  285. package/dist/symbols.d.ts +0 -33
  286. package/dist/tasks.d.ts +0 -57
  287. package/dist/theme.d.ts +0 -2
  288. package/dist/theme.js +0 -20
  289. package/dist/types.d.ts +0 -503
  290. package/dist/types.js +0 -5
  291. package/dist/utils.d.ts +0 -81
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "theme", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return theme;
9
+ }
10
+ });
11
+ const _ansi = require("./ansi");
12
+ const theme = {
13
+ main: _ansi.ANSI.FG_CYAN,
14
+ success: _ansi.ANSI.FG_GREEN,
15
+ error: _ansi.ANSI.FG_RED,
16
+ muted: _ansi.ANSI.FG_GRAY,
17
+ title: _ansi.ANSI.RESET,
18
+ // Add specific syntax colors
19
+ syntax: {
20
+ key: _ansi.ANSI.FG_CYAN,
21
+ string: _ansi.ANSI.FG_GREEN,
22
+ number: _ansi.ANSI.FG_YELLOW,
23
+ boolean: _ansi.ANSI.FG_MAGENTA,
24
+ null: _ansi.ANSI.FG_RED,
25
+ punctuation: _ansi.ANSI.FG_WHITE
26
+ }
27
+ };
28
+
29
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/theme.ts"],"sourcesContent":["import { ANSI } from './ansi';\nimport { ThemeConfig } from './types';\n\nexport const theme: ThemeConfig = {\n main: ANSI.FG_CYAN,\n success: ANSI.FG_GREEN,\n error: ANSI.FG_RED,\n muted: ANSI.FG_GRAY,\n title: ANSI.RESET,\n // Add specific syntax colors\n syntax: {\n key: ANSI.FG_CYAN,\n string: ANSI.FG_GREEN,\n number: ANSI.FG_YELLOW,\n boolean: ANSI.FG_MAGENTA,\n null: ANSI.FG_RED,\n punctuation: ANSI.FG_WHITE,\n }\n};"],"names":["theme","main","ANSI","FG_CYAN","success","FG_GREEN","error","FG_RED","muted","FG_GRAY","title","RESET","syntax","key","string","number","FG_YELLOW","boolean","FG_MAGENTA","null","punctuation","FG_WHITE"],"mappings":";;;;+BAGaA;;;eAAAA;;;sBAHQ;AAGd,MAAMA,QAAqB;IAC9BC,MAAMC,UAAI,CAACC,OAAO;IAClBC,SAASF,UAAI,CAACG,QAAQ;IACtBC,OAAOJ,UAAI,CAACK,MAAM;IAClBC,OAAON,UAAI,CAACO,OAAO;IACnBC,OAAOR,UAAI,CAACS,KAAK;IACjB,6BAA6B;IAC7BC,QAAQ;QACJC,KAAKX,UAAI,CAACC,OAAO;QACjBW,QAAQZ,UAAI,CAACG,QAAQ;QACrBU,QAAQb,UAAI,CAACc,SAAS;QACtBC,SAASf,UAAI,CAACgB,UAAU;QACxBC,MAAMjB,UAAI,CAACK,MAAM;QACjBa,aAAalB,UAAI,CAACmB,QAAQ;IAC9B;AACJ"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Type definitions for Mep CLI interactions.
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/**\n * Type definitions for Mep CLI interactions.\n */\n\nexport interface ThemeConfig {\n main: string; // Primary branding color (e.g., cursor, selected item, values)\n success: string; // Success messages, checkmarks\n error: string; // Error messages, cross marks\n muted: string; // Placeholders, help text, unselected items\n title: string; // Questions/Titles\n syntax: {\n key: string; // JSON Key color\n string: string; // JSON String value color\n number: string; // JSON Number value color\n boolean: string; // JSON Boolean value color\n null: string; // JSON Null value color\n punctuation: string; // JSON Punctuation color\n };\n}\n\nexport interface BaseOptions {\n message: string;\n mouse?: boolean;\n}\n\nexport interface MouseEvent {\n name: 'mouse';\n x: number;\n y: number;\n button: number;\n action: 'press' | 'release' | 'move' | 'scroll';\n scroll?: 'up' | 'down';\n shift?: boolean;\n ctrl?: boolean;\n meta?: boolean;\n}\n\nexport interface TextOptions extends BaseOptions {\n placeholder?: string;\n initial?: string;\n validate?: (value: string) => string | boolean | Promise<string | boolean>;\n isPassword?: boolean;\n multiline?: boolean;\n mask?: string;\n suggest?: (input: string) => string | Promise<string>;\n}\n\nexport interface Separator {\n separator: true;\n text?: string;\n}\n\nexport interface SelectChoice<V> {\n title: string;\n value: V;\n description?: string; // Optional hint\n}\n\nexport interface SelectOptions<V> extends BaseOptions {\n choices: (SelectChoice<V> | Separator)[];\n}\n\nexport interface TransferOptions<V> extends BaseOptions {\n source: (string | SelectChoice<V>)[];\n target?: (string | SelectChoice<V>)[];\n}\n\nexport interface CronOptions extends BaseOptions {\n initial?: string;\n placeholder?: string;\n}\n\n// --- Checkbox Types ---\nexport interface CheckboxChoice<V> extends SelectChoice<V> {\n selected?: boolean; // Default checked state\n}\n\nexport interface CheckboxOptions<V> extends BaseOptions {\n choices: CheckboxChoice<V>[];\n min?: number; // Minimum selections required (optional)\n max?: number; // Maximum selections allowed (optional)\n}\n\nexport interface ConfirmOptions extends BaseOptions {\n initial?: boolean;\n}\n\nexport interface NumberOptions extends BaseOptions {\n initial?: number;\n min?: number;\n max?: number;\n step?: number;\n placeholder?: string;\n}\n\nexport interface ToggleOptions extends BaseOptions {\n initial?: boolean;\n activeText?: string;\n inactiveText?: string;\n}\n\nexport interface ListOptions extends BaseOptions {\n placeholder?: string;\n initial?: string[];\n validate?: (value: string[]) => string | boolean | Promise<string | boolean>;\n}\n\nexport interface SliderOptions extends BaseOptions {\n min: number;\n max: number;\n initial?: number;\n step?: number;\n unit?: string;\n}\n\nexport interface RangeOptions extends BaseOptions {\n min: number;\n max: number;\n initial?: [number, number];\n step?: number;\n unit?: string;\n}\n\nexport interface SelectRangeOptions<V> extends Omit<SelectOptions<V>, 'initial'> {\n initial?: [number, number]; // Start and End indices\n}\n\nexport interface RatingOptions extends BaseOptions {\n min?: number;\n max?: number;\n initial?: number;\n}\n\nexport interface DateOptions extends BaseOptions {\n initial?: Date;\n min?: Date;\n max?: Date;\n}\n\nexport interface FileOptions extends BaseOptions {\n basePath?: string;\n extensions?: string[];\n onlyDirectories?: boolean;\n}\n\nexport interface MultiSelectOptions<V> extends CheckboxOptions<V> {\n // Inherits choices, min, max\n}\n\nexport interface AutocompleteOptions<V> extends BaseOptions {\n suggest: (input: string) => Promise<SelectChoice<V>[]>;\n limit?: number; // defaults to 10\n fallback?: string; // Message when no results\n initial?: string; // Initial query\n}\n\nexport interface SortOptions extends BaseOptions {\n items: string[];\n}\n\nexport interface EditorOptions extends BaseOptions {\n initial?: string;\n extension?: string;\n waitUserInput?: boolean;\n}\n\nexport interface TableRow<V> {\n value: V;\n row: string[];\n}\n\nexport interface TableOptions<V> extends BaseOptions {\n columns: string[];\n data: TableRow<V>[];\n rows?: number; // display rows\n}\n\nexport interface TreeNode<V> {\n title: string;\n value: V;\n children?: TreeNode<V>[];\n expanded?: boolean;\n disabled?: boolean;\n selected?: boolean | 'indeterminate';\n}\n\nexport interface TreeOptions<V> extends BaseOptions {\n data: TreeNode<V>[];\n initial?: V;\n indent?: number;\n}\n\nexport interface KeypressOptions extends BaseOptions {\n keys?: string[];\n showInvisible?: boolean;\n}\n\nexport interface FormField {\n name: string;\n message: string;\n initial?: string;\n validate?: (value: string) => string | boolean | Promise<string | boolean>;\n}\n\nexport interface FormOptions extends BaseOptions {\n fields: FormField[];\n}\n\nexport interface SnippetOptions extends BaseOptions {\n template: string;\n values?: Record<string, string>;\n fields?: Record<string, {\n message?: string;\n validate?: (value: string) => string | boolean;\n }>;\n}\n\nexport interface SpamOptions extends BaseOptions {\n threshold: number;\n spamKey?: string;\n decay?: boolean;\n}\n\nexport interface WaitOptions extends BaseOptions {\n seconds: number;\n autoSubmit?: boolean;\n}\n\nexport interface CodeOptions extends BaseOptions {\n template: string;\n language?: 'json' | 'env' | 'toml' | 'csv' | 'sh' | 'bash' | 'zsh' | 'properties' | 'props' | 'conf';\n /**\n * Enable syntax highlighting (Experimental).\n * @default true\n */\n highlight?: boolean;\n /**\n * Initial values for variables in the template.\n */\n values?: Record<string, string>;\n}\n\nexport interface TreeSelectNode<V> {\n title: string;\n value: V;\n children?: TreeSelectNode<V>[];\n expanded?: boolean;\n disabled?: boolean;\n selected?: boolean | 'indeterminate';\n}\n\nexport interface TreeSelectOptions<V> extends BaseOptions {\n data: TreeSelectNode<V>[];\n initial?: V[];\n indent?: number;\n}\n\nexport interface ColorOptions extends BaseOptions {\n initial?: string; // Hex support (e.g. \"#3B82F6\")\n format?: 'hex' | 'rgb' | 'hsl';\n}\n\nexport interface GridOptions extends BaseOptions {\n rows: string[];\n columns: string[];\n initial?: boolean[][]; // Initial selected state\n}\n\nexport interface SortGridOptions extends BaseOptions {\n data: string[][];\n}\n\nexport interface CalendarOptions extends BaseOptions {\n mode?: 'single' | 'range';\n multiple?: boolean; // Allow picking multiple dates or multiple ranges\n initial?: Date | [Date, Date]; // Single date or Range tuple\n min?: Date;\n max?: Date;\n weekStart?: 0 | 1; // 0 = Sunday, 1 = Monday\n}\n\n// --- New Prompts ---\nexport interface MapOptions extends BaseOptions {\n initial?: Record<string, string>;\n suggestions?: string[];\n}\n\nexport interface SemVerOptions extends BaseOptions {\n currentVersion: string;\n}\n\nexport interface IPOptions extends BaseOptions {\n initial?: string;\n}\n\nexport interface OTPOptions extends BaseOptions {\n length?: number;\n mask?: string;\n secure?: boolean;\n placeholder?: string;\n}\n\nexport interface QuizSelectOptions<V> extends SelectOptions<V> {\n correctValue: V;\n explanation?: string;\n}\n\nexport interface QuizTextOptions extends TextOptions {\n verify?: (value: string) => boolean | Promise<boolean>;\n correctAnswer: string;\n explanation?: string;\n}\n\n// --- Kanban Types ---\nexport interface KanbanItem {\n id: string;\n title: string;\n [key: string]: any;\n}\n\nexport interface KanbanColumn<V extends KanbanItem> {\n id: string;\n title: string;\n items: V[];\n}\n\nexport interface KanbanOptions<V extends KanbanItem> extends BaseOptions {\n columns: KanbanColumn<V>[];\n}\n\n// --- Time Scroller Types ---\nexport interface TimeOptions extends BaseOptions {\n format?: '12h' | '24h';\n step?: number;\n initial?: Date | string;\n}\n\n// --- Heatmap Types ---\nexport interface HeatmapLegend {\n value: number;\n char: string;\n color: (str: string) => string;\n}\n\nexport interface HeatmapOptions extends BaseOptions {\n rows: string[];\n columns: string[];\n legend: HeatmapLegend[];\n initial?: number[][];\n}\n\nexport interface ByteOptions extends BaseOptions {\n initial?: number; // Field initial in bytes\n min?: number; // Min bytes\n max?: number; // Max bytes\n}\n\n// --- Slot Machine Types ---\nexport interface SlotOptions extends BaseOptions {\n choices: string[];\n rows?: number; // Default: 3\n initial?: number; // Default: 0\n}\n\n// --- Rhythm Gauge Types ---\nexport interface GaugeOptions extends BaseOptions {\n theme?: Partial<ThemeConfig>;\n width?: number; // Default: 40\n /** Safe zone width as a percentage (0-1) or absolute character count (>1). Default: 0.2 (20%) */\n safeZone?: number;\n}\n\n// --- Calculator Types ---\nexport interface CalculatorOptions extends BaseOptions {\n initial?: string;\n variables?: Record<string, number>;\n precision?: number;\n placeholder?: string;\n}\n\n// --- Emoji Types ---\nexport interface EmojiItem {\n char: string;\n name: string;\n description?: string;\n}\n\nexport interface EmojiOptions extends BaseOptions {\n emojis: EmojiItem[];\n recent?: string[]; // Array of emoji names\n cols?: number;\n}\n\n// --- Match Types ---\nexport interface MatchItem {\n id: string;\n label: string;\n value?: any;\n}\n\nexport interface MatchOptions extends BaseOptions {\n source: (string | MatchItem)[];\n target: (string | MatchItem)[];\n constraints?: {\n required?: boolean; // Must link all source items?\n oneToMany?: boolean; // Can a target receive multiple sources?\n };\n}\n\n// --- Diff Types ---\nexport interface DiffOptions extends BaseOptions {\n original: string;\n modified: string;\n context?: number;\n mode?: 'inline' | 'split';\n}\n\n// --- Dial Types ---\nexport interface DialOptions extends BaseOptions {\n min: number;\n max: number;\n step?: number;\n radius?: number;\n pointerSymbol?: string;\n initial?: number;\n}\n\n// --- Draw Types ---\nexport interface DrawOptions extends BaseOptions {\n width: number; // Width in characters\n height: number; // Height in characters\n exportType?: 'matrix' | 'text';\n initial?: boolean[][];\n}\n\n// --- Multi-Column Select Types ---\nexport interface MultiColumnSelectOptions<V> extends SelectOptions<V> {\n cols?: number | 'auto';\n}\n\n// --- Fuzzy Match Types ---\nexport interface FuzzySelectOptions<V> extends SelectOptions<V> {\n // Inherits choices\n}\n\n// --- Miller Columns Types ---\nexport interface MillerOptions<V> extends BaseOptions {\n data: TreeNode<V>[];\n initial?: V[]; // Path of values to pre-select\n separator?: string;\n}\n\n// --- Pattern Lock Types ---\nexport interface PatternOptions extends BaseOptions {\n rows?: number; // Default 3\n cols?: number; // Default 3\n nodeChar?: string; // Default ●\n lineChar?: string; // Default based on symbols\n}\n\n// --- Region/Map Selector Types ---\nexport interface MapRegion {\n id: string;\n label: string;\n x: number;\n y: number;\n description?: string;\n}\n\nexport interface RegionOptions extends BaseOptions {\n mapArt: string;\n regions: MapRegion[];\n initial?: string; // Initial selected region ID\n}\n\n// --- Spreadsheet Types ---\nexport interface SpreadsheetColumn {\n name: string;\n key: string;\n width?: number; // Fixed width, or auto if undefined\n editable?: boolean;\n}\n\nexport interface SpreadsheetOptions extends BaseOptions {\n columns: SpreadsheetColumn[];\n data: Record<string, any>[];\n rows?: number; // Viewport height\n keyBindings?: {\n save?: string[];\n cancel?: string[];\n };\n}\n\n// --- Scroll Prompt Types ---\nexport interface ScrollOptions extends BaseOptions {\n content: string;\n height?: number; // Default: 10-15\n requireScrollToBottom?: boolean;\n}\n\n// --- Breadcrumb Types ---\nexport interface BreadcrumbOptions extends BaseOptions {\n root?: string;\n separator?: string;\n showHidden?: boolean;\n}\n\n// --- Schedule Types ---\nexport interface ScheduleTask {\n name: string;\n start: Date;\n end: Date;\n metadata?: any;\n}\n\nexport interface ScheduleOptions extends BaseOptions {\n data: ScheduleTask[];\n}\n\n// --- Data Inspector Types ---\nexport interface DataInspectorOptions extends BaseOptions {\n data: any;\n maxDepth?: number;\n}\n\n// --- Exec Types ---\nexport interface ExecOptions extends BaseOptions {\n command: string;\n timeout?: number; // ms, default 0 (infinite)\n cwd?: string;\n streamOutput?: boolean; // default false\n}\n\n// --- Shortcut Types ---\nexport interface ShortcutResult {\n name: string;\n ctrl: boolean;\n shift: boolean;\n meta: boolean;\n sequence: string;\n}\n\nexport interface ShortcutOptions extends BaseOptions {\n initial?: ShortcutResult;\n}\n\n// --- Seat Types ---\nexport interface SeatOptions extends BaseOptions {\n layout: string[];\n rows?: string[];\n cols?: string[];\n initial?: string[];\n multiple?: boolean;\n}\n\n// --- Dependency Types ---\nexport interface DependencyItem<V> extends CheckboxChoice<V> {\n dependsOn?: V[]; // Values this item depends on\n triggers?: V[]; // Values this item triggers ON\n conflictsWith?: V[]; // Values this item forces OFF\n}\n\nexport interface DependencyOptions<V> extends BaseOptions {\n choices: DependencyItem<V>[];\n min?: number;\n max?: number;\n autoResolve?: boolean; // Default true: automatically check dependencies\n}\n\n// --- License Types ---\nexport interface License {\n id: string; // SPDX\n name: string;\n description: string;\n permissions: string[];\n conditions: string[];\n limitations: string[];\n}\n\nexport interface LicenseOptions extends BaseOptions {\n defaultLicense?: string;\n}\n\n// --- Regex Types ---\nexport interface RegexOptions extends BaseOptions {\n tests: string[];\n flags?: string;\n}\n\n// --- Box Model Types ---\nexport interface BoxOptions extends BaseOptions {\n initial?: number | { top: number; right: number; bottom: number; left: number };\n min?: number;\n max?: number;\n step?: number;\n}\n\n// --- Phone Types ---\nexport interface PhoneOptions extends BaseOptions {\n defaultCountry?: string; // ISO Code (e.g., 'VN')\n placeholder?: string; // Custom placeholder if no default mask\n strict?: boolean; // Enforce strict mask length\n validate?: (value: string) => string | boolean | Promise<string | boolean>;\n}\n\n// --- TaskRunner Types ---\n\nexport type TaskStatus = 'pending' | 'loading' | 'success' | 'error' | 'warning';\n\nexport interface TaskConfig {\n id: string;\n title: string;\n type?: 'spinner' | 'progress'; // Defaults to spinner\n total?: number; // Only used for progress bar\n}\n\n// Internal state of each Task\nexport interface TaskState extends TaskConfig {\n status: TaskStatus;\n current: number; // Progress value\n message?: string; // Secondary message (e.g. \"Downloading 5MB/s...\")\n}\n\nexport interface TaskGroupOptions {\n concurrency?: number; // (Optional) Limit concurrent tasks (for Pipeline)\n renderer?: 'default' | 'minimal'; // Minimal for CI environments\n}\n"],"names":[],"mappings":"AAAA;;CAEC"}
@@ -1,16 +1,42 @@
1
- "use strict";
2
1
  // src/utils.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Graph = exports.Layout = void 0;
5
- exports.detectCapabilities = detectCapabilities;
6
- exports.stripAnsi = stripAnsi;
7
- exports.stringWidth = stringWidth;
8
- exports.safeSplit = safeSplit;
9
- exports.fuzzyMatch = fuzzyMatch;
10
- exports.generateProgressBar = generateProgressBar;
11
2
  /**
12
3
  * Detects terminal capabilities.
13
- */
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ function _export(target, all) {
9
+ for(var name in all)Object.defineProperty(target, name, {
10
+ enumerable: true,
11
+ get: Object.getOwnPropertyDescriptor(all, name).get
12
+ });
13
+ }
14
+ _export(exports, {
15
+ get Graph () {
16
+ return Graph;
17
+ },
18
+ get Layout () {
19
+ return Layout;
20
+ },
21
+ get detectCapabilities () {
22
+ return detectCapabilities;
23
+ },
24
+ get fuzzyMatch () {
25
+ return fuzzyMatch;
26
+ },
27
+ get generateProgressBar () {
28
+ return generateProgressBar;
29
+ },
30
+ get safeSplit () {
31
+ return safeSplit;
32
+ },
33
+ get stringWidth () {
34
+ return stringWidth;
35
+ },
36
+ get stripAnsi () {
37
+ return stripAnsi;
38
+ }
39
+ });
14
40
  function detectCapabilities() {
15
41
  const env = process.env;
16
42
  // Check for CI
@@ -21,35 +47,28 @@ function detectCapabilities() {
21
47
  const isTTY = process.stdout.isTTY;
22
48
  const isWindows = process.platform === 'win32';
23
49
  // Better Unicode detection logic
24
- const isUnicodeSupported = () => {
50
+ const isUnicodeSupported = ()=>{
25
51
  // 1. Windows: Check specific environmental variables
26
52
  if (isWindows) {
27
53
  // Windows Terminal
28
- if (env.WT_SESSION)
29
- return true;
54
+ if (env.WT_SESSION) return true;
30
55
  // VSCode terminal
31
- if (env.TERM_PROGRAM === 'vscode')
32
- return true;
56
+ if (env.TERM_PROGRAM === 'vscode') return true;
33
57
  // Modern terminals setting TERM (e.g. Alacritty, Git Bash, Cygwin)
34
- if (env.TERM === 'xterm-256color' || env.TERM === 'alacritty')
35
- return true;
58
+ if (env.TERM === 'xterm-256color' || env.TERM === 'alacritty') return true;
36
59
  // ConEmu / Cmder
37
- if (env.ConEmuTask)
38
- return true;
60
+ if (env.ConEmuTask) return true;
39
61
  // CI on Windows typically supports Unicode.
40
- if (isCI)
41
- return true;
62
+ if (isCI) return true;
42
63
  // Default cmd.exe / old powershell => False (ASCII)
43
64
  return false;
44
65
  }
45
66
  // 2. Non-Windows (Linux/macOS)
46
- if (env.TERM_PROGRAM === 'Apple_Terminal')
47
- return true;
67
+ if (env.TERM_PROGRAM === 'Apple_Terminal') return true;
48
68
  // Check if the LANG or LC_ALL variable contains UTF-8.
49
69
  const lang = env.LANG || '';
50
70
  const lcAll = env.LC_ALL || '';
51
- return (lang && lang.toUpperCase().endsWith('UTF-8')) ||
52
- (lcAll && lcAll.toUpperCase().endsWith('UTF-8'));
71
+ return lang && lang.toUpperCase().endsWith('UTF-8') || lcAll && lcAll.toUpperCase().endsWith('UTF-8');
53
72
  };
54
73
  return {
55
74
  isCI,
@@ -61,9 +80,6 @@ function detectCapabilities() {
61
80
  hasMouse: isTTY && !isCI
62
81
  };
63
82
  }
64
- /**
65
- * Strips ANSI escape codes from a string.
66
- */
67
83
  function stripAnsi(str) {
68
84
  return str.replace(/\x1b\[[0-9;]*m/g, '');
69
85
  }
@@ -71,62 +87,122 @@ function stripAnsi(str) {
71
87
  * Sorted array of Unicode ranges that are typically full-width (2 columns).
72
88
  * Includes CJK, Emoji, Fullwidth forms, etc.
73
89
  * Format: [start, end] inclusive.
74
- */
75
- const WIDE_RANGES = [
76
- [0x1100, 0x11FF], // Hangul Jamo
77
- [0x2E80, 0x2EFF], // CJK Radicals Supplement
78
- [0x2F00, 0x2FDF], // Kangxi Radicals
79
- [0x3000, 0x303F], // CJK Symbols and Punctuation
80
- [0x3040, 0x309F], // Hiragana
81
- [0x30A0, 0x30FF], // Katakana
82
- [0x3100, 0x312F], // Bopomofo
83
- [0x3130, 0x318F], // Hangul Compatibility Jamo
84
- [0x3200, 0x32FF], // Enclosed CJK Letters and Months
85
- [0x3300, 0x33FF], // CJK Compatibility
86
- [0x3400, 0x4DBF], // CJK Unified Ideographs Extension A
87
- [0x4E00, 0x9FFF], // CJK Unified Ideographs
88
- [0xA960, 0xA97F], // Hangul Jamo Extended-A
89
- [0xAC00, 0xD7AF], // Hangul Syllables
90
- [0xD7B0, 0xD7FF], // Hangul Jamo Extended-B
91
- [0xF900, 0xFAFF], // CJK Compatibility Ideographs
92
- [0xFE10, 0xFE1F], // Vertical Forms
93
- [0xFE30, 0xFE4F], // CJK Compatibility Forms
94
- [0xFE50, 0xFE6F], // Small Form Variants
95
- [0xFF01, 0xFF60], // Fullwidth ASCII variants
96
- [0xFFE0, 0xFFE6], // Fullwidth currency/symbols
97
- [0x1F300, 0x1F6FF], // Miscellaneous Symbols and Pictographs (Emoji)
98
- [0x1F900, 0x1F9FF], // Supplemental Symbols and Pictographs
90
+ */ const WIDE_RANGES = [
91
+ [
92
+ 0x1100,
93
+ 0x11FF
94
+ ],
95
+ [
96
+ 0x2E80,
97
+ 0x2EFF
98
+ ],
99
+ [
100
+ 0x2F00,
101
+ 0x2FDF
102
+ ],
103
+ [
104
+ 0x3000,
105
+ 0x303F
106
+ ],
107
+ [
108
+ 0x3040,
109
+ 0x309F
110
+ ],
111
+ [
112
+ 0x30A0,
113
+ 0x30FF
114
+ ],
115
+ [
116
+ 0x3100,
117
+ 0x312F
118
+ ],
119
+ [
120
+ 0x3130,
121
+ 0x318F
122
+ ],
123
+ [
124
+ 0x3200,
125
+ 0x32FF
126
+ ],
127
+ [
128
+ 0x3300,
129
+ 0x33FF
130
+ ],
131
+ [
132
+ 0x3400,
133
+ 0x4DBF
134
+ ],
135
+ [
136
+ 0x4E00,
137
+ 0x9FFF
138
+ ],
139
+ [
140
+ 0xA960,
141
+ 0xA97F
142
+ ],
143
+ [
144
+ 0xAC00,
145
+ 0xD7AF
146
+ ],
147
+ [
148
+ 0xD7B0,
149
+ 0xD7FF
150
+ ],
151
+ [
152
+ 0xF900,
153
+ 0xFAFF
154
+ ],
155
+ [
156
+ 0xFE10,
157
+ 0xFE1F
158
+ ],
159
+ [
160
+ 0xFE30,
161
+ 0xFE4F
162
+ ],
163
+ [
164
+ 0xFE50,
165
+ 0xFE6F
166
+ ],
167
+ [
168
+ 0xFF01,
169
+ 0xFF60
170
+ ],
171
+ [
172
+ 0xFFE0,
173
+ 0xFFE6
174
+ ],
175
+ [
176
+ 0x1F300,
177
+ 0x1F6FF
178
+ ],
179
+ [
180
+ 0x1F900,
181
+ 0x1F9FF
182
+ ]
99
183
  ];
100
184
  /**
101
185
  * Binary search to check if a code point is in the wide ranges.
102
- */
103
- function isWideCodePoint(cp) {
186
+ */ function isWideCodePoint(cp) {
104
187
  let low = 0;
105
188
  let high = WIDE_RANGES.length - 1;
106
- while (low <= high) {
189
+ while(low <= high){
107
190
  const mid = Math.floor((low + high) / 2);
108
191
  const [start, end] = WIDE_RANGES[mid];
109
192
  if (cp >= start && cp <= end) {
110
193
  return true;
111
- }
112
- else if (cp < start) {
194
+ } else if (cp < start) {
113
195
  high = mid - 1;
114
- }
115
- else {
196
+ } else {
116
197
  low = mid + 1;
117
198
  }
118
199
  }
119
200
  return false;
120
201
  }
121
- /**
122
- * Calculates the visual width of a string.
123
- * Uses binary search for wide characters.
124
- * Handles ANSI codes (zero width).
125
- */
126
202
  function stringWidth(str) {
127
203
  let width = 0;
128
204
  let inAnsi = false;
129
- for (let i = 0; i < str.length; i++) {
205
+ for(let i = 0; i < str.length; i++){
130
206
  const code = str.charCodeAt(i);
131
207
  // Simple ANSI parser state check
132
208
  if (str[i] === '\x1b') {
@@ -135,10 +211,9 @@ function stringWidth(str) {
135
211
  }
136
212
  if (inAnsi) {
137
213
  if (str[i] === '[') {
138
- // Continue, this is the start of CSI
139
214
  continue;
140
215
  }
141
- if ((str[i] >= '@' && str[i] <= '~')) {
216
+ if (str[i] >= '@' && str[i] <= '~') {
142
217
  inAnsi = false;
143
218
  }
144
219
  continue;
@@ -157,27 +232,23 @@ function stringWidth(str) {
157
232
  }
158
233
  return width;
159
234
  }
160
- /**
161
- * Safely splits a string into an array of grapheme clusters.
162
- * Uses Intl.Segmenter (Node 16+).
163
- */
164
235
  function safeSplit(str) {
165
236
  // @ts-ignore - Intl.Segmenter is available in Node 16+ but TS might complain depending on lib settings
166
- const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
237
+ const segmenter = new Intl.Segmenter(undefined, {
238
+ granularity: 'grapheme'
239
+ });
167
240
  const segments = segmenter.segment(str);
168
241
  const result = [];
169
- for (const segment of segments) {
242
+ for (const segment of segments){
170
243
  result.push(segment.segment);
171
244
  }
172
245
  return result;
173
246
  }
174
- /**
175
- * Fuzzy match algorithm (Subsequence matching).
176
- * Returns score and matched indices, or null if no match.
177
- */
178
247
  function fuzzyMatch(query, target) {
179
- if (!query)
180
- return { score: 0, indices: [] };
248
+ if (!query) return {
249
+ score: 0,
250
+ indices: []
251
+ };
181
252
  const queryLower = query.toLowerCase();
182
253
  const targetLower = target.toLowerCase();
183
254
  let queryIdx = 0;
@@ -188,7 +259,7 @@ function fuzzyMatch(query, target) {
188
259
  // Track previous match index for consecutive check
189
260
  let lastMatchIdx = -1;
190
261
  // Simple greedy subsequence match
191
- while (queryIdx < queryLower.length && targetIdx < targetLower.length) {
262
+ while(queryIdx < queryLower.length && targetIdx < targetLower.length){
192
263
  const qChar = queryLower[queryIdx];
193
264
  const tChar = targetLower[targetIdx];
194
265
  if (qChar === tChar) {
@@ -197,22 +268,18 @@ function fuzzyMatch(query, target) {
197
268
  // Bonus: Consecutive match
198
269
  if (lastMatchIdx !== -1 && targetIdx === lastMatchIdx + 1) {
199
270
  consecutive++;
200
- charScore += (consecutive * 2); // Increasing bonus for longer runs
201
- }
202
- else {
271
+ charScore += consecutive * 2; // Increasing bonus for longer runs
272
+ } else {
203
273
  consecutive = 0;
204
274
  }
205
275
  // Bonus: Match at start of string
206
276
  if (targetIdx === 0) {
207
277
  charScore += 5;
208
- }
209
- // Bonus: Match after separator (camelCase or space or special char)
210
- else if (targetIdx > 0) {
278
+ } else if (targetIdx > 0) {
211
279
  const prevChar = target.charAt(targetIdx - 1);
212
280
  if (/[\s_\-.]/.test(prevChar) || prevChar === '/') {
213
281
  charScore += 4;
214
- }
215
- else if (prevChar !== prevChar.toUpperCase() && target.charAt(targetIdx) === target.charAt(targetIdx).toUpperCase()) {
282
+ } else if (prevChar !== prevChar.toUpperCase() && target.charAt(targetIdx) === target.charAt(targetIdx).toUpperCase()) {
216
283
  // CamelCase hump
217
284
  charScore += 3;
218
285
  }
@@ -234,16 +301,15 @@ function fuzzyMatch(query, target) {
234
301
  const spread = indices[indices.length - 1] - indices[0];
235
302
  score -= spread * 0.5;
236
303
  }
237
- return { score, indices };
304
+ return {
305
+ score,
306
+ indices
307
+ };
238
308
  }
239
- /**
240
- * Layout utilities for advanced rendering (Split View, etc.)
241
- */
242
- exports.Layout = {
309
+ const Layout = {
243
310
  /**
244
311
  * Truncates a string to a specific visual width, respecting ANSI codes.
245
- */
246
- truncate(str, width) {
312
+ */ truncate (str, width) {
247
313
  const visualWidth = stringWidth(str);
248
314
  if (visualWidth <= width) {
249
315
  return str;
@@ -251,9 +317,8 @@ exports.Layout = {
251
317
  let currentWidth = 0;
252
318
  let cutIndex = 0;
253
319
  let inAnsi = false;
254
- for (let i = 0; i < str.length; i++) {
255
- if (str[i] === '\x1b')
256
- inAnsi = true;
320
+ for(let i = 0; i < str.length; i++){
321
+ if (str[i] === '\x1b') inAnsi = true;
257
322
  if (!inAnsi) {
258
323
  const code = str.charCodeAt(i);
259
324
  // Handle surrogate pair
@@ -262,8 +327,7 @@ exports.Layout = {
262
327
  if (next >= 0xDC00 && next <= 0xDFFF) {
263
328
  const cp = (code - 0xD800) * 0x400 + (next - 0xDC00) + 0x10000;
264
329
  const w = isWideCodePoint(cp) ? 2 : 1;
265
- if (currentWidth + w > width)
266
- break;
330
+ if (currentWidth + w > width) break;
267
331
  currentWidth += w;
268
332
  cutIndex = i + 2;
269
333
  i++; // Skip next
@@ -271,13 +335,10 @@ exports.Layout = {
271
335
  }
272
336
  }
273
337
  const w = isWideCodePoint(code) ? 2 : 1;
274
- if (currentWidth + w > width)
275
- break;
338
+ if (currentWidth + w > width) break;
276
339
  currentWidth += w;
277
- }
278
- else {
279
- if (str[i] === 'm' || (str[i] >= 'A' && str[i] <= 'Z'))
280
- inAnsi = false;
340
+ } else {
341
+ if (str[i] === 'm' || str[i] >= 'A' && str[i] <= 'Z') inAnsi = false;
281
342
  }
282
343
  cutIndex = i + 1;
283
344
  }
@@ -286,19 +347,15 @@ exports.Layout = {
286
347
  /**
287
348
  * Pads a string to a specific visual length.
288
349
  * Respects ANSI codes (does not count them towards length).
289
- */
290
- pad(text, length, align = 'left') {
350
+ */ pad (text, length, align = 'left') {
291
351
  const visualLen = stringWidth(text);
292
- if (visualLen >= length)
293
- return text;
352
+ if (visualLen >= length) return text;
294
353
  const padLen = Math.max(0, length - visualLen);
295
354
  if (align === 'left') {
296
355
  return text + ' '.repeat(padLen);
297
- }
298
- else if (align === 'right') {
356
+ } else if (align === 'right') {
299
357
  return ' '.repeat(padLen) + text;
300
- }
301
- else {
358
+ } else {
302
359
  const leftPad = Math.floor(padLen / 2);
303
360
  const rightPad = padLen - leftPad;
304
361
  return ' '.repeat(leftPad) + text + ' '.repeat(rightPad);
@@ -310,8 +367,7 @@ exports.Layout = {
310
367
  * @param right Content for right column
311
368
  * @param width Total available width
312
369
  * @param options Configuration for ratio and gap
313
- */
314
- split(left, right, width, options = {}) {
370
+ */ split (left, right, width, options = {}) {
315
371
  const ratio = options.ratio ?? 0.5;
316
372
  const gap = options.gap ?? 2;
317
373
  let leftWidth = Math.floor((width - gap) * ratio);
@@ -319,18 +375,18 @@ exports.Layout = {
319
375
  if (leftWidth < 1 || rightWidth < 1) {
320
376
  leftWidth = Math.max(0, width);
321
377
  rightWidth = 0;
322
- // Fallback to single column if too narrow?
323
- // For now just prevent crash.
378
+ // Fallback to single column if too narrow?
379
+ // For now just prevent crash.
324
380
  }
325
381
  const leftLines = left.split('\n');
326
382
  const rightLines = right.split('\n');
327
383
  const maxLines = Math.max(leftLines.length, rightLines.length);
328
384
  const result = [];
329
- for (let i = 0; i < maxLines; i++) {
385
+ for(let i = 0; i < maxLines; i++){
330
386
  const leftLine = leftLines[i] || '';
331
387
  const rightLine = rightLines[i] || '';
332
- const l = exports.Layout.pad(exports.Layout.truncate(leftLine, leftWidth), leftWidth);
333
- const r = exports.Layout.pad(exports.Layout.truncate(rightLine, rightWidth), rightWidth);
388
+ const l = Layout.pad(Layout.truncate(leftLine, leftWidth), leftWidth);
389
+ const r = Layout.pad(Layout.truncate(rightLine, rightWidth), rightWidth);
334
390
  result.push(`${l}${' '.repeat(gap)}${r}`);
335
391
  }
336
392
  return result.join('\n');
@@ -338,48 +394,39 @@ exports.Layout = {
338
394
  /**
339
395
  * Wraps a string to a specific visual width.
340
396
  * Respects word boundaries where possible.
341
- */
342
- wrap(str, width) {
397
+ */ wrap (str, width) {
343
398
  const paragraphs = str.split('\n');
344
- return paragraphs.map(para => {
399
+ return paragraphs.map((para)=>{
345
400
  const words = para.split(' ');
346
401
  let currentLine = '';
347
402
  const lines = [];
348
- for (const word of words) {
403
+ for (const word of words){
349
404
  const wordWidth = stringWidth(word);
350
405
  const currentWidth = stringWidth(currentLine);
351
406
  const spaceWidth = currentLine ? 1 : 0;
352
407
  if (currentWidth + spaceWidth + wordWidth <= width) {
353
408
  currentLine += (currentLine ? ' ' : '') + word;
354
- }
355
- else {
356
- if (currentLine)
357
- lines.push(currentLine);
409
+ } else {
410
+ if (currentLine) lines.push(currentLine);
358
411
  currentLine = word;
359
412
  }
360
413
  }
361
- if (currentLine)
362
- lines.push(currentLine);
414
+ if (currentLine) lines.push(currentLine);
363
415
  return lines.join('\n');
364
416
  }).join('\n');
365
417
  }
366
418
  };
367
- /**
368
- * Graph utilities for dependency management
369
- */
370
- exports.Graph = {
419
+ const Graph = {
371
420
  /**
372
421
  * Returns all dependencies (transitive) for an item.
373
- */
374
- getDependencies(item, getDeps) {
422
+ */ getDependencies (item, getDeps) {
375
423
  const visited = new Set();
376
424
  const result = [];
377
- const visit = (current) => {
378
- if (visited.has(current))
379
- return;
425
+ const visit = (current)=>{
426
+ if (visited.has(current)) return;
380
427
  visited.add(current);
381
428
  const deps = getDeps(current);
382
- for (const dep of deps) {
429
+ for (const dep of deps){
383
430
  visit(dep);
384
431
  }
385
432
  if (current !== item) {
@@ -393,27 +440,25 @@ exports.Graph = {
393
440
  * Topologically sorts items based on dependencies.
394
441
  * Returns items in order (dependencies first).
395
442
  * Throws error if cycle detected.
396
- */
397
- topologicalSort(items, getDeps) {
443
+ */ topologicalSort (items, getDeps) {
398
444
  const visited = new Set();
399
445
  const temp = new Set();
400
446
  const order = [];
401
- const visit = (node) => {
447
+ const visit = (node)=>{
402
448
  if (temp.has(node)) {
403
449
  throw new Error('Cyclic dependency detected');
404
450
  }
405
- if (visited.has(node))
406
- return;
451
+ if (visited.has(node)) return;
407
452
  temp.add(node);
408
453
  const deps = getDeps(node);
409
- for (const dep of deps) {
454
+ for (const dep of deps){
410
455
  visit(dep);
411
456
  }
412
457
  temp.delete(node);
413
458
  visited.add(node);
414
459
  order.push(node);
415
460
  };
416
- for (const item of items) {
461
+ for (const item of items){
417
462
  if (!visited.has(item)) {
418
463
  visit(item);
419
464
  }
@@ -421,9 +466,6 @@ exports.Graph = {
421
466
  return order;
422
467
  }
423
468
  };
424
- /**
425
- * Generates a progress bar string.
426
- */
427
469
  function generateProgressBar(current, total, width = 20) {
428
470
  const percentage = Math.min(Math.max(current / total, 0), 1);
429
471
  const barWidth = width;
@@ -434,3 +476,5 @@ function generateProgressBar(current, total, width = 20) {
434
476
  const percentStr = Math.round(percentage * 100) + '%';
435
477
  return `[${filled}${empty}] ${percentStr}`;
436
478
  }
479
+
480
+ //# sourceMappingURL=utils.js.map