@cedarjs/tui 9.0.0-canary.1784 → 9.0.0-canary.3124

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import stream from 'stream';
2
- import boxen from 'boxen';
3
- import { prompt as enquirerPrompt } from 'enquirer';
2
+ import type { AnsiColors } from 'ansis';
3
+ import Enquirer from 'enquirer';
4
+ declare const enquirerPrompt: typeof Enquirer.prompt;
4
5
  /**
5
6
  * A default set of styling for the TUI, designed for a cohesive look and feel around the Redwood CLI, CRWA and vairous plugins
6
7
  */
@@ -24,7 +25,6 @@ export declare class ReactiveTUIContent {
24
25
  private header;
25
26
  private content;
26
27
  private spinner;
27
- private boxen;
28
28
  private frameInterval;
29
29
  private spinnerIndex;
30
30
  constructor(options: {
@@ -35,7 +35,6 @@ export declare class ReactiveTUIContent {
35
35
  enabled?: boolean;
36
36
  characters?: string[];
37
37
  };
38
- boxen?: boxen.Options;
39
38
  outStream?: stream.Readable;
40
39
  frameInterval?: number;
41
40
  });
@@ -47,7 +46,6 @@ export declare class ReactiveTUIContent {
47
46
  enabled?: boolean;
48
47
  characters?: string[];
49
48
  };
50
- boxen?: boxen.Options;
51
49
  outStream?: stream.Readable;
52
50
  frameInterval?: number;
53
51
  }): void;
@@ -126,18 +124,25 @@ export declare class RedwoodTUI {
126
124
  */
127
125
  prompt<T = object>(questions: Parameters<typeof enquirerPrompt>[0]): Promise<T>;
128
126
  /**
129
- * Display an error message in a box
127
+ * Writes a fenced text block to the TUI output stream
130
128
  *
131
- * @param title Error box title
129
+ * @param title The string to write out
130
+ */
131
+ drawFencedText(color: AnsiColors, title: string, message: string): void;
132
+ /**
133
+ * Display an error message with a red header and footer
134
+ *
135
+ * @param title Error title
132
136
  * @param message Error message
133
137
  */
134
138
  displayError(title: string, message: string): void;
135
139
  /**
136
- * Display a warning message in a box
140
+ * Display a warning message with a yellow header and footer
137
141
  *
138
- * @param title Error box title
139
- * @param message Error message
142
+ * @param title Warning title
143
+ * @param message Warning message
140
144
  */
141
145
  displayWarning(title: string, message: string): void;
142
146
  }
147
+ export {};
143
148
  //# sourceMappingURL=index.d.ts.map
@@ -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;AACzB,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,KAAK,CAAe;IAC5B,OAAO,CAAC,aAAa,CAAQ;IAI7B,OAAO,CAAC,YAAY,CAAI;gBAEZ,OAAO,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;QACxB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,EAAE,OAAO,CAAA;YACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;SACtB,CAAA;QACD,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAA;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB;IA4CD,MAAM,CAAC,OAAO,EAAE;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;QACxB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,E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;;;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
@@ -1,53 +1,18 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var src_exports = {};
30
- __export(src_exports, {
31
- ReactiveTUIContent: () => ReactiveTUIContent,
32
- RedwoodStyling: () => RedwoodStyling,
33
- RedwoodTUI: () => RedwoodTUI
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
- var import_stream = __toESM(require("stream"));
37
- var import_ansis = __toESM(require("ansis"));
38
- var import_boxen = __toESM(require("boxen"));
39
- var import_enquirer = require("enquirer");
40
- var import_stdout_update = require("stdout-update");
1
+ import stream from "stream";
2
+ import ansis from "ansis";
3
+ import Enquirer from "enquirer";
4
+ import { UpdateManager } from "stdout-update";
5
+ const enquirerPrompt = Enquirer.prompt;
41
6
  const RedwoodStyling = {
42
- error: import_ansis.default.bold.red,
43
- warning: import_ansis.default.hex("#ffa500"),
44
- success: import_ansis.default.greenBright,
45
- info: import_ansis.default.gray,
46
- header: import_ansis.default.bold.underline.hex("#e8e8e8"),
47
- cmd: import_ansis.default.hex("#808080"),
48
- redwood: import_ansis.default.hex("#ff845e"),
49
- love: import_ansis.default.redBright,
50
- green: import_ansis.default.green
7
+ error: ansis.bold.red,
8
+ warning: ansis.hex("#ffa500"),
9
+ success: ansis.greenBright,
10
+ info: ansis.gray,
11
+ header: ansis.bold.underline.hex("#e8e8e8"),
12
+ cmd: ansis.hex("#808080"),
13
+ redwood: ansis.hex("#ff845e"),
14
+ love: ansis.redBright,
15
+ green: ansis.green
51
16
  };
52
17
  class ReactiveTUIContent {
53
18
  outStream;
@@ -55,7 +20,6 @@ class ReactiveTUIContent {
55
20
  header;
56
21
  content;
57
22
  spinner;
58
- boxen;
59
23
  frameInterval;
60
24
  // TODO: Implement a progress bar
61
25
  spinnerIndex = 0;
@@ -75,7 +39,6 @@ class ReactiveTUIContent {
75
39
  );
76
40
  }
77
41
  this.spinner = { ...defaultSpinner, ...options.spinner };
78
- this.boxen = { ...options.boxen };
79
42
  if (options.frameInterval !== void 0) {
80
43
  if (typeof options.frameInterval !== "number" || options.frameInterval <= 0) {
81
44
  throw new Error("tui: `frameInterval` must be a number > 0");
@@ -106,9 +69,6 @@ class ReactiveTUIContent {
106
69
  }
107
70
  this.spinner = { ...this.spinner, ...options.spinner };
108
71
  }
109
- if (options.boxen) {
110
- this.boxen = { ...this.boxen, ...options.boxen };
111
- }
112
72
  if (options.outStream) {
113
73
  this.setOutStream(options.outStream);
114
74
  }
@@ -120,7 +80,7 @@ class ReactiveTUIContent {
120
80
  }
121
81
  }
122
82
  setOutStream(out) {
123
- this.outStream = new import_stream.default.Writable({
83
+ this.outStream = new stream.Writable({
124
84
  write: (chunk, _encoding, next) => {
125
85
  if (this.content === "stream") {
126
86
  this.content += chunk.toString("utf-8");
@@ -163,7 +123,7 @@ class RedwoodTUI {
163
123
  constructor({ out, err } = {}) {
164
124
  this.outStream = out || process.stdout;
165
125
  this.errStream = err || process.stderr;
166
- this.manager = import_stdout_update.UpdateManager.getInstance(this.outStream, this.errStream);
126
+ this.manager = UpdateManager.getInstance(this.outStream, this.errStream);
167
127
  process.on("exit", () => {
168
128
  this.stopReactive();
169
129
  });
@@ -265,48 +225,56 @@ class RedwoodTUI {
265
225
  if (wasReactive) {
266
226
  this.stopReactive();
267
227
  }
268
- const result = await (0, import_enquirer.prompt)(questions);
228
+ const result = await enquirerPrompt(questions);
269
229
  if (wasReactive) {
270
230
  this.startReactive();
271
231
  }
272
232
  return result;
273
233
  }
274
234
  /**
275
- * Display an error message in a box
235
+ * Writes a fenced text block to the TUI output stream
276
236
  *
277
- * @param title Error box title
278
- * @param message Error message
237
+ * @param title The string to write out
279
238
  */
280
- displayError(title, message) {
281
- this.drawText(
282
- (0, import_boxen.default)(message, {
283
- padding: 1,
284
- borderColor: "red",
285
- title: `\u26A0 Error: ${title}`,
286
- titleAlignment: "left"
287
- })
239
+ drawFencedText(color, title, message) {
240
+ const width = Math.min(80, (this.outStream.columns || 80) - 2);
241
+ const headerText = `\u2500\u2500\u2500\u2500 ${title} `;
242
+ const header = ansis[color](
243
+ headerText + "\u2500".repeat(Math.max(0, width - headerText.length))
288
244
  );
245
+ const line = ansis[color]("\u2500".repeat(width));
246
+ this.outStream.write(`
247
+ ${header}
248
+ ${line}
249
+
250
+ ${message}
251
+
252
+ ${line}
253
+ `);
289
254
  }
290
255
  /**
291
- * Display a warning message in a box
256
+ * Display an error message with a red header and footer
292
257
  *
293
- * @param title Error box title
258
+ * @param title Error title
294
259
  * @param message Error message
295
260
  */
261
+ displayError(title, message) {
262
+ const headerText = `\u26A0 Error: ${title}`;
263
+ this.drawFencedText("red", headerText, message);
264
+ }
265
+ /**
266
+ * Display a warning message with a yellow header and footer
267
+ *
268
+ * @param title Warning title
269
+ * @param message Warning message
270
+ */
296
271
  displayWarning(title, message) {
297
- this.drawText(
298
- (0, import_boxen.default)(message, {
299
- padding: 1,
300
- borderColor: "yellow",
301
- title: `\u26A0 Warning: ${title}`,
302
- titleAlignment: "left"
303
- })
304
- );
272
+ const headerText = `\u26A0 Warning: ${title}`;
273
+ this.drawFencedText("yellow", headerText, message);
305
274
  }
306
275
  }
307
- // Annotate the CommonJS export names for ESM import in node:
308
- 0 && (module.exports = {
276
+ export {
309
277
  ReactiveTUIContent,
310
278
  RedwoodStyling,
311
279
  RedwoodTUI
312
- });
280
+ };
package/package.json CHANGED
@@ -1,37 +1,39 @@
1
1
  {
2
2
  "name": "@cedarjs/tui",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
7
7
  "directory": "packages/tui"
8
8
  },
9
9
  "license": "MIT",
10
+ "type": "module",
10
11
  "main": "./dist/index.js",
11
12
  "types": "./dist/index.d.ts",
12
13
  "files": [
13
14
  "dist"
14
15
  ],
15
16
  "scripts": {
16
- "build": "tsx ./build.mts && yarn build:types",
17
+ "build": "node ./build.mts",
17
18
  "build:pack": "yarn pack -o cedarjs-tui.tgz",
18
- "build:types": "tsc --build --verbose",
19
+ "build:types": "tsc --build --verbose ./tsconfig.build.json",
19
20
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
20
21
  "prepublishOnly": "NODE_ENV=production yarn build"
21
22
  },
22
23
  "dependencies": {
23
- "ansis": "4.2.0",
24
- "boxen": "5.1.2",
24
+ "ansis": "4.3.1",
25
25
  "enquirer": "2.4.1",
26
26
  "stdout-update": "1.6.8"
27
27
  },
28
28
  "devDependencies": {
29
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
30
- "tsx": "4.21.0",
29
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
31
30
  "typescript": "5.9.3"
32
31
  },
32
+ "engines": {
33
+ "node": ">=24"
34
+ },
33
35
  "publishConfig": {
34
36
  "access": "public"
35
37
  },
36
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
38
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
37
39
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.