@opentui/core 0.0.0-20250922-6d7f4921 → 0.0.0-20250922-2a20774e
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/3d.js +1 -1
- package/ansi.d.ts +0 -1
- package/{index-ra8j4k81.js → index-mtc20a8y.js} +56 -22
- package/{index-ra8j4k81.js.map → index-mtc20a8y.js.map} +6 -6
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/KeyHandler.d.ts +1 -0
- package/package.json +7 -7
- package/renderer.d.ts +1 -0
- package/testing.js +1 -1
package/3d.js
CHANGED
package/ansi.d.ts
CHANGED
|
@@ -2189,6 +2189,7 @@ function singleton(key, factory) {
|
|
|
2189
2189
|
class KeyHandler extends EventEmitter {
|
|
2190
2190
|
stdin;
|
|
2191
2191
|
useKittyKeyboard;
|
|
2192
|
+
listener;
|
|
2192
2193
|
constructor(stdin, useKittyKeyboard = false) {
|
|
2193
2194
|
super();
|
|
2194
2195
|
this.stdin = stdin || process.stdin;
|
|
@@ -2198,7 +2199,7 @@ class KeyHandler extends EventEmitter {
|
|
|
2198
2199
|
}
|
|
2199
2200
|
this.stdin.resume();
|
|
2200
2201
|
this.stdin.setEncoding("utf8");
|
|
2201
|
-
this.
|
|
2202
|
+
this.listener = (key) => {
|
|
2202
2203
|
const parsedKey = parseKeypress(key, { useKittyKeyboard: this.useKittyKeyboard });
|
|
2203
2204
|
switch (parsedKey.eventType) {
|
|
2204
2205
|
case "press":
|
|
@@ -2214,10 +2215,15 @@ class KeyHandler extends EventEmitter {
|
|
|
2214
2215
|
this.emit("keypress", parsedKey);
|
|
2215
2216
|
break;
|
|
2216
2217
|
}
|
|
2217
|
-
}
|
|
2218
|
+
};
|
|
2219
|
+
this.stdin.on("data", this.listener);
|
|
2218
2220
|
}
|
|
2219
2221
|
destroy() {
|
|
2220
|
-
this.stdin.
|
|
2222
|
+
this.stdin.removeListener("data", this.listener);
|
|
2223
|
+
if (this.stdin.setRawMode) {
|
|
2224
|
+
this.stdin.setRawMode(false);
|
|
2225
|
+
}
|
|
2226
|
+
keyHandler = null;
|
|
2221
2227
|
}
|
|
2222
2228
|
}
|
|
2223
2229
|
var keyHandler = null;
|
|
@@ -7541,12 +7547,12 @@ class TerminalConsoleCache extends EventEmitter4 {
|
|
|
7541
7547
|
super();
|
|
7542
7548
|
}
|
|
7543
7549
|
activate() {
|
|
7550
|
+
if (process.env.OTUI_USE_CONSOLE === "false")
|
|
7551
|
+
return;
|
|
7544
7552
|
this.setupConsoleCapture();
|
|
7545
7553
|
this.overrideConsoleMethods();
|
|
7546
7554
|
}
|
|
7547
7555
|
setupConsoleCapture() {
|
|
7548
|
-
if (process.env.OTUI_USE_CONSOLE === "false")
|
|
7549
|
-
return;
|
|
7550
7556
|
const mockStdout = new CapturedWritableStream("stdout", capture);
|
|
7551
7557
|
const mockStderr = new CapturedWritableStream("stderr", capture);
|
|
7552
7558
|
global.console = new Console({
|
|
@@ -8135,8 +8141,6 @@ var ANSI = {
|
|
|
8135
8141
|
disableAnyEventTracking: "\x1B[?1003l",
|
|
8136
8142
|
enableSGRMouseMode: "\x1B[?1006h",
|
|
8137
8143
|
disableSGRMouseMode: "\x1B[?1006l",
|
|
8138
|
-
makeRoomForRenderer: (height) => `
|
|
8139
|
-
`.repeat(height) + `\x1B[${height}A`,
|
|
8140
8144
|
clearRendererSpace: (height) => `\x1B[${height}A\x1B[1G\x1B[J`
|
|
8141
8145
|
};
|
|
8142
8146
|
|
|
@@ -8270,6 +8274,21 @@ singleton("ProcessExitSignals", () => {
|
|
|
8270
8274
|
});
|
|
8271
8275
|
});
|
|
8272
8276
|
});
|
|
8277
|
+
var rendererTracker = singleton("RendererTracker", () => {
|
|
8278
|
+
const renderers = new Set;
|
|
8279
|
+
return {
|
|
8280
|
+
addRenderer: (renderer) => {
|
|
8281
|
+
renderers.add(renderer);
|
|
8282
|
+
},
|
|
8283
|
+
removeRenderer: (renderer) => {
|
|
8284
|
+
renderers.delete(renderer);
|
|
8285
|
+
if (renderers.size === 0) {
|
|
8286
|
+
getKeyHandler().destroy();
|
|
8287
|
+
process.stdin.pause();
|
|
8288
|
+
}
|
|
8289
|
+
}
|
|
8290
|
+
};
|
|
8291
|
+
});
|
|
8273
8292
|
async function createCliRenderer(config = {}) {
|
|
8274
8293
|
if (process.argv.includes("--delay-start")) {
|
|
8275
8294
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
@@ -8401,17 +8420,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
8401
8420
|
this.realStdoutWrite.call(this.stdout, `
|
|
8402
8421
|
=== FATAL ERROR OCCURRED ===
|
|
8403
8422
|
`);
|
|
8404
|
-
this.
|
|
8405
|
-
`);
|
|
8406
|
-
this.realStdoutWrite.call(this.stdout, this.console.getCachedLogs());
|
|
8407
|
-
this.realStdoutWrite.call(this.stdout, `
|
|
8408
|
-
Captured output:
|
|
8409
|
-
`);
|
|
8410
|
-
const capturedOutput = capture.claimOutput();
|
|
8411
|
-
if (capturedOutput) {
|
|
8412
|
-
this.realStdoutWrite.call(this.stdout, capturedOutput + `
|
|
8413
|
-
`);
|
|
8414
|
-
}
|
|
8423
|
+
this.dumpOutputCache();
|
|
8415
8424
|
this.realStdoutWrite.call(this.stdout, `
|
|
8416
8425
|
Error details:
|
|
8417
8426
|
`);
|
|
@@ -8424,7 +8433,31 @@ Error details:
|
|
|
8424
8433
|
process.exit(1);
|
|
8425
8434
|
});
|
|
8426
8435
|
}).bind(this);
|
|
8436
|
+
dumpOutputCache(optionalMessage = "") {
|
|
8437
|
+
const cachedLogs = this.console.getCachedLogs();
|
|
8438
|
+
const capturedOutput = capture.claimOutput();
|
|
8439
|
+
if (capturedOutput.length > 0 || cachedLogs.length > 0) {
|
|
8440
|
+
this.realStdoutWrite.call(this.stdout, optionalMessage);
|
|
8441
|
+
}
|
|
8442
|
+
if (cachedLogs.length > 0) {
|
|
8443
|
+
this.realStdoutWrite.call(this.stdout, `Console cache:
|
|
8444
|
+
`);
|
|
8445
|
+
this.realStdoutWrite.call(this.stdout, cachedLogs);
|
|
8446
|
+
}
|
|
8447
|
+
if (capturedOutput.length > 0) {
|
|
8448
|
+
this.realStdoutWrite.call(this.stdout, `
|
|
8449
|
+
Captured output:
|
|
8450
|
+
`);
|
|
8451
|
+
this.realStdoutWrite.call(this.stdout, capturedOutput + `
|
|
8452
|
+
`);
|
|
8453
|
+
}
|
|
8454
|
+
}
|
|
8427
8455
|
exitHandler = (() => {
|
|
8456
|
+
if (true) {
|
|
8457
|
+
this.dumpOutputCache(`
|
|
8458
|
+
=== UNHANDLED OUTPUT (this is only printed in non-production environments) ===
|
|
8459
|
+
`);
|
|
8460
|
+
}
|
|
8428
8461
|
this.destroy();
|
|
8429
8462
|
}).bind(this);
|
|
8430
8463
|
warningHandler = ((warning) => {
|
|
@@ -8432,6 +8465,7 @@ Error details:
|
|
|
8432
8465
|
}).bind(this);
|
|
8433
8466
|
constructor(lib, rendererPtr, stdin, stdout, width, height, config = {}) {
|
|
8434
8467
|
super();
|
|
8468
|
+
rendererTracker.addRenderer(this);
|
|
8435
8469
|
this.stdin = stdin;
|
|
8436
8470
|
this.stdout = stdout;
|
|
8437
8471
|
this.realStdoutWrite = stdout.write;
|
|
@@ -8732,7 +8766,7 @@ Error details:
|
|
|
8732
8766
|
}
|
|
8733
8767
|
if (this.exitOnCtrlC && str === "\x03") {
|
|
8734
8768
|
process.nextTick(() => {
|
|
8735
|
-
|
|
8769
|
+
this.destroy();
|
|
8736
8770
|
});
|
|
8737
8771
|
return;
|
|
8738
8772
|
}
|
|
@@ -9089,7 +9123,6 @@ Error details:
|
|
|
9089
9123
|
process.removeListener("SIGWINCH", this.sigwinchHandler);
|
|
9090
9124
|
process.removeListener("uncaughtException", this.handleError);
|
|
9091
9125
|
process.removeListener("unhandledRejection", this.handleError);
|
|
9092
|
-
process.removeListener("exit", this.exitHandler);
|
|
9093
9126
|
process.removeListener("warning", this.warningHandler);
|
|
9094
9127
|
capture.removeListener("write", this.captureCallback);
|
|
9095
9128
|
if (this.memorySnapshotTimer) {
|
|
@@ -9111,6 +9144,7 @@ Error details:
|
|
|
9111
9144
|
this.flushStdoutCache(this._splitHeight, true);
|
|
9112
9145
|
}
|
|
9113
9146
|
this.lib.destroyRenderer(this.rendererPtr);
|
|
9147
|
+
rendererTracker.removeRenderer(this);
|
|
9114
9148
|
}
|
|
9115
9149
|
startRenderLoop() {
|
|
9116
9150
|
if (!this._isRunning)
|
|
@@ -9336,5 +9370,5 @@ Error details:
|
|
|
9336
9370
|
|
|
9337
9371
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyHandler, getKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, SyntaxStyle, hastToStyledText, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, CliRenderer };
|
|
9338
9372
|
|
|
9339
|
-
//# debugId=
|
|
9340
|
-
//# sourceMappingURL=index-
|
|
9373
|
+
//# debugId=4FCA4D27FA80FDD264756E2164756E21
|
|
9374
|
+
//# sourceMappingURL=index-mtc20a8y.js.map
|