mepcli 2.0.0-beta.2 → 2.0.0-beta.3

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 (356) hide show
  1. package/dist/ansi.d.ts +36 -0
  2. package/dist/ansi.js +1 -0
  3. package/dist/base.d.ts +60 -0
  4. package/dist/base.js +1 -0
  5. package/dist/{src/core.js → core.d.ts} +175 -345
  6. package/dist/core.js +1 -0
  7. package/dist/data/countries.d.ts +2 -0
  8. package/dist/data/countries.js +1 -0
  9. package/dist/data/licenses.d.ts +2 -0
  10. package/dist/data/licenses.js +1 -0
  11. package/dist/highlight.d.ts +7 -0
  12. package/dist/highlight.js +1 -0
  13. package/dist/index.d.ts +48 -0
  14. package/dist/index.js +1 -0
  15. package/dist/input.d.ts +14 -0
  16. package/dist/input.js +1 -0
  17. package/dist/pipeline.d.ts +90 -0
  18. package/dist/pipeline.js +1 -0
  19. package/dist/prompts/autocomplete.d.ts +22 -0
  20. package/dist/prompts/autocomplete.js +1 -0
  21. package/dist/prompts/box.d.ts +21 -0
  22. package/dist/prompts/box.js +4 -0
  23. package/dist/prompts/breadcrumb-search.d.ts +14 -0
  24. package/dist/prompts/breadcrumb-search.js +2 -0
  25. package/dist/prompts/breadcrumb.d.ts +32 -0
  26. package/dist/prompts/breadcrumb.js +3 -0
  27. package/dist/prompts/byte.d.ts +13 -0
  28. package/dist/prompts/byte.js +5 -0
  29. package/dist/prompts/calculator.d.ts +17 -0
  30. package/dist/prompts/calculator.js +3 -0
  31. package/dist/prompts/calendar.d.ts +33 -0
  32. package/dist/prompts/calendar.js +3 -0
  33. package/dist/prompts/checkbox.d.ts +13 -0
  34. package/dist/prompts/checkbox.js +2 -0
  35. package/dist/prompts/code.d.ts +19 -0
  36. package/dist/prompts/code.js +4 -0
  37. package/dist/prompts/color.d.ts +14 -0
  38. package/dist/prompts/color.js +10 -0
  39. package/dist/prompts/confirm.d.ts +8 -0
  40. package/dist/prompts/confirm.js +1 -0
  41. package/dist/prompts/connection-string.d.ts +18 -0
  42. package/dist/prompts/connection-string.js +1 -0
  43. package/dist/prompts/cron.d.ts +13 -0
  44. package/dist/prompts/cron.js +4 -0
  45. package/dist/prompts/curl-utils.d.ts +25 -0
  46. package/dist/prompts/curl-utils.js +1 -0
  47. package/dist/prompts/curl.d.ts +41 -0
  48. package/dist/prompts/curl.js +12 -0
  49. package/dist/prompts/data-inspector.d.ts +22 -0
  50. package/dist/prompts/data-inspector.js +5 -0
  51. package/dist/prompts/date.d.ts +12 -0
  52. package/dist/prompts/date.js +2 -0
  53. package/dist/prompts/dependency.d.ts +16 -0
  54. package/dist/prompts/dependency.js +3 -0
  55. package/dist/prompts/dial.d.ts +10 -0
  56. package/dist/prompts/dial.js +3 -0
  57. package/dist/prompts/diff.d.ts +10 -0
  58. package/dist/prompts/diff.js +10 -0
  59. package/dist/prompts/draw.d.ts +20 -0
  60. package/dist/prompts/draw.js +6 -0
  61. package/dist/prompts/editor.d.ts +14 -0
  62. package/dist/prompts/editor.js +2 -0
  63. package/dist/prompts/emoji.d.ts +18 -0
  64. package/dist/prompts/emoji.js +5 -0
  65. package/dist/prompts/exec.d.ts +17 -0
  66. package/dist/prompts/exec.js +1 -0
  67. package/dist/prompts/file.d.ts +21 -0
  68. package/dist/prompts/file.js +2 -0
  69. package/dist/prompts/form.d.ts +18 -0
  70. package/dist/prompts/form.js +1 -0
  71. package/dist/prompts/fuzzy-multi-column.d.ts +12 -0
  72. package/dist/prompts/fuzzy-multi-column.js +2 -0
  73. package/dist/prompts/fuzzy.d.ts +12 -0
  74. package/dist/prompts/fuzzy.js +2 -0
  75. package/dist/prompts/gauge.d.ts +21 -0
  76. package/dist/prompts/gauge.js +4 -0
  77. package/dist/prompts/grid.d.ts +14 -0
  78. package/dist/prompts/grid.js +2 -0
  79. package/dist/prompts/heatmap.d.ts +13 -0
  80. package/dist/prompts/heatmap.js +2 -0
  81. package/dist/prompts/ip.d.ts +11 -0
  82. package/dist/prompts/ip.js +3 -0
  83. package/dist/prompts/kanban.d.ts +17 -0
  84. package/dist/prompts/kanban.js +4 -0
  85. package/dist/prompts/keypress.d.ts +7 -0
  86. package/dist/prompts/keypress.js +1 -0
  87. package/dist/prompts/license.d.ts +9 -0
  88. package/dist/prompts/license.js +13 -0
  89. package/dist/prompts/list.d.ts +9 -0
  90. package/dist/prompts/list.js +1 -0
  91. package/dist/prompts/map.d.ts +17 -0
  92. package/dist/prompts/map.js +5 -0
  93. package/dist/prompts/match.d.ts +19 -0
  94. package/dist/prompts/match.js +7 -0
  95. package/dist/prompts/miller.d.ts +15 -0
  96. package/dist/prompts/miller.js +2 -0
  97. package/dist/prompts/multi-column-select.d.ts +10 -0
  98. package/dist/prompts/multi-column-select.js +2 -0
  99. package/dist/prompts/multi-range.d.ts +9 -0
  100. package/dist/prompts/multi-range.js +3 -0
  101. package/dist/prompts/multi-select.d.ts +15 -0
  102. package/dist/prompts/multi-select.js +4 -0
  103. package/dist/prompts/number.d.ts +11 -0
  104. package/dist/prompts/number.js +2 -0
  105. package/dist/prompts/otp.d.ts +10 -0
  106. package/dist/prompts/otp.js +2 -0
  107. package/dist/prompts/pattern.d.ts +22 -0
  108. package/dist/prompts/pattern.js +4 -0
  109. package/dist/prompts/phone.d.ts +41 -0
  110. package/dist/prompts/phone.js +3 -0
  111. package/dist/prompts/quiz-select.d.ts +10 -0
  112. package/dist/prompts/quiz-select.js +7 -0
  113. package/dist/prompts/quiz-text.d.ts +11 -0
  114. package/dist/prompts/quiz-text.js +8 -0
  115. package/dist/prompts/range.d.ts +9 -0
  116. package/dist/prompts/range.js +1 -0
  117. package/dist/prompts/rating.d.ts +8 -0
  118. package/dist/prompts/rating.js +1 -0
  119. package/dist/prompts/regex.d.ts +13 -0
  120. package/dist/prompts/regex.js +5 -0
  121. package/dist/prompts/region.d.ts +11 -0
  122. package/dist/prompts/region.js +5 -0
  123. package/dist/prompts/schedule.d.ts +20 -0
  124. package/dist/prompts/schedule.js +5 -0
  125. package/dist/prompts/scroll.d.ts +13 -0
  126. package/dist/prompts/scroll.js +1 -0
  127. package/dist/prompts/seat.d.ts +17 -0
  128. package/dist/prompts/seat.js +5 -0
  129. package/dist/prompts/select-range.d.ts +8 -0
  130. package/dist/prompts/select-range.js +3 -0
  131. package/dist/prompts/select.d.ts +15 -0
  132. package/dist/prompts/select.js +2 -0
  133. package/dist/prompts/semver.d.ts +6 -0
  134. package/dist/prompts/semver.js +1 -0
  135. package/dist/prompts/shortcut.d.ts +9 -0
  136. package/dist/prompts/shortcut.js +1 -0
  137. package/dist/prompts/slider.d.ts +8 -0
  138. package/dist/prompts/slider.js +1 -0
  139. package/dist/prompts/slot.d.ts +16 -0
  140. package/dist/prompts/slot.js +8 -0
  141. package/dist/prompts/snippet.d.ts +19 -0
  142. package/dist/prompts/snippet.js +4 -0
  143. package/dist/prompts/sort-grid.d.ts +16 -0
  144. package/dist/prompts/sort-grid.js +2 -0
  145. package/dist/prompts/sort.d.ts +14 -0
  146. package/dist/prompts/sort.js +2 -0
  147. package/dist/prompts/spam.d.ts +17 -0
  148. package/dist/prompts/spam.js +2 -0
  149. package/dist/prompts/spreadsheet.d.ts +21 -0
  150. package/dist/prompts/spreadsheet.js +7 -0
  151. package/dist/prompts/table.d.ts +14 -0
  152. package/dist/prompts/table.js +3 -0
  153. package/dist/prompts/text.d.ts +17 -0
  154. package/dist/prompts/text.js +2 -0
  155. package/dist/prompts/time.d.ts +12 -0
  156. package/dist/prompts/time.js +2 -0
  157. package/dist/prompts/toggle.d.ts +8 -0
  158. package/dist/prompts/toggle.js +1 -0
  159. package/dist/prompts/transfer.d.ts +18 -0
  160. package/dist/prompts/transfer.js +5 -0
  161. package/dist/prompts/tree-select.d.ts +31 -0
  162. package/dist/prompts/tree-select.js +3 -0
  163. package/dist/prompts/tree.d.ts +20 -0
  164. package/dist/prompts/tree.js +3 -0
  165. package/dist/prompts/wait.d.ts +18 -0
  166. package/dist/prompts/wait.js +1 -0
  167. package/dist/spinner.d.ts +33 -0
  168. package/dist/spinner.js +3 -0
  169. package/dist/symbols.d.ts +33 -0
  170. package/dist/symbols.js +1 -0
  171. package/dist/tasks.d.ts +57 -0
  172. package/dist/tasks.js +1 -0
  173. package/dist/theme.d.ts +2 -0
  174. package/dist/theme.js +1 -0
  175. package/dist/types.d.ts +503 -0
  176. package/dist/types.js +1 -0
  177. package/dist/utils.d.ts +81 -0
  178. package/dist/utils.js +1 -0
  179. package/package.json +8 -9
  180. package/dist/src/ansi.js +0 -50
  181. package/dist/src/ansi.js.map +0 -1
  182. package/dist/src/base.js +0 -258
  183. package/dist/src/base.js.map +0 -1
  184. package/dist/src/core.js.map +0 -1
  185. package/dist/src/data/countries.js +0 -569
  186. package/dist/src/data/countries.js.map +0 -1
  187. package/dist/src/data/licenses.js +0 -480
  188. package/dist/src/data/licenses.js.map +0 -1
  189. package/dist/src/highlight.js +0 -185
  190. package/dist/src/highlight.js.map +0 -1
  191. package/dist/src/index.js +0 -66
  192. package/dist/src/index.js.map +0 -1
  193. package/dist/src/input.js +0 -158
  194. package/dist/src/input.js.map +0 -1
  195. package/dist/src/pipeline.js +0 -273
  196. package/dist/src/pipeline.js.map +0 -1
  197. package/dist/src/prompts/autocomplete.js +0 -171
  198. package/dist/src/prompts/autocomplete.js.map +0 -1
  199. package/dist/src/prompts/box.js +0 -225
  200. package/dist/src/prompts/box.js.map +0 -1
  201. package/dist/src/prompts/breadcrumb-search.js +0 -260
  202. package/dist/src/prompts/breadcrumb-search.js.map +0 -1
  203. package/dist/src/prompts/breadcrumb.js +0 -307
  204. package/dist/src/prompts/breadcrumb.js.map +0 -1
  205. package/dist/src/prompts/byte.js +0 -176
  206. package/dist/src/prompts/byte.js.map +0 -1
  207. package/dist/src/prompts/calculator.js +0 -243
  208. package/dist/src/prompts/calculator.js.map +0 -1
  209. package/dist/src/prompts/calendar.js +0 -430
  210. package/dist/src/prompts/calendar.js.map +0 -1
  211. package/dist/src/prompts/checkbox.js +0 -159
  212. package/dist/src/prompts/checkbox.js.map +0 -1
  213. package/dist/src/prompts/code.js +0 -271
  214. package/dist/src/prompts/code.js.map +0 -1
  215. package/dist/src/prompts/color.js +0 -165
  216. package/dist/src/prompts/color.js.map +0 -1
  217. package/dist/src/prompts/confirm.js +0 -55
  218. package/dist/src/prompts/confirm.js.map +0 -1
  219. package/dist/src/prompts/connection-string.js +0 -120
  220. package/dist/src/prompts/connection-string.js.map +0 -1
  221. package/dist/src/prompts/cron.js +0 -207
  222. package/dist/src/prompts/cron.js.map +0 -1
  223. package/dist/src/prompts/curl-utils.js +0 -71
  224. package/dist/src/prompts/curl-utils.js.map +0 -1
  225. package/dist/src/prompts/curl.js +0 -431
  226. package/dist/src/prompts/curl.js.map +0 -1
  227. package/dist/src/prompts/data-inspector.js +0 -261
  228. package/dist/src/prompts/data-inspector.js.map +0 -1
  229. package/dist/src/prompts/date.js +0 -185
  230. package/dist/src/prompts/date.js.map +0 -1
  231. package/dist/src/prompts/dependency.js +0 -283
  232. package/dist/src/prompts/dependency.js.map +0 -1
  233. package/dist/src/prompts/dial.js +0 -124
  234. package/dist/src/prompts/dial.js.map +0 -1
  235. package/dist/src/prompts/diff.js +0 -118
  236. package/dist/src/prompts/diff.js.map +0 -1
  237. package/dist/src/prompts/draw.js +0 -191
  238. package/dist/src/prompts/draw.js.map +0 -1
  239. package/dist/src/prompts/editor.js +0 -234
  240. package/dist/src/prompts/editor.js.map +0 -1
  241. package/dist/src/prompts/emoji.js +0 -226
  242. package/dist/src/prompts/emoji.js.map +0 -1
  243. package/dist/src/prompts/exec.js +0 -151
  244. package/dist/src/prompts/exec.js.map +0 -1
  245. package/dist/src/prompts/file.js +0 -217
  246. package/dist/src/prompts/file.js.map +0 -1
  247. package/dist/src/prompts/form.js +0 -241
  248. package/dist/src/prompts/form.js.map +0 -1
  249. package/dist/src/prompts/fuzzy-multi-column.js +0 -161
  250. package/dist/src/prompts/fuzzy-multi-column.js.map +0 -1
  251. package/dist/src/prompts/fuzzy.js +0 -147
  252. package/dist/src/prompts/fuzzy.js.map +0 -1
  253. package/dist/src/prompts/gauge.js +0 -137
  254. package/dist/src/prompts/gauge.js.map +0 -1
  255. package/dist/src/prompts/grid.js +0 -191
  256. package/dist/src/prompts/grid.js.map +0 -1
  257. package/dist/src/prompts/heatmap.js +0 -147
  258. package/dist/src/prompts/heatmap.js.map +0 -1
  259. package/dist/src/prompts/ip.js +0 -138
  260. package/dist/src/prompts/ip.js.map +0 -1
  261. package/dist/src/prompts/kanban.js +0 -233
  262. package/dist/src/prompts/kanban.js.map +0 -1
  263. package/dist/src/prompts/keypress.js +0 -54
  264. package/dist/src/prompts/keypress.js.map +0 -1
  265. package/dist/src/prompts/license.js +0 -144
  266. package/dist/src/prompts/license.js.map +0 -1
  267. package/dist/src/prompts/list.js +0 -124
  268. package/dist/src/prompts/list.js.map +0 -1
  269. package/dist/src/prompts/map.js +0 -262
  270. package/dist/src/prompts/map.js.map +0 -1
  271. package/dist/src/prompts/match.js +0 -271
  272. package/dist/src/prompts/match.js.map +0 -1
  273. package/dist/src/prompts/miller.js +0 -228
  274. package/dist/src/prompts/miller.js.map +0 -1
  275. package/dist/src/prompts/multi-column-select.js +0 -176
  276. package/dist/src/prompts/multi-column-select.js.map +0 -1
  277. package/dist/src/prompts/multi-range.js +0 -189
  278. package/dist/src/prompts/multi-range.js.map +0 -1
  279. package/dist/src/prompts/multi-select.js +0 -183
  280. package/dist/src/prompts/multi-select.js.map +0 -1
  281. package/dist/src/prompts/number.js +0 -166
  282. package/dist/src/prompts/number.js.map +0 -1
  283. package/dist/src/prompts/otp.js +0 -107
  284. package/dist/src/prompts/otp.js.map +0 -1
  285. package/dist/src/prompts/pattern.js +0 -252
  286. package/dist/src/prompts/pattern.js.map +0 -1
  287. package/dist/src/prompts/phone.js +0 -398
  288. package/dist/src/prompts/phone.js.map +0 -1
  289. package/dist/src/prompts/quiz-select.js +0 -114
  290. package/dist/src/prompts/quiz-select.js.map +0 -1
  291. package/dist/src/prompts/quiz-text.js +0 -98
  292. package/dist/src/prompts/quiz-text.js.map +0 -1
  293. package/dist/src/prompts/range.js +0 -164
  294. package/dist/src/prompts/range.js.map +0 -1
  295. package/dist/src/prompts/rating.js +0 -83
  296. package/dist/src/prompts/rating.js.map +0 -1
  297. package/dist/src/prompts/regex.js +0 -145
  298. package/dist/src/prompts/regex.js.map +0 -1
  299. package/dist/src/prompts/region.js +0 -170
  300. package/dist/src/prompts/region.js.map +0 -1
  301. package/dist/src/prompts/schedule.js +0 -270
  302. package/dist/src/prompts/schedule.js.map +0 -1
  303. package/dist/src/prompts/scroll.js +0 -155
  304. package/dist/src/prompts/scroll.js.map +0 -1
  305. package/dist/src/prompts/seat.js +0 -164
  306. package/dist/src/prompts/seat.js.map +0 -1
  307. package/dist/src/prompts/select-range.js +0 -148
  308. package/dist/src/prompts/select-range.js.map +0 -1
  309. package/dist/src/prompts/select.js +0 -163
  310. package/dist/src/prompts/select.js.map +0 -1
  311. package/dist/src/prompts/semver.js +0 -43
  312. package/dist/src/prompts/semver.js.map +0 -1
  313. package/dist/src/prompts/shortcut.js +0 -133
  314. package/dist/src/prompts/shortcut.js.map +0 -1
  315. package/dist/src/prompts/slider.js +0 -69
  316. package/dist/src/prompts/slider.js.map +0 -1
  317. package/dist/src/prompts/slot.js +0 -117
  318. package/dist/src/prompts/slot.js.map +0 -1
  319. package/dist/src/prompts/snippet.js +0 -228
  320. package/dist/src/prompts/snippet.js.map +0 -1
  321. package/dist/src/prompts/sort-grid.js +0 -151
  322. package/dist/src/prompts/sort-grid.js.map +0 -1
  323. package/dist/src/prompts/sort.js +0 -166
  324. package/dist/src/prompts/sort.js.map +0 -1
  325. package/dist/src/prompts/spam.js +0 -80
  326. package/dist/src/prompts/spam.js.map +0 -1
  327. package/dist/src/prompts/spreadsheet.js +0 -240
  328. package/dist/src/prompts/spreadsheet.js.map +0 -1
  329. package/dist/src/prompts/table.js +0 -120
  330. package/dist/src/prompts/table.js.map +0 -1
  331. package/dist/src/prompts/text.js +0 -317
  332. package/dist/src/prompts/text.js.map +0 -1
  333. package/dist/src/prompts/time.js +0 -211
  334. package/dist/src/prompts/time.js.map +0 -1
  335. package/dist/src/prompts/toggle.js +0 -53
  336. package/dist/src/prompts/toggle.js.map +0 -1
  337. package/dist/src/prompts/transfer.js +0 -207
  338. package/dist/src/prompts/transfer.js.map +0 -1
  339. package/dist/src/prompts/tree-select.js +0 -270
  340. package/dist/src/prompts/tree-select.js.map +0 -1
  341. package/dist/src/prompts/tree.js +0 -233
  342. package/dist/src/prompts/tree.js.map +0 -1
  343. package/dist/src/prompts/wait.js +0 -79
  344. package/dist/src/prompts/wait.js.map +0 -1
  345. package/dist/src/spinner.js +0 -105
  346. package/dist/src/spinner.js.map +0 -1
  347. package/dist/src/symbols.js +0 -66
  348. package/dist/src/symbols.js.map +0 -1
  349. package/dist/src/tasks.js +0 -231
  350. package/dist/src/tasks.js.map +0 -1
  351. package/dist/src/theme.js +0 -29
  352. package/dist/src/theme.js.map +0 -1
  353. package/dist/src/types.js +0 -8
  354. package/dist/src/types.js.map +0 -1
  355. package/dist/src/utils.js +0 -480
  356. package/dist/src/utils.js.map +0 -1
package/dist/core.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"MepCLI",{enumerable:true,get:function(){return MepCLI}});const _theme=require("./theme");const _spinner=require("./spinner");const _text=require("./prompts/text");const _select=require("./prompts/select");const _checkbox=require("./prompts/checkbox");const _confirm=require("./prompts/confirm");const _toggle=require("./prompts/toggle");const _number=require("./prompts/number");const _list=require("./prompts/list");const _slider=require("./prompts/slider");const _range=require("./prompts/range");const _transfer=require("./prompts/transfer");const _cron=require("./prompts/cron");const _date=require("./prompts/date");const _file=require("./prompts/file");const _multiselect=require("./prompts/multi-select");const _rating=require("./prompts/rating");const _autocomplete=require("./prompts/autocomplete");const _sort=require("./prompts/sort");const _table=require("./prompts/table");const _editor=require("./prompts/editor");const _tree=require("./prompts/tree");const _keypress=require("./prompts/keypress");const _form=require("./prompts/form");const _snippet=require("./prompts/snippet");const _spam=require("./prompts/spam");const _wait=require("./prompts/wait");const _code=require("./prompts/code");const _treeselect=require("./prompts/tree-select");const _color=require("./prompts/color");const _grid=require("./prompts/grid");const _calendar=require("./prompts/calendar");const _map=require("./prompts/map");const _semver=require("./prompts/semver");const _ip=require("./prompts/ip");const _otp=require("./prompts/otp");const _quizselect=require("./prompts/quiz-select");const _quiztext=require("./prompts/quiz-text");const _kanban=require("./prompts/kanban");const _time=require("./prompts/time");const _heatmap=require("./prompts/heatmap");const _byte=require("./prompts/byte");const _slot=require("./prompts/slot");const _gauge=require("./prompts/gauge");const _calculator=require("./prompts/calculator");const _emoji=require("./prompts/emoji");const _match=require("./prompts/match");const _diff=require("./prompts/diff");const _dial=require("./prompts/dial");const _draw=require("./prompts/draw");const _multicolumnselect=require("./prompts/multi-column-select");const _fuzzy=require("./prompts/fuzzy");const _miller=require("./prompts/miller");const _pattern=require("./prompts/pattern");const _region=require("./prompts/region");const _spreadsheet=require("./prompts/spreadsheet");const _scroll=require("./prompts/scroll");const _breadcrumb=require("./prompts/breadcrumb");const _schedule=require("./prompts/schedule");const _datainspector=require("./prompts/data-inspector");const _exec=require("./prompts/exec");const _shortcut=require("./prompts/shortcut");const _seat=require("./prompts/seat");const _selectrange=require("./prompts/select-range");const _sortgrid=require("./prompts/sort-grid");const _dependency=require("./prompts/dependency");const _license=require("./prompts/license");const _regex=require("./prompts/regex");const _box=require("./prompts/box");const _phone=require("./prompts/phone");const _fuzzymulticolumn=require("./prompts/fuzzy-multi-column");const _multirange=require("./prompts/multi-range");const _breadcrumbsearch=require("./prompts/breadcrumb-search");const _connectionstring=require("./prompts/connection-string");const _curl=require("./prompts/curl");const _pipeline=require("./pipeline");const _tasks=require("./tasks");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let MepCLI=class MepCLI{static spinner(message){return new _spinner.Spinner(message)}static tasks(options){return new _tasks.TaskRunner(options)}static pipeline(){return new _pipeline.Pipeline}static text(options){return new _text.TextPrompt(options).run()}static select(options){return new _select.SelectPrompt(options).run()}static checkbox(options){return new _checkbox.CheckboxPrompt(options).run()}static confirm(options){return new _confirm.ConfirmPrompt(options).run()}static password(options){return new _text.TextPrompt({...options,isPassword:true}).run()}static secret(options){return new _text.TextPrompt({...options,mask:""}).run()}static number(options){return new _number.NumberPrompt(options).run()}static toggle(options){return new _toggle.TogglePrompt(options).run()}static list(options){return new _list.ListPrompt(options).run()}static slider(options){return new _slider.SliderPrompt(options).run()}static range(options){return new _range.RangePrompt(options).run()}static transfer(options){return new _transfer.TransferPrompt(options).run()}static cron(options){return new _cron.CronPrompt(options).run()}static date(options){return new _date.DatePrompt(options).run()}static file(options){return new _file.FilePrompt(options).run()}static multiSelect(options){return new _multiselect.MultiSelectPrompt(options).run()}static rating(options){return new _rating.RatingPrompt(options).run()}static autocomplete(options){return new _autocomplete.AutocompletePrompt(options).run()}static sort(options){return new _sort.SortPrompt(options).run()}static table(options){return new _table.TablePrompt(options).run()}static editor(options){return new _editor.EditorPrompt(options).run()}static tree(options){return new _tree.TreePrompt(options).run()}static keypress(options){return new _keypress.KeypressPrompt(options).run()}static form(options){return new _form.FormPrompt(options).run()}static snippet(options){return new _snippet.SnippetPrompt(options).run()}static spam(options){return new _spam.SpamPrompt(options).run()}static wait(options){return new _wait.WaitPrompt(options).run()}static code(options){return new _code.CodePrompt(options).run()}static treeSelect(options){return new _treeselect.TreeSelectPrompt(options).run()}static color(options){return new _color.ColorPrompt(options).run()}static grid(options){return new _grid.GridPrompt(options).run()}static calendar(options){return new _calendar.CalendarPrompt(options).run()}static map(options){return new _map.MapPrompt(options).run()}static semver(options){return new _semver.SemVerPrompt(options).run()}static ip(options){return new _ip.IPPrompt(options).run()}static otp(options){return new _otp.OTPPrompt(options).run()}static quizSelect(options){return new _quizselect.QuizSelectPrompt(options).run()}static quizText(options){return new _quiztext.QuizTextPrompt(options).run()}static kanban(options){return new _kanban.KanbanPrompt(options).run()}static time(options){return new _time.TimePrompt(options).run()}static heatmap(options){return new _heatmap.HeatmapPrompt(options).run()}static byte(options){return new _byte.BytePrompt(options).run()}static slot(options){return new _slot.SlotPrompt(options).run()}static gauge(options){return new _gauge.GaugePrompt(options).run()}static calculator(options){return new _calculator.CalculatorPrompt(options).run()}static emoji(options){return new _emoji.EmojiPrompt(options).run()}static match(options){return new _match.MatchPrompt(options).run()}static diff(options){return new _diff.DiffPrompt(options).run()}static dial(options){return new _dial.DialPrompt(options).run()}static draw(options){return new _draw.DrawPrompt(options).run()}static multiColumnSelect(options){return new _multicolumnselect.MultiColumnSelectPrompt(options).run()}static fuzzySelect(options){return new _fuzzy.FuzzySelectPrompt(options).run()}static miller(options){return new _miller.MillerPrompt(options).run()}static pattern(options){return new _pattern.PatternPrompt(options).run()}static region(options){return new _region.RegionPrompt(options).run()}static spreadsheet(options){return new _spreadsheet.SpreadsheetPrompt(options).run()}static scroll(options){return new _scroll.ScrollPrompt(options).run()}static breadcrumb(options){return new _breadcrumb.BreadcrumbPrompt(options).run()}static schedule(options){return new _schedule.SchedulePrompt(options).run()}static inspector(options){return new _datainspector.DataInspectorPrompt(options).run()}static exec(options){return new _exec.ExecPrompt(options).run()}static shortcut(options){return new _shortcut.ShortcutPrompt(options).run()}static seat(options){return new _seat.SeatPrompt(options).run()}static selectRange(options){return new _selectrange.SelectRangePrompt(options).run()}static sortGrid(options){return new _sortgrid.SortGridPrompt(options).run()}static dependency(options){return new _dependency.DependencyPrompt(options).run()}static license(options){return new _license.LicensePrompt(options).run()}static regex(options){return new _regex.RegexPrompt(options).run()}static box(options){return new _box.BoxPrompt(options).run()}static connectionString(options){return(0,_connectionstring.connectionString)(options)}static curl(options){return new _curl.CurlPrompt(options).run()}static phone(options){return new _phone.PhonePrompt(options).run()}static fuzzyMultiColumn(options){return new _fuzzymulticolumn.FuzzyMultiColumnPrompt(options).run()}static multiRange(options){return new _multirange.MultiRangePrompt(options).run()}static breadcrumbSearch(options){return new _breadcrumbsearch.BreadcrumbSearchPrompt(options).run()}};_define_property(MepCLI,"theme",_theme.theme);
@@ -0,0 +1,2 @@
1
+ export type CountryEntry = [string, string, string, string];
2
+ export declare const COUNTRIES: CountryEntry[];
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"COUNTRIES",{enumerable:true,get:function(){return COUNTRIES}});const COUNTRIES=[["US","United States","1","### ### ####"],["GB","United Kingdom","44","#### ######"],["VN","Vietnam","84","### #### ###"],["JP","Japan","81","## #### ####"],["CN","China","86","### #### ####"],["IN","India","91","#### ######"],["DE","Germany","49","#### #######"],["FR","France","33","# ## ## ## ##"],["RU","Russia","7","### ###-##-##"],["BR","Brazil","55","## #####-####"],["IT","Italy","39","### #######"],["CA","Canada","1","### ### ####"],["AU","Australia","61","# #### ####"],["KR","South Korea","82","## #### ####"],["ES","Spain","34","### ## ## ##"],["ID","Indonesia","62","###-####-####"],["MX","Mexico","52","## #### ####"],["TR","Turkey","90","### ### ## ##"],["NL","Netherlands","31","# ########"],["SA","Saudi Arabia","966","# ### ####"],["CH","Switzerland","41","## ### ## ##"],["SE","Sweden","46","## ### ## ##"],["BE","Belgium","32","### ## ## ##"],["AT","Austria","43","#### #######"],["PL","Poland","48","### ### ###"],["AR","Argentina","54","# ## ####-####"],["NO","Norway","47","### ## ###"],["TW","Taiwan","886","### ### ###"],["TH","Thailand","66","## ### ####"],["MY","Malaysia","60","##-### ####"],["SG","Singapore","65","#### ####"],["ZA","South Africa","27","## ### ####"],["HK","Hong Kong","852","#### ####"],["PH","Philippines","63","### ### ####"],["UA","Ukraine","380","## ### ## ##"],["EG","Egypt","20","### ### ####"],["PK","Pakistan","92","### #######"],["IL","Israel","972","##-#######"],["DK","Denmark","45","## ## ## ##"],["FI","Finland","358","## ### ## ##"],["NZ","New Zealand","64","## ### ####"],["IE","Ireland","353","## #######"],["PT","Portugal","351","### ### ###"],["GR","Greece","30","### #######"],["HU","Hungary","36","## ### ####"],["CZ","Czech Republic","420","### ### ###"],["RO","Romania","40","## ### ####"],["CL","Chile","56","# #### ####"],["CO","Colombia","57","### ### ####"],["NG","Nigeria","234","### ### ####"],["KH","Cambodia","855","## ### ###"],["LA","Laos","856","## ## ####"],["MM","Myanmar","95","## ### ###"],["BD","Bangladesh","880","####-######"],["LK","Sri Lanka","94","## # ### ###"],["NP","Nepal","977","##-######"],["AE","United Arab Emirates","971","## ### ####"],["QA","Qatar","974","#### ####"],["KW","Kuwait","965","#### ####"],["BH","Bahrain","973","#### ####"],["OM","Oman","968","#### ####"],["JO","Jordan","962","# #### ####"],["LB","Lebanon","961","## ######"],["IR","Iran","98","### ### ####"],["IQ","Iraq","964","### ### ####"],["BG","Bulgaria","359","## ### ###"],["HR","Croatia","385","## ### ####"],["RS","Serbia","381","## #######"],["SK","Slovakia","421","### ### ###"],["SI","Slovenia","386","## ### ###"],["EE","Estonia","372","#### ####"],["LV","Latvia","371","## ### ###"],["LT","Lithuania","370","### ## ###"],["PE","Peru","51","### ### ###"],["VE","Venezuela","58","###-#######"],["EC","Ecuador","593","## ### ####"],["UY","Uruguay","598","# ### ## ##"],["PY","Paraguay","595","### ### ###"],["CR","Costa Rica","506","#### ####"],["PA","Panama","507","####-####"],["DO","Dominican Republic","1","### ### ####"],["MA","Morocco","212","##-####-###"],["DZ","Algeria","213","## ## ## ##"],["TN","Tunisia","216","## ### ###"],["KE","Kenya","254","### ######"],["GH","Ghana","233","## ### ####"],["ET","Ethiopia","251","## ### ####"],["UG","Uganda","256","### ######"],["TZ","Tanzania","255","## ### ####"],["KZ","Kazakhstan","7","### ###-##-##"],["UZ","Uzbekistan","998","## ### ## ##"]];
@@ -0,0 +1,2 @@
1
+ import { License } from '../types';
2
+ export declare const POPULAR_LICENSES: License[];
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"POPULAR_LICENSES",{enumerable:true,get:function(){return POPULAR_LICENSES}});const POPULAR_LICENSES=[{id:"MIT",name:"MIT License",description:"A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"Apache-2.0",name:"Apache License 2.0",description:"A permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["License and copyright notice","State changes"],limitations:["Liability","Warranty","Trademark use"]},{id:"GPL-3.0",name:"GNU General Public License v3.0",description:"Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"BSD-3-Clause",name:'BSD 3-Clause "New" or "Revised" License',description:"A permissive license similar to the BSD 2-Clause License, but with a 3rd clause that prohibits others from using the name of the project or its contributors to promote derived products without written consent.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"ISC",name:"ISC License",description:"A permissive license that is functionally equivalent to the BSD 2-Clause and MIT licenses, but removing some language that is no longer necessary.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"Unlicense",name:"The Unlicense",description:"A license with no conditions whatsoever which dedicates works to the public domain. Unlicensed works, modifications, and larger works may be distributed under different terms and without source code.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:[],limitations:["Liability","Warranty"]},{id:"BSD-2-Clause",name:'BSD 2-Clause "Simplified" License',description:"A permissive license that is similar to the MIT License, with conditions requiring preservation of copyright and license notices.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"LGPL-3.0",name:"GNU Lesser General Public License v3.0",description:"A weak copyleft license permitting proprietary use. Requires preservation of copyright and license notices. Modifications of the library under the same license must be provided under the LGPL, but applications built on top may be licensed proprietary.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"AGPL-3.0",name:"GNU Affero General Public License v3.0",description:"A strong copyleft license that requires releasing source code when distributing the software over a network. Includes all conditions of GPL-3.0 plus a network use clause.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Network use disclosure","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"MPL-2.0",name:"Mozilla Public License 2.0",description:"A copyleft license that is easy to comply with. You must make the source code for any of your modifications available under MPL-2.0, but you can combine the software with code under other licenses.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license"],limitations:["Liability","Warranty","Trademark use"]},{id:"EPL-2.0",name:"Eclipse Public License 2.0",description:"A copyleft license based on the Mozilla Public License, designed for programs and libraries. Modified code under the same license must be provided.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license"],limitations:["Liability","Warranty"]},{id:"WTFPL",name:"Do What The F* You Want To Public License",description:"An extremely permissive license that allows anyone to do whatever they want with the work with no restrictions whatsoever.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:[],limitations:["Liability","Warranty"]},{id:"Zlib",name:"zlib License",description:"A short permissive license similar to the BSD licenses, requiring altered source versions to be documented and restricting use of the original authors' names from promoting derived products.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice","State changes"],limitations:["Liability","Warranty"]},{id:"BSL-1.0",name:"Boost Software License 1.0",description:"A simple permissive license only requiring preservation of copyright and license notices for source (and not object) code.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"GPL-2.0",name:"GNU General Public License v2.0",description:"A copyleft license that requires anyone who distributes your code or a derivative work to make the source available under the same terms.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"LGPL-2.1",name:"GNU Lesser General Public License v2.1",description:"A primarily copyleft license that allows you to link to the library in proprietary software without releasing the proprietary code.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"MS-PL",name:"Microsoft Public License",description:"A permissive license that allows you to release compiled versions of the code under a different license, though source versions must use the MS-PL.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["License and copyright notice","Same license"],limitations:["Liability","Warranty","Trademark use"]},{id:"0BSD",name:"BSD Zero Clause License",description:"A permissive license that allows for unlimited reuse, modification, and redistribution. It removes the requirement to include a copyright notice.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:[],limitations:["Liability","Warranty"]},{id:"EUPL-1.2",name:"European Union Public License 1.2",description:"A copyleft license created by the European Union. It provides compatibility with other copyleft licenses and supports translations in multiple European languages.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["Disclose source","License and copyright notice","Same license","State changes"],limitations:["Liability","Warranty"]},{id:"MulanPSL-2.0",name:"Mulan Permissive Software License, Version 2",description:"A permissive license that provides an express grant of patent rights and has no attribution requirements for redistributed binaries.",permissions:["Commercial use","Modification","Distribution","Patent use","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty","Trademark use"]},{id:"PostgreSQL",name:"PostgreSQL License",description:"A liberal Open Source license, similar to the BSD or MIT licenses.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"CC0-1.0",name:"Creative Commons Zero v1.0 Universal",description:"A public domain dedication waiver that places works in the public domain. A work released under CC0 incurs no obligations and anyone may use the work in any way.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:[],limitations:["Liability","Warranty"]},{id:"CC-BY-4.0",name:"Creative Commons Attribution 4.0 International",description:"A license that allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice"],limitations:["Liability","Warranty"]},{id:"CC-BY-SA-4.0",name:"Creative Commons Attribution-ShareAlike 4.0 International",description:"A license that requires reusers to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. Modifications must be shared under the same terms.",permissions:["Commercial use","Modification","Distribution","Private use"],conditions:["License and copyright notice","Same license"],limitations:["Liability","Warranty"]}];
@@ -0,0 +1,7 @@
1
+ export declare function highlightJson(json: string): string;
2
+ export declare function highlightEnv(env: string): string;
3
+ export declare function highlightToml(toml: string): string;
4
+ export declare function highlightCsv(csv: string): string;
5
+ export declare function highlightShell(script: string): string;
6
+ export declare function highlightProperties(props: string): string;
7
+ export declare function highlight(code: string, language: string): string;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get highlight(){return highlight},get highlightCsv(){return highlightCsv},get highlightEnv(){return highlightEnv},get highlightJson(){return highlightJson},get highlightProperties(){return highlightProperties},get highlightShell(){return highlightShell},get highlightToml(){return highlightToml}});const _ansi=require("./ansi");const _theme=require("./theme");function highlightJson(json){if(!json)return"";const tokenRegex=/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"?)|(-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)|(true|false|null)|([{}[\],:])/g;let result="";let lastIndex=0;let match;while((match=tokenRegex.exec(json))!==null){if(match.index>lastIndex){result+=json.substring(lastIndex,match.index)}const token=match[0];if(token.startsWith('"')){const remaining=json.substring(tokenRegex.lastIndex);if(/^\s*:/.test(remaining)){result+=`${_theme.theme.syntax.key}${token}${_ansi.ANSI.RESET}`}else{result+=`${_theme.theme.syntax.string}${token}${_ansi.ANSI.RESET}`}}else if(/^-?\d/.test(token)){result+=`${_theme.theme.syntax.number}${token}${_ansi.ANSI.RESET}`}else if(/^(true|false|null)$/.test(token)){result+=token==="null"?`${_theme.theme.syntax.null}${token}${_ansi.ANSI.RESET}`:`${_theme.theme.syntax.boolean}${token}${_ansi.ANSI.RESET}`}else if(/^[{}[\],:]$/.test(token)){result+=`${_theme.theme.syntax.punctuation}${token}${_ansi.ANSI.RESET}`}else{result+=token}lastIndex=tokenRegex.lastIndex}if(lastIndex<json.length){result+=json.substring(lastIndex)}return result}function highlightEnv(env){if(!env)return"";return env.split("\n").map(line=>{if(line.trim().startsWith("#")){return`${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`}const match=line.match(/^([^=]+)=(.*)$/);if(match){const[,key,value]=match;return`${_theme.theme.syntax.key}${key}${_theme.theme.syntax.punctuation}=${_theme.theme.syntax.string}${value}${_ansi.ANSI.RESET}`}return line}).join("\n")}function highlightToml(toml){if(!toml)return"";return toml.split("\n").map(line=>{const trimmed=line.trim();if(trimmed.startsWith("#")){return`${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`}if(trimmed.startsWith("[")&&trimmed.endsWith("]")){return`${_theme.theme.syntax.key}${line}${_ansi.ANSI.RESET}`}const match=line.match(/^(\s*[\w\d_-]+)(\s*=)/);if(match){const fullMatch=match[0];const keyPart=match[1];const eqPart=match[2];const rest=line.substring(fullMatch.length);return`${_theme.theme.syntax.key}${keyPart}${_ansi.ANSI.RESET}${_theme.theme.syntax.punctuation}${eqPart}${_theme.theme.syntax.string}${rest}${_ansi.ANSI.RESET}`}return line}).join("\n")}function highlightCsv(csv){if(!csv)return"";const colors=[_theme.theme.syntax.string,_theme.theme.syntax.key,_theme.theme.syntax.number,_theme.theme.syntax.boolean];return csv.split("\n").map(line=>{if(!line.trim())return line;const parts=line.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);return parts.map((part,index)=>{const color=colors[index%colors.length];return`${color}${part}${_ansi.ANSI.RESET}`}).join(`${_theme.theme.syntax.punctuation},${_ansi.ANSI.RESET}`)}).join("\n")}function highlightShell(script){if(!script)return"";const keywords=/\b(if|then|else|elif|fi|for|in|do|done|while|case|esac|return|exit|export|source|echo|printf)\b/g;return script.split("\n").map(line=>{if(line.trim().startsWith("#")){return`${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`}const processed=line.replace(keywords,match=>`${_theme.theme.syntax.boolean}${match}${_ansi.ANSI.RESET}`).replace(/(\$[\w\d_]+|\$\{[^}]+\})/g,match=>`${_theme.theme.syntax.key}${match}${_ansi.ANSI.RESET}`).replace(/(\s|^)(-{1,2}[a-zA-Z0-9_-]+)/g,(_match,prefix,flag)=>`${prefix}${_theme.theme.syntax.number}${flag}${_ansi.ANSI.RESET}`);return processed}).join("\n")}function highlightProperties(props){if(!props)return"";return props.split("\n").map(line=>{const trimmed=line.trim();if(trimmed.startsWith("#")||trimmed.startsWith("!")){return`${_theme.theme.muted}${line}${_ansi.ANSI.RESET}`}const match=line.match(/^([^=:]+)([=:])(.*)$/);if(match){const[,key,sep,value]=match;return`${_theme.theme.syntax.key}${key}${_theme.theme.syntax.punctuation}${sep}${_theme.theme.syntax.string}${value}${_ansi.ANSI.RESET}`}return line}).join("\n")}const highlighters={"json":highlightJson,"env":highlightEnv,"toml":highlightToml,"csv":highlightCsv,"sh":highlightShell,"bash":highlightShell,"zsh":highlightShell,"properties":highlightProperties,"props":highlightProperties,"conf":highlightProperties};function highlight(code,language){const lang=language.toLowerCase();const highlightFunc=highlighters[lang];if(highlightFunc){return highlightFunc(code)}return code}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Mep (A Interactive CLI Prompt)
3
+ * Export file
4
+ */
5
+ export * from './types';
6
+ export * from './core';
7
+ export * from './prompts/map';
8
+ export * from './prompts/semver';
9
+ export * from './prompts/ip';
10
+ export * from './prompts/kanban';
11
+ export * from './prompts/time';
12
+ export * from './prompts/heatmap';
13
+ export * from './prompts/byte';
14
+ export * from './prompts/slot';
15
+ export * from './prompts/gauge';
16
+ export * from './prompts/calculator';
17
+ export * from './prompts/emoji';
18
+ export * from './prompts/match';
19
+ export * from './prompts/diff';
20
+ export * from './prompts/dial';
21
+ export * from './prompts/draw';
22
+ export * from './prompts/multi-column-select';
23
+ export * from './prompts/fuzzy';
24
+ export * from './prompts/miller';
25
+ export * from './prompts/pattern';
26
+ export * from './prompts/region';
27
+ export * from './prompts/spreadsheet';
28
+ export * from './prompts/scroll';
29
+ export * from './prompts/breadcrumb';
30
+ export * from './prompts/schedule';
31
+ export * from './prompts/data-inspector';
32
+ export * from './prompts/exec';
33
+ export * from './prompts/shortcut';
34
+ export * from './prompts/seat';
35
+ export * from './prompts/select-range';
36
+ export * from './prompts/sort-grid';
37
+ export * from './prompts/dependency';
38
+ export * from './prompts/license';
39
+ export * from './prompts/regex';
40
+ export * from './prompts/box';
41
+ export * from './prompts/connection-string';
42
+ export * from './prompts/curl';
43
+ export * from './prompts/phone';
44
+ export * from './prompts/fuzzy-multi-column';
45
+ export * from './prompts/multi-range';
46
+ export * from './prompts/breadcrumb-search';
47
+ export * from './pipeline';
48
+ export * from './tasks';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});_export_star(require("./types"),exports);_export_star(require("./core"),exports);_export_star(require("./prompts/map"),exports);_export_star(require("./prompts/semver"),exports);_export_star(require("./prompts/ip"),exports);_export_star(require("./prompts/kanban"),exports);_export_star(require("./prompts/time"),exports);_export_star(require("./prompts/heatmap"),exports);_export_star(require("./prompts/byte"),exports);_export_star(require("./prompts/slot"),exports);_export_star(require("./prompts/gauge"),exports);_export_star(require("./prompts/calculator"),exports);_export_star(require("./prompts/emoji"),exports);_export_star(require("./prompts/match"),exports);_export_star(require("./prompts/diff"),exports);_export_star(require("./prompts/dial"),exports);_export_star(require("./prompts/draw"),exports);_export_star(require("./prompts/multi-column-select"),exports);_export_star(require("./prompts/fuzzy"),exports);_export_star(require("./prompts/miller"),exports);_export_star(require("./prompts/pattern"),exports);_export_star(require("./prompts/region"),exports);_export_star(require("./prompts/spreadsheet"),exports);_export_star(require("./prompts/scroll"),exports);_export_star(require("./prompts/breadcrumb"),exports);_export_star(require("./prompts/schedule"),exports);_export_star(require("./prompts/data-inspector"),exports);_export_star(require("./prompts/exec"),exports);_export_star(require("./prompts/shortcut"),exports);_export_star(require("./prompts/seat"),exports);_export_star(require("./prompts/select-range"),exports);_export_star(require("./prompts/sort-grid"),exports);_export_star(require("./prompts/dependency"),exports);_export_star(require("./prompts/license"),exports);_export_star(require("./prompts/regex"),exports);_export_star(require("./prompts/box"),exports);_export_star(require("./prompts/connection-string"),exports);_export_star(require("./prompts/curl"),exports);_export_star(require("./prompts/phone"),exports);_export_star(require("./prompts/fuzzy-multi-column"),exports);_export_star(require("./prompts/multi-range"),exports);_export_star(require("./prompts/breadcrumb-search"),exports);_export_star(require("./pipeline"),exports);_export_star(require("./tasks"),exports);function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
@@ -0,0 +1,14 @@
1
+ import { EventEmitter } from 'events';
2
+ export declare class InputParser extends EventEmitter {
3
+ private buffer;
4
+ private timeout;
5
+ private state;
6
+ constructor();
7
+ /**
8
+ * Feed data into the parser.
9
+ */
10
+ feed(data: Buffer): void;
11
+ private processChar;
12
+ private parseSGRMouse;
13
+ private emitKey;
14
+ }
package/dist/input.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"InputParser",{enumerable:true,get:function(){return InputParser}});const _events=require("events");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let InputParser=class InputParser extends _events.EventEmitter{feed(data){const input=data.toString("utf-8");for(let i=0;i<input.length;i++){const char=input[i];this.processChar(char)}}processChar(char){if(this.state==="NORMAL"){if(char==="\x1b"){this.state="ESC";this.buffer=char;this.timeout=setTimeout(()=>{this.emitKey(this.buffer);this.buffer="";this.state="NORMAL"},20)}else{this.emitKey(char)}}else if(this.state==="ESC"){if(this.timeout)clearTimeout(this.timeout);this.timeout=null;this.buffer+=char;if(char==="["){this.state="CSI"}else if(char==="O"){this.state="CSI"}else{this.emitKey(this.buffer);this.buffer="";this.state="NORMAL"}}else if(this.state==="CSI"){this.buffer+=char;if(char==="<"){this.state="MOUSE_SGR";this.buffer="<";return}if(char>="@"&&char<="~"){this.emitKey(this.buffer);this.buffer="";this.state="NORMAL"}}else if(this.state==="MOUSE_SGR"){this.buffer+=char;if(char==="m"||char==="M"){this.parseSGRMouse(this.buffer);this.buffer="";this.state="NORMAL"}}}parseSGRMouse(buffer){const content=buffer.slice(1,-1);const type=buffer.slice(-1);const parts=content.split(";").map(Number);if(parts.length>=3){const[b,x,y]=parts;let action="press";const shift=!!(b&4);const meta=!!(b&8);const ctrl=!!(b&16);if(b&64){action="scroll";const scroll=b&1?"down":"up";this.emit("mouse",{name:"mouse",x,y,button:0,action,scroll,shift,ctrl,meta});if(scroll==="up")this.emit("scrollup");else this.emit("scrolldown");return}if(type==="m"){action="release"}else{action="press";if(b&32){action="move"}}this.emit("mouse",{name:"mouse",x,y,button:b&3,action,shift,ctrl,meta})}}emitKey(key){if(key==="\r")key="\n";this.emit("keypress",key,Buffer.from(key))}constructor(){super(),_define_property(this,"buffer",""),_define_property(this,"timeout",null),_define_property(this,"state","NORMAL")}};
@@ -0,0 +1,90 @@
1
+ import { TaskRunner } from './tasks';
2
+ export declare const PipelineExit: unique symbol;
3
+ export type PipelineAction<Ctx, T> = (context: Ctx, tasks?: TaskRunner) => Promise<T | typeof PipelineExit> | T | typeof PipelineExit;
4
+ export type PipelineCondition<Ctx> = (context: Readonly<Ctx>) => boolean;
5
+ export interface ValidationSchema {
6
+ parse?: (data: any) => any;
7
+ safeParse?: (data: any) => {
8
+ success: boolean;
9
+ error?: any;
10
+ issues?: any;
11
+ data?: any;
12
+ };
13
+ }
14
+ export type Validator = ((value: any) => boolean | string | Promise<boolean | string>) | ValidationSchema;
15
+ export type Transformer<Ctx> = (value: any, context: Readonly<Ctx>) => any | Promise<any>;
16
+ export interface PipelineStep<Ctx> extends StepConfig<Ctx> {
17
+ name?: keyof Ctx;
18
+ action: PipelineAction<Ctx, any>;
19
+ condition?: PipelineCondition<Ctx>;
20
+ }
21
+ export interface StepConfig<Ctx> {
22
+ validate?: Validator;
23
+ transform?: Transformer<Ctx>;
24
+ onError?: (error: unknown, context: Readonly<Ctx>) => void | Promise<void>;
25
+ fallback?: any | ((error: unknown, context: Readonly<Ctx>) => any | Promise<any>);
26
+ optional?: boolean;
27
+ timeout?: number;
28
+ }
29
+ export interface StepMetadata {
30
+ index: number;
31
+ name?: string;
32
+ type: 'named' | 'anonymous';
33
+ }
34
+ export interface PipelineOptions<Ctx> {
35
+ onStepStart?: (meta: StepMetadata, context: Readonly<Ctx>) => void | Promise<void>;
36
+ onStepComplete?: (meta: StepMetadata, context: Readonly<Ctx>) => void | Promise<void>;
37
+ onError?: (error: unknown, meta: StepMetadata, context: Readonly<Ctx>) => void | Promise<void>;
38
+ validate?: Validator;
39
+ onPipelineStart?: (context: Readonly<Ctx>) => void | Promise<void>;
40
+ onPipelineComplete?: (context: Readonly<Ctx>) => void | Promise<void>;
41
+ signal?: AbortSignal;
42
+ }
43
+ export declare class PipelineValidationError<Ctx = any> extends Error {
44
+ step?: StepMetadata;
45
+ context?: Ctx;
46
+ constructor(message: string, step?: StepMetadata, context?: Ctx);
47
+ }
48
+ export declare class PipelineTimeoutError<Ctx = any> extends Error {
49
+ step?: StepMetadata;
50
+ context?: Ctx;
51
+ constructor(message: string, step?: StepMetadata, context?: Ctx);
52
+ }
53
+ export declare class PipelineAbortError extends Error {
54
+ constructor(message?: string);
55
+ }
56
+ /**
57
+ * Pipeline (Workflow Engine)
58
+ *
59
+ * Implements a sequential workflow where steps are executed one by one,
60
+ * accumulating results into a Context object.
61
+ *
62
+ * Philosophy: Enter-and-Forget (EAF), Zero-Dependency, Method Chaining.
63
+ */
64
+ export declare class Pipeline<Ctx extends Record<string, any> = Record<string, any>> {
65
+ private steps;
66
+ private options;
67
+ constructor(options?: PipelineOptions<Ctx>);
68
+ /**
69
+ * Adds a named step to the pipeline. The result of the action is stored in the context under the given name.
70
+ */
71
+ step<K extends keyof Ctx>(name: K, action: PipelineAction<Ctx, Ctx[K]> | Pipeline<any>, config?: StepConfig<Ctx>): this;
72
+ /**
73
+ * Adds an anonymous step to the pipeline. The action can mutate the context directly or return a partial context to merge in.
74
+ */
75
+ step(action: PipelineAction<Ctx, void | Partial<Ctx>> | Pipeline<any>, config?: StepConfig<Ctx>): this;
76
+ /**
77
+ * Adds a conditional named step to the pipeline.
78
+ */
79
+ stepIf<K extends keyof Ctx>(condition: PipelineCondition<Ctx>, name: K, action: PipelineAction<Ctx, Ctx[K]> | Pipeline<any>, config?: StepConfig<Ctx>): this;
80
+ /**
81
+ * Adds a conditional anonymous step to the pipeline.
82
+ */
83
+ stepIf(condition: PipelineCondition<Ctx>, action: PipelineAction<Ctx, void | Partial<Ctx>> | Pipeline<any>, config?: StepConfig<Ctx>): this;
84
+ /**
85
+ * Executes the pipeline steps sequentially.
86
+ * @param initialContext Optional initial context.
87
+ * @param tasks Optional TaskRunner instance to pass to steps.
88
+ */
89
+ run(initialContext?: Partial<Ctx>, tasks?: TaskRunner): Promise<Ctx>;
90
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get Pipeline(){return Pipeline},get PipelineAbortError(){return PipelineAbortError},get PipelineExit(){return PipelineExit},get PipelineTimeoutError(){return PipelineTimeoutError},get PipelineValidationError(){return PipelineValidationError}});function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}const PipelineExit=Symbol.for("PipelineExit");let PipelineValidationError=class PipelineValidationError extends Error{constructor(message,step,context){super(message),_define_property(this,"step",void 0),_define_property(this,"context",void 0);this.name="PipelineValidationError";this.step=step;this.context=context}};let PipelineTimeoutError=class PipelineTimeoutError extends Error{constructor(message,step,context){super(message),_define_property(this,"step",void 0),_define_property(this,"context",void 0);this.name="PipelineTimeoutError";this.step=step;this.context=context}};let PipelineAbortError=class PipelineAbortError extends Error{constructor(message="Pipeline aborted"){super(message);this.name="PipelineAbortError"}};let Pipeline=class Pipeline{step(nameOrAction,actionOrConfig,config){if(typeof nameOrAction==="function"||nameOrAction instanceof Pipeline){const action=nameOrAction instanceof Pipeline?(ctx,tasks)=>nameOrAction.run(ctx,tasks):nameOrAction;this.steps.push({action:action,...actionOrConfig||{}})}else{const action=actionOrConfig instanceof Pipeline?(ctx,tasks)=>actionOrConfig.run(ctx,tasks):actionOrConfig;this.steps.push({name:nameOrAction,action:action,...config||{}})}return this}stepIf(condition,nameOrAction,actionOrConfig,config){if(typeof nameOrAction==="function"||nameOrAction instanceof Pipeline){const action=nameOrAction instanceof Pipeline?(ctx,tasks)=>nameOrAction.run(ctx,tasks):nameOrAction;this.steps.push({condition,action:action,...actionOrConfig||{}})}else{const action=actionOrConfig instanceof Pipeline?(ctx,tasks)=>actionOrConfig.run(ctx,tasks):actionOrConfig;this.steps.push({condition,name:nameOrAction,action:action,...config||{}})}return this}async run(initialContext={},tasks){const context={...initialContext};if(this.options.onPipelineStart){await this.options.onPipelineStart({...context})}try{for(let i=0;i<this.steps.length;i++){if(this.options.signal?.aborted){throw new PipelineAbortError}const step=this.steps[i];const meta={index:i,name:step.name,type:step.name?"named":"anonymous"};if(step.condition&&!step.condition(context)){continue}if(this.options.onStepStart){await this.options.onStepStart(meta,{...context})}try{let result;if(step.timeout&&step.timeout>0){const timeoutPromise=new Promise((_,reject)=>{setTimeout(()=>{reject(new PipelineTimeoutError(`Step timed out after ${step.timeout}ms`,meta,context))},step.timeout)});result=await Promise.race([step.action(context,tasks),timeoutPromise])}else{result=await step.action(context,tasks)}if(result===PipelineExit){break}if(!step.name){if(result&&typeof result==="object"&&!Array.isArray(result)){Object.assign(context,result)}}else{if(step.transform){result=await step.transform(result,{...context})}if(step.validate){const validator=step.validate;if(typeof validator==="function"){const valid=await validator(result);if(valid===false){throw new PipelineValidationError(`Validation failed for step at index ${i} (${String(step.name)})`,meta,context)}if(typeof valid==="string"){throw new PipelineValidationError(valid,meta,context)}}else if(typeof validator==="object"){if(typeof validator.safeParse==="function"){const res=validator.safeParse(result);if(!res.success){const errorMsg=res.error?.message||res.issues?.[0]?.message||"Schema validation failed";throw new PipelineValidationError(`Validation failed: ${errorMsg}`,meta,context)}result=res.data!==undefined?res.data:result}else if(typeof validator.parse==="function"){try{const parsed=validator.parse(result);result=parsed!==undefined?parsed:result}catch(err){throw new PipelineValidationError(`Validation failed: ${err.message||"Schema parsing error"}`,meta,context)}}}}context[step.name]=result}if(this.options.onStepComplete){await this.options.onStepComplete(meta,{...context})}}catch(err){let handled=false;if(step.onError){await step.onError(err,{...context})}if("fallback"in step){const fallbackValue=typeof step.fallback==="function"?await step.fallback(err,{...context}):step.fallback;if(step.name){context[step.name]=fallbackValue}handled=true}else if(step.optional){if(step.name){context[step.name]=undefined}handled=true}if(!handled){if(this.options.onError){await this.options.onError(err,meta,{...context})}throw err}}}if(this.options.validate){const validator=this.options.validate;if(typeof validator==="function"){const valid=await validator(context);if(valid===false){throw new PipelineValidationError(`Final validation failed`)}if(typeof valid==="string"){throw new PipelineValidationError(valid)}}else if(typeof validator==="object"){if(typeof validator.safeParse==="function"){const res=validator.safeParse(context);if(!res.success){const errorMsg=res.error?.message||res.issues?.[0]?.message||"Schema validation failed";throw new PipelineValidationError(`Final validation failed: ${errorMsg}`)}Object.assign(context,res.data!==undefined?res.data:context)}else if(typeof validator.parse==="function"){try{const parsed=validator.parse(context);Object.assign(context,parsed!==undefined?parsed:context)}catch(err){throw new PipelineValidationError(`Final validation failed: ${err.message||"Schema parsing error"}`)}}}}}finally{if(this.options.onPipelineComplete){await this.options.onPipelineComplete({...context})}}return context}constructor(options){_define_property(this,"steps",[]);_define_property(this,"options",void 0);this.options=options||{}}};
@@ -0,0 +1,22 @@
1
+ import { Prompt } from '../base';
2
+ import { AutocompleteOptions, MouseEvent } from '../types';
3
+ export declare class AutocompletePrompt<V> extends Prompt<V, AutocompleteOptions<V>> {
4
+ private input;
5
+ private choices;
6
+ private selectedIndex;
7
+ private loading;
8
+ private debounceTimer?;
9
+ private spinnerFrame;
10
+ private spinnerTimer?;
11
+ private scrollTop;
12
+ private readonly pageSize;
13
+ private hasSearched;
14
+ constructor(options: AutocompleteOptions<V>);
15
+ private search;
16
+ private startSpinner;
17
+ private stopSpinner;
18
+ protected cleanup(): void;
19
+ protected render(_firstRender: boolean): void;
20
+ protected handleInput(char: string): void;
21
+ protected handleMouse(event: MouseEvent): void;
22
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"AutocompletePrompt",{enumerable:true,get:function(){return AutocompletePrompt}});const _ansi=require("../ansi");const _base=require("../base");const _theme=require("../theme");const _symbols=require("../symbols");const _utils=require("../utils");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let AutocompletePrompt=class AutocompletePrompt extends _base.Prompt{search(query){if(this.debounceTimer)clearTimeout(this.debounceTimer);this.loading=true;this.startSpinner();this.render(false);this.debounceTimer=setTimeout(async()=>{try{const results=await this.options.suggest(query);if(query!==this.input)return;this.choices=results.slice(0,this.options.limit||10);this.selectedIndex=0;this.scrollTop=0;this.hasSearched=true}catch(_err){this.choices=[]}finally{this.loading=false;this.stopSpinner();this.render(false)}},300)}startSpinner(){if(this.spinnerTimer)return;this.spinnerTimer=setInterval(()=>{this.spinnerFrame=(this.spinnerFrame+1)%_symbols.symbols.spinner.length;this.render(false)},80)}stopSpinner(){if(this.spinnerTimer){clearInterval(this.spinnerTimer);this.spinnerTimer=undefined}}cleanup(){this.stopSpinner();super.cleanup()}render(_firstRender){if(this.lastRenderHeight>1){this.print(`\x1b[${this.lastRenderHeight-1}B`)}let output="";const icon=this.loading?`${_theme.theme.main}${_symbols.symbols.spinner[this.spinnerFrame]}${_ansi.ANSI.RESET}`:`${_theme.theme.success}?${_ansi.ANSI.RESET}`;output+=`${icon} ${_ansi.ANSI.BOLD}${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} ${this.input}`;output+="\n";if(this.loading){output+=` ${_theme.theme.muted}Searching...${_ansi.ANSI.RESET}`}else if(this.choices.length===0&&this.hasSearched){output+=` ${_theme.theme.muted}${this.options.fallback||"No results found."}${_ansi.ANSI.RESET}`}else if(this.choices.length>0){if(this.selectedIndex<this.scrollTop){this.scrollTop=this.selectedIndex}else if(this.selectedIndex>=this.scrollTop+this.pageSize){this.scrollTop=this.selectedIndex-this.pageSize+1}const visibleChoices=this.choices.slice(this.scrollTop,this.scrollTop+this.pageSize);visibleChoices.forEach((choice,index)=>{const actualIndex=this.scrollTop+index;if(index>0)output+="\n";if(actualIndex===this.selectedIndex){output+=`${_theme.theme.main}${_symbols.symbols.pointer} ${choice.title}${_ansi.ANSI.RESET}`}else{output+=` ${choice.title}`}})}this.renderFrame(output);const lines=output.split("\n");const height=lines.length;if(height>1){this.print(`\x1b[${height-1}A`)}this.print(`\r`);const firstLine=lines[0];const visualLen=(0,_utils.stringWidth)(this.stripAnsi(firstLine));this.print(`\x1b[${visualLen}C`);this.print(_ansi.ANSI.SHOW_CURSOR)}handleInput(char){if(char==="\r"||char==="\n"){if(this.choices.length>0){this.submit(this.choices[this.selectedIndex].value)}return}if(char==="\b"||char===""){if(this.input.length>0){this.input=this.input.slice(0,-1);this.search(this.input)}return}if(this.isUp(char)){if(this.choices.length>0){this.selectedIndex=this.selectedIndex>0?this.selectedIndex-1:this.choices.length-1;this.render(false)}return}if(this.isDown(char)){if(this.choices.length>0){this.selectedIndex=this.selectedIndex<this.choices.length-1?this.selectedIndex+1:0;this.render(false)}return}if(char.length===1&&!/^[\x00-\x1F]/.test(char)){this.input+=char;this.search(this.input)}}handleMouse(event){if(this.choices.length===0)return;if(event.action==="scroll"){if(event.scroll==="up"){this.selectedIndex=this.selectedIndex>0?this.selectedIndex-1:this.choices.length-1;this.render(false)}else if(event.scroll==="down"){this.selectedIndex=this.selectedIndex<this.choices.length-1?this.selectedIndex+1:0;this.render(false)}}}constructor(options){super(options),_define_property(this,"input",""),_define_property(this,"choices",[]),_define_property(this,"selectedIndex",0),_define_property(this,"loading",false),_define_property(this,"debounceTimer",void 0),_define_property(this,"spinnerFrame",0),_define_property(this,"spinnerTimer",void 0),_define_property(this,"scrollTop",0),_define_property(this,"pageSize",7),_define_property(this,"hasSearched",false);this.input=options.initial||"";this.search(this.input)}};
@@ -0,0 +1,21 @@
1
+ import { Prompt } from '../base';
2
+ import { BoxOptions, MouseEvent } from '../types';
3
+ interface BoxValues {
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ }
9
+ export declare class BoxPrompt extends Prompt<BoxValues, BoxOptions> {
10
+ private values;
11
+ private focus;
12
+ private inputBuffer;
13
+ constructor(options: BoxOptions);
14
+ private commitBuffer;
15
+ private changeFocus;
16
+ private increment;
17
+ protected render(_firstRender: boolean): void;
18
+ protected handleMouse(event: MouseEvent): void;
19
+ protected handleInput(char: string, _key: Buffer): void;
20
+ }
21
+ export {};
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BoxPrompt",{enumerable:true,get:function(){return BoxPrompt}});const _base=require("../base");const _ansi=require("../ansi");const _theme=require("../theme");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let BoxPrompt=class BoxPrompt extends _base.Prompt{commitBuffer(){let val=parseInt(this.inputBuffer,10);if(isNaN(val))val=0;if(this.options.min!==undefined&&val<this.options.min)val=this.options.min;if(this.options.max!==undefined&&val>this.options.max)val=this.options.max;this.values[this.focus]=val;this.inputBuffer=val.toString()}changeFocus(newFocus){this.commitBuffer();this.focus=newFocus;this.inputBuffer=this.values[newFocus].toString()}increment(amount){let val=parseInt(this.inputBuffer,10);if(isNaN(val))val=0;val+=amount;if(this.options.min!==undefined&&val<this.options.min)val=this.options.min;if(this.options.max!==undefined&&val>this.options.max)val=this.options.max;this.inputBuffer=val.toString()}render(_firstRender){const title=`${_theme.theme.success}? ${_ansi.ANSI.BOLD}${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} (Arrows to navigate, Numbers to edit)`;const formatVal=side=>{const isFocused=this.focus===side;const text=isFocused?this.inputBuffer:this.values[side].toString();if(isFocused){return`${_ansi.ANSI.FG_CYAN}${_ansi.ANSI.BOLD}[ ${text} ]${_ansi.ANSI.RESET}`}return` ${text} `};const vTop=formatVal("top");const vRight=formatVal("right");const vBottom=formatVal("bottom");const vLeft=formatVal("left");let output=title+"\n\n";output+=` ${vTop}
2
+ `;output+=` ${vLeft} ${vRight}
3
+ `;output+=` ${vBottom}
4
+ `;this.renderFrame(output)}handleMouse(event){if(event.name==="mouse"&&event.action==="scroll"){const order=["top","right","bottom","left"];const idx=order.indexOf(this.focus);if(event.scroll==="down"){this.changeFocus(order[(idx+1)%4])}else if(event.scroll==="up"){this.changeFocus(order[(idx+3)%4])}this.render(false)}}handleInput(char,_key){if(char==="\r"||char==="\n"){this.commitBuffer();this.submit(this.values);return}if(this.isUp(char)){if(this.focus==="bottom"||this.focus==="left"||this.focus==="right"){this.changeFocus("top")}this.render(false);return}if(this.isDown(char)){if(this.focus==="top"||this.focus==="left"||this.focus==="right"){this.changeFocus("bottom")}this.render(false);return}if(this.isLeft(char)){if(this.focus==="right"||this.focus==="top"||this.focus==="bottom"){this.changeFocus("left")}this.render(false);return}if(this.isRight(char)){if(this.focus==="left"||this.focus==="top"||this.focus==="bottom"){this.changeFocus("right")}this.render(false);return}if(char===" "){const order=["top","right","bottom","left"];const idx=order.indexOf(this.focus);this.changeFocus(order[(idx+1)%4]);this.render(false);return}if(char==="\x1b[Z"){const order=["top","right","bottom","left"];const idx=order.indexOf(this.focus);this.changeFocus(order[(idx+3)%4]);this.render(false);return}const step=this.options.step||1;if(char==="+"||char==="="){this.increment(step);this.render(false);return}if(char==="-"||char==="_"){this.increment(-step);this.render(false);return}if(/^[0-9]$/.test(char)){if(this.inputBuffer==="0"){this.inputBuffer=char}else{this.inputBuffer+=char}this.render(false);return}if(char==="\b"||char===""){if(this.inputBuffer.length>0){this.inputBuffer=this.inputBuffer.slice(0,-1);if(this.inputBuffer==="")this.inputBuffer="0"}this.render(false);return}}constructor(options){super(options),_define_property(this,"values",void 0),_define_property(this,"focus","top"),_define_property(this,"inputBuffer","");const initial=options.initial;if(typeof initial==="number"){this.values={top:initial,right:initial,bottom:initial,left:initial}}else if(typeof initial==="object"){this.values={top:initial.top??0,right:initial.right??0,bottom:initial.bottom??0,left:initial.left??0}}else{this.values={top:0,right:0,bottom:0,left:0}}this.inputBuffer=this.values.top.toString()}};
@@ -0,0 +1,14 @@
1
+ import { BreadcrumbPrompt } from './breadcrumb';
2
+ import { BreadcrumbOptions, MouseEvent } from '../types';
3
+ export declare class BreadcrumbSearchPrompt extends BreadcrumbPrompt {
4
+ private isSearchMode;
5
+ private searchBuffer;
6
+ private filteredEntries;
7
+ private searchCursor;
8
+ constructor(options: BreadcrumbOptions);
9
+ protected handleInput(char: string, key: Buffer): void;
10
+ private updateSearchResults;
11
+ protected handleMouse(event: MouseEvent): void;
12
+ protected render(firstRender: boolean): void;
13
+ private highlight;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BreadcrumbSearchPrompt",{enumerable:true,get:function(){return BreadcrumbSearchPrompt}});const _breadcrumb=require("./breadcrumb");const _theme=require("../theme");const _ansi=require("../ansi");const _symbols=require("../symbols");const _utils=require("../utils");const _path=/*#__PURE__*/_interop_require_wildcard(require("path"));function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}let BreadcrumbSearchPrompt=class BreadcrumbSearchPrompt extends _breadcrumb.BreadcrumbPrompt{handleInput(char,key){if(this.isLoading)return;if(!this.isSearchMode){if(char.length===1&&!/^[\x00-\x1F]/.test(char)&&!char.startsWith("\x1b")){this.isSearchMode=true;this.searchBuffer=char;this.updateSearchResults();this.render(false);return}super.handleInput(char,key);return}if(char==="\x1b"){this.isSearchMode=false;this.searchBuffer="";this.render(false);return}if(char==="\b"||char===""){if(this.searchBuffer.length>0){this.searchBuffer=this.searchBuffer.slice(0,-1);if(this.searchBuffer.length===0){this.isSearchMode=false}else{this.updateSearchResults()}this.render(false)}else{this.isSearchMode=false;this.render(false)}return}if(char==="\r"||char==="\n"){if(this.filteredEntries.length===0)return;const entry=this.filteredEntries[this.searchCursor];if(entry.isDirectory){const realIndex=this.currentEntries.findIndex(e=>e.name===entry.name);if(realIndex!==-1){this.cursor=realIndex;this.drillDown().then(()=>{this.isSearchMode=false;this.searchBuffer=""})}}else{const fullPath=_path.join(this.currentPath,entry.name);this.submit(fullPath)}return}if(this.isUp(char)){if(this.searchCursor>0){this.searchCursor--}else{this.searchCursor=Math.max(0,this.filteredEntries.length-1)}this.render(false);return}if(this.isDown(char)){if(this.searchCursor<this.filteredEntries.length-1){this.searchCursor++}else{this.searchCursor=0}this.render(false);return}if(char.length===1&&!/^[\x00-\x1F]/.test(char)&&!char.startsWith("\x1b")){this.searchBuffer+=char;this.updateSearchResults();this.render(false)}}updateSearchResults(){if(!this.searchBuffer){this.filteredEntries=[];return}const results=this.currentEntries.map(entry=>{const match=(0,_utils.fuzzyMatch)(this.searchBuffer,entry.name);return{entry,match}}).filter(item=>item.match!==null).sort((a,b)=>b.match.score-a.match.score);this.filteredEntries=results.map(r=>({...r.entry,_match:r.match}));this.searchCursor=0}handleMouse(event){if(!this.isSearchMode){super.handleMouse(event);return}if(this.isLoading)return;if(event.action==="scroll"){if(event.scroll==="up"){if(this.searchCursor>0){this.searchCursor--;this.render(false)}}else if(event.scroll==="down"){if(this.searchCursor<this.filteredEntries.length-1){this.searchCursor++;this.render(false)}}}}render(firstRender){if(!this.isSearchMode){super.render(firstRender);return}let output="";const relative=_path.relative(this.root,this.currentPath);const pathStr=relative||_path.basename(this.root);const prefix=`${_theme.theme.success}?${_ansi.ANSI.RESET} ${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} `;output+=`${prefix}${_theme.theme.muted}${pathStr}/${_ansi.ANSI.RESET} ${_ansi.ANSI.FG_YELLOW}(Search: ${this.searchBuffer})${_ansi.ANSI.RESET}
2
+ `;if(this.filteredEntries.length===0){output+=` ${_theme.theme.muted}No results found${_ansi.ANSI.RESET}`}else{const pageSize=this.pageSize;let start=0;const half=Math.floor(pageSize/2);start=Math.max(0,this.searchCursor-half);if(start+pageSize>this.filteredEntries.length){start=Math.max(0,this.filteredEntries.length-pageSize)}const visible=this.filteredEntries.slice(start,start+pageSize);visible.forEach((entry,index)=>{const actualIndex=start+index;const isSelected=actualIndex===this.searchCursor;const icon=entry.isDirectory?"📂":"📄";const title=this.highlight(entry.name,entry._match.indices,isSelected);let line="";if(isSelected){line+=`${_theme.theme.main}${_symbols.symbols.pointer} ${icon} ${title}${_ansi.ANSI.RESET}`}else{line+=` ${icon} ${title}`}if(index>0||index===0)output+=line;if(index<visible.length-1)output+="\n"})}this.renderFrame(output)}highlight(text,indices,isSelected){let output="";const indexSet=new Set(indices);for(let i=0;i<text.length;i++){if(indexSet.has(i)){if(isSelected){output+=`${_ansi.ANSI.BOLD}${_ansi.ANSI.FG_WHITE}${text[i]}${_theme.theme.main}`}else{output+=`${_ansi.ANSI.BOLD}${_ansi.ANSI.FG_CYAN}${text[i]}${_ansi.ANSI.RESET}`}}else{output+=text[i]}}return output}constructor(options){super(options),_define_property(this,"isSearchMode",false),_define_property(this,"searchBuffer",""),_define_property(this,"filteredEntries",[]),_define_property(this,"searchCursor",0)}};
@@ -0,0 +1,32 @@
1
+ import { Prompt } from '../base';
2
+ import { BreadcrumbOptions, MouseEvent } from '../types';
3
+ interface StackItem {
4
+ path: string;
5
+ cursor: number;
6
+ scrollTop: number;
7
+ }
8
+ interface DirEntry {
9
+ name: string;
10
+ isDirectory: boolean;
11
+ }
12
+ export declare class BreadcrumbPrompt extends Prompt<string, BreadcrumbOptions> {
13
+ protected stack: StackItem[];
14
+ protected currentEntries: DirEntry[];
15
+ protected cursor: number;
16
+ protected scrollTop: number;
17
+ protected root: string;
18
+ protected currentPath: string;
19
+ protected separator: string;
20
+ protected showHidden: boolean;
21
+ protected isLoading: boolean;
22
+ protected error: string | null;
23
+ protected readonly pageSize: number;
24
+ constructor(options: BreadcrumbOptions);
25
+ protected loadDirectory(dir: string): Promise<void>;
26
+ protected drillDown(): Promise<void>;
27
+ protected goUp(): Promise<void>;
28
+ protected render(_firstRender: boolean): void;
29
+ protected handleInput(char: string, _key: Buffer): void;
30
+ protected handleMouse(_event: MouseEvent): void;
31
+ }
32
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BreadcrumbPrompt",{enumerable:true,get:function(){return BreadcrumbPrompt}});const _base=require("../base");const _ansi=require("../ansi");const _theme=require("../theme");const _symbols=require("../symbols");const _promises=/*#__PURE__*/_interop_require_wildcard(require("fs/promises"));const _path=/*#__PURE__*/_interop_require_wildcard(require("path"));function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}let BreadcrumbPrompt=class BreadcrumbPrompt extends _base.Prompt{async loadDirectory(dir){this.isLoading=true;this.error=null;this.render(false);try{await _promises.access(dir);const dirents=await _promises.readdir(dir,{withFileTypes:true});let entries=dirents.map(d=>({name:d.name,isDirectory:d.isDirectory()}));if(!this.showHidden){entries=entries.filter(e=>!e.name.startsWith("."))}entries.sort((a,b)=>{if(a.isDirectory===b.isDirectory){return a.name.localeCompare(b.name)}return a.isDirectory?-1:1});this.currentEntries=entries;if(this.currentEntries.length===0){this.cursor=0}else if(this.cursor>=this.currentEntries.length){this.cursor=this.currentEntries.length-1}}catch(err){this.error=err.message||"Error reading directory";this.currentEntries=[]}finally{this.isLoading=false;this.render(false)}}async drillDown(){const entry=this.currentEntries[this.cursor];if(!entry||!entry.isDirectory)return;const nextPath=_path.join(this.currentPath,entry.name);this.stack.push({path:this.currentPath,cursor:this.cursor,scrollTop:this.scrollTop});this.currentPath=nextPath;this.cursor=0;this.scrollTop=0;await this.loadDirectory(nextPath)}async goUp(){if(this.stack.length===0)return;const prevState=this.stack.pop();if(prevState){this.currentPath=prevState.path;this.cursor=prevState.cursor;this.scrollTop=prevState.scrollTop;await this.loadDirectory(this.currentPath)}}render(_firstRender){const width=this.stdout.columns||80;let output="";const relative=_path.relative(this.root,this.currentPath);const parts=relative?relative.split(_path.sep):[];const rootName=_path.basename(this.root);const segments=[rootName,...parts];const prefix=`${_theme.theme.success}?${_ansi.ANSI.RESET} ${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} `;const prefixWidth=this.stripAnsi(prefix).length;const availableWidth=Math.max(20,width-prefixWidth-5);let breadcrumbStr=segments.join(this.separator);if(breadcrumbStr.length>availableWidth){let suffix=segments[segments.length-1];for(let i=segments.length-2;i>=1;i--){const next=segments[i]+this.separator+suffix;if(next.length+4>availableWidth)break;suffix=next}breadcrumbStr=`${segments[0]}${this.separator}...${this.separator}${suffix}`;if(breadcrumbStr.length>availableWidth){breadcrumbStr="..."+breadcrumbStr.slice(-(availableWidth-3))}}output+=`${prefix}${breadcrumbStr}
2
+ `;if(this.isLoading){output+=` ${_theme.theme.muted}Loading...${_ansi.ANSI.RESET}`}else if(this.error){output+=` ${_theme.theme.error}${this.error}${_ansi.ANSI.RESET}`}else if(this.currentEntries.length===0){output+=` ${_theme.theme.muted}(Empty directory)${_ansi.ANSI.RESET}
3
+ ${_theme.theme.muted}(Backspace to go back)${_ansi.ANSI.RESET}`}else{if(this.cursor<this.scrollTop){this.scrollTop=this.cursor}else if(this.cursor>=this.scrollTop+this.pageSize){this.scrollTop=this.cursor-this.pageSize+1}if(this.scrollTop>this.currentEntries.length-1){this.scrollTop=Math.max(0,this.currentEntries.length-this.pageSize)}const visibleEntries=this.currentEntries.slice(this.scrollTop,this.scrollTop+this.pageSize);visibleEntries.forEach((entry,index)=>{const absoluteIndex=this.scrollTop+index;const isSelected=absoluteIndex===this.cursor;const icon=entry.isDirectory?"📂":"📄";let line="";if(isSelected){line+=`${_theme.theme.main}${_symbols.symbols.pointer} ${icon} ${entry.name}${_ansi.ANSI.RESET}`}else{line+=` ${icon} ${entry.name}`}if(index>0||index===0)output+=line;if(index<visibleEntries.length-1)output+="\n"})}this.renderFrame(output)}handleInput(char,_key){if(this.isLoading)return;if(char==="\r"||char==="\n"){if(this.currentEntries.length===0)return;const entry=this.currentEntries[this.cursor];if(entry.isDirectory){this.drillDown()}else{const fullPath=_path.join(this.currentPath,entry.name);this.submit(fullPath)}return}if(char===""||char==="\b"||this.isLeft(char)){this.goUp();return}if(this.isRight(char)){const entry=this.currentEntries[this.cursor];if(entry&&entry.isDirectory){this.drillDown()}return}if(char===" "){if(this.currentEntries.length===0)return;this.cursor=(this.cursor+1)%this.currentEntries.length;this.render(false);return}if(char==="\x1b[Z"){if(this.currentEntries.length===0)return;this.cursor=(this.cursor-1+this.currentEntries.length)%this.currentEntries.length;this.render(false);return}if(this.isUp(char)){if(this.cursor>0){this.cursor--;this.render(false)}else if(this.currentEntries.length>0){this.cursor=this.currentEntries.length-1;this.render(false)}return}if(this.isDown(char)){if(this.cursor<this.currentEntries.length-1){this.cursor++;this.render(false)}else if(this.currentEntries.length>0){this.cursor=0;this.render(false)}return}if(char==="\x1b[5~"){this.cursor=Math.max(0,this.cursor-this.pageSize);this.render(false);return}if(char==="\x1b[6~"){this.cursor=Math.min(this.currentEntries.length-1,this.cursor+this.pageSize);this.render(false);return}}handleMouse(_event){if(this.isLoading)return;if(_event.action==="scroll"){if(_event.scroll==="up"){if(this.cursor>0){this.cursor--;this.render(false)}}else if(_event.scroll==="down"){if(this.cursor<this.currentEntries.length-1){this.cursor++;this.render(false)}}}}constructor(options){super(options),_define_property(this,"stack",[]),_define_property(this,"currentEntries",[]),_define_property(this,"cursor",0),_define_property(this,"scrollTop",0),_define_property(this,"root",void 0),_define_property(this,"currentPath",void 0),_define_property(this,"separator",void 0),_define_property(this,"showHidden",void 0),_define_property(this,"isLoading",false),_define_property(this,"error",null),_define_property(this,"pageSize",10);this.root=_path.resolve(options.root||process.cwd());this.currentPath=this.root;this.separator=options.separator||" › ";this.showHidden=options.showHidden||false;this.loadDirectory(this.currentPath)}};
@@ -0,0 +1,13 @@
1
+ import { Prompt } from '../base';
2
+ import { ByteOptions, MouseEvent } from '../types';
3
+ export declare class BytePrompt extends Prompt<number, ByteOptions> {
4
+ private inputValue;
5
+ private buffer;
6
+ private unitIndex;
7
+ private errorMsg;
8
+ constructor(options: ByteOptions);
9
+ protected render(_firstRender: boolean): void;
10
+ protected handleInput(char: string): void;
11
+ private formatBytes;
12
+ protected handleMouse(event: MouseEvent): void;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BytePrompt",{enumerable:true,get:function(){return BytePrompt}});const _ansi=require("../ansi");const _base=require("../base");const _theme=require("../theme");const _symbols=require("../symbols");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}const UNITS=["B","KB","MB","GB","TB","PB"];let BytePrompt=class BytePrompt extends _base.Prompt{render(_firstRender){const unitStr=UNITS[this.unitIndex];const icon=this.errorMsg?`${_theme.theme.error}${_symbols.symbols.cross}`:`${_theme.theme.success}?`;let output=`${icon} ${_ansi.ANSI.BOLD}${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} `;output+=`${_theme.theme.main}${_ansi.ANSI.UNDERLINE}${this.buffer}${_ansi.ANSI.RESET} ${_ansi.ANSI.BOLD}${unitStr}${_ansi.ANSI.RESET}
2
+ `;let bar=" ";UNITS.forEach((u,i)=>{if(i===this.unitIndex){bar+=`${_theme.theme.main}${_ansi.ANSI.REVERSE} ${u} ${_ansi.ANSI.RESET}`}else{bar+=`${_theme.theme.muted} ${u} ${_ansi.ANSI.RESET}`}if(i<UNITS.length-1){bar+=` ${_theme.theme.muted}›${_ansi.ANSI.RESET} `}});output+=`
3
+ ${bar}
4
+ `;output+=`${_theme.theme.muted} (Arrows: Adjust | Tab: Switch Unit | Enter: Submit)${_ansi.ANSI.RESET}`;if(this.errorMsg){output+=`
5
+ ${_theme.theme.error}>> ${this.errorMsg}${_ansi.ANSI.RESET}`}this.renderFrame(output)}handleInput(char){this.errorMsg="";if(char==="\r"||char==="\n"){const finalVal=parseFloat(this.buffer);if(isNaN(finalVal)){this.errorMsg="Invalid number";this.render(false);return}const bytes=finalVal*Math.pow(1024,this.unitIndex);if(this.options.min!==undefined&&bytes<this.options.min){this.errorMsg=`Minimum value is ${this.formatBytes(this.options.min)}`;this.render(false);return}if(this.options.max!==undefined&&bytes>this.options.max){this.errorMsg=`Maximum value is ${this.formatBytes(this.options.max)}`;this.render(false);return}this.submit(Math.round(bytes));return}if(char===" "||this.isRight(char)){if(this.unitIndex<UNITS.length-1){this.unitIndex++;this.render(false)}return}if(char==="\x1b[Z"||this.isLeft(char)){if(this.unitIndex>0){this.unitIndex--;this.render(false)}return}if(this.isUp(char)||this.isDown(char)){let val=parseFloat(this.buffer)||0;const step=this.buffer.includes(".")?.1:1;if(this.isUp(char))val+=step;if(this.isDown(char))val-=step;val=Math.round(val*100)/100;if(val<0)val=0;this.buffer=val.toString();this.render(false);return}if(char==="\b"||char===""){if(this.buffer.length>0){this.buffer=this.buffer.slice(0,-1);this.render(false)}return}if(/^[0-9.]$/.test(char)){if(char==="."&&this.buffer.includes("."))return;this.buffer+=char;this.render(false)}}formatBytes(bytes){if(bytes===0)return"0 B";const i=Math.floor(Math.log(bytes)/Math.log(1024));return parseFloat((bytes/Math.pow(1024,i)).toFixed(2))+" "+UNITS[i]}handleMouse(event){if(event.action==="scroll"){if(event.scroll==="up"){let val=parseFloat(this.buffer)||0;val+=1;this.buffer=val.toString();this.render(false)}else if(event.scroll==="down"){let val=parseFloat(this.buffer)||0;val=Math.max(0,val-1);this.buffer=val.toString();this.render(false)}}}constructor(options){super(options),_define_property(this,"inputValue",0),_define_property(this,"buffer",""),_define_property(this,"unitIndex",0),_define_property(this,"errorMsg","");let val=options.initial||0;let idx=0;while(val>=1024&&idx<UNITS.length-1){val/=1024;idx++}this.inputValue=Math.round(val*100)/100;this.buffer=this.inputValue.toString();this.unitIndex=idx}};
@@ -0,0 +1,17 @@
1
+ import { Prompt } from '../base';
2
+ import { CalculatorOptions } from '../types';
3
+ export declare class CalculatorPrompt extends Prompt<number, CalculatorOptions> {
4
+ protected errorMsg: string;
5
+ protected cursor: number;
6
+ protected hasTyped: boolean;
7
+ protected segments: string[];
8
+ protected lastLinesUp: number;
9
+ protected previewValue: string;
10
+ constructor(options: CalculatorOptions);
11
+ private updatePreview;
12
+ private evaluate;
13
+ protected render(firstRender: boolean): void;
14
+ private getVisualCursorPosition;
15
+ protected cleanup(): void;
16
+ protected handleInput(char: string): void;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CalculatorPrompt",{enumerable:true,get:function(){return CalculatorPrompt}});const _ansi=require("../ansi");const _base=require("../base");const _theme=require("../theme");const _symbols=require("../symbols");const _utils=require("../utils");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let CalculatorPrompt=class CalculatorPrompt extends _base.Prompt{updatePreview(){const input=this.segments.join("");if(!input.trim()){this.previewValue="";return}try{const result=this.evaluate(input);if(result!==null&&!isNaN(result)&&isFinite(result)){if(this.options.precision!==undefined){this.previewValue=parseFloat(result.toFixed(this.options.precision)).toString()}else{this.previewValue=result.toString()}}else{this.previewValue=""}}catch(_e){this.previewValue=""}}evaluate(expression){let expr=expression;if(this.options.variables){const keys=Object.keys(this.options.variables).sort((a,b)=>b.length-a.length);for(const key of keys){const val=this.options.variables[key];const regex=new RegExp(`\\b${key}\\b`,"g");expr=expr.replace(regex,String(val))}}if(/[a-zA-Z_]/.test(expr)){const allowedMath=["sin","cos","tan","log","sqrt","abs","pow","floor","ceil","round","PI","E"];let checkStr=expr;allowedMath.forEach(k=>{checkStr=checkStr.replace(new RegExp(k,"g"),"")});if(/[a-zA-Z_]/.test(checkStr)){return null}allowedMath.forEach(k=>{if(["PI","E"].includes(k)){expr=expr.replace(new RegExp(`\\b${k}\\b`,"g"),`Math.${k}`)}else{expr=expr.replace(new RegExp(`\\b${k}\\(`,"g"),`Math.${k}(`)}})}try{const func=new Function(`return (${expr})`);const res=func();return typeof res==="number"?res:null}catch(_err){return null}}render(firstRender){if(!firstRender&&this.lastLinesUp>0){this.print(`\x1b[${this.lastLinesUp}B`)}this.lastLinesUp=0;const icon=this.errorMsg?`${_theme.theme.error}${_symbols.symbols.cross}`:`${_theme.theme.success}?`;const prefix=`${icon} ${_ansi.ANSI.BOLD}${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} `;const prefixVisualLen=this.stripAnsi(prefix).length;let displayValue="";const inputStr=this.segments.join("");if(!inputStr&&this.options.placeholder&&!this.errorMsg&&!this.hasTyped){displayValue=`${_theme.theme.muted}${this.options.placeholder}${_ansi.ANSI.RESET}`}else{displayValue=_theme.theme.main+inputStr+_ansi.ANSI.RESET}let output=`${prefix}${displayValue}`;let previewStr="";if(this.previewValue&&!this.errorMsg){previewStr=`
2
+ ${_theme.theme.muted}= ${this.previewValue}${_ansi.ANSI.RESET}`;output+=previewStr}if(this.errorMsg){output+=`
3
+ ${_theme.theme.error}>> ${this.errorMsg}${_ansi.ANSI.RESET}`}this.renderFrame(output);this.print(_ansi.ANSI.SHOW_CURSOR);let totalRows=1;if(previewStr)totalRows++;if(this.errorMsg)totalRows++;const linesUp=totalRows-1;if(linesUp>0){this.print(`\x1b[${linesUp}A`)}this.lastLinesUp=linesUp;const cursorVisualCol=this.getVisualCursorPosition();const targetCol=prefixVisualLen+cursorVisualCol;this.print(_ansi.ANSI.CURSOR_LEFT);if(targetCol>0){this.print(`\x1b[${targetCol}C`)}}getVisualCursorPosition(){let width=0;for(let i=0;i<this.cursor;i++){width+=(0,_utils.stringWidth)(this.segments[i])}return width}cleanup(){if(this.lastLinesUp>0){this.print(`\x1b[${this.lastLinesUp}B`);this.lastLinesUp=0}super.cleanup()}handleInput(char){if(char==="\r"||char==="\n"){const input=this.segments.join("");const result=this.evaluate(input);if(result===null||isNaN(result)){this.errorMsg="Invalid expression";this.render(false);return}this.submit(result);return}if(char==="\b"||char===""){this.hasTyped=true;if(this.cursor>0){this.segments.splice(this.cursor-1,1);this.cursor--;this.errorMsg="";this.updatePreview();this.render(false)}return}if(this.isLeft(char)){if(this.cursor>0){this.cursor--;this.render(false)}return}if(this.isRight(char)){if(this.cursor<this.segments.length){this.cursor++;this.render(false)}return}if(char==="\x1b[3~"){this.hasTyped=true;if(this.cursor<this.segments.length){this.segments.splice(this.cursor,1);this.errorMsg="";this.updatePreview();this.render(false)}return}if(!/^[\x00-\x1F]/.test(char)&&!char.startsWith("\x1b")){this.hasTyped=true;const newSegments=(0,_utils.safeSplit)(char);this.segments.splice(this.cursor,0,...newSegments);this.cursor+=newSegments.length;this.errorMsg="";this.updatePreview();this.render(false)}}constructor(options){super(options),_define_property(this,"errorMsg",""),_define_property(this,"cursor",0),_define_property(this,"hasTyped",false),_define_property(this,"segments",[]),_define_property(this,"lastLinesUp",0),_define_property(this,"previewValue","");this.value=options.initial?String(options.initial):"";this.segments=(0,_utils.safeSplit)(this.value);this.cursor=this.segments.length;this.updatePreview()}};
@@ -0,0 +1,33 @@
1
+ import { Prompt } from '../base';
2
+ import { CalendarOptions, MouseEvent } from '../types';
3
+ type SingleSelection = Date;
4
+ type RangeSelection = [Date, Date];
5
+ type CalendarValue = SingleSelection | RangeSelection | SingleSelection[] | RangeSelection[];
6
+ interface ExtendedCalendarOptions extends CalendarOptions {
7
+ multiple?: boolean;
8
+ }
9
+ export declare class CalendarPrompt extends Prompt<CalendarValue, ExtendedCalendarOptions> {
10
+ private cursor;
11
+ private viewDate;
12
+ private selections;
13
+ private tempRangeStart;
14
+ constructor(options: ExtendedCalendarOptions);
15
+ private getDaysInMonth;
16
+ private generateMonthGrid;
17
+ private isSameDay;
18
+ /**
19
+ * Check if a date is part of any committed selection
20
+ */
21
+ private isSelected;
22
+ /**
23
+ * Visual feedback for the range currently being defined (before Enter is pressed the 2nd time)
24
+ */
25
+ private isInTempRange;
26
+ protected render(_firstRender: boolean): void;
27
+ private syncViewDate;
28
+ private alignCursorToViewDate;
29
+ private submitResult;
30
+ protected handleInput(char: string, _key: any): void;
31
+ protected handleMouse(event: MouseEvent): void;
32
+ }
33
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CalendarPrompt",{enumerable:true,get:function(){return CalendarPrompt}});const _ansi=require("../ansi");const _base=require("../base");const _theme=require("../theme");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let CalendarPrompt=class CalendarPrompt extends _base.Prompt{getDaysInMonth(year,month){return new Date(year,month+1,0).getDate()}generateMonthGrid(year,month){const days=[];const firstDayOfMonth=new Date(year,month,1);const startDayOfWeek=firstDayOfMonth.getDay();const weekStart=this.options.weekStart||0;const daysFromPrevMonth=(startDayOfWeek-weekStart+7)%7;const prevMonthDate=new Date(year,month,0);const prevMonthDaysCount=prevMonthDate.getDate();for(let i=daysFromPrevMonth-1;i>=0;i--){days.push({date:new Date(year,month-1,prevMonthDaysCount-i),inMonth:false})}const daysInMonth=this.getDaysInMonth(year,month);for(let i=1;i<=daysInMonth;i++){days.push({date:new Date(year,month,i),inMonth:true})}let nextMonthDay=1;while(days.length<42){days.push({date:new Date(year,month+1,nextMonthDay++),inMonth:false})}return days}isSameDay(d1,d2){return d1.getFullYear()===d2.getFullYear()&&d1.getMonth()===d2.getMonth()&&d1.getDate()===d2.getDate()}isSelected(d){const dTime=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime();return this.selections.some(sel=>{if(Array.isArray(sel)){const[start,end]=sel;const sTime=new Date(start.getFullYear(),start.getMonth(),start.getDate()).getTime();const eTime=new Date(end.getFullYear(),end.getMonth(),end.getDate()).getTime();return dTime>=Math.min(sTime,eTime)&&dTime<=Math.max(sTime,eTime)}else{const sTime=new Date(sel.getFullYear(),sel.getMonth(),sel.getDate()).getTime();return dTime===sTime}})}isInTempRange(d){if(!this.tempRangeStart)return false;const dTime=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime();const sTime=new Date(this.tempRangeStart.getFullYear(),this.tempRangeStart.getMonth(),this.tempRangeStart.getDate()).getTime();const cTime=new Date(this.cursor.getFullYear(),this.cursor.getMonth(),this.cursor.getDate()).getTime();return dTime>=Math.min(sTime,cTime)&&dTime<=Math.max(sTime,cTime)}render(_firstRender){const monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];const year=this.viewDate.getFullYear();const month=this.viewDate.getMonth();const header=`${_ansi.ANSI.BOLD}${monthNames[month]} ${year}${_ansi.ANSI.RESET}`;const weekDays=this.options.weekStart===1?["Mo","Tu","We","Th","Fr","Sa","Su"]:["Su","Mo","Tu","We","Th","Fr","Sa"];const grid=this.generateMonthGrid(year,month);let output=`${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET}
2
+ `;output+=`${_theme.theme.muted}< ${header} >${_ansi.ANSI.RESET}
3
+ `;output+=weekDays.map(d=>`${_theme.theme.muted}${d}${_ansi.ANSI.RESET}`).join(" ")+"\n";let rowLine="";for(let i=0;i<grid.length;i++){const cell=grid[i];const dateStr=cell.date.getDate().toString().padStart(2," ");let style="";const isCursor=this.isSameDay(cell.date,this.cursor);const isSel=this.isSelected(cell.date);const isTemp=this.isInTempRange(cell.date);const isToday=this.isSameDay(cell.date,new Date);if(!cell.inMonth){style=_theme.theme.muted}if(isSel||isTemp){style=_theme.theme.main}if(isToday&&!isSel&&!isTemp){style+=_ansi.ANSI.UNDERLINE}if(isCursor){style+=_ansi.ANSI.REVERSE}rowLine+=`${style}${dateStr}${_ansi.ANSI.RESET}`;if((i+1)%7===0){output+=rowLine+"\n";rowLine=""}else{rowLine+=" "}}let help="";if(this.options.mode==="range"){if(this.options.multiple){help="Enter: Range Points | D: Done"}else{help="Enter: Start/End"}}else{if(this.options.multiple){help="Space/Enter: Toggle | D: Done"}else{help="Enter: Select"}}if(this.tempRangeStart){help+=` ${_theme.theme.muted}(Selecting range...)${_ansi.ANSI.RESET}`}output+=`${_theme.theme.muted}${help}${_ansi.ANSI.RESET}`;this.renderFrame(output)}syncViewDate(){if(this.cursor.getMonth()!==this.viewDate.getMonth()||this.cursor.getFullYear()!==this.viewDate.getFullYear()){this.viewDate=new Date(this.cursor);this.viewDate.setDate(1)}}alignCursorToViewDate(){const day=this.cursor.getDate();const year=this.viewDate.getFullYear();const month=this.viewDate.getMonth();const daysInTarget=this.getDaysInMonth(year,month);const newDay=Math.min(day,daysInTarget);this.cursor=new Date(year,month,newDay)}submitResult(){if(this.options.multiple){if(this.options.mode==="range"){this.submit(this.selections.filter(Array.isArray))}else{this.submit(this.selections.filter(sel=>!Array.isArray(sel)))}}else{this.submit(this.selections[0]||null)}}handleInput(char,_key){const isUp=this.isUp(char);const isDown=this.isDown(char);const isLeft=this.isLeft(char);const isRight=this.isRight(char);if(isUp||isDown||isLeft||isRight){const d=new Date(this.cursor);if(isUp)d.setDate(d.getDate()-7);if(isDown)d.setDate(d.getDate()+7);if(isLeft)d.setDate(d.getDate()-1);if(isRight)d.setDate(d.getDate()+1);this.cursor=d;this.syncViewDate();this.render(false);return}if(char==="\x1b[5~"){this.cursor.setMonth(this.cursor.getMonth()-1);this.syncViewDate();this.render(false);return}if(char==="\x1b[6~"){this.cursor.setMonth(this.cursor.getMonth()+1);this.syncViewDate();this.render(false);return}if(char==="\x1b[1;5A"){this.cursor.setFullYear(this.cursor.getFullYear()-1);this.syncViewDate();this.render(false);return}if(char==="\x1b[1;5B"){this.cursor.setFullYear(this.cursor.getFullYear()+1);this.syncViewDate();this.render(false);return}if(char==="\x1b[H"||char==="\x1b[1~"){this.cursor.setDate(1);this.render(false);return}if(char==="\x1b[F"||char==="\x1b[4~"){this.cursor.setMonth(this.cursor.getMonth()+1);this.cursor.setDate(0);this.render(false);return}if(char==="t"){this.cursor=new Date;this.syncViewDate();this.render(false);return}if(char==="<"||char===","){this.viewDate.setMonth(this.viewDate.getMonth()-1);this.alignCursorToViewDate();this.render(false);return}if(char===">"||char==="."){this.viewDate.setMonth(this.viewDate.getMonth()+1);this.alignCursorToViewDate();this.render(false);return}if((char==="d"||char==="D")&&this.options.multiple){this.submitResult();return}if(char==="\r"||char==="\n"||char===" "){if(this.options.mode==="range"){if(!this.tempRangeStart){this.tempRangeStart=this.cursor;if(!this.options.multiple){this.selections=[]}}else{const start=this.tempRangeStart;const end=this.cursor;const newRange=start<end?[start,end]:[end,start];if(this.options.multiple){this.selections.push(newRange);this.tempRangeStart=null}else{this.selections=[newRange];this.submitResult();return}}}else{const date=this.cursor;if(this.options.multiple){const idx=this.selections.findIndex(s=>!Array.isArray(s)&&this.isSameDay(s,date));if(idx>=0){this.selections.splice(idx,1)}else{this.selections.push(date)}}else{this.selections=[date];this.submitResult();return}}this.render(false);return}}handleMouse(event){if(event.action==="scroll"){const direction=event.scroll==="up"?-1:1;if(event.ctrl){this.cursor.setDate(this.cursor.getDate()+direction);this.syncViewDate()}else{this.viewDate.setMonth(this.viewDate.getMonth()+direction);this.alignCursorToViewDate()}this.render(false)}}constructor(options){super(options),_define_property(this,"cursor",void 0),_define_property(this,"viewDate",void 0),_define_property(this,"selections",[]),_define_property(this,"tempRangeStart",null);this.cursor=new Date;this.viewDate=new Date;this.viewDate.setDate(1);if(options.initial){if(Array.isArray(options.initial)){const init=options.initial;if(init.length>0){if(options.mode==="range"&&!options.multiple&&init.length===2&&init[0]instanceof Date){this.selections=[[init[0],init[1]]];this.cursor=new Date(init[1])}else if(Array.isArray(init[0])){this.selections=[...init];const lastRange=init[init.length-1];this.cursor=new Date(lastRange[1])}else{this.selections=[...init];this.cursor=new Date(init[init.length-1])}}}else{this.selections=[options.initial];this.cursor=new Date(options.initial)}}else{if(this.options.mode!=="range"&&!this.options.multiple){this.selections=[new Date]}}this.viewDate=new Date(this.cursor);this.viewDate.setDate(1)}};
@@ -0,0 +1,13 @@
1
+ import { Prompt } from '../base';
2
+ import { CheckboxOptions, MouseEvent } from '../types';
3
+ export declare class CheckboxPrompt<V> extends Prompt<any[], CheckboxOptions<V>> {
4
+ private selectedIndex;
5
+ private checkedState;
6
+ private errorMsg;
7
+ private scrollTop;
8
+ private readonly pageSize;
9
+ constructor(options: CheckboxOptions<V>);
10
+ protected render(_firstRender: boolean): void;
11
+ protected handleInput(char: string): void;
12
+ protected handleMouse(event: MouseEvent): void;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CheckboxPrompt",{enumerable:true,get:function(){return CheckboxPrompt}});const _ansi=require("../ansi");const _base=require("../base");const _theme=require("../theme");const _symbols=require("../symbols");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let CheckboxPrompt=class CheckboxPrompt extends _base.Prompt{render(_firstRender){if(this.selectedIndex<this.scrollTop){this.scrollTop=this.selectedIndex}else if(this.selectedIndex>=this.scrollTop+this.pageSize){this.scrollTop=this.selectedIndex-this.pageSize+1}if(this.options.choices.length<=this.pageSize){this.scrollTop=0}let output="";const icon=this.errorMsg?`${_theme.theme.error}${_symbols.symbols.cross}`:`${_theme.theme.success}?`;output+=`${icon} ${_ansi.ANSI.BOLD}${_theme.theme.title}${this.options.message}${_ansi.ANSI.RESET} ${_theme.theme.muted}(Space: toggle, a: all, x: none, Enter: submit)${_ansi.ANSI.RESET}`;const choices=this.options.choices;const visibleChoices=choices.slice(this.scrollTop,this.scrollTop+this.pageSize);visibleChoices.forEach((choice,index)=>{const actualIndex=this.scrollTop+index;output+="\n";const cursor=actualIndex===this.selectedIndex?`${_theme.theme.main}${_symbols.symbols.pointer}${_ansi.ANSI.RESET}`:" ";const isChecked=this.checkedState[actualIndex];const checkbox=isChecked?`${_theme.theme.success}${_symbols.symbols.checked}${_ansi.ANSI.RESET}`:`${_theme.theme.muted}${_symbols.symbols.unchecked}${_ansi.ANSI.RESET}`;const title=actualIndex===this.selectedIndex?`${_theme.theme.main}${choice.title}${_ansi.ANSI.RESET}`:choice.title;output+=`${cursor} ${checkbox} ${title}`});if(choices.length>this.pageSize){}if(this.errorMsg){output+=`
2
+ ${_theme.theme.error}>> ${this.errorMsg}${_ansi.ANSI.RESET}`}this.renderFrame(output)}handleInput(char){if(char==="\r"||char==="\n"){const selectedCount=this.checkedState.filter(Boolean).length;const{min=0,max}=this.options;if(selectedCount<min){this.errorMsg=`You must select at least ${min} options.`;this.render(false);return}if(max&&selectedCount>max){this.errorMsg=`You can only select up to ${max} options.`;this.render(false);return}this.cleanup();const results=this.options.choices.filter((_,i)=>this.checkedState[i]).map(c=>c.value);if(this._resolve)this._resolve(results);return}if(char==="a"){if(this.options.max&&this.options.choices.length>this.options.max){this.errorMsg=`Cannot select all: Max limit is ${this.options.max}`}else{this.checkedState.fill(true);this.errorMsg=""}this.render(false);return}if(char==="x"||char==="n"){this.checkedState.fill(false);this.errorMsg="";this.render(false);return}if(char==="i"){const potentialCount=this.checkedState.filter(s=>!s).length;if(this.options.max&&potentialCount>this.options.max){this.errorMsg=`Cannot invert: Result exceeds max limit ${this.options.max}`}else{this.checkedState=this.checkedState.map(s=>!s);this.errorMsg=""}this.render(false);return}if(char===" "){const currentChecked=this.checkedState[this.selectedIndex];const selectedCount=this.checkedState.filter(Boolean).length;const{max}=this.options;if(!currentChecked&&max&&selectedCount>=max){this.errorMsg=`Max ${max} selections allowed.`}else{this.checkedState[this.selectedIndex]=!currentChecked;this.errorMsg=""}this.render(false)}if(this.isUp(char)){this.selectedIndex=this.selectedIndex>0?this.selectedIndex-1:this.options.choices.length-1;this.errorMsg="";this.render(false)}if(this.isDown(char)){this.selectedIndex=this.selectedIndex<this.options.choices.length-1?this.selectedIndex+1:0;this.errorMsg="";this.render(false)}}handleMouse(event){if(event.action==="scroll"){if(event.scroll==="up"){this.selectedIndex=this.selectedIndex>0?this.selectedIndex-1:this.options.choices.length-1;this.errorMsg="";this.render(false)}else if(event.scroll==="down"){this.selectedIndex=this.selectedIndex<this.options.choices.length-1?this.selectedIndex+1:0;this.errorMsg="";this.render(false)}}}constructor(options){super(options),_define_property(this,"selectedIndex",0),_define_property(this,"checkedState",void 0),_define_property(this,"errorMsg",""),_define_property(this,"scrollTop",0),_define_property(this,"pageSize",10);this.checkedState=options.choices.map(c=>!!c.selected)}};