@opentui/core 0.0.0-20251031-fc297165 → 0.0.0-20251102-23e7b561
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/{index-vr8t68wb.js → index-rzgaxyf4.js} +272 -83
- package/{index-vr8t68wb.js.map → index-rzgaxyf4.js.map} +10 -9
- package/index.js +15 -3
- package/index.js.map +3 -3
- package/lib/KeyHandler.d.ts +4 -1
- package/lib/index.d.ts +1 -0
- package/lib/parse.keypress.d.ts +1 -0
- package/lib/stdin-buffer.d.ts +42 -0
- package/package.json +7 -7
- package/renderables/Box.d.ts +1 -0
- package/testing.js +1 -1
package/3d.js
CHANGED
|
@@ -1896,6 +1896,7 @@ function parseKittyKeyboard(sequence) {
|
|
|
1896
1896
|
sequence,
|
|
1897
1897
|
raw: sequence,
|
|
1898
1898
|
eventType: "press",
|
|
1899
|
+
source: "kitty",
|
|
1899
1900
|
super: false,
|
|
1900
1901
|
hyper: false,
|
|
1901
1902
|
capsLock: false,
|
|
@@ -2107,10 +2108,11 @@ var parseKeypress = (s = "", options = {}) => {
|
|
|
2107
2108
|
number: false,
|
|
2108
2109
|
sequence: s,
|
|
2109
2110
|
raw: s,
|
|
2110
|
-
eventType: "press"
|
|
2111
|
+
eventType: "press",
|
|
2112
|
+
source: "raw"
|
|
2111
2113
|
};
|
|
2112
2114
|
key.sequence = key.sequence || s || key.name;
|
|
2113
|
-
if (options.useKittyKeyboard
|
|
2115
|
+
if (options.useKittyKeyboard) {
|
|
2114
2116
|
const kittyResult = parseKittyKeyboard(s);
|
|
2115
2117
|
if (kittyResult) {
|
|
2116
2118
|
return kittyResult;
|
|
@@ -2135,6 +2137,9 @@ var parseKeypress = (s = "", options = {}) => {
|
|
|
2135
2137
|
} else if (s === " " || s === "\x1B ") {
|
|
2136
2138
|
key.name = "space";
|
|
2137
2139
|
key.meta = s.length === 2;
|
|
2140
|
+
} else if (s === "\x00") {
|
|
2141
|
+
key.name = "space";
|
|
2142
|
+
key.ctrl = true;
|
|
2138
2143
|
} else if (s.length === 1 && s <= "\x1A") {
|
|
2139
2144
|
key.name = String.fromCharCode(s.charCodeAt(0) + 97 - 1);
|
|
2140
2145
|
key.ctrl = true;
|
|
@@ -2185,8 +2190,184 @@ var parseKeypress = (s = "", options = {}) => {
|
|
|
2185
2190
|
return key;
|
|
2186
2191
|
};
|
|
2187
2192
|
|
|
2188
|
-
// src/lib/
|
|
2193
|
+
// src/lib/stdin-buffer.ts
|
|
2189
2194
|
import { EventEmitter } from "events";
|
|
2195
|
+
var ESC = "\x1B";
|
|
2196
|
+
function isCompleteSequence(data) {
|
|
2197
|
+
if (!data.startsWith(ESC)) {
|
|
2198
|
+
return "not-escape";
|
|
2199
|
+
}
|
|
2200
|
+
if (data.length === 1) {
|
|
2201
|
+
return "incomplete";
|
|
2202
|
+
}
|
|
2203
|
+
const afterEsc = data.slice(1);
|
|
2204
|
+
if (afterEsc.startsWith("[")) {
|
|
2205
|
+
if (afterEsc.startsWith("[M")) {
|
|
2206
|
+
return data.length >= 6 ? "complete" : "incomplete";
|
|
2207
|
+
}
|
|
2208
|
+
return isCompleteCsiSequence(data);
|
|
2209
|
+
}
|
|
2210
|
+
if (afterEsc.startsWith("]")) {
|
|
2211
|
+
return isCompleteOscSequence(data);
|
|
2212
|
+
}
|
|
2213
|
+
if (afterEsc.startsWith("O")) {
|
|
2214
|
+
return afterEsc.length >= 2 ? "complete" : "incomplete";
|
|
2215
|
+
}
|
|
2216
|
+
if (afterEsc.length === 1) {
|
|
2217
|
+
return "complete";
|
|
2218
|
+
}
|
|
2219
|
+
return "complete";
|
|
2220
|
+
}
|
|
2221
|
+
function isCompleteCsiSequence(data) {
|
|
2222
|
+
if (!data.startsWith(ESC + "[")) {
|
|
2223
|
+
return "complete";
|
|
2224
|
+
}
|
|
2225
|
+
if (data.length < 3) {
|
|
2226
|
+
return "incomplete";
|
|
2227
|
+
}
|
|
2228
|
+
const payload = data.slice(2);
|
|
2229
|
+
const lastChar = payload[payload.length - 1];
|
|
2230
|
+
const lastCharCode = lastChar.charCodeAt(0);
|
|
2231
|
+
if (lastCharCode >= 64 && lastCharCode <= 126) {
|
|
2232
|
+
if (payload.startsWith("<")) {
|
|
2233
|
+
const mouseMatch = /^<\d+;\d+;\d+[Mm]$/.test(payload);
|
|
2234
|
+
if (mouseMatch) {
|
|
2235
|
+
return "complete";
|
|
2236
|
+
}
|
|
2237
|
+
if (lastChar === "M" || lastChar === "m") {
|
|
2238
|
+
const parts = payload.slice(1, -1).split(";");
|
|
2239
|
+
if (parts.length === 3 && parts.every((p) => /^\d+$/.test(p))) {
|
|
2240
|
+
return "complete";
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
return "incomplete";
|
|
2244
|
+
}
|
|
2245
|
+
return "complete";
|
|
2246
|
+
}
|
|
2247
|
+
return "incomplete";
|
|
2248
|
+
}
|
|
2249
|
+
function isCompleteOscSequence(data) {
|
|
2250
|
+
if (!data.startsWith(ESC + "]")) {
|
|
2251
|
+
return "complete";
|
|
2252
|
+
}
|
|
2253
|
+
if (data.endsWith(ESC + "\\") || data.endsWith("\x07")) {
|
|
2254
|
+
return "complete";
|
|
2255
|
+
}
|
|
2256
|
+
return "incomplete";
|
|
2257
|
+
}
|
|
2258
|
+
function extractCompleteSequences(buffer) {
|
|
2259
|
+
const sequences = [];
|
|
2260
|
+
let pos = 0;
|
|
2261
|
+
while (pos < buffer.length) {
|
|
2262
|
+
const remaining = buffer.slice(pos);
|
|
2263
|
+
if (remaining.startsWith(ESC)) {
|
|
2264
|
+
let seqEnd = 1;
|
|
2265
|
+
while (seqEnd <= remaining.length) {
|
|
2266
|
+
const candidate = remaining.slice(0, seqEnd);
|
|
2267
|
+
const status = isCompleteSequence(candidate);
|
|
2268
|
+
if (status === "complete") {
|
|
2269
|
+
sequences.push(candidate);
|
|
2270
|
+
pos += seqEnd;
|
|
2271
|
+
break;
|
|
2272
|
+
} else if (status === "incomplete") {
|
|
2273
|
+
seqEnd++;
|
|
2274
|
+
} else {
|
|
2275
|
+
sequences.push(candidate);
|
|
2276
|
+
pos += seqEnd;
|
|
2277
|
+
break;
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
if (seqEnd > remaining.length) {
|
|
2281
|
+
return { sequences, remainder: remaining };
|
|
2282
|
+
}
|
|
2283
|
+
} else {
|
|
2284
|
+
sequences.push(remaining[0]);
|
|
2285
|
+
pos++;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
return { sequences, remainder: "" };
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
class StdinBuffer extends EventEmitter {
|
|
2292
|
+
buffer = "";
|
|
2293
|
+
timeout = null;
|
|
2294
|
+
timeoutMs;
|
|
2295
|
+
stdin;
|
|
2296
|
+
stdinListener;
|
|
2297
|
+
constructor(stdin, options = {}) {
|
|
2298
|
+
super();
|
|
2299
|
+
this.stdin = stdin;
|
|
2300
|
+
this.timeoutMs = options.timeout ?? 10;
|
|
2301
|
+
this.stdinListener = (data) => {
|
|
2302
|
+
this.handleData(data);
|
|
2303
|
+
};
|
|
2304
|
+
this.stdin.on("data", this.stdinListener);
|
|
2305
|
+
}
|
|
2306
|
+
handleData(data) {
|
|
2307
|
+
if (this.timeout) {
|
|
2308
|
+
clearTimeout(this.timeout);
|
|
2309
|
+
this.timeout = null;
|
|
2310
|
+
}
|
|
2311
|
+
let str;
|
|
2312
|
+
if (Buffer.isBuffer(data)) {
|
|
2313
|
+
if (data.length === 1 && data[0] > 127) {
|
|
2314
|
+
const byte = data[0] - 128;
|
|
2315
|
+
str = "\x1B" + String.fromCharCode(byte);
|
|
2316
|
+
} else {
|
|
2317
|
+
str = data.toString();
|
|
2318
|
+
}
|
|
2319
|
+
} else {
|
|
2320
|
+
str = data;
|
|
2321
|
+
}
|
|
2322
|
+
if (str.length === 0 && this.buffer.length === 0) {
|
|
2323
|
+
this.emit("data", "");
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
this.buffer += str;
|
|
2327
|
+
const result = extractCompleteSequences(this.buffer);
|
|
2328
|
+
this.buffer = result.remainder;
|
|
2329
|
+
for (const sequence of result.sequences) {
|
|
2330
|
+
this.emit("data", sequence);
|
|
2331
|
+
}
|
|
2332
|
+
if (this.buffer.length > 0) {
|
|
2333
|
+
this.timeout = setTimeout(() => {
|
|
2334
|
+
const flushed = this.flush();
|
|
2335
|
+
for (const sequence of flushed) {
|
|
2336
|
+
this.emit("data", sequence);
|
|
2337
|
+
}
|
|
2338
|
+
}, this.timeoutMs);
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
flush() {
|
|
2342
|
+
if (this.timeout) {
|
|
2343
|
+
clearTimeout(this.timeout);
|
|
2344
|
+
this.timeout = null;
|
|
2345
|
+
}
|
|
2346
|
+
if (this.buffer.length === 0) {
|
|
2347
|
+
return [];
|
|
2348
|
+
}
|
|
2349
|
+
const sequences = [this.buffer];
|
|
2350
|
+
this.buffer = "";
|
|
2351
|
+
return sequences;
|
|
2352
|
+
}
|
|
2353
|
+
clear() {
|
|
2354
|
+
if (this.timeout) {
|
|
2355
|
+
clearTimeout(this.timeout);
|
|
2356
|
+
this.timeout = null;
|
|
2357
|
+
}
|
|
2358
|
+
this.buffer = "";
|
|
2359
|
+
}
|
|
2360
|
+
getBuffer() {
|
|
2361
|
+
return this.buffer;
|
|
2362
|
+
}
|
|
2363
|
+
destroy() {
|
|
2364
|
+
this.stdin.removeListener("data", this.stdinListener);
|
|
2365
|
+
this.clear();
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
// src/lib/KeyHandler.ts
|
|
2370
|
+
import { EventEmitter as EventEmitter2 } from "events";
|
|
2190
2371
|
|
|
2191
2372
|
// src/ansi.ts
|
|
2192
2373
|
var ANSI = {
|
|
@@ -2214,6 +2395,7 @@ class KeyEvent {
|
|
|
2214
2395
|
number;
|
|
2215
2396
|
raw;
|
|
2216
2397
|
eventType;
|
|
2398
|
+
source;
|
|
2217
2399
|
code;
|
|
2218
2400
|
super;
|
|
2219
2401
|
hyper;
|
|
@@ -2231,6 +2413,7 @@ class KeyEvent {
|
|
|
2231
2413
|
this.number = key.number;
|
|
2232
2414
|
this.raw = key.raw;
|
|
2233
2415
|
this.eventType = key.eventType;
|
|
2416
|
+
this.source = key.source;
|
|
2234
2417
|
this.code = key.code;
|
|
2235
2418
|
this.super = key.super;
|
|
2236
2419
|
this.hyper = key.hyper;
|
|
@@ -2260,65 +2443,70 @@ class PasteEvent {
|
|
|
2260
2443
|
}
|
|
2261
2444
|
}
|
|
2262
2445
|
|
|
2263
|
-
class KeyHandler extends
|
|
2446
|
+
class KeyHandler extends EventEmitter2 {
|
|
2264
2447
|
stdin;
|
|
2265
2448
|
useKittyKeyboard;
|
|
2266
|
-
listener;
|
|
2267
2449
|
pasteMode = false;
|
|
2268
2450
|
pasteBuffer = [];
|
|
2269
2451
|
suspended = false;
|
|
2452
|
+
stdinBuffer;
|
|
2453
|
+
dataListener;
|
|
2270
2454
|
constructor(stdin, useKittyKeyboard = false) {
|
|
2271
2455
|
super();
|
|
2272
2456
|
this.stdin = stdin || process.stdin;
|
|
2273
2457
|
this.useKittyKeyboard = useKittyKeyboard;
|
|
2274
|
-
this.
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
this.pasteMode = true;
|
|
2278
|
-
}
|
|
2279
|
-
if (this.pasteMode) {
|
|
2280
|
-
this.pasteBuffer.push(Bun.stripANSI(data));
|
|
2281
|
-
if (data.endsWith(ANSI.bracketedPasteEnd)) {
|
|
2282
|
-
this.pasteMode = false;
|
|
2283
|
-
this.emit("paste", new PasteEvent(this.pasteBuffer.join("")));
|
|
2284
|
-
this.pasteBuffer = [];
|
|
2285
|
-
}
|
|
2286
|
-
return;
|
|
2287
|
-
}
|
|
2288
|
-
const parsedKey = parseKeypress(key, { useKittyKeyboard: this.useKittyKeyboard });
|
|
2289
|
-
if (!parsedKey) {
|
|
2290
|
-
return;
|
|
2291
|
-
}
|
|
2292
|
-
switch (parsedKey.eventType) {
|
|
2293
|
-
case "press":
|
|
2294
|
-
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2295
|
-
break;
|
|
2296
|
-
case "repeat":
|
|
2297
|
-
this.emit("keyrepeat", new KeyEvent(parsedKey));
|
|
2298
|
-
break;
|
|
2299
|
-
case "release":
|
|
2300
|
-
this.emit("keyrelease", new KeyEvent(parsedKey));
|
|
2301
|
-
break;
|
|
2302
|
-
default:
|
|
2303
|
-
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2304
|
-
break;
|
|
2305
|
-
}
|
|
2458
|
+
this.stdinBuffer = new StdinBuffer(this.stdin, { timeout: 5 });
|
|
2459
|
+
this.dataListener = (sequence) => {
|
|
2460
|
+
this.processSequence(sequence);
|
|
2306
2461
|
};
|
|
2307
|
-
this.
|
|
2462
|
+
this.stdinBuffer.on("data", this.dataListener);
|
|
2463
|
+
}
|
|
2464
|
+
processSequence(data) {
|
|
2465
|
+
if (data.startsWith(ANSI.bracketedPasteStart)) {
|
|
2466
|
+
this.pasteMode = true;
|
|
2467
|
+
}
|
|
2468
|
+
if (this.pasteMode) {
|
|
2469
|
+
this.pasteBuffer.push(Bun.stripANSI(data));
|
|
2470
|
+
if (data.endsWith(ANSI.bracketedPasteEnd)) {
|
|
2471
|
+
this.pasteMode = false;
|
|
2472
|
+
this.emit("paste", new PasteEvent(this.pasteBuffer.join("")));
|
|
2473
|
+
this.pasteBuffer = [];
|
|
2474
|
+
}
|
|
2475
|
+
return;
|
|
2476
|
+
}
|
|
2477
|
+
const parsedKey = parseKeypress(data, { useKittyKeyboard: this.useKittyKeyboard });
|
|
2478
|
+
if (!parsedKey) {
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2481
|
+
switch (parsedKey.eventType) {
|
|
2482
|
+
case "press":
|
|
2483
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2484
|
+
break;
|
|
2485
|
+
case "repeat":
|
|
2486
|
+
this.emit("keyrepeat", new KeyEvent(parsedKey));
|
|
2487
|
+
break;
|
|
2488
|
+
case "release":
|
|
2489
|
+
this.emit("keyrelease", new KeyEvent(parsedKey));
|
|
2490
|
+
break;
|
|
2491
|
+
default:
|
|
2492
|
+
this.emit("keypress", new KeyEvent(parsedKey));
|
|
2493
|
+
break;
|
|
2494
|
+
}
|
|
2308
2495
|
}
|
|
2309
2496
|
destroy() {
|
|
2310
|
-
this.
|
|
2497
|
+
this.stdinBuffer.removeListener("data", this.dataListener);
|
|
2498
|
+
this.stdinBuffer.destroy();
|
|
2311
2499
|
}
|
|
2312
2500
|
suspend() {
|
|
2313
2501
|
if (!this.suspended) {
|
|
2314
2502
|
this.suspended = true;
|
|
2315
|
-
this.
|
|
2503
|
+
this.stdinBuffer.removeListener("data", this.dataListener);
|
|
2316
2504
|
}
|
|
2317
2505
|
}
|
|
2318
2506
|
resume() {
|
|
2319
2507
|
if (this.suspended) {
|
|
2320
2508
|
this.suspended = false;
|
|
2321
|
-
this.
|
|
2509
|
+
this.stdinBuffer.on("data", this.dataListener);
|
|
2322
2510
|
}
|
|
2323
2511
|
}
|
|
2324
2512
|
}
|
|
@@ -5325,7 +5513,7 @@ async function treeSitterToStyledText(content, filetype, syntaxStyle, client, op
|
|
|
5325
5513
|
}
|
|
5326
5514
|
|
|
5327
5515
|
// src/lib/tree-sitter/client.ts
|
|
5328
|
-
import { EventEmitter as
|
|
5516
|
+
import { EventEmitter as EventEmitter3 } from "events";
|
|
5329
5517
|
|
|
5330
5518
|
// src/lib/debounce.ts
|
|
5331
5519
|
var TIMERS_MAP = new Map;
|
|
@@ -5496,9 +5684,8 @@ function getParsers() {
|
|
|
5496
5684
|
}
|
|
5497
5685
|
|
|
5498
5686
|
// src/lib/tree-sitter/client.ts
|
|
5499
|
-
import { resolve as resolve2, isAbsolute } from "path";
|
|
5687
|
+
import { resolve as resolve2, isAbsolute, parse } from "path";
|
|
5500
5688
|
import { existsSync } from "fs";
|
|
5501
|
-
import { parse } from "path";
|
|
5502
5689
|
registerEnvVar({
|
|
5503
5690
|
name: "OTUI_TREE_SITTER_WORKER_PATH",
|
|
5504
5691
|
description: "Path to the TreeSitter worker",
|
|
@@ -5518,7 +5705,7 @@ function addDefaultParsers(parsers) {
|
|
|
5518
5705
|
}
|
|
5519
5706
|
var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
5520
5707
|
|
|
5521
|
-
class TreeSitterClient extends
|
|
5708
|
+
class TreeSitterClient extends EventEmitter3 {
|
|
5522
5709
|
initialized = false;
|
|
5523
5710
|
worker;
|
|
5524
5711
|
buffers = new Map;
|
|
@@ -5551,9 +5738,9 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
5551
5738
|
}
|
|
5552
5739
|
let worker_path;
|
|
5553
5740
|
if (env.OTUI_TREE_SITTER_WORKER_PATH) {
|
|
5554
|
-
worker_path = env.OTUI_TREE_SITTER_WORKER_PATH;
|
|
5741
|
+
worker_path = resolve2(env.OTUI_TREE_SITTER_WORKER_PATH);
|
|
5555
5742
|
} else if (typeof OTUI_TREE_SITTER_WORKER_PATH !== "undefined") {
|
|
5556
|
-
worker_path = OTUI_TREE_SITTER_WORKER_PATH;
|
|
5743
|
+
worker_path = resolve2(OTUI_TREE_SITTER_WORKER_PATH);
|
|
5557
5744
|
} else if (this.options.workerPath) {
|
|
5558
5745
|
worker_path = this.options.workerPath;
|
|
5559
5746
|
} else {
|
|
@@ -5969,7 +6156,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
5969
6156
|
// src/lib/data-paths.ts
|
|
5970
6157
|
import os from "os";
|
|
5971
6158
|
import path from "path";
|
|
5972
|
-
import { EventEmitter as
|
|
6159
|
+
import { EventEmitter as EventEmitter4 } from "events";
|
|
5973
6160
|
|
|
5974
6161
|
// src/lib/validate-dir-name.ts
|
|
5975
6162
|
function isValidDirectoryName(name) {
|
|
@@ -6033,7 +6220,7 @@ registerEnvVar({
|
|
|
6033
6220
|
default: ""
|
|
6034
6221
|
});
|
|
6035
6222
|
|
|
6036
|
-
class DataPathsManager extends
|
|
6223
|
+
class DataPathsManager extends EventEmitter4 {
|
|
6037
6224
|
_appName;
|
|
6038
6225
|
_globalConfigPath;
|
|
6039
6226
|
_globalConfigFile;
|
|
@@ -7156,7 +7343,7 @@ function createExtmarksController(editBuffer, editorView) {
|
|
|
7156
7343
|
// src/zig.ts
|
|
7157
7344
|
import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as ptr3 } from "bun:ffi";
|
|
7158
7345
|
import { existsSync as existsSync2 } from "fs";
|
|
7159
|
-
import { EventEmitter as
|
|
7346
|
+
import { EventEmitter as EventEmitter5 } from "events";
|
|
7160
7347
|
|
|
7161
7348
|
// src/buffer.ts
|
|
7162
7349
|
import { toArrayBuffer } from "bun:ffi";
|
|
@@ -8837,7 +9024,7 @@ class FFIRenderLib {
|
|
|
8837
9024
|
decoder = new TextDecoder;
|
|
8838
9025
|
logCallbackWrapper;
|
|
8839
9026
|
eventCallbackWrapper;
|
|
8840
|
-
_nativeEvents = new
|
|
9027
|
+
_nativeEvents = new EventEmitter5;
|
|
8841
9028
|
_anyEventHandlers = [];
|
|
8842
9029
|
constructor(libPath) {
|
|
8843
9030
|
this.opentui = getOpenTUILib(libPath);
|
|
@@ -9974,7 +10161,7 @@ class TextBuffer {
|
|
|
9974
10161
|
}
|
|
9975
10162
|
|
|
9976
10163
|
// src/Renderable.ts
|
|
9977
|
-
import { EventEmitter as
|
|
10164
|
+
import { EventEmitter as EventEmitter6 } from "events";
|
|
9978
10165
|
|
|
9979
10166
|
// src/lib/renderable.validations.ts
|
|
9980
10167
|
function validateOptions(id, options) {
|
|
@@ -10067,7 +10254,7 @@ function isRenderable(obj) {
|
|
|
10067
10254
|
return !!obj?.[BrandedRenderable];
|
|
10068
10255
|
}
|
|
10069
10256
|
|
|
10070
|
-
class BaseRenderable extends
|
|
10257
|
+
class BaseRenderable extends EventEmitter6 {
|
|
10071
10258
|
[BrandedRenderable] = true;
|
|
10072
10259
|
static renderableNumber = 1;
|
|
10073
10260
|
_id;
|
|
@@ -11388,7 +11575,7 @@ function delegate(mapping, vnode) {
|
|
|
11388
11575
|
}
|
|
11389
11576
|
|
|
11390
11577
|
// src/console.ts
|
|
11391
|
-
import { EventEmitter as
|
|
11578
|
+
import { EventEmitter as EventEmitter8 } from "events";
|
|
11392
11579
|
import { Console } from "console";
|
|
11393
11580
|
import fs from "fs";
|
|
11394
11581
|
import path4 from "path";
|
|
@@ -11396,9 +11583,9 @@ import util2 from "util";
|
|
|
11396
11583
|
|
|
11397
11584
|
// src/lib/output.capture.ts
|
|
11398
11585
|
import { Writable } from "stream";
|
|
11399
|
-
import { EventEmitter as
|
|
11586
|
+
import { EventEmitter as EventEmitter7 } from "events";
|
|
11400
11587
|
|
|
11401
|
-
class Capture extends
|
|
11588
|
+
class Capture extends EventEmitter7 {
|
|
11402
11589
|
output = [];
|
|
11403
11590
|
constructor() {
|
|
11404
11591
|
super();
|
|
@@ -11474,7 +11661,7 @@ registerEnvVar({
|
|
|
11474
11661
|
default: false
|
|
11475
11662
|
});
|
|
11476
11663
|
|
|
11477
|
-
class TerminalConsoleCache extends
|
|
11664
|
+
class TerminalConsoleCache extends EventEmitter8 {
|
|
11478
11665
|
_cachedLogs = [];
|
|
11479
11666
|
MAX_CACHE_SIZE = 1000;
|
|
11480
11667
|
_collectCallerInfo = false;
|
|
@@ -11600,7 +11787,7 @@ var DEFAULT_CONSOLE_OPTIONS = {
|
|
|
11600
11787
|
};
|
|
11601
11788
|
var INDENT_WIDTH = 2;
|
|
11602
11789
|
|
|
11603
|
-
class TerminalConsole extends
|
|
11790
|
+
class TerminalConsole extends EventEmitter8 {
|
|
11604
11791
|
isVisible = false;
|
|
11605
11792
|
isFocused = false;
|
|
11606
11793
|
renderer;
|
|
@@ -11689,34 +11876,34 @@ class TerminalConsole extends EventEmitter7 {
|
|
|
11689
11876
|
}
|
|
11690
11877
|
this.markNeedsRerender();
|
|
11691
11878
|
}
|
|
11692
|
-
_updateConsoleDimensions() {
|
|
11693
|
-
const
|
|
11694
|
-
const
|
|
11879
|
+
_updateConsoleDimensions(termWidth, termHeight) {
|
|
11880
|
+
const width = termWidth ?? this.renderer.terminalWidth;
|
|
11881
|
+
const height = termHeight ?? this.renderer.terminalHeight;
|
|
11695
11882
|
const sizePercent = this.options.sizePercent / 100;
|
|
11696
11883
|
switch (this.options.position) {
|
|
11697
11884
|
case "top" /* TOP */:
|
|
11698
11885
|
this.consoleX = 0;
|
|
11699
11886
|
this.consoleY = 0;
|
|
11700
|
-
this.consoleWidth =
|
|
11701
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11887
|
+
this.consoleWidth = width;
|
|
11888
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11702
11889
|
break;
|
|
11703
11890
|
case "bottom" /* BOTTOM */:
|
|
11704
|
-
this.consoleHeight = Math.max(1, Math.floor(
|
|
11705
|
-
this.consoleWidth =
|
|
11891
|
+
this.consoleHeight = Math.max(1, Math.floor(height * sizePercent));
|
|
11892
|
+
this.consoleWidth = width;
|
|
11706
11893
|
this.consoleX = 0;
|
|
11707
|
-
this.consoleY =
|
|
11894
|
+
this.consoleY = height - this.consoleHeight;
|
|
11708
11895
|
break;
|
|
11709
11896
|
case "left" /* LEFT */:
|
|
11710
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11711
|
-
this.consoleHeight =
|
|
11897
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11898
|
+
this.consoleHeight = height;
|
|
11712
11899
|
this.consoleX = 0;
|
|
11713
11900
|
this.consoleY = 0;
|
|
11714
11901
|
break;
|
|
11715
11902
|
case "right" /* RIGHT */:
|
|
11716
|
-
this.consoleWidth = Math.max(1, Math.floor(
|
|
11717
|
-
this.consoleHeight =
|
|
11903
|
+
this.consoleWidth = Math.max(1, Math.floor(width * sizePercent));
|
|
11904
|
+
this.consoleHeight = height;
|
|
11718
11905
|
this.consoleY = 0;
|
|
11719
|
-
this.consoleX =
|
|
11906
|
+
this.consoleX = width - this.consoleWidth;
|
|
11720
11907
|
break;
|
|
11721
11908
|
}
|
|
11722
11909
|
this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, this.consoleHeight - 1));
|
|
@@ -11838,7 +12025,7 @@ class TerminalConsole extends EventEmitter7 {
|
|
|
11838
12025
|
}).join(" ");
|
|
11839
12026
|
}
|
|
11840
12027
|
resize(width, height) {
|
|
11841
|
-
this._updateConsoleDimensions();
|
|
12028
|
+
this._updateConsoleDimensions(width, height);
|
|
11842
12029
|
if (this.frameBuffer) {
|
|
11843
12030
|
this.frameBuffer.resize(this.consoleWidth, this.consoleHeight);
|
|
11844
12031
|
const displayLineCount = this._displayLines.length;
|
|
@@ -12060,7 +12247,7 @@ class TerminalConsole extends EventEmitter7 {
|
|
|
12060
12247
|
}
|
|
12061
12248
|
|
|
12062
12249
|
// src/renderer.ts
|
|
12063
|
-
import { EventEmitter as
|
|
12250
|
+
import { EventEmitter as EventEmitter9 } from "events";
|
|
12064
12251
|
|
|
12065
12252
|
// src/lib/objects-in-viewport.ts
|
|
12066
12253
|
function getObjectsInViewport(viewport, objects, direction = "column", padding = 10, minTriggerSize = 16) {
|
|
@@ -12286,7 +12473,7 @@ var RendererControlState;
|
|
|
12286
12473
|
RendererControlState2["EXPLICIT_STOPPED"] = "explicit_stopped";
|
|
12287
12474
|
})(RendererControlState ||= {});
|
|
12288
12475
|
|
|
12289
|
-
class CliRenderer extends
|
|
12476
|
+
class CliRenderer extends EventEmitter9 {
|
|
12290
12477
|
static animationFrameId = 0;
|
|
12291
12478
|
lib;
|
|
12292
12479
|
rendererPtr;
|
|
@@ -12465,6 +12652,14 @@ Captured output:
|
|
|
12465
12652
|
this._console = new TerminalConsole(this, config.consoleOptions);
|
|
12466
12653
|
this.useConsole = config.useConsole ?? true;
|
|
12467
12654
|
this._keyHandler = new InternalKeyHandler(this.stdin, config.useKittyKeyboard ?? false);
|
|
12655
|
+
this._keyHandler.on("keypress", (event) => {
|
|
12656
|
+
if (this.exitOnCtrlC && event.name === "c" && event.ctrl) {
|
|
12657
|
+
process.nextTick(() => {
|
|
12658
|
+
this.destroy();
|
|
12659
|
+
});
|
|
12660
|
+
return;
|
|
12661
|
+
}
|
|
12662
|
+
});
|
|
12468
12663
|
global.requestAnimationFrame = (callback) => {
|
|
12469
12664
|
const id = CliRenderer.animationFrameId++;
|
|
12470
12665
|
this.animationRequest.set(id, callback);
|
|
@@ -12724,12 +12919,6 @@ Captured output:
|
|
|
12724
12919
|
return;
|
|
12725
12920
|
}
|
|
12726
12921
|
}
|
|
12727
|
-
if (this.exitOnCtrlC && str === "\x03") {
|
|
12728
|
-
process.nextTick(() => {
|
|
12729
|
-
this.destroy();
|
|
12730
|
-
});
|
|
12731
|
-
return;
|
|
12732
|
-
}
|
|
12733
12922
|
if (this._useMouse && this.handleMouseData(data)) {
|
|
12734
12923
|
return;
|
|
12735
12924
|
}
|
|
@@ -13369,7 +13558,7 @@ Captured output:
|
|
|
13369
13558
|
}
|
|
13370
13559
|
}
|
|
13371
13560
|
|
|
13372
|
-
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, ANSI, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, 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, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, 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, RendererControlState, CliRenderer };
|
|
13561
|
+
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, ANSI, StdinBuffer, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, 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, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, 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, RendererControlState, CliRenderer };
|
|
13373
13562
|
|
|
13374
|
-
//# debugId=
|
|
13375
|
-
//# sourceMappingURL=index-
|
|
13563
|
+
//# debugId=4704E8A57986003964756E2164756E21
|
|
13564
|
+
//# sourceMappingURL=index-rzgaxyf4.js.map
|