mepcli 1.0.0 → 1.0.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.
@@ -12,5 +12,6 @@ export declare class CalculatorPrompt extends Prompt<number, CalculatorOptions>
12
12
  private evaluate;
13
13
  protected render(firstRender: boolean): void;
14
14
  private getVisualCursorPosition;
15
+ protected cleanup(): void;
15
16
  protected handleInput(char: string): void;
16
17
  }
@@ -147,6 +147,13 @@ class CalculatorPrompt extends base_1.Prompt {
147
147
  }
148
148
  return width;
149
149
  }
150
+ cleanup() {
151
+ if (this.lastLinesUp > 0) {
152
+ this.print(`\x1b[${this.lastLinesUp}B`);
153
+ this.lastLinesUp = 0;
154
+ }
155
+ super.cleanup();
156
+ }
150
157
  handleInput(char) {
151
158
  // Enter
152
159
  if (char === '\r' || char === '\n') {
@@ -31,6 +31,7 @@ export declare class CurlPrompt extends Prompt<CurlResult, CurlOptions> {
31
31
  private shellEscapeDoubleQuoted;
32
32
  private generateCommand;
33
33
  protected render(firstRender: boolean): void;
34
+ protected cleanup(): void;
34
35
  protected handleInput(char: string, _buffer: Buffer): void;
35
36
  private cycleSection;
36
37
  private editHeaders;
@@ -155,6 +155,13 @@ class CurlPrompt extends base_1.Prompt {
155
155
  this.print(ansi_1.ANSI.HIDE_CURSOR);
156
156
  }
157
157
  }
158
+ cleanup() {
159
+ if (this.lastLinesUp > 0) {
160
+ this.print(`\x1b[${this.lastLinesUp}B`);
161
+ this.lastLinesUp = 0;
162
+ }
163
+ super.cleanup();
164
+ }
158
165
  handleInput(char, _buffer) {
159
166
  // Navigation
160
167
  if (char === '\t') {
@@ -16,5 +16,6 @@ export declare class FilePrompt extends Prompt<string, FileOptions> {
16
16
  */
17
17
  private updateSuggestions;
18
18
  protected render(firstRender: boolean): void;
19
+ protected cleanup(): void;
19
20
  protected handleInput(char: string): void;
20
21
  }
@@ -147,6 +147,13 @@ class FilePrompt extends base_1.Prompt {
147
147
  this.print(`\x1b[${targetCol}C`);
148
148
  this.print(ansi_1.ANSI.SHOW_CURSOR);
149
149
  }
150
+ cleanup() {
151
+ if (this.lastLinesUp > 0) {
152
+ this.print(`\x1b[${this.lastLinesUp}B`);
153
+ this.lastLinesUp = 0;
154
+ }
155
+ super.cleanup();
156
+ }
150
157
  handleInput(char) {
151
158
  if (char === '\t') {
152
159
  if (this.suggestions.length > 0) {
@@ -166,11 +173,6 @@ class FilePrompt extends base_1.Prompt {
166
173
  return;
167
174
  }
168
175
  if (char === '\r' || char === '\n') {
169
- // Move cursor to the bottom to ensure clean exit UI
170
- if (this.lastLinesUp > 0) {
171
- this.print(`\x1b[${this.lastLinesUp}B`);
172
- this.lastLinesUp = 0;
173
- }
174
176
  this.submit(this.input);
175
177
  return;
176
178
  }
@@ -13,5 +13,6 @@ export declare class FormPrompt extends Prompt<Record<string, string>, FormOptio
13
13
  protected handleMouse(event: MouseEvent): void;
14
14
  private moveFocus;
15
15
  private validateCurrentField;
16
+ protected cleanup(): void;
16
17
  private submitForm;
17
18
  }
@@ -196,6 +196,13 @@ class FormPrompt extends base_1.Prompt {
196
196
  this.render(false);
197
197
  return true;
198
198
  }
199
+ cleanup() {
200
+ if (this.lastLinesUp > 0) {
201
+ this.print(`\x1b[${this.lastLinesUp}B`);
202
+ this.lastLinesUp = 0;
203
+ }
204
+ super.cleanup();
205
+ }
199
206
  async submitForm() {
200
207
  this.globalError = '';
201
208
  // Validate all fields
@@ -30,6 +30,7 @@ export declare class PhonePrompt extends Prompt<string, PhoneOptions> {
30
30
  */
31
31
  private renderFormattedNumber;
32
32
  protected render(firstRender: boolean): void;
33
+ protected cleanup(): void;
33
34
  protected handleInput(char: string): void;
34
35
  private filterCountries;
35
36
  private cycleCountry;
@@ -206,6 +206,13 @@ class PhonePrompt extends base_1.Prompt {
206
206
  }
207
207
  this.print(ansi_1.ANSI.SHOW_CURSOR);
208
208
  }
209
+ cleanup() {
210
+ if (this.lastLinesUp > 0) {
211
+ this.print(`\x1b[${this.lastLinesUp}B`);
212
+ this.lastLinesUp = 0;
213
+ }
214
+ super.cleanup();
215
+ }
209
216
  handleInput(char) {
210
217
  // Handle common keys
211
218
  if (char === '\r' || char === '\n') {
@@ -11,6 +11,7 @@ export declare class SnippetPrompt extends Prompt<string, SnippetOptions> {
11
11
  constructor(options: SnippetOptions);
12
12
  private parseTemplate;
13
13
  protected render(firstRender: boolean): void;
14
+ protected cleanup(): void;
14
15
  protected handleInput(char: string, _key: Buffer): void;
15
16
  protected handleMouse(event: MouseEvent): void;
16
17
  private moveFocus;
@@ -114,6 +114,13 @@ class SnippetPrompt extends base_1.Prompt {
114
114
  this.print(`\x1b[${cursorVisualIndex}C`);
115
115
  }
116
116
  }
117
+ cleanup() {
118
+ if (this.lastLinesUp > 0) {
119
+ this.print(`\x1b[${this.lastLinesUp}B`);
120
+ this.lastLinesUp = 0;
121
+ }
122
+ super.cleanup();
123
+ }
117
124
  handleInput(char, _key) {
118
125
  // Navigation: Tab / Shift+Tab
119
126
  if (char === '\u001b[Z') {
@@ -11,6 +11,7 @@ export declare class TextPrompt<O extends TextOptions = TextOptions> extends Pro
11
11
  private triggerSuggest;
12
12
  protected render(firstRender: boolean): void;
13
13
  private getSegmentWidth;
14
+ protected cleanup(): void;
14
15
  protected handleInput(char: string): void;
15
16
  private validateAndSubmit;
16
17
  }
@@ -179,6 +179,13 @@ class TextPrompt extends base_1.Prompt {
179
179
  getSegmentWidth(seg) {
180
180
  return (0, utils_1.stringWidth)(seg);
181
181
  }
182
+ cleanup() {
183
+ if (this.lastLinesUp > 0) {
184
+ this.print(`\x1b[${this.lastLinesUp}B`);
185
+ this.lastLinesUp = 0;
186
+ }
187
+ super.cleanup();
188
+ }
182
189
  handleInput(char) {
183
190
  // Tab (Accept Suggestion)
184
191
  if (char === '\t') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mepcli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Zero-dependency, interactive CLI prompt",
5
5
  "repository": {
6
6
  "type": "git",