@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,134 +0,0 @@
1
- import type { AnimationName } from "@figliolia/chalk-animation";
2
- import type { TSchema } from "@sinclair/typebox";
3
- import type { LogLevel, LogType } from "../utils/constants.js";
4
- export type State = "initial" | "active" | "cancel" | "submit" | "error";
5
- export type MsgType = "M_NULL" | "M_START" | "M_MIDDLE" | "M_GENERAL" | "M_GENERAL_NULL" | "M_INFO" | "M_INFO_NULL" | "M_NEWLINE" | "M_END" | "M_ERROR" | "M_ERROR_NULL";
6
- export type TypographyName = "bold" | "strikethrough" | "underline" | "italic";
7
- export type Variant = "box" | "doubleBox" | "banner" | "underline" | "none" | "animated";
8
- export type ColorName = "dim" | "inverse" | "black" | "red" | "redBright" | "bgRed" | "bgRedBright" | "green" | "greenBright" | "bgGreen" | "bgGreenBright" | "yellow" | "yellowBright" | "blue" | "blueBright" | "magenta" | "cyan" | "cyanBright" | "bgCyan" | "bgCyanBright" | "white" | "gray" | "gradientGradient" | "rainbowGradient" | "cristalGradient" | "mindGradient" | "passionGradient" | "viceGradient" | "retroGradient" | "none";
9
- export type MsgConfig = {
10
- symbol: string;
11
- prefix?: string;
12
- color?: (text: string) => string;
13
- newLineBefore?: boolean;
14
- newLineAfter?: boolean;
15
- suffix?: string;
16
- };
17
- export type FmtMsgOptions = {
18
- type: MsgType;
19
- title?: string;
20
- titleAfterAnim?: string;
21
- content?: string;
22
- titleColor?: ColorName;
23
- titleTypography?: TypographyName;
24
- titleVariant?: Variant;
25
- contentColor?: ColorName;
26
- contentTypography?: TypographyName;
27
- contentVariant?: Variant;
28
- hint?: string;
29
- border?: boolean;
30
- borderColor?: ColorName;
31
- dontRemoveBar?: boolean;
32
- variantOptions?: {
33
- box?: {
34
- limit?: number;
35
- };
36
- };
37
- errorMessage?: string;
38
- addNewLineBefore?: boolean;
39
- addNewLineAfter?: boolean;
40
- placeholder?: string;
41
- };
42
- export type RequiredPromptOptions = {
43
- id: string;
44
- title: string;
45
- };
46
- export type OptionalPromptOptions<T extends TSchema = any> = {
47
- schema?: T;
48
- titleColor?: ColorName;
49
- titleTypography?: TypographyName;
50
- titleVariant?: Variant;
51
- titleAnimation?: AnimationName;
52
- titleAnimationDelay?: number;
53
- content?: string;
54
- contentColor?: ColorName;
55
- contentTypography?: TypographyName;
56
- contentVariant?: Variant;
57
- hint?: string;
58
- placeholder?: string;
59
- validate?: (value: any) => boolean | string | Promise<boolean | string>;
60
- defaultValue?: string | string[] | number | boolean;
61
- defaultColor?: ColorName;
62
- defaultTypography?: TypographyName;
63
- choices?: ChoiceOptions[];
64
- variantOptions?: {
65
- box?: {
66
- limit?: number;
67
- };
68
- };
69
- action?: () => Promise<void>;
70
- border?: boolean;
71
- borderColor?: ColorName;
72
- clearConsole?: boolean;
73
- additionalLinesToDelete?: number;
74
- hintColor?: ColorName;
75
- hints?: string[];
76
- required?: boolean;
77
- initial?: any[];
78
- endTitle?: string;
79
- endTitleColor?: ColorName;
80
- };
81
- export type PromptOptions<T extends TSchema = any> = RequiredPromptOptions & OptionalPromptOptions<T>;
82
- export type ChoiceRequiredOptions = {
83
- id: string;
84
- title: string;
85
- };
86
- export type ChoiceOptionalOptions = {
87
- description?: string;
88
- titleTypography?: TypographyName;
89
- action?: () => Promise<void>;
90
- };
91
- export type ChoiceOptions = ChoiceRequiredOptions & ChoiceOptionalOptions;
92
- export type PromptType = "text" | "number" | "confirm" | "numSelect" | "select" | "multiselect" | "password" | "date" | "start" | "nextSteps" | "end";
93
- export type RelinkaOptions = {
94
- reporters: RelinkaReporter[];
95
- types: Record<LogType, InputLogObject>;
96
- level: LogLevel;
97
- defaults: InputLogObject;
98
- throttle: number;
99
- throttleMin: number;
100
- stdout?: NodeJS.WriteStream;
101
- stderr?: NodeJS.WriteStream;
102
- mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
103
- prompt?: typeof import("../components/mono/monoTwo.js").prompt | undefined;
104
- formatOptions: FormatOptions;
105
- };
106
- export type FormatOptions = {
107
- columns?: number;
108
- date?: boolean;
109
- colors?: boolean;
110
- compact?: boolean | number;
111
- [key: string]: unknown;
112
- };
113
- export type InputLogObject = {
114
- level?: LogLevel;
115
- tag?: string;
116
- type?: LogType;
117
- message?: string;
118
- additional?: string | string[];
119
- args?: any[];
120
- date?: Date;
121
- };
122
- export type LogObject = {
123
- level: LogLevel;
124
- type: LogType;
125
- tag: string;
126
- args: any[];
127
- date: Date;
128
- [key: string]: unknown;
129
- } & InputLogObject;
130
- export type RelinkaReporter = {
131
- log: (logObj: LogObject, ctx: {
132
- options: RelinkaOptions;
133
- }) => void;
134
- };
@@ -1,2 +0,0 @@
1
- export * from "./relinka.js";
2
- export * from "./utils.js";
@@ -1,2 +0,0 @@
1
- export * from "./relinka.js";
2
- export * from "./utils.js";
@@ -1,52 +0,0 @@
1
- import type { Readable } from "stream";
2
- export declare enum KeyName {
3
- RETURN = "return",
4
- ENTER = "enter",
5
- TAB = "tab",
6
- BACKSPACE = "backspace",
7
- ESCAPE = "escape",
8
- SPACE = "space",
9
- UP = "up",
10
- DOWN = "down",
11
- RIGHT = "right",
12
- LEFT = "left",
13
- F1 = "f1",
14
- F2 = "f2",
15
- F3 = "f3",
16
- F4 = "f4",
17
- F5 = "f5",
18
- F6 = "f6",
19
- F7 = "f7",
20
- F8 = "f8",
21
- F9 = "f9",
22
- F10 = "f10",
23
- F11 = "f11",
24
- F12 = "f12",
25
- CLEAR = "clear",
26
- END = "end",
27
- HOME = "home",
28
- INSERT = "insert",
29
- PAGEUP = "pageup",
30
- PAGEDOWN = "pagedown",
31
- DELETE = "delete",
32
- NEXT = "next",
33
- PREVIOUS = "previous",
34
- SUBMIT = "submit",
35
- ABORT = "abort"
36
- }
37
- export type Keypress = {
38
- name: KeyName | string;
39
- ctrl: boolean;
40
- meta: boolean;
41
- shift: boolean;
42
- sequence: string;
43
- code?: string;
44
- raw: string;
45
- };
46
- export type KeypressCallback = (key: Keypress) => void;
47
- export type ListenForKeys = {
48
- (stream: Readable, callback: KeypressCallback): () => void;
49
- parse: (s: string | Buffer, enc?: string) => Keypress | Keypress[];
50
- };
51
- declare const listenForKeys: ListenForKeys;
52
- export default listenForKeys;
@@ -1,37 +0,0 @@
1
- export var KeyName = ((KeyName2) => {
2
- KeyName2["RETURN"] = "return";
3
- KeyName2["ENTER"] = "enter";
4
- KeyName2["TAB"] = "tab";
5
- KeyName2["BACKSPACE"] = "backspace";
6
- KeyName2["ESCAPE"] = "escape";
7
- KeyName2["SPACE"] = "space";
8
- KeyName2["UP"] = "up";
9
- KeyName2["DOWN"] = "down";
10
- KeyName2["RIGHT"] = "right";
11
- KeyName2["LEFT"] = "left";
12
- KeyName2["F1"] = "f1";
13
- KeyName2["F2"] = "f2";
14
- KeyName2["F3"] = "f3";
15
- KeyName2["F4"] = "f4";
16
- KeyName2["F5"] = "f5";
17
- KeyName2["F6"] = "f6";
18
- KeyName2["F7"] = "f7";
19
- KeyName2["F8"] = "f8";
20
- KeyName2["F9"] = "f9";
21
- KeyName2["F10"] = "f10";
22
- KeyName2["F11"] = "f11";
23
- KeyName2["F12"] = "f12";
24
- KeyName2["CLEAR"] = "clear";
25
- KeyName2["END"] = "end";
26
- KeyName2["HOME"] = "home";
27
- KeyName2["INSERT"] = "insert";
28
- KeyName2["PAGEUP"] = "pageup";
29
- KeyName2["PAGEDOWN"] = "pagedown";
30
- KeyName2["DELETE"] = "delete";
31
- KeyName2["NEXT"] = "next";
32
- KeyName2["PREVIOUS"] = "previous";
33
- KeyName2["SUBMIT"] = "submit";
34
- KeyName2["ABORT"] = "abort";
35
- return KeyName2;
36
- })(KeyName || {});
37
- export default listenForKeys;
@@ -1,30 +0,0 @@
1
- import type { Duplex } from "node:stream";
2
- export type RelinkaReadline = {
3
- output: Duplex & {
4
- mute: () => void;
5
- unmute: () => void;
6
- };
7
- input: NodeJS.ReadableStream;
8
- clearLine: (dir: 0 | 1 | -1) => void;
9
- getCursorPos: () => {
10
- rows: number;
11
- cols: number;
12
- };
13
- setPrompt: (prompt: string) => void;
14
- line: string;
15
- write: (data: string) => void;
16
- on: (event: string, listener: (...args: unknown[]) => void) => void;
17
- removeListener: (event: string, listener: (...args: unknown[]) => void) => void;
18
- pause: () => void;
19
- resume: () => void;
20
- close: () => void;
21
- };
22
- export type Context = {
23
- input?: NodeJS.ReadableStream;
24
- output?: NodeJS.WritableStream;
25
- clearPromptOnDone?: boolean;
26
- signal?: AbortSignal;
27
- };
28
- export type Prompt<Value, Config> = (config: Config, context?: Context) => Promise<Value> & {
29
- cancel: () => void;
30
- };
File without changes
@@ -1,30 +0,0 @@
1
- import type { Duplex } from "node:stream";
2
- export type RelinkaReadline = {
3
- output: Duplex & {
4
- mute: () => void;
5
- unmute: () => void;
6
- };
7
- input: NodeJS.ReadableStream;
8
- clearLine: (dir: 0 | 1 | -1) => void;
9
- getCursorPos: () => {
10
- rows: number;
11
- cols: number;
12
- };
13
- setPrompt: (prompt: string) => void;
14
- line: string;
15
- write: (data: string) => void;
16
- on: (event: string, listener: (...args: unknown[]) => void) => void;
17
- removeListener: (event: string, listener: (...args: unknown[]) => void) => void;
18
- pause: () => void;
19
- resume: () => void;
20
- close: () => void;
21
- };
22
- export type Context = {
23
- input?: NodeJS.ReadableStream;
24
- output?: NodeJS.WritableStream;
25
- clearPromptOnDone?: boolean;
26
- signal?: AbortSignal;
27
- };
28
- export type Prompt<Value, Config> = (config: Config, context?: Context) => Promise<Value> & {
29
- cancel: () => void;
30
- };
File without changes
@@ -1,17 +0,0 @@
1
- type Key = string | number | symbol;
2
- export type Prettify<T> = {
3
- [K in keyof T]: T[K];
4
- } & {};
5
- export type PartialDeep<T> = T extends object ? {
6
- [P in keyof T]?: PartialDeep<T[P]>;
7
- } : T;
8
- export type LiteralUnion<T extends F, F = string> = T | (F & {});
9
- export type KeyUnion<T> = LiteralUnion<Extract<keyof T, string>>;
10
- export type DistributiveMerge<A, B> = A extends any ? Prettify<Omit<A, keyof B> & B> : never;
11
- export type UnionToIntersection<T> = (T extends any ? (input: T) => void : never) extends (input: infer Intersection) => void ? Intersection : never;
12
- type __Pick<O extends object, K extends keyof O> = {
13
- [P in K]: O[P];
14
- } & {};
15
- export type _Pick<O extends object, K extends Key> = __Pick<O, keyof O & K>;
16
- export type Pick<O extends object, K extends Key> = O extends unknown ? _Pick<O, K> : never;
17
- export {};
File without changes
@@ -1,2 +0,0 @@
1
- import type { ColorName, TypographyName } from "../types/general.js";
2
- export declare function colorize(text: string, colorName?: ColorName, typography?: TypographyName): string;
@@ -1,130 +0,0 @@
1
- import gradient, {
2
- cristal,
3
- mind,
4
- passion,
5
- rainbow,
6
- vice
7
- } from "gradient-string";
8
- import {
9
- red,
10
- inverse,
11
- dim,
12
- black,
13
- green,
14
- yellow,
15
- blue,
16
- magenta,
17
- cyan,
18
- cyanBright,
19
- bgCyan,
20
- bgCyanBright,
21
- white,
22
- gray,
23
- underline,
24
- bold,
25
- strikethrough,
26
- italic
27
- } from "picocolors";
28
- export function colorize(text, colorName, typography) {
29
- let result = text;
30
- switch (colorName) {
31
- case "inverse":
32
- result = inverse(` ${result} `);
33
- break;
34
- case "dim":
35
- result = dim(result);
36
- break;
37
- case "black":
38
- result = black(result);
39
- break;
40
- case "red":
41
- result = red(result);
42
- break;
43
- case "green":
44
- result = green(result);
45
- break;
46
- case "yellow":
47
- result = yellow(result);
48
- break;
49
- case "blue":
50
- result = blue(result);
51
- break;
52
- case "magenta":
53
- result = magenta(result);
54
- break;
55
- case "cyan":
56
- result = cyan(result);
57
- break;
58
- case "cyanBright":
59
- result = cyanBright(result);
60
- break;
61
- case "bgCyan":
62
- result = bgCyan(` ${result} `);
63
- break;
64
- case "bgCyanBright":
65
- result = bgCyanBright(` ${result} `);
66
- break;
67
- case "white":
68
- result = white(result);
69
- break;
70
- case "gray":
71
- result = gray(result);
72
- break;
73
- case "gradientGradient":
74
- result = gradient(["red", "yellow", "green", "cyan", "blue", "magenta"])(
75
- result
76
- );
77
- break;
78
- case "rainbowGradient":
79
- result = rainbow(result);
80
- break;
81
- case "cristalGradient":
82
- result = cristal(result);
83
- break;
84
- case "mindGradient":
85
- result = mind(result);
86
- break;
87
- case "passionGradient":
88
- result = passion(result);
89
- break;
90
- case "viceGradient":
91
- result = vice(result);
92
- break;
93
- case "none":
94
- break;
95
- default:
96
- break;
97
- }
98
- const gradientColors = [
99
- "gradientGradient",
100
- "cristalGradient",
101
- "mindGradient",
102
- "passionGradient",
103
- "rainbowGradient",
104
- "viceGradient"
105
- ];
106
- if (gradientColors.includes(colorName ?? "") && typography) {
107
- throw new Error(
108
- "[colorize] Cannot apply typography to gradient color.\n\u2502 Use regular colorize()'s color or remove typography."
109
- );
110
- }
111
- if (!gradientColors.includes(colorName ?? "") && typography) {
112
- switch (typography) {
113
- case "bold":
114
- result = bold(result);
115
- break;
116
- case "strikethrough":
117
- result = strikethrough(result);
118
- break;
119
- case "underline":
120
- result = underline(result);
121
- break;
122
- case "italic":
123
- result = italic(result);
124
- break;
125
- default:
126
- break;
127
- }
128
- }
129
- return result;
130
- }
@@ -1,101 +0,0 @@
1
- export { isCancel } from "../components/prompts/prompt.js";
2
- export type TextOptions = {
3
- message: string;
4
- placeholder?: string;
5
- defaultValue?: string;
6
- initialValue?: string;
7
- validate?: (value: string) => string | void;
8
- };
9
- export declare const text: (opts: TextOptions) => any;
10
- export type PasswordOptions = {
11
- message: string;
12
- mask?: string;
13
- validate?: (value: string) => string | void;
14
- };
15
- export declare const password: (opts: PasswordOptions) => any;
16
- export type ConfirmOptions = {
17
- message: string;
18
- active?: string;
19
- inactive?: string;
20
- initialValue?: boolean;
21
- };
22
- export declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
23
- type Primitive = Readonly<string | boolean | number>;
24
- type Option<Value> = Value extends Primitive ? {
25
- value: Value;
26
- label?: string;
27
- hint?: string;
28
- } : {
29
- value: Value;
30
- label: string;
31
- hint?: string;
32
- };
33
- export type SelectOptions<Value> = {
34
- message: string;
35
- options: Option<Value>[];
36
- initialValue?: Value;
37
- maxItems?: number;
38
- };
39
- export declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
40
- export declare const selectKey: <Value extends string>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
41
- export type MultiSelectOptions<Value> = {
42
- message: string;
43
- options: Option<Value>[];
44
- initialValues?: Value[];
45
- maxItems?: number;
46
- required?: boolean;
47
- cursorAt?: Value;
48
- };
49
- export declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
50
- export type GroupMultiSelectOptions<Value> = {
51
- message: string;
52
- options: Record<string, Option<Value>[]>;
53
- initialValues?: Value[];
54
- required?: boolean;
55
- cursorAt?: Value;
56
- };
57
- export declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
58
- export declare const note: (message?: string, title?: string) => void;
59
- export declare const cancel: (message?: string) => void;
60
- export declare const intro: (title?: string) => void;
61
- export declare const outro: (message?: string) => void;
62
- export type LogMessageOptions = {
63
- symbol?: string;
64
- };
65
- export declare const log: {
66
- message: (message?: string, { symbol }?: LogMessageOptions) => void;
67
- info: (message: string) => void;
68
- success: (message: string) => void;
69
- step: (message: string) => void;
70
- warn: (message: string) => void;
71
- warning: (message: string) => void;
72
- error: (message: string) => void;
73
- };
74
- export declare const spinner: () => {
75
- start: (msg?: string) => void;
76
- stop: (msg?: string, code?: number) => void;
77
- message: (msg?: string) => void;
78
- };
79
- export type PromptGroupAwaitedReturn<T> = {
80
- [P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
81
- };
82
- export type PromptGroupOptions<T> = {
83
- onCancel?: (opts: {
84
- results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
85
- }) => void;
86
- };
87
- type Prettify<T> = {
88
- [P in keyof T]: T[P];
89
- } & {};
90
- export type PromptGroup<T> = {
91
- [P in keyof T]: (opts: {
92
- results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
93
- }) => void | Promise<T[P] | void>;
94
- };
95
- export declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
96
- export type Task = {
97
- title: string;
98
- task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
99
- enabled?: boolean;
100
- };
101
- export declare const tasks: (tasks: Task[]) => Promise<void>;