@reliverse/rempts-core 1.6.1 → 2.3.2

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 (155) hide show
  1. package/README.md +398 -102
  2. package/dist/cli.d.ts +32 -0
  3. package/dist/cli.js +731 -0
  4. package/dist/config-loader.d.ts +42 -0
  5. package/dist/config-loader.js +20 -0
  6. package/dist/config.d.ts +99 -0
  7. package/dist/config.js +188 -0
  8. package/dist/file-loader.d.ts +43 -0
  9. package/dist/file-loader.js +199 -0
  10. package/dist/global-flags.d.ts +36 -0
  11. package/dist/global-flags.js +36 -0
  12. package/dist/mod.d.ts +13 -0
  13. package/dist/mod.js +19 -0
  14. package/dist/parser.d.ts +6 -0
  15. package/dist/parser.js +137 -0
  16. package/dist/plugin/context.d.ts +13 -0
  17. package/dist/plugin/context.js +53 -0
  18. package/dist/plugin/create.d.ts +92 -0
  19. package/dist/plugin/create.js +61 -0
  20. package/dist/plugin/loader.d.ts +12 -0
  21. package/dist/plugin/loader.js +65 -0
  22. package/dist/plugin/manager.d.ts +53 -0
  23. package/dist/plugin/manager.js +135 -0
  24. package/dist/plugin/mod.d.ts +10 -0
  25. package/dist/plugin/mod.js +27 -0
  26. package/dist/plugin/store.d.ts +45 -0
  27. package/dist/plugin/store.js +60 -0
  28. package/dist/plugin/testing.d.ts +38 -0
  29. package/dist/plugin/testing.js +175 -0
  30. package/dist/plugin/types.d.ts +146 -0
  31. package/dist/tui/registry.d.ts +8 -0
  32. package/dist/tui/registry.js +10 -0
  33. package/dist/tui/types.d.ts +58 -0
  34. package/dist/tui/types.js +10 -0
  35. package/dist/types.d.ts +178 -0
  36. package/dist/types.js +25 -0
  37. package/dist/utils/logger.d.ts +10 -0
  38. package/dist/utils/logger.js +27 -0
  39. package/dist/utils/merge.d.ts +13 -0
  40. package/dist/utils/merge.js +25 -0
  41. package/dist/utils/mod.d.ts +6 -0
  42. package/dist/utils/mod.js +2 -0
  43. package/dist/utils/type-helpers.d.ts +41 -0
  44. package/dist/utils/type-helpers.js +0 -0
  45. package/dist/validation.d.ts +30 -0
  46. package/dist/validation.js +121 -0
  47. package/package.json +47 -44
  48. package/src/cli.ts +1049 -0
  49. package/src/config-loader.ts +71 -0
  50. package/src/config.ts +270 -0
  51. package/src/file-loader.ts +346 -0
  52. package/src/global-flags.ts +50 -0
  53. package/src/mod.ts +74 -0
  54. package/src/parser.ts +212 -0
  55. package/src/plugin/context.ts +88 -0
  56. package/src/plugin/create.ts +174 -0
  57. package/src/plugin/loader.ts +111 -0
  58. package/src/plugin/manager.ts +244 -0
  59. package/src/plugin/mod.ts +51 -0
  60. package/src/plugin/store.ts +124 -0
  61. package/src/plugin/testing.ts +236 -0
  62. package/src/plugin/types.ts +206 -0
  63. package/src/tui/registry.ts +22 -0
  64. package/src/tui/types.ts +79 -0
  65. package/src/types.ts +285 -0
  66. package/src/utils/logger.ts +43 -0
  67. package/src/utils/merge.ts +54 -0
  68. package/src/utils/mod.ts +7 -0
  69. package/src/utils/type-helpers.ts +151 -0
  70. package/src/validation.ts +177 -0
  71. package/LICENSE +0 -21
  72. package/bin/core-impl/anykey/anykey-mod.d.ts +0 -12
  73. package/bin/core-impl/anykey/anykey-mod.js +0 -125
  74. package/bin/core-impl/date/date.d.ts +0 -2
  75. package/bin/core-impl/date/date.js +0 -236
  76. package/bin/core-impl/editor/editor-mod.d.ts +0 -25
  77. package/bin/core-impl/editor/editor-mod.js +0 -896
  78. package/bin/core-impl/figures/figures-mod.d.ts +0 -233
  79. package/bin/core-impl/figures/figures-mod.js +0 -286
  80. package/bin/core-impl/figures/figures.test.d.ts +0 -1
  81. package/bin/core-impl/figures/figures.test.js +0 -474
  82. package/bin/core-impl/input/confirm-prompt.d.ts +0 -5
  83. package/bin/core-impl/input/confirm-prompt.js +0 -173
  84. package/bin/core-impl/input/input-prompt.d.ts +0 -16
  85. package/bin/core-impl/input/input-prompt.js +0 -370
  86. package/bin/core-impl/launcher/_parser.d.ts +0 -2
  87. package/bin/core-impl/launcher/_parser.js +0 -122
  88. package/bin/core-impl/launcher/_utils.d.ts +0 -8
  89. package/bin/core-impl/launcher/_utils.js +0 -29
  90. package/bin/core-impl/launcher/args.d.ts +0 -3
  91. package/bin/core-impl/launcher/args.js +0 -89
  92. package/bin/core-impl/launcher/command.d.ts +0 -8
  93. package/bin/core-impl/launcher/command.js +0 -68
  94. package/bin/core-impl/launcher/launcher-mod.d.ts +0 -8
  95. package/bin/core-impl/launcher/launcher-mod.js +0 -34
  96. package/bin/core-impl/launcher/usage.d.ts +0 -3
  97. package/bin/core-impl/launcher/usage.js +0 -104
  98. package/bin/core-impl/msg-fmt/colors.d.ts +0 -30
  99. package/bin/core-impl/msg-fmt/colors.js +0 -42
  100. package/bin/core-impl/msg-fmt/logger.d.ts +0 -17
  101. package/bin/core-impl/msg-fmt/logger.js +0 -106
  102. package/bin/core-impl/msg-fmt/mapping.d.ts +0 -3
  103. package/bin/core-impl/msg-fmt/mapping.js +0 -49
  104. package/bin/core-impl/msg-fmt/messages.d.ts +0 -35
  105. package/bin/core-impl/msg-fmt/messages.js +0 -314
  106. package/bin/core-impl/msg-fmt/terminal.d.ts +0 -15
  107. package/bin/core-impl/msg-fmt/terminal.js +0 -59
  108. package/bin/core-impl/msg-fmt/variants.d.ts +0 -11
  109. package/bin/core-impl/msg-fmt/variants.js +0 -52
  110. package/bin/core-impl/next-steps/next-steps.d.ts +0 -14
  111. package/bin/core-impl/next-steps/next-steps.js +0 -24
  112. package/bin/core-impl/number/number-mod.d.ts +0 -28
  113. package/bin/core-impl/number/number-mod.js +0 -197
  114. package/bin/core-impl/results/results.d.ts +0 -7
  115. package/bin/core-impl/results/results.js +0 -27
  116. package/bin/core-impl/select/multiselect-prompt.d.ts +0 -2
  117. package/bin/core-impl/select/multiselect-prompt.js +0 -341
  118. package/bin/core-impl/select/nummultiselect-prompt.d.ts +0 -6
  119. package/bin/core-impl/select/nummultiselect-prompt.js +0 -105
  120. package/bin/core-impl/select/numselect-prompt.d.ts +0 -7
  121. package/bin/core-impl/select/numselect-prompt.js +0 -115
  122. package/bin/core-impl/select/select-prompt.d.ts +0 -33
  123. package/bin/core-impl/select/select-prompt.js +0 -302
  124. package/bin/core-impl/select/toggle-prompt.d.ts +0 -5
  125. package/bin/core-impl/select/toggle-prompt.js +0 -208
  126. package/bin/core-impl/st-end/end.d.ts +0 -2
  127. package/bin/core-impl/st-end/end.js +0 -42
  128. package/bin/core-impl/st-end/start.d.ts +0 -17
  129. package/bin/core-impl/st-end/start.js +0 -66
  130. package/bin/core-impl/task/progress.d.ts +0 -2
  131. package/bin/core-impl/task/progress.js +0 -57
  132. package/bin/core-impl/task/spinner.d.ts +0 -15
  133. package/bin/core-impl/task/spinner.js +0 -110
  134. package/bin/core-impl/utils/colorize.d.ts +0 -2
  135. package/bin/core-impl/utils/colorize.js +0 -134
  136. package/bin/core-impl/utils/errors.d.ts +0 -1
  137. package/bin/core-impl/utils/errors.js +0 -15
  138. package/bin/core-impl/utils/prevent.d.ts +0 -10
  139. package/bin/core-impl/utils/prevent.js +0 -69
  140. package/bin/core-impl/utils/prompt-end.d.ts +0 -8
  141. package/bin/core-impl/utils/prompt-end.js +0 -33
  142. package/bin/core-impl/utils/stream-text.d.ts +0 -18
  143. package/bin/core-impl/utils/stream-text.js +0 -136
  144. package/bin/core-impl/utils/system.d.ts +0 -6
  145. package/bin/core-impl/utils/system.js +0 -7
  146. package/bin/core-impl/utils/validate.d.ts +0 -22
  147. package/bin/core-impl/utils/validate.js +0 -17
  148. package/bin/core-impl/visual/animate/animate.d.ts +0 -14
  149. package/bin/core-impl/visual/animate/animate.js +0 -64
  150. package/bin/core-impl/visual/ascii-art/ascii-art.d.ts +0 -6
  151. package/bin/core-impl/visual/ascii-art/ascii-art.js +0 -12
  152. package/bin/core-types.d.ts +0 -434
  153. package/bin/main.d.ts +0 -41
  154. package/bin/main.js +0 -96
  155. /package/{bin/core-types.js → dist/plugin/types.js} +0 -0
@@ -1,474 +0,0 @@
1
- import { vi, it, expect, afterAll } from "vitest";
2
- afterAll(() => {
3
- vi.unstubAllEnvs();
4
- });
5
- it("falls back to ascii figures when unicode is not supported", async () => {
6
- const { default: unicodeFigures } = await import("./figures-mod.js");
7
- vi.resetModules().stubEnv("TERM", "linux");
8
- const { default: asciiFigures } = await import("./figures-mod.js");
9
- expect(asciiFigures.checkboxOn).not.toEqual(unicodeFigures.checkboxOn);
10
- expect(unicodeFigures).toMatchInlineSnapshot(`
11
- {
12
- "almostEqual": "\u2248",
13
- "arrowDown": "\u2193",
14
- "arrowLeft": "\u2190",
15
- "arrowLeftRight": "\u2194",
16
- "arrowRight": "\u2192",
17
- "arrowUp": "\u2191",
18
- "arrowUpDown": "\u2195",
19
- "bullet": "\u25CF",
20
- "checkboxCircleOff": "\u24BE",
21
- "checkboxCircleOn": "\u24E7",
22
- "checkboxOff": "\u2610",
23
- "checkboxOn": "\u2612",
24
- "circle": "\u25EF",
25
- "circleCircle": "\u24DE",
26
- "circleCross": "\u24E7",
27
- "circleDotted": "\u25CC",
28
- "circleDouble": "\u25CE",
29
- "circleFilled": "\u25C9",
30
- "circlePipe": "\u24BE",
31
- "circleQuestionMark": "(?)",
32
- "cross": "\u2718",
33
- "dot": "\u2024",
34
- "ellipsis": "\u2026",
35
- "fiveEighths": "\u215D",
36
- "fiveSixths": "\u215A",
37
- "fourFifths": "\u2158",
38
- "greaterOrEqual": "\u2265",
39
- "hamburger": "\u2630",
40
- "heart": "\u2665",
41
- "home": "\u2302",
42
- "identical": "\u2261",
43
- "infinity": "\u221E",
44
- "info": "\u2139",
45
- "lessOrEqual": "\u2264",
46
- "line": "\u2500",
47
- "lineBackslash": "\u2572",
48
- "lineBold": "\u2501",
49
- "lineCross": "\u2573",
50
- "lineDashed0": "\u2504",
51
- "lineDashed1": "\u2505",
52
- "lineDashed10": "\u257C",
53
- "lineDashed11": "\u257E",
54
- "lineDashed12": "\u2212",
55
- "lineDashed13": "\u2013",
56
- "lineDashed14": "\u2010",
57
- "lineDashed15": "\u2043",
58
- "lineDashed2": "\u2508",
59
- "lineDashed3": "\u2509",
60
- "lineDashed4": "\u254C",
61
- "lineDashed5": "\u254D",
62
- "lineDashed6": "\u2574",
63
- "lineDashed7": "\u2576",
64
- "lineDashed8": "\u2578",
65
- "lineDashed9": "\u257A",
66
- "lineDouble": "\u2550",
67
- "lineDownBoldLeft": "\u2512",
68
- "lineDownBoldLeftBold": "\u2513",
69
- "lineDownBoldLeftBoldRight": "\u2531",
70
- "lineDownBoldLeftBoldRightBold": "\u2533",
71
- "lineDownBoldLeftRight": "\u2530",
72
- "lineDownBoldLeftRightBold": "\u2532",
73
- "lineDownBoldRight": "\u250E",
74
- "lineDownBoldRightBold": "\u250F",
75
- "lineDownDoubleLeft": "\u2556",
76
- "lineDownDoubleLeftDouble": "\u2557",
77
- "lineDownDoubleLeftDoubleRightDouble": "\u2566",
78
- "lineDownDoubleLeftRight": "\u2565",
79
- "lineDownDoubleRight": "\u2553",
80
- "lineDownDoubleRightDouble": "\u2554",
81
- "lineDownLeft": "\u2510",
82
- "lineDownLeftArc": "\u256E",
83
- "lineDownLeftBold": "\u2511",
84
- "lineDownLeftBoldRight": "\u252D",
85
- "lineDownLeftBoldRightBold": "\u252F",
86
- "lineDownLeftDouble": "\u2555",
87
- "lineDownLeftDoubleRightDouble": "\u2564",
88
- "lineDownLeftRight": "\u252C",
89
- "lineDownLeftRightBold": "\u252E",
90
- "lineDownRight": "\u250C",
91
- "lineDownRightArc": "\u256D",
92
- "lineDownRightBold": "\u250D",
93
- "lineDownRightDouble": "\u2552",
94
- "lineSlash": "\u2571",
95
- "lineUpBoldDownBoldLeft": "\u2528",
96
- "lineUpBoldDownBoldLeftBold": "\u252B",
97
- "lineUpBoldDownBoldLeftBoldRight": "\u2549",
98
- "lineUpBoldDownBoldLeftBoldRightBold": "\u254B",
99
- "lineUpBoldDownBoldLeftRight": "\u2542",
100
- "lineUpBoldDownBoldLeftRightBold": "\u254A",
101
- "lineUpBoldDownBoldRight": "\u2520",
102
- "lineUpBoldDownBoldRightBold": "\u2523",
103
- "lineUpBoldDownLeft": "\u2526",
104
- "lineUpBoldDownLeftBold": "\u2529",
105
- "lineUpBoldDownLeftBoldRight": "\u2543",
106
- "lineUpBoldDownLeftBoldRightBold": "\u2547",
107
- "lineUpBoldDownLeftRight": "\u2540",
108
- "lineUpBoldDownLeftRightBold": "\u2544",
109
- "lineUpBoldDownRight": "\u251E",
110
- "lineUpBoldDownRightBold": "\u2521",
111
- "lineUpBoldLeft": "\u251A",
112
- "lineUpBoldLeftBold": "\u251B",
113
- "lineUpBoldLeftBoldRight": "\u2539",
114
- "lineUpBoldLeftBoldRightBold": "\u253B",
115
- "lineUpBoldLeftRight": "\u2538",
116
- "lineUpBoldLeftRightBold": "\u253A",
117
- "lineUpBoldRight": "\u2516",
118
- "lineUpBoldRightBold": "\u2517",
119
- "lineUpDoubleDownDoubleLeft": "\u2562",
120
- "lineUpDoubleDownDoubleLeftDouble": "\u2563",
121
- "lineUpDoubleDownDoubleLeftDoubleRightDouble": "\u256C",
122
- "lineUpDoubleDownDoubleLeftRight": "\u256B",
123
- "lineUpDoubleDownDoubleRight": "\u255F",
124
- "lineUpDoubleDownDoubleRightDouble": "\u2560",
125
- "lineUpDoubleLeft": "\u255C",
126
- "lineUpDoubleLeftDouble": "\u255D",
127
- "lineUpDoubleLeftDoubleRightDouble": "\u2569",
128
- "lineUpDoubleLeftRight": "\u2568",
129
- "lineUpDoubleRight": "\u2559",
130
- "lineUpDoubleRightDouble": "\u255A",
131
- "lineUpDownBoldLeft": "\u2527",
132
- "lineUpDownBoldLeftBold": "\u252A",
133
- "lineUpDownBoldLeftBoldRight": "\u2545",
134
- "lineUpDownBoldLeftBoldRightBold": "\u2548",
135
- "lineUpDownBoldLeftRight": "\u2541",
136
- "lineUpDownBoldLeftRightBold": "\u2546",
137
- "lineUpDownBoldRight": "\u251F",
138
- "lineUpDownBoldRightBold": "\u2522",
139
- "lineUpDownLeft": "\u2524",
140
- "lineUpDownLeftBold": "\u2525",
141
- "lineUpDownLeftBoldRight": "\u253D",
142
- "lineUpDownLeftBoldRightBold": "\u253F",
143
- "lineUpDownLeftDouble": "\u2561",
144
- "lineUpDownLeftDoubleRightDouble": "\u256A",
145
- "lineUpDownLeftRight": "\u253C",
146
- "lineUpDownLeftRightBold": "\u253E",
147
- "lineUpDownRight": "\u251C",
148
- "lineUpDownRightBold": "\u251D",
149
- "lineUpDownRightDouble": "\u255E",
150
- "lineUpLeft": "\u2518",
151
- "lineUpLeftArc": "\u256F",
152
- "lineUpLeftBold": "\u2519",
153
- "lineUpLeftBoldRight": "\u2535",
154
- "lineUpLeftBoldRightBold": "\u2537",
155
- "lineUpLeftDouble": "\u255B",
156
- "lineUpLeftDoubleRightDouble": "\u2567",
157
- "lineUpLeftRight": "\u2534",
158
- "lineUpLeftRightBold": "\u2536",
159
- "lineUpRight": "\u2514",
160
- "lineUpRightArc": "\u2570",
161
- "lineUpRightBold": "\u2515",
162
- "lineUpRightDouble": "\u2558",
163
- "lineVertical": "\u2502",
164
- "lineVerticalBold": "\u2503",
165
- "lineVerticalDashed0": "\u2506",
166
- "lineVerticalDashed1": "\u2507",
167
- "lineVerticalDashed10": "\u257D",
168
- "lineVerticalDashed11": "\u257F",
169
- "lineVerticalDashed2": "\u250A",
170
- "lineVerticalDashed3": "\u250B",
171
- "lineVerticalDashed4": "\u254E",
172
- "lineVerticalDashed5": "\u254F",
173
- "lineVerticalDashed6": "\u2575",
174
- "lineVerticalDashed7": "\u2577",
175
- "lineVerticalDashed8": "\u2579",
176
- "lineVerticalDashed9": "\u257B",
177
- "lineVerticalDouble": "\u2551",
178
- "lozenge": "\u25C6",
179
- "lozengeOutline": "\u25C7",
180
- "musicNote": "\u266A",
181
- "musicNoteBeamed": "\u266B",
182
- "mustache": "\u0DF4",
183
- "nodejs": "\u2B22",
184
- "notEqual": "\u2260",
185
- "oneEighth": "\u215B",
186
- "oneFifth": "\u2155",
187
- "oneHalf": "\xBD",
188
- "oneNinth": "\u2151",
189
- "oneQuarter": "\xBC",
190
- "oneSeventh": "\u2150",
191
- "oneSixth": "\u2159",
192
- "oneTenth": "\u2152",
193
- "oneThird": "\u2153",
194
- "play": "\u25B6",
195
- "pointer": "\u276F",
196
- "pointerSmall": "\u203A",
197
- "questionMarkPrefix": "(?)",
198
- "radioOff": "\u25EF",
199
- "radioOn": "\u25C9",
200
- "sevenEighths": "\u215E",
201
- "smiley": "\u32E1",
202
- "square": "\u2588",
203
- "squareBottom": "\u2584",
204
- "squareCenter": "\u25A0",
205
- "squareDarkShade": "\u2593",
206
- "squareLeft": "\u258C",
207
- "squareLightShade": "\u2591",
208
- "squareMediumShade": "\u2592",
209
- "squareRight": "\u2590",
210
- "squareSmall": "\u25FB",
211
- "squareSmallFilled": "\u25FC",
212
- "squareTop": "\u2580",
213
- "star": "\u2605",
214
- "subscriptEight": "\u2088",
215
- "subscriptFive": "\u2085",
216
- "subscriptFour": "\u2084",
217
- "subscriptNine": "\u2089",
218
- "subscriptOne": "\u2081",
219
- "subscriptSeven": "\u2087",
220
- "subscriptSix": "\u2086",
221
- "subscriptThree": "\u2083",
222
- "subscriptTwo": "\u2082",
223
- "subscriptZero": "\u2080",
224
- "threeEighths": "\u215C",
225
- "threeFifths": "\u2157",
226
- "threeQuarters": "\xBE",
227
- "tick": "\u2714",
228
- "triangleDown": "\u25BC",
229
- "triangleDownSmall": "\u25BE",
230
- "triangleLeft": "\u25C0",
231
- "triangleLeftSmall": "\u25C2",
232
- "triangleRight": "\u25B6",
233
- "triangleRightSmall": "\u25B8",
234
- "triangleUp": "\u25B2",
235
- "triangleUpOutline": "\u25B3",
236
- "triangleUpSmall": "\u25B4",
237
- "twoFifths": "\u2156",
238
- "twoThirds": "\u2154",
239
- "warning": "\u26A0",
240
- }
241
- `);
242
- expect(asciiFigures).toMatchInlineSnapshot(`
243
- {
244
- "almostEqual": "\u2248",
245
- "arrowDown": "\u2193",
246
- "arrowLeft": "\u2190",
247
- "arrowLeftRight": "\u2194",
248
- "arrowRight": "\u2192",
249
- "arrowUp": "\u2191",
250
- "arrowUpDown": "\u2195",
251
- "bullet": "\u25CF",
252
- "checkboxCircleOff": "( )",
253
- "checkboxCircleOn": "(\xD7)",
254
- "checkboxOff": "[ ]",
255
- "checkboxOn": "[\xD7]",
256
- "circle": "( )",
257
- "circleCircle": "(\u25CB)",
258
- "circleCross": "(\xD7)",
259
- "circleDotted": "( )",
260
- "circleDouble": "( )",
261
- "circleFilled": "(*)",
262
- "circlePipe": "(\u2502)",
263
- "circleQuestionMark": "(?)",
264
- "cross": "\xD7",
265
- "dot": "\u2024",
266
- "ellipsis": "\u2026",
267
- "fiveEighths": "\u215D",
268
- "fiveSixths": "\u215A",
269
- "fourFifths": "\u2158",
270
- "greaterOrEqual": "\u2265",
271
- "hamburger": "\u2261",
272
- "heart": "\u2665",
273
- "home": "\u2302",
274
- "identical": "\u2261",
275
- "infinity": "\u221E",
276
- "info": "i",
277
- "lessOrEqual": "\u2264",
278
- "line": "\u2500",
279
- "lineBackslash": "\u2572",
280
- "lineBold": "\u2501",
281
- "lineCross": "\u2573",
282
- "lineDashed0": "\u2504",
283
- "lineDashed1": "\u2505",
284
- "lineDashed10": "\u257C",
285
- "lineDashed11": "\u257E",
286
- "lineDashed12": "\u2212",
287
- "lineDashed13": "\u2013",
288
- "lineDashed14": "\u2010",
289
- "lineDashed15": "\u2043",
290
- "lineDashed2": "\u2508",
291
- "lineDashed3": "\u2509",
292
- "lineDashed4": "\u254C",
293
- "lineDashed5": "\u254D",
294
- "lineDashed6": "\u2574",
295
- "lineDashed7": "\u2576",
296
- "lineDashed8": "\u2578",
297
- "lineDashed9": "\u257A",
298
- "lineDouble": "\u2550",
299
- "lineDownBoldLeft": "\u2512",
300
- "lineDownBoldLeftBold": "\u2513",
301
- "lineDownBoldLeftBoldRight": "\u2531",
302
- "lineDownBoldLeftBoldRightBold": "\u2533",
303
- "lineDownBoldLeftRight": "\u2530",
304
- "lineDownBoldLeftRightBold": "\u2532",
305
- "lineDownBoldRight": "\u250E",
306
- "lineDownBoldRightBold": "\u250F",
307
- "lineDownDoubleLeft": "\u2556",
308
- "lineDownDoubleLeftDouble": "\u2557",
309
- "lineDownDoubleLeftDoubleRightDouble": "\u2566",
310
- "lineDownDoubleLeftRight": "\u2565",
311
- "lineDownDoubleRight": "\u2553",
312
- "lineDownDoubleRightDouble": "\u2554",
313
- "lineDownLeft": "\u2510",
314
- "lineDownLeftArc": "\u256E",
315
- "lineDownLeftBold": "\u2511",
316
- "lineDownLeftBoldRight": "\u252D",
317
- "lineDownLeftBoldRightBold": "\u252F",
318
- "lineDownLeftDouble": "\u2555",
319
- "lineDownLeftDoubleRightDouble": "\u2564",
320
- "lineDownLeftRight": "\u252C",
321
- "lineDownLeftRightBold": "\u252E",
322
- "lineDownRight": "\u250C",
323
- "lineDownRightArc": "\u256D",
324
- "lineDownRightBold": "\u250D",
325
- "lineDownRightDouble": "\u2552",
326
- "lineSlash": "\u2571",
327
- "lineUpBoldDownBoldLeft": "\u2528",
328
- "lineUpBoldDownBoldLeftBold": "\u252B",
329
- "lineUpBoldDownBoldLeftBoldRight": "\u2549",
330
- "lineUpBoldDownBoldLeftBoldRightBold": "\u254B",
331
- "lineUpBoldDownBoldLeftRight": "\u2542",
332
- "lineUpBoldDownBoldLeftRightBold": "\u254A",
333
- "lineUpBoldDownBoldRight": "\u2520",
334
- "lineUpBoldDownBoldRightBold": "\u2523",
335
- "lineUpBoldDownLeft": "\u2526",
336
- "lineUpBoldDownLeftBold": "\u2529",
337
- "lineUpBoldDownLeftBoldRight": "\u2543",
338
- "lineUpBoldDownLeftBoldRightBold": "\u2547",
339
- "lineUpBoldDownLeftRight": "\u2540",
340
- "lineUpBoldDownLeftRightBold": "\u2544",
341
- "lineUpBoldDownRight": "\u251E",
342
- "lineUpBoldDownRightBold": "\u2521",
343
- "lineUpBoldLeft": "\u251A",
344
- "lineUpBoldLeftBold": "\u251B",
345
- "lineUpBoldLeftBoldRight": "\u2539",
346
- "lineUpBoldLeftBoldRightBold": "\u253B",
347
- "lineUpBoldLeftRight": "\u2538",
348
- "lineUpBoldLeftRightBold": "\u253A",
349
- "lineUpBoldRight": "\u2516",
350
- "lineUpBoldRightBold": "\u2517",
351
- "lineUpDoubleDownDoubleLeft": "\u2562",
352
- "lineUpDoubleDownDoubleLeftDouble": "\u2563",
353
- "lineUpDoubleDownDoubleLeftDoubleRightDouble": "\u256C",
354
- "lineUpDoubleDownDoubleLeftRight": "\u256B",
355
- "lineUpDoubleDownDoubleRight": "\u255F",
356
- "lineUpDoubleDownDoubleRightDouble": "\u2560",
357
- "lineUpDoubleLeft": "\u255C",
358
- "lineUpDoubleLeftDouble": "\u255D",
359
- "lineUpDoubleLeftDoubleRightDouble": "\u2569",
360
- "lineUpDoubleLeftRight": "\u2568",
361
- "lineUpDoubleRight": "\u2559",
362
- "lineUpDoubleRightDouble": "\u255A",
363
- "lineUpDownBoldLeft": "\u2527",
364
- "lineUpDownBoldLeftBold": "\u252A",
365
- "lineUpDownBoldLeftBoldRight": "\u2545",
366
- "lineUpDownBoldLeftBoldRightBold": "\u2548",
367
- "lineUpDownBoldLeftRight": "\u2541",
368
- "lineUpDownBoldLeftRightBold": "\u2546",
369
- "lineUpDownBoldRight": "\u251F",
370
- "lineUpDownBoldRightBold": "\u2522",
371
- "lineUpDownLeft": "\u2524",
372
- "lineUpDownLeftBold": "\u2525",
373
- "lineUpDownLeftBoldRight": "\u253D",
374
- "lineUpDownLeftBoldRightBold": "\u253F",
375
- "lineUpDownLeftDouble": "\u2561",
376
- "lineUpDownLeftDoubleRightDouble": "\u256A",
377
- "lineUpDownLeftRight": "\u253C",
378
- "lineUpDownLeftRightBold": "\u253E",
379
- "lineUpDownRight": "\u251C",
380
- "lineUpDownRightBold": "\u251D",
381
- "lineUpDownRightDouble": "\u255E",
382
- "lineUpLeft": "\u2518",
383
- "lineUpLeftArc": "\u256F",
384
- "lineUpLeftBold": "\u2519",
385
- "lineUpLeftBoldRight": "\u2535",
386
- "lineUpLeftBoldRightBold": "\u2537",
387
- "lineUpLeftDouble": "\u255B",
388
- "lineUpLeftDoubleRightDouble": "\u2567",
389
- "lineUpLeftRight": "\u2534",
390
- "lineUpLeftRightBold": "\u2536",
391
- "lineUpRight": "\u2514",
392
- "lineUpRightArc": "\u2570",
393
- "lineUpRightBold": "\u2515",
394
- "lineUpRightDouble": "\u2558",
395
- "lineVertical": "\u2502",
396
- "lineVerticalBold": "\u2503",
397
- "lineVerticalDashed0": "\u2506",
398
- "lineVerticalDashed1": "\u2507",
399
- "lineVerticalDashed10": "\u257D",
400
- "lineVerticalDashed11": "\u257F",
401
- "lineVerticalDashed2": "\u250A",
402
- "lineVerticalDashed3": "\u250B",
403
- "lineVerticalDashed4": "\u254E",
404
- "lineVerticalDashed5": "\u254F",
405
- "lineVerticalDashed6": "\u2575",
406
- "lineVerticalDashed7": "\u2577",
407
- "lineVerticalDashed8": "\u2579",
408
- "lineVerticalDashed9": "\u257B",
409
- "lineVerticalDouble": "\u2551",
410
- "lozenge": "\u2666",
411
- "lozengeOutline": "\u25CA",
412
- "musicNote": "\u266A",
413
- "musicNoteBeamed": "\u266B",
414
- "mustache": "\u250C\u2500\u2510",
415
- "nodejs": "\u2666",
416
- "notEqual": "\u2260",
417
- "oneEighth": "\u215B",
418
- "oneFifth": "\u2155",
419
- "oneHalf": "\xBD",
420
- "oneNinth": "1/9",
421
- "oneQuarter": "\xBC",
422
- "oneSeventh": "1/7",
423
- "oneSixth": "\u2159",
424
- "oneTenth": "1/10",
425
- "oneThird": "\u2153",
426
- "play": "\u25BA",
427
- "pointer": ">",
428
- "pointerSmall": "\u203A",
429
- "questionMarkPrefix": "(?)",
430
- "radioOff": "( )",
431
- "radioOn": "(*)",
432
- "sevenEighths": "\u215E",
433
- "smiley": "\u263A",
434
- "square": "\u2588",
435
- "squareBottom": "\u2584",
436
- "squareCenter": "\u25A0",
437
- "squareDarkShade": "\u2593",
438
- "squareLeft": "\u258C",
439
- "squareLightShade": "\u2591",
440
- "squareMediumShade": "\u2592",
441
- "squareRight": "\u2590",
442
- "squareSmall": "\u25A1",
443
- "squareSmallFilled": "\u25A0",
444
- "squareTop": "\u2580",
445
- "star": "\u2736",
446
- "subscriptEight": "\u2088",
447
- "subscriptFive": "\u2085",
448
- "subscriptFour": "\u2084",
449
- "subscriptNine": "\u2089",
450
- "subscriptOne": "\u2081",
451
- "subscriptSeven": "\u2087",
452
- "subscriptSix": "\u2086",
453
- "subscriptThree": "\u2083",
454
- "subscriptTwo": "\u2082",
455
- "subscriptZero": "\u2080",
456
- "threeEighths": "\u215C",
457
- "threeFifths": "\u2157",
458
- "threeQuarters": "\xBE",
459
- "tick": "\u221A",
460
- "triangleDown": "\u25BC",
461
- "triangleDownSmall": "\u25BE",
462
- "triangleLeft": "\u25C4",
463
- "triangleLeftSmall": "\u25C2",
464
- "triangleRight": "\u25BA",
465
- "triangleRightSmall": "\u25B8",
466
- "triangleUp": "\u25B2",
467
- "triangleUpOutline": "\u2206",
468
- "triangleUpSmall": "\u25B4",
469
- "twoFifths": "\u2156",
470
- "twoThirds": "\u2154",
471
- "warning": "\u203C",
472
- }
473
- `);
474
- });
@@ -1,5 +0,0 @@
1
- import type { ConfirmPromptOptions } from "../../core-types.js";
2
- /**
3
- * Prompts the user with a yes/no question, returning a boolean based on their input.
4
- */
5
- export declare function confirmPrompt(options: ConfirmPromptOptions): Promise<boolean>;
@@ -1,173 +0,0 @@
1
- import { colorize, re } from "@reliverse/relico";
2
- import { stdin as input, stdout as output } from "node:process";
3
- import readline from "node:readline/promises";
4
- import { bar, msg } from "../msg-fmt/messages.js";
5
- import { deleteLastLine } from "../msg-fmt/terminal.js";
6
- import { completePrompt } from "../utils/prompt-end.js";
7
- function renderPrompt(params) {
8
- const {
9
- title,
10
- content,
11
- borderColor,
12
- titleColor,
13
- titleTypography,
14
- titleVariant,
15
- contentColor,
16
- contentTypography,
17
- contentVariant,
18
- hintPlaceholderColor,
19
- border,
20
- variantOptions,
21
- errorMessage,
22
- displayInstructions,
23
- instructions,
24
- isRerender = false
25
- } = params;
26
- let uiLineCount = 0;
27
- if (!isRerender) {
28
- msg({
29
- hintPlaceholderColor,
30
- type: errorMessage ? "M_ERROR" : "M_GENERAL",
31
- title,
32
- titleColor,
33
- titleTypography,
34
- ...titleVariant ? { titleVariant } : {},
35
- ...content ? {
36
- content: content.split("\n").map((line) => line.trim()).join("\n")
37
- } : {},
38
- contentColor,
39
- contentTypography,
40
- ...contentVariant ? { contentVariant } : {},
41
- borderColor,
42
- variantOptions,
43
- errorMessage,
44
- border
45
- });
46
- }
47
- if (displayInstructions && !isRerender) {
48
- msg({
49
- type: "M_NULL",
50
- title: re.blue(instructions)
51
- });
52
- uiLineCount++;
53
- }
54
- if (errorMessage) {
55
- msg({
56
- type: "M_NULL",
57
- title: re.redBright(errorMessage)
58
- });
59
- uiLineCount++;
60
- }
61
- return uiLineCount;
62
- }
63
- export async function confirmPrompt(options) {
64
- const {
65
- title = "",
66
- defaultValue,
67
- titleColor = "cyan",
68
- titleTypography = "none",
69
- titleVariant,
70
- content,
71
- contentColor = "dim",
72
- contentTypography = "italic",
73
- contentVariant,
74
- borderColor = "dim",
75
- hintPlaceholderColor = "blue",
76
- variantOptions,
77
- action,
78
- displayInstructions = false,
79
- endTitle = "",
80
- endTitleColor = "dim",
81
- border = true
82
- } = options;
83
- const rl = readline.createInterface({ input, output });
84
- let errorMessage = "";
85
- const effectiveDefault = defaultValue ?? true;
86
- const defaultHint = effectiveDefault ? "[Y/n]" : "[y/N]";
87
- const adjustedTitle = displayInstructions ? title : `${re.blue(defaultHint)} ${title}`;
88
- const instructions = `Use <y/n> to confirm or deny, <Enter> for default (${effectiveDefault ? "Y" : "N"}), <Ctrl+C> to exit`;
89
- let lastUILineCount = 0;
90
- function endPrompt(isCtrlC = false) {
91
- if (endTitle !== "") {
92
- msg({
93
- type: "M_END",
94
- title: endTitle,
95
- titleColor: endTitleColor,
96
- titleTypography,
97
- ...titleVariant ? { titleVariant } : {},
98
- border,
99
- borderColor
100
- });
101
- }
102
- rl.close();
103
- if (isCtrlC) {
104
- process.exit(0);
105
- }
106
- }
107
- rl.on("SIGINT", () => {
108
- endPrompt(true);
109
- });
110
- try {
111
- while (true) {
112
- if (lastUILineCount > 0) {
113
- for (let i = 0; i < lastUILineCount; i++) {
114
- process.stdout.write("\x1B[1A\x1B[2K");
115
- }
116
- }
117
- lastUILineCount = renderPrompt({
118
- title: adjustedTitle,
119
- ...content ? { content } : {},
120
- borderColor,
121
- titleColor,
122
- titleTypography,
123
- ...titleVariant ? { titleVariant } : {},
124
- contentColor,
125
- contentTypography,
126
- ...contentVariant ? { contentVariant } : {},
127
- hintPlaceholderColor,
128
- border,
129
- variantOptions,
130
- errorMessage,
131
- effectiveDefault,
132
- displayInstructions,
133
- defaultHint,
134
- instructions,
135
- isRerender: errorMessage !== ""
136
- // Only rerender if there's an error
137
- });
138
- const formattedBar = bar({ borderColor });
139
- const answer = (await rl.question(`${formattedBar} `)).toLowerCase().trim();
140
- let result;
141
- if (!answer) {
142
- deleteLastLine();
143
- msg({
144
- type: "M_NULL",
145
- title: `${colorize(re.reset(formattedBar), borderColor)} ${re.reset(effectiveDefault ? "y" : "n")}`
146
- });
147
- result = effectiveDefault;
148
- } else if (answer === "y" || answer === "yes") {
149
- result = true;
150
- } else if (answer === "n" || answer === "no") {
151
- result = false;
152
- } else {
153
- errorMessage = 'Please answer with "y" or "n".';
154
- deleteLastLine();
155
- continue;
156
- }
157
- return await completePrompt(
158
- "confirm",
159
- false,
160
- endTitle,
161
- endTitleColor,
162
- titleTypography,
163
- titleVariant ? titleVariant : void 0,
164
- border,
165
- borderColor,
166
- action,
167
- result
168
- );
169
- }
170
- } finally {
171
- rl.close();
172
- }
173
- }
@@ -1,16 +0,0 @@
1
- import type { InputPromptOptions } from "../../core-types.js";
2
- /**
3
- * inputPrompt()
4
- *
5
- * Main entry point to prompt the user for input.
6
- * - Renders a text prompt with optional hint, placeholder, and content.
7
- * - Waits for user input (supporting "plain" or "password" modes).
8
- * - Validates input with an optional TypeBox schema or custom validate() fn.
9
- * - Shows errors if invalid, re-prompts if necessary.
10
- * - Handles Ctrl+C gracefully, optionally printing an endTitle.
11
- * - Returns the user's validated input, or a default value if empty.
12
- *
13
- * @param options InputPromptOptions to customize the prompt.
14
- * @returns A Promise resolving to the validated user input (string).
15
- */
16
- export declare function inputPrompt(options: InputPromptOptions): Promise<string>;