@reliverse/relinka 1.1.10 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -42
  3. package/dist-npm/components/core/core.d.ts +2 -0
  4. package/dist-npm/components/core/core.js +2 -0
  5. package/dist-npm/{utils/constants.d.ts → components/levels/levels.d.ts} +1 -1
  6. package/dist-npm/components/{prompts/create.d.ts → modes/basic.d.ts} +3 -3
  7. package/dist-npm/components/{instance → modes}/basic.js +4 -4
  8. package/dist-npm/components/{instance → modes}/browser.d.ts +2 -2
  9. package/dist-npm/components/modes/browser.js +12 -0
  10. package/dist-npm/components/modes/shared.d.ts +5 -0
  11. package/dist-npm/components/modes/shared.js +2 -0
  12. package/dist-npm/components/{prompts → relinka}/relinka.d.ts +2 -4
  13. package/dist-npm/components/{prompts → relinka}/relinka.js +1 -7
  14. package/dist-npm/components/{instance/reporter → reporters}/basic.d.ts +1 -1
  15. package/dist-npm/components/{instance/reporter → reporters}/basic.js +2 -2
  16. package/dist-npm/components/{instance/reporter → reporters}/browser.d.ts +1 -1
  17. package/dist-npm/components/{instance/reporter → reporters}/fancy.d.ts +3 -3
  18. package/dist-npm/components/{instance/reporter → reporters}/fancy.js +5 -7
  19. package/dist-npm/main.d.ts +8 -1
  20. package/dist-npm/main.js +34 -1
  21. package/dist-npm/types/mod.d.ts +42 -0
  22. package/dist-npm/utils/color.js +4 -1
  23. package/dist-npm/utils/mod.d.ts +3 -0
  24. package/dist-npm/utils/mod.js +9 -0
  25. package/package.json +3 -2
  26. package/dist-npm/components/anykey/index.d.ts +0 -7
  27. package/dist-npm/components/anykey/index.js +0 -61
  28. package/dist-npm/components/block/block.d.ts +0 -10
  29. package/dist-npm/components/block/block.js +0 -52
  30. package/dist-npm/components/checkbox/index.d.ts +0 -3
  31. package/dist-npm/components/checkbox/index.js +0 -217
  32. package/dist-npm/components/confirm/confirm-main.d.ts +0 -3
  33. package/dist-npm/components/confirm/confirm-main.js +0 -98
  34. package/dist-npm/components/confirm/confirm-three.d.ts +0 -13
  35. package/dist-npm/components/confirm/confirm-three.js +0 -26
  36. package/dist-npm/components/confirm/index.d.ts +0 -2
  37. package/dist-npm/components/confirm/index.js +0 -41
  38. package/dist-npm/components/core/Separator.d.ts +0 -6
  39. package/dist-npm/components/core/Separator.js +0 -18
  40. package/dist-npm/components/core/create-prompt.d.ts +0 -4
  41. package/dist-npm/components/core/create-prompt.js +0 -107
  42. package/dist-npm/components/core/errors.d.ts +0 -20
  43. package/dist-npm/components/core/errors.js +0 -21
  44. package/dist-npm/components/core/hook-engine.d.ts +0 -23
  45. package/dist-npm/components/core/hook-engine.js +0 -109
  46. package/dist-npm/components/core/index.d.ts +0 -13
  47. package/dist-npm/components/core/index.js +0 -12
  48. package/dist-npm/components/core/key.d.ts +0 -10
  49. package/dist-npm/components/core/key.js +0 -16
  50. package/dist-npm/components/core/lines.d.ts +0 -14
  51. package/dist-npm/components/core/lines.js +0 -52
  52. package/dist-npm/components/core/make-theme.d.ts +0 -3
  53. package/dist-npm/components/core/make-theme.js +0 -28
  54. package/dist-npm/components/core/position.d.ts +0 -12
  55. package/dist-npm/components/core/position.js +0 -29
  56. package/dist-npm/components/core/promise-polyfill.d.ts +0 -7
  57. package/dist-npm/components/core/promise-polyfill.js +0 -13
  58. package/dist-npm/components/core/screen-manager.d.ts +0 -14
  59. package/dist-npm/components/core/screen-manager.js +0 -67
  60. package/dist-npm/components/core/theme.d.ts +0 -21
  61. package/dist-npm/components/core/theme.js +0 -24
  62. package/dist-npm/components/core/use-effect.d.ts +0 -2
  63. package/dist-npm/components/core/use-effect.js +0 -11
  64. package/dist-npm/components/core/use-keypress.d.ts +0 -3
  65. package/dist-npm/components/core/use-keypress.js +0 -21
  66. package/dist-npm/components/core/use-memo.d.ts +0 -1
  67. package/dist-npm/components/core/use-memo.js +0 -12
  68. package/dist-npm/components/core/use-pagination.d.ts +0 -11
  69. package/dist-npm/components/core/use-pagination.js +0 -34
  70. package/dist-npm/components/core/use-prefix.d.ts +0 -5
  71. package/dist-npm/components/core/use-prefix.js +0 -42
  72. package/dist-npm/components/core/use-ref.d.ts +0 -6
  73. package/dist-npm/components/core/use-ref.js +0 -4
  74. package/dist-npm/components/core/use-state.d.ts +0 -4
  75. package/dist-npm/components/core/use-state.js +0 -17
  76. package/dist-npm/components/core/useKeyPress.d.ts +0 -4
  77. package/dist-npm/components/core/useKeyPress.js +0 -16
  78. package/dist-npm/components/core/usePromptState.d.ts +0 -6
  79. package/dist-npm/components/core/usePromptState.js +0 -10
  80. package/dist-npm/components/core/utils.d.ts +0 -2
  81. package/dist-npm/components/core/utils.js +0 -11
  82. package/dist-npm/components/date/date.d.ts +0 -6
  83. package/dist-npm/components/date/date.js +0 -210
  84. package/dist-npm/components/editor/index.d.ts +0 -2
  85. package/dist-npm/components/editor/index.js +0 -78
  86. package/dist-npm/components/expand/index.d.ts +0 -3
  87. package/dist-npm/components/expand/index.js +0 -119
  88. package/dist-npm/components/figures/index.d.ts +0 -465
  89. package/dist-npm/components/figures/index.js +0 -299
  90. package/dist-npm/components/input/index.d.ts +0 -2
  91. package/dist-npm/components/input/index.js +0 -66
  92. package/dist-npm/components/input/text-main.d.ts +0 -3
  93. package/dist-npm/components/input/text-main.js +0 -103
  94. package/dist-npm/components/input/text.d.ts +0 -11
  95. package/dist-npm/components/input/text.js +0 -26
  96. package/dist-npm/components/instance/basic.d.ts +0 -8
  97. package/dist-npm/components/instance/browser.js +0 -18
  98. package/dist-npm/components/instance/shared.d.ts +0 -6
  99. package/dist-npm/components/instance/shared.js +0 -2
  100. package/dist-npm/components/mono/mono.d.ts +0 -5
  101. package/dist-npm/components/mono/mono.js +0 -64
  102. package/dist-npm/components/mono/monoTwo.d.ts +0 -30
  103. package/dist-npm/components/mono/monoTwo.js +0 -37
  104. package/dist-npm/components/multiselect/group-multiselect.d.ts +0 -23
  105. package/dist-npm/components/multiselect/group-multiselect.js +0 -58
  106. package/dist-npm/components/multiselect/multi-select-two.d.ts +0 -3
  107. package/dist-npm/components/multiselect/multi-select-two.js +0 -111
  108. package/dist-npm/components/multiselect/multi-select.d.ts +0 -21
  109. package/dist-npm/components/multiselect/multi-select.js +0 -45
  110. package/dist-npm/components/multiselect/multiselect-main.d.ts +0 -18
  111. package/dist-npm/components/multiselect/multiselect-main.js +0 -166
  112. package/dist-npm/components/multiselect/num-multi-select.d.ts +0 -3
  113. package/dist-npm/components/multiselect/num-multi-select.js +0 -111
  114. package/dist-npm/components/multiselect/num-multiselect-main.d.ts +0 -6
  115. package/dist-npm/components/multiselect/num-multiselect-main.js +0 -28
  116. package/dist-npm/components/next-steps/next-steps.d.ts +0 -2
  117. package/dist-npm/components/next-steps/next-steps.js +0 -24
  118. package/dist-npm/components/number/index.d.ts +0 -2
  119. package/dist-npm/components/number/index.js +0 -100
  120. package/dist-npm/components/number/number-main.d.ts +0 -3
  121. package/dist-npm/components/number/number-main.js +0 -95
  122. package/dist-npm/components/password/index.d.ts +0 -2
  123. package/dist-npm/components/password/index.js +0 -59
  124. package/dist-npm/components/password/password-main.d.ts +0 -3
  125. package/dist-npm/components/password/password-main.js +0 -119
  126. package/dist-npm/components/password/password-three.d.ts +0 -13
  127. package/dist-npm/components/password/password-three.js +0 -28
  128. package/dist-npm/components/progressbar/ProgressBar.d.ts +0 -22
  129. package/dist-npm/components/progressbar/ProgressBar.js +0 -53
  130. package/dist-npm/components/progressbar/helper.d.ts +0 -6
  131. package/dist-npm/components/progressbar/helper.js +0 -38
  132. package/dist-npm/components/progressbar/index.d.ts +0 -2
  133. package/dist-npm/components/progressbar/index.js +0 -1
  134. package/dist-npm/components/prompts/create.js +0 -35
  135. package/dist-npm/components/prompts/index.d.ts +0 -49
  136. package/dist-npm/components/prompts/index.js +0 -46
  137. package/dist-npm/components/prompts/prompt.d.ts +0 -36
  138. package/dist-npm/components/prompts/prompt.js +0 -232
  139. package/dist-npm/components/prompts/promptTwo.d.ts +0 -92
  140. package/dist-npm/components/prompts/promptTwo.js +0 -653
  141. package/dist-npm/components/range/range.d.ts +0 -62
  142. package/dist-npm/components/range/range.js +0 -270
  143. package/dist-npm/components/rawlist/index.d.ts +0 -3
  144. package/dist-npm/components/rawlist/index.js +0 -104
  145. package/dist-npm/components/results/results.d.ts +0 -10
  146. package/dist-npm/components/results/results.js +0 -34
  147. package/dist-npm/components/search/index.d.ts +0 -3
  148. package/dist-npm/components/search/index.js +0 -186
  149. package/dist-npm/components/select/index.d.ts +0 -3
  150. package/dist-npm/components/select/index.js +0 -176
  151. package/dist-npm/components/select/num-select-main.d.ts +0 -8
  152. package/dist-npm/components/select/num-select-main.js +0 -30
  153. package/dist-npm/components/select/num-select.d.ts +0 -5
  154. package/dist-npm/components/select/num-select.js +0 -125
  155. package/dist-npm/components/select/select-key.d.ts +0 -15
  156. package/dist-npm/components/select/select-key.js +0 -26
  157. package/dist-npm/components/select/select-main.d.ts +0 -19
  158. package/dist-npm/components/select/select-main.js +0 -151
  159. package/dist-npm/components/select/select-three.d.ts +0 -18
  160. package/dist-npm/components/select/select-three.js +0 -35
  161. package/dist-npm/components/select/select-two.d.ts +0 -2
  162. package/dist-npm/components/select/select-two.js +0 -98
  163. package/dist-npm/components/spinner/index.d.ts +0 -15
  164. package/dist-npm/components/spinner/index.js +0 -110
  165. package/dist-npm/components/st-end/end.d.ts +0 -2
  166. package/dist-npm/components/st-end/end.js +0 -35
  167. package/dist-npm/components/st-end/start.d.ts +0 -2
  168. package/dist-npm/components/st-end/start.js +0 -32
  169. package/dist-npm/components/toggle/index.d.ts +0 -13
  170. package/dist-npm/components/toggle/index.js +0 -121
  171. package/dist-npm/components/visual/animate/animate.d.ts +0 -13
  172. package/dist-npm/components/visual/animate/animate.js +0 -55
  173. package/dist-npm/components/visual/ascii-art/ascii-art.d.ts +0 -6
  174. package/dist-npm/components/visual/ascii-art/ascii-art.js +0 -12
  175. package/dist-npm/testing/index.d.ts +0 -18
  176. package/dist-npm/testing/index.js +0 -64
  177. package/dist-npm/types/general.d.ts +0 -134
  178. package/dist-npm/types/index.d.ts +0 -2
  179. package/dist-npm/types/index.js +0 -2
  180. package/dist-npm/types/keypress.d.ts +0 -52
  181. package/dist-npm/types/keypress.js +0 -37
  182. package/dist-npm/types/readline.d.ts +0 -30
  183. package/dist-npm/types/readline.js +0 -0
  184. package/dist-npm/types/relinka.d.ts +0 -30
  185. package/dist-npm/types/relinka.js +0 -0
  186. package/dist-npm/types/utils.d.ts +0 -17
  187. package/dist-npm/types/utils.js +0 -0
  188. package/dist-npm/utils/colorize.d.ts +0 -2
  189. package/dist-npm/utils/colorize.js +0 -130
  190. package/dist-npm/utils/component.d.ts +0 -101
  191. package/dist-npm/utils/component.js +0 -630
  192. package/dist-npm/utils/core.d.ts +0 -2
  193. package/dist-npm/utils/core.js +0 -2
  194. package/dist-npm/utils/decoder.d.ts +0 -14
  195. package/dist-npm/utils/decoder.js +0 -281
  196. package/dist-npm/utils/errors.d.ts +0 -1
  197. package/dist-npm/utils/errors.js +0 -15
  198. package/dist-npm/utils/keypress.d.ts +0 -7
  199. package/dist-npm/utils/keypress.js +0 -327
  200. package/dist-npm/utils/mapping.d.ts +0 -4
  201. package/dist-npm/utils/mapping.js +0 -49
  202. package/dist-npm/utils/messages.d.ts +0 -17
  203. package/dist-npm/utils/messages.js +0 -213
  204. package/dist-npm/utils/platforms.d.ts +0 -1
  205. package/dist-npm/utils/platforms.js +0 -22
  206. package/dist-npm/utils/prompt-tmp.d.ts +0 -13
  207. package/dist-npm/utils/prompt-tmp.js +0 -254
  208. package/dist-npm/utils/prompt-two.d.ts +0 -13
  209. package/dist-npm/utils/prompt-two.js +0 -254
  210. package/dist-npm/utils/readline.d.ts +0 -2
  211. package/dist-npm/utils/readline.js +0 -9
  212. package/dist-npm/utils/skeleton.d.ts +0 -7
  213. package/dist-npm/utils/skeleton.js +0 -145
  214. package/dist-npm/utils/terminal.d.ts +0 -5
  215. package/dist-npm/utils/terminal.js +0 -33
  216. package/dist-npm/utils/types.d.ts +0 -0
  217. package/dist-npm/utils/types.js +0 -0
  218. package/dist-npm/utils/utils.d.ts +0 -3
  219. package/dist-npm/utils/utils.js +0 -9
  220. package/dist-npm/utils/variants.d.ts +0 -9
  221. package/dist-npm/utils/variants.js +0 -49
  222. /package/dist-npm/{utils/constants.js → components/levels/levels.js} +0 -0
  223. /package/dist-npm/components/{instance/reporter → reporters}/browser.js +0 -0
  224. /package/dist-npm/types/{general.js → mod.js} +0 -0
@@ -1,299 +0,0 @@
1
- import process from "node:process";
2
- function isUnicodeSupported() {
3
- if (process.platform !== "win32") {
4
- return process.env.TERM !== "linux";
5
- }
6
- return Boolean(process.env.WT_SESSION) ||
7
- Boolean(process.env.TERMINUS_SUBLIME) ||
8
- process.env.ConEmuTask === "{cmd::Cmder}" ||
9
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
10
- }
11
- const common = {
12
- circleQuestionMark: "(?)",
13
- questionMarkPrefix: "(?)",
14
- square: "\u2588",
15
- squareDarkShade: "\u2593",
16
- squareMediumShade: "\u2592",
17
- squareLightShade: "\u2591",
18
- squareTop: "\u2580",
19
- squareBottom: "\u2584",
20
- squareLeft: "\u258C",
21
- squareRight: "\u2590",
22
- squareCenter: "\u25A0",
23
- bullet: "\u25CF",
24
- dot: "\u2024",
25
- ellipsis: "\u2026",
26
- pointerSmall: "\u203A",
27
- triangleUp: "\u25B2",
28
- triangleUpSmall: "\u25B4",
29
- triangleDown: "\u25BC",
30
- triangleDownSmall: "\u25BE",
31
- triangleLeftSmall: "\u25C2",
32
- triangleRightSmall: "\u25B8",
33
- home: "\u2302",
34
- heart: "\u2665",
35
- musicNote: "\u266A",
36
- musicNoteBeamed: "\u266B",
37
- arrowUp: "\u2191",
38
- arrowDown: "\u2193",
39
- arrowLeft: "\u2190",
40
- arrowRight: "\u2192",
41
- arrowLeftRight: "\u2194",
42
- arrowUpDown: "\u2195",
43
- almostEqual: "\u2248",
44
- notEqual: "\u2260",
45
- lessOrEqual: "\u2264",
46
- greaterOrEqual: "\u2265",
47
- identical: "\u2261",
48
- infinity: "\u221E",
49
- subscriptZero: "\u2080",
50
- subscriptOne: "\u2081",
51
- subscriptTwo: "\u2082",
52
- subscriptThree: "\u2083",
53
- subscriptFour: "\u2084",
54
- subscriptFive: "\u2085",
55
- subscriptSix: "\u2086",
56
- subscriptSeven: "\u2087",
57
- subscriptEight: "\u2088",
58
- subscriptNine: "\u2089",
59
- oneHalf: "\xBD",
60
- oneThird: "\u2153",
61
- oneQuarter: "\xBC",
62
- oneFifth: "\u2155",
63
- oneSixth: "\u2159",
64
- oneEighth: "\u215B",
65
- twoThirds: "\u2154",
66
- twoFifths: "\u2156",
67
- threeQuarters: "\xBE",
68
- threeFifths: "\u2157",
69
- threeEighths: "\u215C",
70
- fourFifths: "\u2158",
71
- fiveSixths: "\u215A",
72
- fiveEighths: "\u215D",
73
- sevenEighths: "\u215E",
74
- line: "\u2500",
75
- lineBold: "\u2501",
76
- lineDouble: "\u2550",
77
- lineDashed0: "\u2504",
78
- lineDashed1: "\u2505",
79
- lineDashed2: "\u2508",
80
- lineDashed3: "\u2509",
81
- lineDashed4: "\u254C",
82
- lineDashed5: "\u254D",
83
- lineDashed6: "\u2574",
84
- lineDashed7: "\u2576",
85
- lineDashed8: "\u2578",
86
- lineDashed9: "\u257A",
87
- lineDashed10: "\u257C",
88
- lineDashed11: "\u257E",
89
- lineDashed12: "\u2212",
90
- lineDashed13: "\u2013",
91
- lineDashed14: "\u2010",
92
- lineDashed15: "\u2043",
93
- lineVertical: "\u2502",
94
- lineVerticalBold: "\u2503",
95
- lineVerticalDouble: "\u2551",
96
- lineVerticalDashed0: "\u2506",
97
- lineVerticalDashed1: "\u2507",
98
- lineVerticalDashed2: "\u250A",
99
- lineVerticalDashed3: "\u250B",
100
- lineVerticalDashed4: "\u254E",
101
- lineVerticalDashed5: "\u254F",
102
- lineVerticalDashed6: "\u2575",
103
- lineVerticalDashed7: "\u2577",
104
- lineVerticalDashed8: "\u2579",
105
- lineVerticalDashed9: "\u257B",
106
- lineVerticalDashed10: "\u257D",
107
- lineVerticalDashed11: "\u257F",
108
- lineDownLeft: "\u2510",
109
- lineDownLeftArc: "\u256E",
110
- lineDownBoldLeftBold: "\u2513",
111
- lineDownBoldLeft: "\u2512",
112
- lineDownLeftBold: "\u2511",
113
- lineDownDoubleLeftDouble: "\u2557",
114
- lineDownDoubleLeft: "\u2556",
115
- lineDownLeftDouble: "\u2555",
116
- lineDownRight: "\u250C",
117
- lineDownRightArc: "\u256D",
118
- lineDownBoldRightBold: "\u250F",
119
- lineDownBoldRight: "\u250E",
120
- lineDownRightBold: "\u250D",
121
- lineDownDoubleRightDouble: "\u2554",
122
- lineDownDoubleRight: "\u2553",
123
- lineDownRightDouble: "\u2552",
124
- lineUpLeft: "\u2518",
125
- lineUpLeftArc: "\u256F",
126
- lineUpBoldLeftBold: "\u251B",
127
- lineUpBoldLeft: "\u251A",
128
- lineUpLeftBold: "\u2519",
129
- lineUpDoubleLeftDouble: "\u255D",
130
- lineUpDoubleLeft: "\u255C",
131
- lineUpLeftDouble: "\u255B",
132
- lineUpRight: "\u2514",
133
- lineUpRightArc: "\u2570",
134
- lineUpBoldRightBold: "\u2517",
135
- lineUpBoldRight: "\u2516",
136
- lineUpRightBold: "\u2515",
137
- lineUpDoubleRightDouble: "\u255A",
138
- lineUpDoubleRight: "\u2559",
139
- lineUpRightDouble: "\u2558",
140
- lineUpDownLeft: "\u2524",
141
- lineUpBoldDownBoldLeftBold: "\u252B",
142
- lineUpBoldDownBoldLeft: "\u2528",
143
- lineUpDownLeftBold: "\u2525",
144
- lineUpBoldDownLeftBold: "\u2529",
145
- lineUpDownBoldLeftBold: "\u252A",
146
- lineUpDownBoldLeft: "\u2527",
147
- lineUpBoldDownLeft: "\u2526",
148
- lineUpDoubleDownDoubleLeftDouble: "\u2563",
149
- lineUpDoubleDownDoubleLeft: "\u2562",
150
- lineUpDownLeftDouble: "\u2561",
151
- lineUpDownRight: "\u251C",
152
- lineUpBoldDownBoldRightBold: "\u2523",
153
- lineUpBoldDownBoldRight: "\u2520",
154
- lineUpDownRightBold: "\u251D",
155
- lineUpBoldDownRightBold: "\u2521",
156
- lineUpDownBoldRightBold: "\u2522",
157
- lineUpDownBoldRight: "\u251F",
158
- lineUpBoldDownRight: "\u251E",
159
- lineUpDoubleDownDoubleRightDouble: "\u2560",
160
- lineUpDoubleDownDoubleRight: "\u255F",
161
- lineUpDownRightDouble: "\u255E",
162
- lineDownLeftRight: "\u252C",
163
- lineDownBoldLeftBoldRightBold: "\u2533",
164
- lineDownLeftBoldRightBold: "\u252F",
165
- lineDownBoldLeftRight: "\u2530",
166
- lineDownBoldLeftBoldRight: "\u2531",
167
- lineDownBoldLeftRightBold: "\u2532",
168
- lineDownLeftRightBold: "\u252E",
169
- lineDownLeftBoldRight: "\u252D",
170
- lineDownDoubleLeftDoubleRightDouble: "\u2566",
171
- lineDownDoubleLeftRight: "\u2565",
172
- lineDownLeftDoubleRightDouble: "\u2564",
173
- lineUpLeftRight: "\u2534",
174
- lineUpBoldLeftBoldRightBold: "\u253B",
175
- lineUpLeftBoldRightBold: "\u2537",
176
- lineUpBoldLeftRight: "\u2538",
177
- lineUpBoldLeftBoldRight: "\u2539",
178
- lineUpBoldLeftRightBold: "\u253A",
179
- lineUpLeftRightBold: "\u2536",
180
- lineUpLeftBoldRight: "\u2535",
181
- lineUpDoubleLeftDoubleRightDouble: "\u2569",
182
- lineUpDoubleLeftRight: "\u2568",
183
- lineUpLeftDoubleRightDouble: "\u2567",
184
- lineUpDownLeftRight: "\u253C",
185
- lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
186
- lineUpDownBoldLeftBoldRightBold: "\u2548",
187
- lineUpBoldDownLeftBoldRightBold: "\u2547",
188
- lineUpBoldDownBoldLeftRightBold: "\u254A",
189
- lineUpBoldDownBoldLeftBoldRight: "\u2549",
190
- lineUpBoldDownLeftRight: "\u2540",
191
- lineUpDownBoldLeftRight: "\u2541",
192
- lineUpDownLeftBoldRight: "\u253D",
193
- lineUpDownLeftRightBold: "\u253E",
194
- lineUpBoldDownBoldLeftRight: "\u2542",
195
- lineUpDownLeftBoldRightBold: "\u253F",
196
- lineUpBoldDownLeftBoldRight: "\u2543",
197
- lineUpBoldDownLeftRightBold: "\u2544",
198
- lineUpDownBoldLeftBoldRight: "\u2545",
199
- lineUpDownBoldLeftRightBold: "\u2546",
200
- lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
201
- lineUpDoubleDownDoubleLeftRight: "\u256B",
202
- lineUpDownLeftDoubleRightDouble: "\u256A",
203
- lineCross: "\u2573",
204
- lineBackslash: "\u2572",
205
- lineSlash: "\u2571"
206
- };
207
- const specialMainSymbols = {
208
- tick: "\u2714",
209
- info: "\u2139",
210
- warning: "\u26A0",
211
- cross: "\u2718",
212
- squareSmall: "\u25FB",
213
- squareSmallFilled: "\u25FC",
214
- circle: "\u25EF",
215
- circleFilled: "\u25C9",
216
- circleDotted: "\u25CC",
217
- circleDouble: "\u25CE",
218
- circleCircle: "\u24DE",
219
- circleCross: "\u24E7",
220
- circlePipe: "\u24BE",
221
- radioOn: "\u25C9",
222
- radioOff: "\u25EF",
223
- checkboxOn: "\u2612",
224
- checkboxOff: "\u2610",
225
- checkboxCircleOn: "\u24E7",
226
- checkboxCircleOff: "\u24BE",
227
- pointer: "\u276F",
228
- triangleUpOutline: "\u25B3",
229
- triangleLeft: "\u25C0",
230
- triangleRight: "\u25B6",
231
- lozenge: "\u25C6",
232
- lozengeOutline: "\u25C7",
233
- hamburger: "\u2630",
234
- smiley: "\u32E1",
235
- mustache: "\u0DF4",
236
- star: "\u2605",
237
- play: "\u25B6",
238
- nodejs: "\u2B22",
239
- oneSeventh: "\u2150",
240
- oneNinth: "\u2151",
241
- oneTenth: "\u2152"
242
- };
243
- const specialFallbackSymbols = {
244
- tick: "\u221A",
245
- info: "i",
246
- warning: "\u203C",
247
- cross: "\xD7",
248
- squareSmall: "\u25A1",
249
- squareSmallFilled: "\u25A0",
250
- circle: "( )",
251
- circleFilled: "(*)",
252
- circleDotted: "( )",
253
- circleDouble: "( )",
254
- circleCircle: "(\u25CB)",
255
- circleCross: "(\xD7)",
256
- circlePipe: "(\u2502)",
257
- radioOn: "(*)",
258
- radioOff: "( )",
259
- checkboxOn: "[\xD7]",
260
- checkboxOff: "[ ]",
261
- checkboxCircleOn: "(\xD7)",
262
- checkboxCircleOff: "( )",
263
- pointer: ">",
264
- triangleUpOutline: "\u2206",
265
- triangleLeft: "\u25C4",
266
- triangleRight: "\u25BA",
267
- lozenge: "\u2666",
268
- lozengeOutline: "\u25CA",
269
- hamburger: "\u2261",
270
- smiley: "\u263A",
271
- mustache: "\u250C\u2500\u2510",
272
- star: "\u2736",
273
- play: "\u25BA",
274
- nodejs: "\u2666",
275
- oneSeventh: "1/7",
276
- oneNinth: "1/9",
277
- oneTenth: "1/10"
278
- };
279
- export const mainSymbols = { ...common, ...specialMainSymbols };
280
- export const fallbackSymbols = {
281
- ...common,
282
- ...specialFallbackSymbols
283
- };
284
- const shouldUseMain = isUnicodeSupported();
285
- const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
286
- export default figures;
287
- const replacements = Object.entries(specialMainSymbols);
288
- export const replaceSymbols = (string, { useFallback = !shouldUseMain } = {}) => {
289
- if (useFallback) {
290
- for (const [key, mainSymbol] of replacements) {
291
- const fallbackSymbol = fallbackSymbols[key];
292
- if (!fallbackSymbol) {
293
- throw new Error(`Unable to find fallback for ${key}`);
294
- }
295
- string = string.replaceAll(mainSymbol, fallbackSymbol);
296
- }
297
- }
298
- return string;
299
- };
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,66 +0,0 @@
1
- import {
2
- createPrompt,
3
- useState,
4
- useKeypress,
5
- usePrefix,
6
- isEnterKey,
7
- isBackspaceKey,
8
- makeTheme
9
- } from "../../components/core/index.js";
10
- export default createPrompt((config, done) => {
11
- const { required, validate = () => true } = config;
12
- const theme = makeTheme(config.theme);
13
- const [status, setStatus] = useState("idle");
14
- const [defaultValue = "", setDefaultValue] = useState(config.default);
15
- const [errorMsg, setError] = useState();
16
- const [value, setValue] = useState("");
17
- const prefix = usePrefix({ status, theme });
18
- useKeypress(async (key, rl) => {
19
- if (status !== "idle") {
20
- return;
21
- }
22
- if (isEnterKey(key)) {
23
- const answer = value || defaultValue;
24
- setStatus("loading");
25
- const isValid = required && !answer ? "You must provide a value" : await validate(answer);
26
- if (isValid === true) {
27
- setValue(answer);
28
- setStatus("done");
29
- done(answer);
30
- } else {
31
- rl.write(value);
32
- setError(isValid || "You must provide a valid value");
33
- setStatus("idle");
34
- }
35
- } else if (isBackspaceKey(key) && !value) {
36
- setDefaultValue(void 0);
37
- } else if (key.name === "tab" && !value) {
38
- setDefaultValue(void 0);
39
- rl.clearLine(0);
40
- rl.write(defaultValue);
41
- setValue(defaultValue);
42
- } else {
43
- setValue(rl.line);
44
- setError(void 0);
45
- }
46
- });
47
- const message = theme.style.message(config.message, status);
48
- let formattedValue = value;
49
- if (typeof config.transformer === "function") {
50
- formattedValue = config.transformer(value, { isFinal: status === "done" });
51
- } else if (status === "done") {
52
- formattedValue = theme.style.answer(value);
53
- }
54
- let defaultStr;
55
- if (defaultValue && status !== "done" && !value) {
56
- defaultStr = theme.style.defaultAnswer(defaultValue);
57
- }
58
- let error = "";
59
- if (errorMsg) {
60
- error = theme.style.error(errorMsg);
61
- }
62
- return [
63
- [prefix, message, defaultStr, formattedValue].filter((v) => v !== void 0).join(" "),
64
- error
65
- ];
66
- });
@@ -1,3 +0,0 @@
1
- import type { TSchema, Static } from "@sinclair/typebox";
2
- import type { PromptOptions } from "../../types/general.js";
3
- export declare function textPrompt<T extends TSchema>(options: PromptOptions<T>): Promise<Static<T>>;
@@ -1,103 +0,0 @@
1
- import { Value } from "@sinclair/typebox/value";
2
- import { stdin as input, stdout as output } from "node:process";
3
- import readline from "node:readline/promises";
4
- import { fmt, msg } from "../../utils/messages.js";
5
- import {
6
- countLines,
7
- deleteLastLine,
8
- deleteLastLines
9
- } from "../../utils/terminal.js";
10
- export async function textPrompt(options) {
11
- const {
12
- title,
13
- hint,
14
- validate,
15
- defaultValue = "",
16
- schema,
17
- titleColor = "cyanBright",
18
- titleTypography = "bold",
19
- titleVariant,
20
- content,
21
- contentColor,
22
- contentTypography,
23
- contentVariant,
24
- borderColor = "viceGradient",
25
- variantOptions,
26
- placeholder
27
- } = options;
28
- const rl = readline.createInterface({ input, output });
29
- let linesToDelete = 0;
30
- let errorMessage = "";
31
- let currentInput = "";
32
- let showPlaceholder = true;
33
- while (true) {
34
- if (linesToDelete > 0) {
35
- deleteLastLines(linesToDelete);
36
- }
37
- const question = fmt({
38
- type: errorMessage !== "" ? "M_ERROR" : "M_GENERAL",
39
- title,
40
- titleColor,
41
- titleTypography,
42
- titleVariant,
43
- content,
44
- contentColor,
45
- contentTypography,
46
- contentVariant,
47
- borderColor,
48
- hint,
49
- placeholder: showPlaceholder ? placeholder : void 0,
50
- variantOptions,
51
- errorMessage
52
- });
53
- const questionLines = countLines(question);
54
- const prompt = await rl.question(question);
55
- currentInput = prompt.trim();
56
- if (showPlaceholder && currentInput !== "") {
57
- showPlaceholder = false;
58
- deleteLastLine();
59
- deleteLastLine();
60
- msg({ type: "M_MIDDLE", title: ` ${currentInput}` });
61
- }
62
- linesToDelete = questionLines + 1;
63
- const answer = currentInput || defaultValue;
64
- if (currentInput === "" && defaultValue !== "") {
65
- deleteLastLine();
66
- deleteLastLine();
67
- const defaultMsg = fmt({
68
- type: "M_MIDDLE",
69
- title: ` ${defaultValue}`,
70
- borderColor
71
- });
72
- console.log(defaultMsg);
73
- linesToDelete += countLines(defaultMsg);
74
- }
75
- let isValid = true;
76
- errorMessage = "";
77
- if (schema) {
78
- isValid = Value.Check(schema, answer);
79
- if (!isValid) {
80
- const errors = [...Value.Errors(schema, answer)];
81
- if (errors.length > 0) {
82
- errorMessage = errors[0]?.message ?? "Invalid input.";
83
- } else {
84
- errorMessage = "Invalid input.";
85
- }
86
- }
87
- }
88
- if (validate && isValid) {
89
- const validation = await validate(answer);
90
- if (validation !== true) {
91
- isValid = false;
92
- errorMessage = typeof validation === "string" ? validation : "Invalid input.";
93
- }
94
- }
95
- if (isValid) {
96
- msg({ type: "M_NEWLINE" });
97
- rl.close();
98
- return answer;
99
- } else {
100
- linesToDelete += 0;
101
- }
102
- }
103
- }
@@ -1,11 +0,0 @@
1
- import type { PromptOptions } from "../prompts/prompt.js";
2
- import Prompt from "../prompts/prompt.js";
3
- export type TextOptions = {
4
- placeholder?: string;
5
- defaultValue?: string;
6
- } & PromptOptions<TextPrompt>;
7
- export default class TextPrompt extends Prompt {
8
- valueWithCursor: string;
9
- get cursor(): number;
10
- constructor(opts: TextOptions);
11
- }
@@ -1,26 +0,0 @@
1
- import color from "picocolors";
2
- import Prompt from "../prompts/prompt.js";
3
- export default class TextPrompt extends Prompt {
4
- valueWithCursor = "";
5
- get cursor() {
6
- return this._cursor;
7
- }
8
- constructor(opts) {
9
- super(opts);
10
- this.on("finalize", () => {
11
- if (!this.value) {
12
- this.value = opts.defaultValue;
13
- }
14
- this.valueWithCursor = this.value;
15
- });
16
- this.on("value", () => {
17
- if (this.cursor >= this.value.length) {
18
- this.valueWithCursor = `${this.value}${color.inverse(color.hidden("_"))}`;
19
- } else {
20
- const s1 = this.value.slice(0, this.cursor);
21
- const s2 = this.value.slice(this.cursor);
22
- this.valueWithCursor = `${s1}${color.inverse(s2[0])}${s2.slice(1)}`;
23
- }
24
- });
25
- }
26
- }
@@ -1,8 +0,0 @@
1
- import type { RelinkaInstance } from "../../components/prompts/relinka.js";
2
- import type { RelinkaOptions } from "../../types/general.js";
3
- export * from "../../components/instance/shared.js";
4
- export declare function createRelinka(options?: Partial<RelinkaOptions & {
5
- fancy: boolean;
6
- }>): RelinkaInstance;
7
- export declare const relinka: RelinkaInstance;
8
- export default relinka;
@@ -1,18 +0,0 @@
1
- import { BrowserReporter } from "../../components/instance/reporter/browser.js";
2
- import { createRelinka as _createRelinka } from "../../components/prompts/relinka.js";
3
- export * from "../../components/instance/shared.js";
4
- export function createRelinka(options = {}) {
5
- const relinka2 = _createRelinka({
6
- reporters: options.reporters || [new BrowserReporter({})],
7
- prompt(message, options2 = {}) {
8
- if (options2.type === "confirm") {
9
- return Promise.resolve(confirm(message));
10
- }
11
- return Promise.resolve(prompt(message));
12
- },
13
- ...options
14
- });
15
- return relinka2;
16
- }
17
- export const relinka = createRelinka();
18
- export default relinka;
@@ -1,6 +0,0 @@
1
- export { LogLevels, LogTypes } from "../../utils/constants.js";
2
- export { Relinka } from "../../components/prompts/relinka.js";
3
- export type * from "../../utils/types.js";
4
- export type { RelinkaInstance } from "../../components/prompts/relinka.js";
5
- export type { LogLevel, LogType } from "../../utils/constants.js";
6
- export type { PromptOptions, ConfirmPromptOptions, MultiSelectOptions, SelectPromptOptions, TextPromptOptions, } from "../../components/mono/monoTwo.js";
@@ -1,2 +0,0 @@
1
- export { LogLevels, LogTypes } from "../../utils/constants.js";
2
- export { Relinka } from "../../components/prompts/relinka.js";
@@ -1,5 +0,0 @@
1
- import type { TSchema, Static } from "@sinclair/typebox";
2
- import type { PromptOptions, PromptType } from "../../types/general.js";
3
- export declare function prompt<T extends TSchema>(options: PromptOptions<T> & {
4
- type: PromptType;
5
- }): Promise<Record<(typeof options)["id"], Static<T>>>;
@@ -1,64 +0,0 @@
1
- import { confirmPrompt } from "../../components/confirm/confirm-main.js";
2
- import { datePrompt } from "../../components/date/date.js";
3
- import { textPrompt } from "../../components/input/text-main.js";
4
- import { nextStepsPrompt } from "../../components/next-steps/next-steps.js";
5
- import { numberPrompt } from "../../components/number/number-main.js";
6
- import { passwordPrompt } from "../../components/password/password-main.js";
7
- import { numSelectPrompt } from "../../components/select/num-select.js";
8
- import { endPrompt } from "../../components/st-end/end.js";
9
- import { startPrompt } from "../../components/st-end/start.js";
10
- export async function prompt(options) {
11
- const { type, id, action } = options;
12
- let value;
13
- switch (type) {
14
- case "start":
15
- await startPrompt(options);
16
- value = null;
17
- break;
18
- case "text":
19
- value = await textPrompt(options);
20
- break;
21
- case "number":
22
- value = await numberPrompt(options);
23
- break;
24
- case "confirm":
25
- value = await confirmPrompt(options);
26
- break;
27
- case "numSelect":
28
- value = await numSelectPrompt(options);
29
- break;
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- case "password":
40
- value = await passwordPrompt(options);
41
- break;
42
- case "date":
43
- value = await datePrompt({
44
- ...options,
45
- dateFormat: "DD/MM/YYYY",
46
- dateKind: "other"
47
- });
48
- break;
49
- case "nextSteps":
50
- await nextStepsPrompt(options);
51
- value = null;
52
- break;
53
- case "end":
54
- await endPrompt(options);
55
- value = null;
56
- break;
57
- default:
58
- throw new Error(`Unknown prompt type: ${type}`);
59
- }
60
- if (action) {
61
- await action();
62
- }
63
- return { [id]: value };
64
- }
@@ -1,30 +0,0 @@
1
- type SelectOption = {
2
- label: string;
3
- value: string;
4
- hint?: string;
5
- };
6
- export type TextPromptOptions = {
7
- type?: "text";
8
- default?: string;
9
- placeholder?: string;
10
- initial?: string;
11
- };
12
- export type ConfirmPromptOptions = {
13
- type: "confirm";
14
- initial?: boolean;
15
- };
16
- export type SelectPromptOptions = {
17
- type: "select";
18
- initial?: string;
19
- options: (string | SelectOption)[];
20
- };
21
- export type MultiSelectOptions = {
22
- type: "multiselect";
23
- initial?: string[];
24
- options: (string | SelectOption)[];
25
- required?: boolean;
26
- };
27
- export type PromptOptions = TextPromptOptions | ConfirmPromptOptions | SelectPromptOptions | MultiSelectOptions;
28
- type inferPromptReturnType<T extends PromptOptions> = T extends TextPromptOptions ? string : T extends ConfirmPromptOptions ? boolean : T extends SelectPromptOptions ? T["options"][number] extends SelectOption ? T["options"][number]["value"] : T["options"][number] : T extends MultiSelectOptions ? T["options"] : unknown;
29
- export declare function prompt<_ = any, __ = any, T extends PromptOptions = TextPromptOptions>(message: string, opts?: PromptOptions): Promise<inferPromptReturnType<T>>;
30
- export {};