@cedarjs/tui 4.0.0-canary.13695 → 4.0.0-canary.13697
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.
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -27
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import stream from 'stream';
|
|
2
|
-
import
|
|
2
|
+
import type { AnsiColors } from 'ansis';
|
|
3
3
|
import { prompt as enquirerPrompt } from 'enquirer';
|
|
4
4
|
/**
|
|
5
5
|
* A default set of styling for the TUI, designed for a cohesive look and feel around the Redwood CLI, CRWA and vairous plugins
|
|
@@ -24,7 +24,6 @@ export declare class ReactiveTUIContent {
|
|
|
24
24
|
private header;
|
|
25
25
|
private content;
|
|
26
26
|
private spinner;
|
|
27
|
-
private boxen;
|
|
28
27
|
private frameInterval;
|
|
29
28
|
private spinnerIndex;
|
|
30
29
|
constructor(options: {
|
|
@@ -35,7 +34,6 @@ export declare class ReactiveTUIContent {
|
|
|
35
34
|
enabled?: boolean;
|
|
36
35
|
characters?: string[];
|
|
37
36
|
};
|
|
38
|
-
boxen?: boxen.Options;
|
|
39
37
|
outStream?: stream.Readable;
|
|
40
38
|
frameInterval?: number;
|
|
41
39
|
});
|
|
@@ -47,7 +45,6 @@ export declare class ReactiveTUIContent {
|
|
|
47
45
|
enabled?: boolean;
|
|
48
46
|
characters?: string[];
|
|
49
47
|
};
|
|
50
|
-
boxen?: boxen.Options;
|
|
51
48
|
outStream?: stream.Readable;
|
|
52
49
|
frameInterval?: number;
|
|
53
50
|
}): void;
|
|
@@ -126,17 +123,23 @@ export declare class RedwoodTUI {
|
|
|
126
123
|
*/
|
|
127
124
|
prompt<T = object>(questions: Parameters<typeof enquirerPrompt>[0]): Promise<T>;
|
|
128
125
|
/**
|
|
129
|
-
*
|
|
126
|
+
* Writes a fenced text block to the TUI output stream
|
|
130
127
|
*
|
|
131
|
-
* @param title
|
|
128
|
+
* @param title The string to write out
|
|
129
|
+
*/
|
|
130
|
+
drawFencedText(color: AnsiColors, title: string, message: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Display an error message with a red header and footer
|
|
133
|
+
*
|
|
134
|
+
* @param title Error title
|
|
132
135
|
* @param message Error message
|
|
133
136
|
*/
|
|
134
137
|
displayError(title: string, message: string): void;
|
|
135
138
|
/**
|
|
136
|
-
* Display a warning message
|
|
139
|
+
* Display a warning message with a yellow header and footer
|
|
137
140
|
*
|
|
138
|
-
* @param title
|
|
139
|
-
* @param message
|
|
141
|
+
* @param title Warning title
|
|
142
|
+
* @param message Warning message
|
|
140
143
|
*/
|
|
141
144
|
displayWarning(title: string, message: string): void;
|
|
142
145
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,UAAU,CAAA;AAGnD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;CAY1B,CAAA;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAiB;IAEnC,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAGd;IACD,OAAO,CAAC,aAAa,CAAQ;IAI7B,OAAO,CAAC,YAAY,CAAI;gBAEZ,OA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W/C;;;;OAIG;IACH,aAAa,CAAC,eAAe,CAAC,EAAE,kBAAkB;IAkClD;;;;OAIG;IACH,YAAY,CAAC,KAAK,UAAQ;IAyB1B;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAgBpB;;;;OAIG;IACH,kBAAkB,IAAI,kBAAkB,GAAG,SAAS;IAIpD;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM;IAKrB;;;;;;OAMG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,EACrB,SAAS,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,CAAC,CAAC;IAYb;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAYhE;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAM3C;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK9C"}
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
var import_stream = __toESM(require("stream"));
|
|
37
37
|
var import_ansis = __toESM(require("ansis"));
|
|
38
|
-
var import_boxen = __toESM(require("boxen"));
|
|
39
38
|
var import_enquirer = require("enquirer");
|
|
40
39
|
var import_stdout_update = require("stdout-update");
|
|
41
40
|
const RedwoodStyling = {
|
|
@@ -55,7 +54,6 @@ class ReactiveTUIContent {
|
|
|
55
54
|
header;
|
|
56
55
|
content;
|
|
57
56
|
spinner;
|
|
58
|
-
boxen;
|
|
59
57
|
frameInterval;
|
|
60
58
|
// TODO: Implement a progress bar
|
|
61
59
|
spinnerIndex = 0;
|
|
@@ -75,7 +73,6 @@ class ReactiveTUIContent {
|
|
|
75
73
|
);
|
|
76
74
|
}
|
|
77
75
|
this.spinner = { ...defaultSpinner, ...options.spinner };
|
|
78
|
-
this.boxen = { ...options.boxen };
|
|
79
76
|
if (options.frameInterval !== void 0) {
|
|
80
77
|
if (typeof options.frameInterval !== "number" || options.frameInterval <= 0) {
|
|
81
78
|
throw new Error("tui: `frameInterval` must be a number > 0");
|
|
@@ -106,9 +103,6 @@ class ReactiveTUIContent {
|
|
|
106
103
|
}
|
|
107
104
|
this.spinner = { ...this.spinner, ...options.spinner };
|
|
108
105
|
}
|
|
109
|
-
if (options.boxen) {
|
|
110
|
-
this.boxen = { ...this.boxen, ...options.boxen };
|
|
111
|
-
}
|
|
112
106
|
if (options.outStream) {
|
|
113
107
|
this.setOutStream(options.outStream);
|
|
114
108
|
}
|
|
@@ -272,36 +266,45 @@ class RedwoodTUI {
|
|
|
272
266
|
return result;
|
|
273
267
|
}
|
|
274
268
|
/**
|
|
275
|
-
*
|
|
269
|
+
* Writes a fenced text block to the TUI output stream
|
|
276
270
|
*
|
|
277
|
-
* @param title
|
|
278
|
-
* @param message Error message
|
|
271
|
+
* @param title The string to write out
|
|
279
272
|
*/
|
|
280
|
-
|
|
281
|
-
this.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
title: `\u26A0 Error: ${title}`,
|
|
286
|
-
titleAlignment: "left"
|
|
287
|
-
})
|
|
273
|
+
drawFencedText(color, title, message) {
|
|
274
|
+
const width = Math.min(80, (this.outStream.columns || 80) - 2);
|
|
275
|
+
const headerText = `\u2500\u2500\u2500\u2500 ${title} `;
|
|
276
|
+
const header = import_ansis.default[color](
|
|
277
|
+
headerText + "\u2500".repeat(Math.max(0, width - headerText.length))
|
|
288
278
|
);
|
|
279
|
+
const line = import_ansis.default[color]("\u2500".repeat(width));
|
|
280
|
+
this.outStream.write(`
|
|
281
|
+
${header}
|
|
282
|
+
${line}
|
|
283
|
+
|
|
284
|
+
${message}
|
|
285
|
+
|
|
286
|
+
${line}
|
|
287
|
+
`);
|
|
289
288
|
}
|
|
290
289
|
/**
|
|
291
|
-
* Display
|
|
290
|
+
* Display an error message with a red header and footer
|
|
292
291
|
*
|
|
293
|
-
* @param title Error
|
|
292
|
+
* @param title Error title
|
|
294
293
|
* @param message Error message
|
|
295
294
|
*/
|
|
295
|
+
displayError(title, message) {
|
|
296
|
+
const headerText = `\u26A0 Error: ${title}`;
|
|
297
|
+
this.drawFencedText("red", headerText, message);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Display a warning message with a yellow header and footer
|
|
301
|
+
*
|
|
302
|
+
* @param title Warning title
|
|
303
|
+
* @param message Warning message
|
|
304
|
+
*/
|
|
296
305
|
displayWarning(title, message) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
padding: 1,
|
|
300
|
-
borderColor: "yellow",
|
|
301
|
-
title: `\u26A0 Warning: ${title}`,
|
|
302
|
-
titleAlignment: "left"
|
|
303
|
-
})
|
|
304
|
-
);
|
|
306
|
+
const headerText = `\u26A0 Warning: ${title}`;
|
|
307
|
+
this.drawFencedText("yellow", headerText, message);
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/tui",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.13697+da977d134",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"ansis": "4.2.0",
|
|
24
|
-
"boxen": "5.1.2",
|
|
25
24
|
"enquirer": "2.4.1",
|
|
26
25
|
"stdout-update": "1.6.8"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@cedarjs/framework-tools": "4.0.0-canary.
|
|
28
|
+
"@cedarjs/framework-tools": "4.0.0-canary.13697",
|
|
30
29
|
"tsx": "4.21.0",
|
|
31
30
|
"typescript": "5.9.3"
|
|
32
31
|
},
|
|
@@ -36,5 +35,5 @@
|
|
|
36
35
|
"publishConfig": {
|
|
37
36
|
"access": "public"
|
|
38
37
|
},
|
|
39
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "da977d13429363d3425ffef14998d095df199f37"
|
|
40
39
|
}
|