@opentui/core 0.1.12 → 0.1.14
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/Renderable.d.ts +30 -9
- package/animation/Timeline.d.ts +11 -0
- package/buffer.d.ts +6 -0
- package/console.d.ts +1 -1
- package/{index-bpwzbxgn.js → index-rv93tneq.js} +290 -99
- package/{index-bpwzbxgn.js.map → index-rv93tneq.js.map} +10 -10
- package/index.js +221 -106
- package/index.js.map +12 -13
- package/lib/KeyHandler.d.ts +6 -1
- package/package.json +7 -7
- package/renderables/Box.d.ts +7 -1
- package/renderables/Text.d.ts +13 -0
- package/renderables/composition/constructs.d.ts +1 -3
- package/renderables/composition/vnode.d.ts +13 -6
- package/renderables/index.d.ts +0 -1
- package/renderer.d.ts +3 -1
- package/types.d.ts +1 -1
- package/zig.d.ts +12 -1
- package/renderables/Group.d.ts +0 -5
|
@@ -4822,7 +4822,7 @@ class ASCIIFontSelectionHelper {
|
|
|
4822
4822
|
}
|
|
4823
4823
|
}
|
|
4824
4824
|
// src/zig.ts
|
|
4825
|
-
import { dlopen, toArrayBuffer } from "bun:ffi";
|
|
4825
|
+
import { dlopen, toArrayBuffer, JSCallback } from "bun:ffi";
|
|
4826
4826
|
import { existsSync } from "fs";
|
|
4827
4827
|
|
|
4828
4828
|
// src/buffer.ts
|
|
@@ -4890,7 +4890,7 @@ class OptimizedBuffer {
|
|
|
4890
4890
|
return this.bufferPtr;
|
|
4891
4891
|
}
|
|
4892
4892
|
constructor(lib, ptr, buffer, width, height, options) {
|
|
4893
|
-
this.id = `fb_${OptimizedBuffer.fbIdCounter++}`;
|
|
4893
|
+
this.id = options.id || `fb_${OptimizedBuffer.fbIdCounter++}`;
|
|
4894
4894
|
this.lib = lib;
|
|
4895
4895
|
this.respectAlpha = options.respectAlpha || false;
|
|
4896
4896
|
this._width = width;
|
|
@@ -4901,7 +4901,8 @@ class OptimizedBuffer {
|
|
|
4901
4901
|
static create(width, height, widthMethod, options = {}) {
|
|
4902
4902
|
const lib = resolveRenderLib();
|
|
4903
4903
|
const respectAlpha = options.respectAlpha || false;
|
|
4904
|
-
|
|
4904
|
+
const id = options.id && options.id.trim() !== "" ? options.id : "unnamed buffer";
|
|
4905
|
+
return lib.createOptimizedBuffer(width, height, widthMethod, respectAlpha, id);
|
|
4905
4906
|
}
|
|
4906
4907
|
get buffers() {
|
|
4907
4908
|
return this.buffer;
|
|
@@ -4919,6 +4920,9 @@ class OptimizedBuffer {
|
|
|
4919
4920
|
this.lib.bufferSetRespectAlpha(this.bufferPtr, respectAlpha);
|
|
4920
4921
|
this.respectAlpha = respectAlpha;
|
|
4921
4922
|
}
|
|
4923
|
+
getNativeId() {
|
|
4924
|
+
return this.lib.bufferGetId(this.bufferPtr);
|
|
4925
|
+
}
|
|
4922
4926
|
clear(bg2 = RGBA.fromValues(0, 0, 0, 1), clearChar = " ") {
|
|
4923
4927
|
if (this.useFFI) {
|
|
4924
4928
|
this.clearFFI(bg2);
|
|
@@ -5180,6 +5184,15 @@ class OptimizedBuffer {
|
|
|
5180
5184
|
const packedOptions = packDrawOptions(options.border, options.shouldFill ?? false, options.titleAlignment || "left");
|
|
5181
5185
|
this.lib.bufferDrawBox(this.bufferPtr, options.x, options.y, options.width, options.height, borderChars, packedOptions, options.borderColor, options.backgroundColor, options.title ?? null);
|
|
5182
5186
|
}
|
|
5187
|
+
pushScissorRect(x, y, width, height) {
|
|
5188
|
+
this.lib.bufferPushScissorRect(this.bufferPtr, x, y, width, height);
|
|
5189
|
+
}
|
|
5190
|
+
popScissorRect() {
|
|
5191
|
+
this.lib.bufferPopScissorRect(this.bufferPtr);
|
|
5192
|
+
}
|
|
5193
|
+
clearScissorRects() {
|
|
5194
|
+
this.lib.bufferClearScissorRects(this.bufferPtr);
|
|
5195
|
+
}
|
|
5183
5196
|
}
|
|
5184
5197
|
|
|
5185
5198
|
// src/zig.ts
|
|
@@ -5191,6 +5204,10 @@ if (!existsSync(targetLibPath)) {
|
|
|
5191
5204
|
function getOpenTUILib(libPath) {
|
|
5192
5205
|
const resolvedLibPath = libPath || targetLibPath;
|
|
5193
5206
|
return dlopen(resolvedLibPath, {
|
|
5207
|
+
setLogCallback: {
|
|
5208
|
+
args: ["ptr"],
|
|
5209
|
+
returns: "void"
|
|
5210
|
+
},
|
|
5194
5211
|
createRenderer: {
|
|
5195
5212
|
args: ["u32", "u32"],
|
|
5196
5213
|
returns: "ptr"
|
|
@@ -5232,7 +5249,7 @@ function getOpenTUILib(libPath) {
|
|
|
5232
5249
|
returns: "ptr"
|
|
5233
5250
|
},
|
|
5234
5251
|
createOptimizedBuffer: {
|
|
5235
|
-
args: ["u32", "u32", "bool", "u8"],
|
|
5252
|
+
args: ["u32", "u32", "bool", "u8", "ptr", "usize"],
|
|
5236
5253
|
returns: "ptr"
|
|
5237
5254
|
},
|
|
5238
5255
|
destroyOptimizedBuffer: {
|
|
@@ -5279,6 +5296,10 @@ function getOpenTUILib(libPath) {
|
|
|
5279
5296
|
args: ["ptr", "bool"],
|
|
5280
5297
|
returns: "void"
|
|
5281
5298
|
},
|
|
5299
|
+
bufferGetId: {
|
|
5300
|
+
args: ["ptr", "ptr", "usize"],
|
|
5301
|
+
returns: "usize"
|
|
5302
|
+
},
|
|
5282
5303
|
bufferDrawText: {
|
|
5283
5304
|
args: ["ptr", "ptr", "u32", "u32", "u32", "ptr", "ptr", "u8"],
|
|
5284
5305
|
returns: "void"
|
|
@@ -5319,6 +5340,10 @@ function getOpenTUILib(libPath) {
|
|
|
5319
5340
|
args: ["ptr"],
|
|
5320
5341
|
returns: "void"
|
|
5321
5342
|
},
|
|
5343
|
+
setTerminalTitle: {
|
|
5344
|
+
args: ["ptr", "ptr", "usize"],
|
|
5345
|
+
returns: "void"
|
|
5346
|
+
},
|
|
5322
5347
|
bufferDrawSuperSampleBuffer: {
|
|
5323
5348
|
args: ["ptr", "u32", "u32", "ptr", "usize", "u8", "u32"],
|
|
5324
5349
|
returns: "void"
|
|
@@ -5331,6 +5356,18 @@ function getOpenTUILib(libPath) {
|
|
|
5331
5356
|
args: ["ptr", "i32", "i32", "u32", "u32", "ptr", "u32", "ptr", "ptr", "ptr", "u32"],
|
|
5332
5357
|
returns: "void"
|
|
5333
5358
|
},
|
|
5359
|
+
bufferPushScissorRect: {
|
|
5360
|
+
args: ["ptr", "i32", "i32", "u32", "u32"],
|
|
5361
|
+
returns: "void"
|
|
5362
|
+
},
|
|
5363
|
+
bufferPopScissorRect: {
|
|
5364
|
+
args: ["ptr"],
|
|
5365
|
+
returns: "void"
|
|
5366
|
+
},
|
|
5367
|
+
bufferClearScissorRects: {
|
|
5368
|
+
args: ["ptr"],
|
|
5369
|
+
returns: "void"
|
|
5370
|
+
},
|
|
5334
5371
|
addToHitGrid: {
|
|
5335
5372
|
args: ["ptr", "i32", "i32", "u32", "u32", "u32"],
|
|
5336
5373
|
returns: "void"
|
|
@@ -5477,12 +5514,67 @@ function getOpenTUILib(libPath) {
|
|
|
5477
5514
|
}
|
|
5478
5515
|
});
|
|
5479
5516
|
}
|
|
5517
|
+
var LogLevel2;
|
|
5518
|
+
((LogLevel3) => {
|
|
5519
|
+
LogLevel3[LogLevel3["Error"] = 0] = "Error";
|
|
5520
|
+
LogLevel3[LogLevel3["Warn"] = 1] = "Warn";
|
|
5521
|
+
LogLevel3[LogLevel3["Info"] = 2] = "Info";
|
|
5522
|
+
LogLevel3[LogLevel3["Debug"] = 3] = "Debug";
|
|
5523
|
+
})(LogLevel2 ||= {});
|
|
5480
5524
|
|
|
5481
5525
|
class FFIRenderLib {
|
|
5482
5526
|
opentui;
|
|
5483
5527
|
encoder = new TextEncoder;
|
|
5528
|
+
decoder = new TextDecoder;
|
|
5529
|
+
logCallbackWrapper;
|
|
5484
5530
|
constructor(libPath) {
|
|
5485
5531
|
this.opentui = getOpenTUILib(libPath);
|
|
5532
|
+
this.setupLogging();
|
|
5533
|
+
}
|
|
5534
|
+
setupLogging() {
|
|
5535
|
+
if (this.logCallbackWrapper) {
|
|
5536
|
+
return;
|
|
5537
|
+
}
|
|
5538
|
+
const logCallback = new JSCallback((level, msgPtr, msgLenBigInt) => {
|
|
5539
|
+
try {
|
|
5540
|
+
const msgLen = typeof msgLenBigInt === "bigint" ? Number(msgLenBigInt) : msgLenBigInt;
|
|
5541
|
+
if (msgLen === 0 || !msgPtr) {
|
|
5542
|
+
return;
|
|
5543
|
+
}
|
|
5544
|
+
const msgBuffer = toArrayBuffer(msgPtr, 0, msgLen);
|
|
5545
|
+
const msgBytes = new Uint8Array(msgBuffer);
|
|
5546
|
+
const message = this.decoder.decode(msgBytes);
|
|
5547
|
+
switch (level) {
|
|
5548
|
+
case 0 /* Error */:
|
|
5549
|
+
console.error(message);
|
|
5550
|
+
break;
|
|
5551
|
+
case 1 /* Warn */:
|
|
5552
|
+
console.warn(message);
|
|
5553
|
+
break;
|
|
5554
|
+
case 2 /* Info */:
|
|
5555
|
+
console.info(message);
|
|
5556
|
+
break;
|
|
5557
|
+
case 3 /* Debug */:
|
|
5558
|
+
console.debug(message);
|
|
5559
|
+
break;
|
|
5560
|
+
default:
|
|
5561
|
+
console.log(message);
|
|
5562
|
+
}
|
|
5563
|
+
} catch (error) {
|
|
5564
|
+
console.error("Error in Zig log callback:", error);
|
|
5565
|
+
}
|
|
5566
|
+
}, {
|
|
5567
|
+
args: ["u8", "ptr", "usize"],
|
|
5568
|
+
returns: "void"
|
|
5569
|
+
});
|
|
5570
|
+
this.logCallbackWrapper = logCallback;
|
|
5571
|
+
if (!logCallback.ptr) {
|
|
5572
|
+
throw new Error("Failed to create log callback");
|
|
5573
|
+
}
|
|
5574
|
+
this.setLogCallback(logCallback.ptr);
|
|
5575
|
+
}
|
|
5576
|
+
setLogCallback(callbackPtr) {
|
|
5577
|
+
this.opentui.symbols.setLogCallback(callbackPtr);
|
|
5486
5578
|
}
|
|
5487
5579
|
createRenderer(width, height) {
|
|
5488
5580
|
return this.opentui.symbols.createRenderer(width, height);
|
|
@@ -5514,7 +5606,7 @@ class FFIRenderLib {
|
|
|
5514
5606
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
5515
5607
|
const size = width * height;
|
|
5516
5608
|
const buffers = this.getBuffer(bufferPtr, size);
|
|
5517
|
-
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, {});
|
|
5609
|
+
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, { id: "next buffer" });
|
|
5518
5610
|
}
|
|
5519
5611
|
getCurrentBuffer(renderer) {
|
|
5520
5612
|
const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
|
|
@@ -5525,7 +5617,7 @@ class FFIRenderLib {
|
|
|
5525
5617
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
5526
5618
|
const size = width * height;
|
|
5527
5619
|
const buffers = this.getBuffer(bufferPtr, size);
|
|
5528
|
-
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, {});
|
|
5620
|
+
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, { id: "current buffer" });
|
|
5529
5621
|
}
|
|
5530
5622
|
getBuffer(bufferPtr, size) {
|
|
5531
5623
|
const charPtr = this.opentui.symbols.bufferGetCharPtr(bufferPtr);
|
|
@@ -5560,32 +5652,32 @@ class FFIRenderLib {
|
|
|
5560
5652
|
return buffers;
|
|
5561
5653
|
}
|
|
5562
5654
|
bufferGetCharPtr(buffer) {
|
|
5563
|
-
const
|
|
5564
|
-
if (!
|
|
5655
|
+
const ptr2 = this.opentui.symbols.bufferGetCharPtr(buffer);
|
|
5656
|
+
if (!ptr2) {
|
|
5565
5657
|
throw new Error("Failed to get char pointer");
|
|
5566
5658
|
}
|
|
5567
|
-
return
|
|
5659
|
+
return ptr2;
|
|
5568
5660
|
}
|
|
5569
5661
|
bufferGetFgPtr(buffer) {
|
|
5570
|
-
const
|
|
5571
|
-
if (!
|
|
5662
|
+
const ptr2 = this.opentui.symbols.bufferGetFgPtr(buffer);
|
|
5663
|
+
if (!ptr2) {
|
|
5572
5664
|
throw new Error("Failed to get fg pointer");
|
|
5573
5665
|
}
|
|
5574
|
-
return
|
|
5666
|
+
return ptr2;
|
|
5575
5667
|
}
|
|
5576
5668
|
bufferGetBgPtr(buffer) {
|
|
5577
|
-
const
|
|
5578
|
-
if (!
|
|
5669
|
+
const ptr2 = this.opentui.symbols.bufferGetBgPtr(buffer);
|
|
5670
|
+
if (!ptr2) {
|
|
5579
5671
|
throw new Error("Failed to get bg pointer");
|
|
5580
5672
|
}
|
|
5581
|
-
return
|
|
5673
|
+
return ptr2;
|
|
5582
5674
|
}
|
|
5583
5675
|
bufferGetAttributesPtr(buffer) {
|
|
5584
|
-
const
|
|
5585
|
-
if (!
|
|
5676
|
+
const ptr2 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
|
|
5677
|
+
if (!ptr2) {
|
|
5586
5678
|
throw new Error("Failed to get attributes pointer");
|
|
5587
5679
|
}
|
|
5588
|
-
return
|
|
5680
|
+
return ptr2;
|
|
5589
5681
|
}
|
|
5590
5682
|
bufferGetRespectAlpha(buffer) {
|
|
5591
5683
|
return this.opentui.symbols.bufferGetRespectAlpha(buffer);
|
|
@@ -5593,6 +5685,13 @@ class FFIRenderLib {
|
|
|
5593
5685
|
bufferSetRespectAlpha(buffer, respectAlpha) {
|
|
5594
5686
|
this.opentui.symbols.bufferSetRespectAlpha(buffer, respectAlpha);
|
|
5595
5687
|
}
|
|
5688
|
+
bufferGetId(buffer) {
|
|
5689
|
+
const maxLen = 256;
|
|
5690
|
+
const outBuffer = new Uint8Array(maxLen);
|
|
5691
|
+
const actualLen = this.opentui.symbols.bufferGetId(buffer, outBuffer, maxLen);
|
|
5692
|
+
const len = typeof actualLen === "bigint" ? Number(actualLen) : actualLen;
|
|
5693
|
+
return this.decoder.decode(outBuffer.slice(0, len));
|
|
5694
|
+
}
|
|
5596
5695
|
getBufferWidth(buffer) {
|
|
5597
5696
|
return this.opentui.symbols.getBufferWidth(buffer);
|
|
5598
5697
|
}
|
|
@@ -5653,18 +5752,20 @@ class FFIRenderLib {
|
|
|
5653
5752
|
render(renderer, force) {
|
|
5654
5753
|
this.opentui.symbols.render(renderer, force);
|
|
5655
5754
|
}
|
|
5656
|
-
createOptimizedBuffer(width, height, widthMethod, respectAlpha = false) {
|
|
5755
|
+
createOptimizedBuffer(width, height, widthMethod, respectAlpha = false, id) {
|
|
5657
5756
|
if (Number.isNaN(width) || Number.isNaN(height)) {
|
|
5658
5757
|
console.error(new Error(`Invalid dimensions for OptimizedBuffer: ${width}x${height}`).stack);
|
|
5659
5758
|
}
|
|
5660
5759
|
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
5661
|
-
const
|
|
5760
|
+
const idToUse = id || "unnamed buffer";
|
|
5761
|
+
const idBytes = this.encoder.encode(idToUse);
|
|
5762
|
+
const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, respectAlpha, widthMethodCode, idBytes, idBytes.length);
|
|
5662
5763
|
if (!bufferPtr) {
|
|
5663
5764
|
throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
|
|
5664
5765
|
}
|
|
5665
5766
|
const size = width * height;
|
|
5666
5767
|
const buffers = this.getBuffer(bufferPtr, size);
|
|
5667
|
-
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, { respectAlpha });
|
|
5768
|
+
return new OptimizedBuffer(this, bufferPtr, buffers, width, height, { respectAlpha, id });
|
|
5668
5769
|
}
|
|
5669
5770
|
destroyOptimizedBuffer(bufferPtr) {
|
|
5670
5771
|
this.opentui.symbols.destroyOptimizedBuffer(bufferPtr);
|
|
@@ -5682,6 +5783,10 @@ class FFIRenderLib {
|
|
|
5682
5783
|
clearTerminal(renderer) {
|
|
5683
5784
|
this.opentui.symbols.clearTerminal(renderer);
|
|
5684
5785
|
}
|
|
5786
|
+
setTerminalTitle(renderer, title) {
|
|
5787
|
+
const titleBytes = this.encoder.encode(title);
|
|
5788
|
+
this.opentui.symbols.setTerminalTitle(renderer, titleBytes, titleBytes.length);
|
|
5789
|
+
}
|
|
5685
5790
|
addToHitGrid(renderer, x, y, width, height, id) {
|
|
5686
5791
|
this.opentui.symbols.addToHitGrid(renderer, x, y, width, height, id);
|
|
5687
5792
|
}
|
|
@@ -5736,32 +5841,32 @@ class FFIRenderLib {
|
|
|
5736
5841
|
this.opentui.symbols.destroyTextBuffer(buffer);
|
|
5737
5842
|
}
|
|
5738
5843
|
textBufferGetCharPtr(buffer) {
|
|
5739
|
-
const
|
|
5740
|
-
if (!
|
|
5844
|
+
const ptr2 = this.opentui.symbols.textBufferGetCharPtr(buffer);
|
|
5845
|
+
if (!ptr2) {
|
|
5741
5846
|
throw new Error("Failed to get TextBuffer char pointer");
|
|
5742
5847
|
}
|
|
5743
|
-
return
|
|
5848
|
+
return ptr2;
|
|
5744
5849
|
}
|
|
5745
5850
|
textBufferGetFgPtr(buffer) {
|
|
5746
|
-
const
|
|
5747
|
-
if (!
|
|
5851
|
+
const ptr2 = this.opentui.symbols.textBufferGetFgPtr(buffer);
|
|
5852
|
+
if (!ptr2) {
|
|
5748
5853
|
throw new Error("Failed to get TextBuffer fg pointer");
|
|
5749
5854
|
}
|
|
5750
|
-
return
|
|
5855
|
+
return ptr2;
|
|
5751
5856
|
}
|
|
5752
5857
|
textBufferGetBgPtr(buffer) {
|
|
5753
|
-
const
|
|
5754
|
-
if (!
|
|
5858
|
+
const ptr2 = this.opentui.symbols.textBufferGetBgPtr(buffer);
|
|
5859
|
+
if (!ptr2) {
|
|
5755
5860
|
throw new Error("Failed to get TextBuffer bg pointer");
|
|
5756
5861
|
}
|
|
5757
|
-
return
|
|
5862
|
+
return ptr2;
|
|
5758
5863
|
}
|
|
5759
5864
|
textBufferGetAttributesPtr(buffer) {
|
|
5760
|
-
const
|
|
5761
|
-
if (!
|
|
5865
|
+
const ptr2 = this.opentui.symbols.textBufferGetAttributesPtr(buffer);
|
|
5866
|
+
if (!ptr2) {
|
|
5762
5867
|
throw new Error("Failed to get TextBuffer attributes pointer");
|
|
5763
5868
|
}
|
|
5764
|
-
return
|
|
5869
|
+
return ptr2;
|
|
5765
5870
|
}
|
|
5766
5871
|
textBufferGetLength(buffer) {
|
|
5767
5872
|
return this.opentui.symbols.textBufferGetLength(buffer);
|
|
@@ -5855,6 +5960,15 @@ class FFIRenderLib {
|
|
|
5855
5960
|
const clipHeight = clipRect?.height ?? 0;
|
|
5856
5961
|
this.opentui.symbols.bufferDrawTextBuffer(buffer, textBuffer, x, y, clipX, clipY, clipWidth, clipHeight, hasClipRect);
|
|
5857
5962
|
}
|
|
5963
|
+
bufferPushScissorRect(buffer, x, y, width, height) {
|
|
5964
|
+
this.opentui.symbols.bufferPushScissorRect(buffer, x, y, width, height);
|
|
5965
|
+
}
|
|
5966
|
+
bufferPopScissorRect(buffer) {
|
|
5967
|
+
this.opentui.symbols.bufferPopScissorRect(buffer);
|
|
5968
|
+
}
|
|
5969
|
+
bufferClearScissorRects(buffer) {
|
|
5970
|
+
this.opentui.symbols.bufferClearScissorRects(buffer);
|
|
5971
|
+
}
|
|
5858
5972
|
getTerminalCapabilities(renderer) {
|
|
5859
5973
|
const capsBuffer = new Uint8Array(64);
|
|
5860
5974
|
this.opentui.symbols.getTerminalCapabilities(renderer, capsBuffer);
|
|
@@ -5911,9 +6025,9 @@ class TextBuffer {
|
|
|
5911
6025
|
_length = 0;
|
|
5912
6026
|
_capacity;
|
|
5913
6027
|
_lineInfo;
|
|
5914
|
-
constructor(lib,
|
|
6028
|
+
constructor(lib, ptr2, buffer, capacity) {
|
|
5915
6029
|
this.lib = lib;
|
|
5916
|
-
this.bufferPtr =
|
|
6030
|
+
this.bufferPtr = ptr2;
|
|
5917
6031
|
this.buffer = buffer;
|
|
5918
6032
|
this._capacity = capacity;
|
|
5919
6033
|
}
|
|
@@ -6045,9 +6159,12 @@ function isPositionType(value) {
|
|
|
6045
6159
|
}
|
|
6046
6160
|
return isValidPercentage(value);
|
|
6047
6161
|
}
|
|
6048
|
-
function
|
|
6162
|
+
function isPositionTypeType(value) {
|
|
6049
6163
|
return value === "relative" || value === "absolute";
|
|
6050
6164
|
}
|
|
6165
|
+
function isOverflowType(value) {
|
|
6166
|
+
return value === "visible" || value === "hidden" || value === "scroll";
|
|
6167
|
+
}
|
|
6051
6168
|
function isDimensionType(value) {
|
|
6052
6169
|
return isPositionType(value);
|
|
6053
6170
|
}
|
|
@@ -6076,6 +6193,8 @@ class Renderable extends EventEmitter3 {
|
|
|
6076
6193
|
id;
|
|
6077
6194
|
num;
|
|
6078
6195
|
_ctx;
|
|
6196
|
+
_translateX = 0;
|
|
6197
|
+
_translateY = 0;
|
|
6079
6198
|
_x = 0;
|
|
6080
6199
|
_y = 0;
|
|
6081
6200
|
_width;
|
|
@@ -6099,6 +6218,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6099
6218
|
_keyListeners = {};
|
|
6100
6219
|
layoutNode;
|
|
6101
6220
|
_positionType = "relative";
|
|
6221
|
+
_overflow = "visible";
|
|
6102
6222
|
_position = {};
|
|
6103
6223
|
_childHostOverride = null;
|
|
6104
6224
|
renderableMap = new Map;
|
|
@@ -6159,7 +6279,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6159
6279
|
if (this._focused) {
|
|
6160
6280
|
this.blur();
|
|
6161
6281
|
}
|
|
6162
|
-
this.
|
|
6282
|
+
this.requestRender();
|
|
6163
6283
|
}
|
|
6164
6284
|
hasSelection() {
|
|
6165
6285
|
return false;
|
|
@@ -6181,7 +6301,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6181
6301
|
if (this._focused || !this.focusable)
|
|
6182
6302
|
return;
|
|
6183
6303
|
this._focused = true;
|
|
6184
|
-
this.
|
|
6304
|
+
this.requestRender();
|
|
6185
6305
|
this.keypressHandler = (key) => {
|
|
6186
6306
|
this._keyListeners["down"]?.(key);
|
|
6187
6307
|
if (this.handleKeyPress) {
|
|
@@ -6199,7 +6319,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6199
6319
|
if (!this._focused || !this.focusable)
|
|
6200
6320
|
return;
|
|
6201
6321
|
this._focused = false;
|
|
6202
|
-
this.
|
|
6322
|
+
this.requestRender();
|
|
6203
6323
|
if (this.keypressHandler) {
|
|
6204
6324
|
this.keyHandler.off("keypress", this.keypressHandler);
|
|
6205
6325
|
this.keypressHandler = null;
|
|
@@ -6258,15 +6378,33 @@ class Renderable extends EventEmitter3 {
|
|
|
6258
6378
|
markClean() {
|
|
6259
6379
|
this._dirty = false;
|
|
6260
6380
|
}
|
|
6261
|
-
|
|
6381
|
+
requestRender() {
|
|
6262
6382
|
this._dirty = true;
|
|
6263
|
-
this._ctx.
|
|
6383
|
+
this._ctx.requestRender();
|
|
6384
|
+
}
|
|
6385
|
+
get translateX() {
|
|
6386
|
+
return this._translateX;
|
|
6387
|
+
}
|
|
6388
|
+
set translateX(value) {
|
|
6389
|
+
if (this._translateX === value)
|
|
6390
|
+
return;
|
|
6391
|
+
this._translateX = value;
|
|
6392
|
+
this.requestRender();
|
|
6393
|
+
}
|
|
6394
|
+
get translateY() {
|
|
6395
|
+
return this._translateY;
|
|
6396
|
+
}
|
|
6397
|
+
set translateY(value) {
|
|
6398
|
+
if (this._translateY === value)
|
|
6399
|
+
return;
|
|
6400
|
+
this._translateY = value;
|
|
6401
|
+
this.requestRender();
|
|
6264
6402
|
}
|
|
6265
6403
|
get x() {
|
|
6266
6404
|
if (this.parent && this._positionType === "relative") {
|
|
6267
|
-
return this.parent.x + this._x;
|
|
6405
|
+
return this.parent.x + this._x + this._translateX;
|
|
6268
6406
|
}
|
|
6269
|
-
return this._x;
|
|
6407
|
+
return this._x + this._translateX;
|
|
6270
6408
|
}
|
|
6271
6409
|
set x(value) {
|
|
6272
6410
|
this.left = value;
|
|
@@ -6305,9 +6443,9 @@ class Renderable extends EventEmitter3 {
|
|
|
6305
6443
|
}
|
|
6306
6444
|
get y() {
|
|
6307
6445
|
if (this.parent && this._positionType === "relative") {
|
|
6308
|
-
return this.parent.y + this._y;
|
|
6446
|
+
return this.parent.y + this._y + this._translateY;
|
|
6309
6447
|
}
|
|
6310
|
-
return this._y;
|
|
6448
|
+
return this._y + this._translateY;
|
|
6311
6449
|
}
|
|
6312
6450
|
set y(value) {
|
|
6313
6451
|
this.top = value;
|
|
@@ -6319,7 +6457,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6319
6457
|
if (isDimensionType(value)) {
|
|
6320
6458
|
this._width = value;
|
|
6321
6459
|
this.layoutNode.setWidth(value);
|
|
6322
|
-
this.
|
|
6460
|
+
this.requestRender();
|
|
6323
6461
|
}
|
|
6324
6462
|
}
|
|
6325
6463
|
get height() {
|
|
@@ -6329,7 +6467,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6329
6467
|
if (isDimensionType(value)) {
|
|
6330
6468
|
this._height = value;
|
|
6331
6469
|
this.layoutNode.setHeight(value);
|
|
6332
|
-
this.
|
|
6470
|
+
this.requestRender();
|
|
6333
6471
|
}
|
|
6334
6472
|
}
|
|
6335
6473
|
get zIndex() {
|
|
@@ -6375,12 +6513,18 @@ class Renderable extends EventEmitter3 {
|
|
|
6375
6513
|
if (options.flexDirection !== undefined) {
|
|
6376
6514
|
node.setFlexDirection(parseFlexDirection(options.flexDirection));
|
|
6377
6515
|
}
|
|
6516
|
+
if (options.flexWrap !== undefined) {
|
|
6517
|
+
node.setFlexWrap(parseWrap(options.flexWrap));
|
|
6518
|
+
}
|
|
6378
6519
|
if (options.alignItems !== undefined) {
|
|
6379
6520
|
node.setAlignItems(parseAlign(options.alignItems));
|
|
6380
6521
|
}
|
|
6381
6522
|
if (options.justifyContent !== undefined) {
|
|
6382
6523
|
node.setJustifyContent(parseJustify(options.justifyContent));
|
|
6383
6524
|
}
|
|
6525
|
+
if (options.alignSelf !== undefined) {
|
|
6526
|
+
node.setAlignSelf(parseAlign(options.alignSelf));
|
|
6527
|
+
}
|
|
6384
6528
|
if (isDimensionType(options.width)) {
|
|
6385
6529
|
this._width = options.width;
|
|
6386
6530
|
this.layoutNode.setWidth(options.width);
|
|
@@ -6393,6 +6537,10 @@ class Renderable extends EventEmitter3 {
|
|
|
6393
6537
|
if (this._positionType !== "relative") {
|
|
6394
6538
|
node.setPositionType(parsePositionType(this._positionType));
|
|
6395
6539
|
}
|
|
6540
|
+
this._overflow = options.overflow === "hidden" ? "hidden" : options.overflow === "scroll" ? "scroll" : "visible";
|
|
6541
|
+
if (this._overflow !== "visible") {
|
|
6542
|
+
node.setOverflow(parseOverflow(this._overflow));
|
|
6543
|
+
}
|
|
6396
6544
|
const hasPositionProps = options.top !== undefined || options.right !== undefined || options.bottom !== undefined || options.left !== undefined;
|
|
6397
6545
|
if (hasPositionProps) {
|
|
6398
6546
|
this._position = {
|
|
@@ -6451,11 +6599,21 @@ class Renderable extends EventEmitter3 {
|
|
|
6451
6599
|
}
|
|
6452
6600
|
}
|
|
6453
6601
|
set position(positionType) {
|
|
6454
|
-
if (!
|
|
6602
|
+
if (!isPositionTypeType(positionType) || this._positionType === positionType)
|
|
6455
6603
|
return;
|
|
6456
6604
|
this._positionType = positionType;
|
|
6457
6605
|
this.layoutNode.yogaNode.setPositionType(parsePositionType(positionType));
|
|
6458
|
-
this.
|
|
6606
|
+
this.requestRender();
|
|
6607
|
+
}
|
|
6608
|
+
get overflow() {
|
|
6609
|
+
return this._overflow;
|
|
6610
|
+
}
|
|
6611
|
+
set overflow(overflow) {
|
|
6612
|
+
if (!isOverflowType(overflow) || this._overflow === overflow)
|
|
6613
|
+
return;
|
|
6614
|
+
this._overflow = overflow;
|
|
6615
|
+
this.layoutNode.yogaNode.setOverflow(parseOverflow(overflow));
|
|
6616
|
+
this.requestRender();
|
|
6459
6617
|
}
|
|
6460
6618
|
setPosition(position) {
|
|
6461
6619
|
this._position = { ...this._position, ...position };
|
|
@@ -6492,56 +6650,64 @@ class Renderable extends EventEmitter3 {
|
|
|
6492
6650
|
node.setPosition(Edge.Left, left);
|
|
6493
6651
|
}
|
|
6494
6652
|
}
|
|
6495
|
-
this.
|
|
6653
|
+
this.requestRender();
|
|
6496
6654
|
}
|
|
6497
6655
|
set flexGrow(grow) {
|
|
6498
6656
|
this.layoutNode.yogaNode.setFlexGrow(grow);
|
|
6499
|
-
this.
|
|
6657
|
+
this.requestRender();
|
|
6500
6658
|
}
|
|
6501
6659
|
set flexShrink(shrink) {
|
|
6502
6660
|
this.layoutNode.yogaNode.setFlexShrink(shrink);
|
|
6503
|
-
this.
|
|
6661
|
+
this.requestRender();
|
|
6504
6662
|
}
|
|
6505
6663
|
set flexDirection(direction) {
|
|
6506
6664
|
this.layoutNode.yogaNode.setFlexDirection(parseFlexDirection(direction));
|
|
6507
|
-
this.
|
|
6665
|
+
this.requestRender();
|
|
6666
|
+
}
|
|
6667
|
+
set flexWrap(wrap) {
|
|
6668
|
+
this.layoutNode.yogaNode.setFlexWrap(parseWrap(wrap));
|
|
6669
|
+
this.requestRender();
|
|
6508
6670
|
}
|
|
6509
6671
|
set alignItems(alignItems) {
|
|
6510
6672
|
this.layoutNode.yogaNode.setAlignItems(parseAlign(alignItems));
|
|
6511
|
-
this.
|
|
6673
|
+
this.requestRender();
|
|
6512
6674
|
}
|
|
6513
6675
|
set justifyContent(justifyContent) {
|
|
6514
6676
|
this.layoutNode.yogaNode.setJustifyContent(parseJustify(justifyContent));
|
|
6515
|
-
this.
|
|
6677
|
+
this.requestRender();
|
|
6678
|
+
}
|
|
6679
|
+
set alignSelf(alignSelf) {
|
|
6680
|
+
this.layoutNode.yogaNode.setAlignSelf(parseAlign(alignSelf));
|
|
6681
|
+
this.requestRender();
|
|
6516
6682
|
}
|
|
6517
6683
|
set flexBasis(basis) {
|
|
6518
6684
|
if (isFlexBasisType(basis)) {
|
|
6519
6685
|
this.layoutNode.yogaNode.setFlexBasis(basis);
|
|
6520
|
-
this.
|
|
6686
|
+
this.requestRender();
|
|
6521
6687
|
}
|
|
6522
6688
|
}
|
|
6523
6689
|
set minWidth(minWidth) {
|
|
6524
6690
|
if (isSizeType(minWidth)) {
|
|
6525
6691
|
this.layoutNode.yogaNode.setMinWidth(minWidth);
|
|
6526
|
-
this.
|
|
6692
|
+
this.requestRender();
|
|
6527
6693
|
}
|
|
6528
6694
|
}
|
|
6529
6695
|
set maxWidth(maxWidth) {
|
|
6530
6696
|
if (isSizeType(maxWidth)) {
|
|
6531
6697
|
this.layoutNode.yogaNode.setMaxWidth(maxWidth);
|
|
6532
|
-
this.
|
|
6698
|
+
this.requestRender();
|
|
6533
6699
|
}
|
|
6534
6700
|
}
|
|
6535
6701
|
set minHeight(minHeight) {
|
|
6536
6702
|
if (isSizeType(minHeight)) {
|
|
6537
6703
|
this.layoutNode.yogaNode.setMinHeight(minHeight);
|
|
6538
|
-
this.
|
|
6704
|
+
this.requestRender();
|
|
6539
6705
|
}
|
|
6540
6706
|
}
|
|
6541
6707
|
set maxHeight(maxHeight) {
|
|
6542
6708
|
if (isSizeType(maxHeight)) {
|
|
6543
6709
|
this.layoutNode.yogaNode.setMaxHeight(maxHeight);
|
|
6544
|
-
this.
|
|
6710
|
+
this.requestRender();
|
|
6545
6711
|
}
|
|
6546
6712
|
}
|
|
6547
6713
|
set margin(margin) {
|
|
@@ -6551,31 +6717,31 @@ class Renderable extends EventEmitter3 {
|
|
|
6551
6717
|
node.setMargin(Edge.Right, margin);
|
|
6552
6718
|
node.setMargin(Edge.Bottom, margin);
|
|
6553
6719
|
node.setMargin(Edge.Left, margin);
|
|
6554
|
-
this.
|
|
6720
|
+
this.requestRender();
|
|
6555
6721
|
}
|
|
6556
6722
|
}
|
|
6557
6723
|
set marginTop(margin) {
|
|
6558
6724
|
if (isMarginType(margin)) {
|
|
6559
6725
|
this.layoutNode.yogaNode.setMargin(Edge.Top, margin);
|
|
6560
|
-
this.
|
|
6726
|
+
this.requestRender();
|
|
6561
6727
|
}
|
|
6562
6728
|
}
|
|
6563
6729
|
set marginRight(margin) {
|
|
6564
6730
|
if (isMarginType(margin)) {
|
|
6565
6731
|
this.layoutNode.yogaNode.setMargin(Edge.Right, margin);
|
|
6566
|
-
this.
|
|
6732
|
+
this.requestRender();
|
|
6567
6733
|
}
|
|
6568
6734
|
}
|
|
6569
6735
|
set marginBottom(margin) {
|
|
6570
6736
|
if (isMarginType(margin)) {
|
|
6571
6737
|
this.layoutNode.yogaNode.setMargin(Edge.Bottom, margin);
|
|
6572
|
-
this.
|
|
6738
|
+
this.requestRender();
|
|
6573
6739
|
}
|
|
6574
6740
|
}
|
|
6575
6741
|
set marginLeft(margin) {
|
|
6576
6742
|
if (isMarginType(margin)) {
|
|
6577
6743
|
this.layoutNode.yogaNode.setMargin(Edge.Left, margin);
|
|
6578
|
-
this.
|
|
6744
|
+
this.requestRender();
|
|
6579
6745
|
}
|
|
6580
6746
|
}
|
|
6581
6747
|
set padding(padding) {
|
|
@@ -6585,31 +6751,31 @@ class Renderable extends EventEmitter3 {
|
|
|
6585
6751
|
node.setPadding(Edge.Right, padding);
|
|
6586
6752
|
node.setPadding(Edge.Bottom, padding);
|
|
6587
6753
|
node.setPadding(Edge.Left, padding);
|
|
6588
|
-
this.
|
|
6754
|
+
this.requestRender();
|
|
6589
6755
|
}
|
|
6590
6756
|
}
|
|
6591
6757
|
set paddingTop(padding) {
|
|
6592
6758
|
if (isPaddingType(padding)) {
|
|
6593
6759
|
this.layoutNode.yogaNode.setPadding(Edge.Top, padding);
|
|
6594
|
-
this.
|
|
6760
|
+
this.requestRender();
|
|
6595
6761
|
}
|
|
6596
6762
|
}
|
|
6597
6763
|
set paddingRight(padding) {
|
|
6598
6764
|
if (isPaddingType(padding)) {
|
|
6599
6765
|
this.layoutNode.yogaNode.setPadding(Edge.Right, padding);
|
|
6600
|
-
this.
|
|
6766
|
+
this.requestRender();
|
|
6601
6767
|
}
|
|
6602
6768
|
}
|
|
6603
6769
|
set paddingBottom(padding) {
|
|
6604
6770
|
if (isPaddingType(padding)) {
|
|
6605
6771
|
this.layoutNode.yogaNode.setPadding(Edge.Bottom, padding);
|
|
6606
|
-
this.
|
|
6772
|
+
this.requestRender();
|
|
6607
6773
|
}
|
|
6608
6774
|
}
|
|
6609
6775
|
set paddingLeft(padding) {
|
|
6610
6776
|
if (isPaddingType(padding)) {
|
|
6611
6777
|
this.layoutNode.yogaNode.setPadding(Edge.Left, padding);
|
|
6612
|
-
this.
|
|
6778
|
+
this.requestRender();
|
|
6613
6779
|
}
|
|
6614
6780
|
}
|
|
6615
6781
|
getLayoutNode() {
|
|
@@ -6632,7 +6798,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6632
6798
|
if (this._visible) {
|
|
6633
6799
|
this.handleFrameBufferResize(width, height);
|
|
6634
6800
|
this.onResize(width, height);
|
|
6635
|
-
this.
|
|
6801
|
+
this.requestRender();
|
|
6636
6802
|
}
|
|
6637
6803
|
}
|
|
6638
6804
|
handleFrameBufferResize(width, height) {
|
|
@@ -6661,7 +6827,9 @@ class Renderable extends EventEmitter3 {
|
|
|
6661
6827
|
this.frameBuffer = null;
|
|
6662
6828
|
}
|
|
6663
6829
|
}
|
|
6664
|
-
onResize(width, height) {
|
|
6830
|
+
onResize(width, height) {
|
|
6831
|
+
this.emit("resize");
|
|
6832
|
+
}
|
|
6665
6833
|
replaceParent(obj) {
|
|
6666
6834
|
if (obj.parent) {
|
|
6667
6835
|
obj.parent.remove(obj.id);
|
|
@@ -6692,7 +6860,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6692
6860
|
if (obj._liveCount > 0) {
|
|
6693
6861
|
this.propagateLiveCount(obj._liveCount);
|
|
6694
6862
|
}
|
|
6695
|
-
this.
|
|
6863
|
+
this.requestRender();
|
|
6696
6864
|
return insertedIndex;
|
|
6697
6865
|
}
|
|
6698
6866
|
insertBefore(obj, anchor) {
|
|
@@ -6734,7 +6902,7 @@ class Renderable extends EventEmitter3 {
|
|
|
6734
6902
|
}
|
|
6735
6903
|
const childLayoutNode = obj.getLayoutNode();
|
|
6736
6904
|
this.layoutNode.removeChild(childLayoutNode);
|
|
6737
|
-
this.
|
|
6905
|
+
this.requestRender();
|
|
6738
6906
|
obj.onRemove();
|
|
6739
6907
|
obj.parent = null;
|
|
6740
6908
|
}
|
|
@@ -6770,14 +6938,30 @@ class Renderable extends EventEmitter3 {
|
|
|
6770
6938
|
this.markClean();
|
|
6771
6939
|
this._ctx.addToHitGrid(this.x, this.y, this.width, this.height, this.num);
|
|
6772
6940
|
this.ensureZIndexSorted();
|
|
6941
|
+
const shouldPushScissor = this._overflow !== "visible" && this.width > 0 && this.height > 0;
|
|
6942
|
+
if (shouldPushScissor) {
|
|
6943
|
+
const scissorRect = this.getScissorRect();
|
|
6944
|
+
renderBuffer.pushScissorRect(scissorRect.x, scissorRect.y, scissorRect.width, scissorRect.height);
|
|
6945
|
+
}
|
|
6773
6946
|
for (const child of this.renderableArray) {
|
|
6774
6947
|
child.render(renderBuffer, deltaTime);
|
|
6775
6948
|
}
|
|
6949
|
+
if (shouldPushScissor) {
|
|
6950
|
+
renderBuffer.popScissorRect();
|
|
6951
|
+
}
|
|
6776
6952
|
if (this.buffered && this.frameBuffer) {
|
|
6777
6953
|
buffer.drawFrameBuffer(this.x, this.y, this.frameBuffer);
|
|
6778
6954
|
}
|
|
6779
6955
|
}
|
|
6780
6956
|
beforeRender() {}
|
|
6957
|
+
getScissorRect() {
|
|
6958
|
+
return {
|
|
6959
|
+
x: this.buffered ? 0 : this.x,
|
|
6960
|
+
y: this.buffered ? 0 : this.y,
|
|
6961
|
+
width: this.width,
|
|
6962
|
+
height: this.height
|
|
6963
|
+
};
|
|
6964
|
+
}
|
|
6781
6965
|
renderSelf(buffer, deltaTime) {}
|
|
6782
6966
|
destroy() {
|
|
6783
6967
|
if (this.parent) {
|
|
@@ -7332,9 +7516,9 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7332
7516
|
_displayLines = [];
|
|
7333
7517
|
_allLogEntries = [];
|
|
7334
7518
|
_needsFrameBufferUpdate = false;
|
|
7335
|
-
|
|
7519
|
+
markNeedsRerender() {
|
|
7336
7520
|
this._needsFrameBufferUpdate = true;
|
|
7337
|
-
this.renderer.
|
|
7521
|
+
this.renderer.requestRender();
|
|
7338
7522
|
}
|
|
7339
7523
|
_rgbaInfo;
|
|
7340
7524
|
_rgbaWarn;
|
|
@@ -7401,7 +7585,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7401
7585
|
if (this.isScrolledToBottom) {
|
|
7402
7586
|
this._scrollToBottom();
|
|
7403
7587
|
}
|
|
7404
|
-
this.
|
|
7588
|
+
this.markNeedsRerender();
|
|
7405
7589
|
}
|
|
7406
7590
|
_updateConsoleDimensions() {
|
|
7407
7591
|
const termWidth = this.renderer.terminalWidth;
|
|
@@ -7506,7 +7690,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7506
7690
|
break;
|
|
7507
7691
|
}
|
|
7508
7692
|
if (needsRedraw) {
|
|
7509
|
-
this.
|
|
7693
|
+
this.markNeedsRerender();
|
|
7510
7694
|
}
|
|
7511
7695
|
}
|
|
7512
7696
|
attachStdin() {
|
|
@@ -7563,7 +7747,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7563
7747
|
const visibleLineCount = Math.min(logAreaHeight, displayLineCount - this.scrollTopIndex);
|
|
7564
7748
|
this.currentLineIndex = Math.max(0, Math.min(this.currentLineIndex, visibleLineCount - 1));
|
|
7565
7749
|
if (this.isVisible) {
|
|
7566
|
-
this.
|
|
7750
|
+
this.markNeedsRerender();
|
|
7567
7751
|
}
|
|
7568
7752
|
}
|
|
7569
7753
|
}
|
|
@@ -7571,7 +7755,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7571
7755
|
terminalConsoleCache.clearConsole();
|
|
7572
7756
|
this._allLogEntries = [];
|
|
7573
7757
|
this._displayLines = [];
|
|
7574
|
-
this.
|
|
7758
|
+
this.markNeedsRerender();
|
|
7575
7759
|
}
|
|
7576
7760
|
toggle() {
|
|
7577
7761
|
if (this.isVisible) {
|
|
@@ -7584,17 +7768,17 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7584
7768
|
this.show();
|
|
7585
7769
|
}
|
|
7586
7770
|
if (!this.renderer.isRunning) {
|
|
7587
|
-
this.renderer.
|
|
7771
|
+
this.renderer.requestRender();
|
|
7588
7772
|
}
|
|
7589
7773
|
}
|
|
7590
7774
|
focus() {
|
|
7591
7775
|
this.attachStdin();
|
|
7592
7776
|
this._scrollToBottom(true);
|
|
7593
|
-
this.
|
|
7777
|
+
this.markNeedsRerender();
|
|
7594
7778
|
}
|
|
7595
7779
|
blur() {
|
|
7596
7780
|
this.detachStdin();
|
|
7597
|
-
this.
|
|
7781
|
+
this.markNeedsRerender();
|
|
7598
7782
|
}
|
|
7599
7783
|
show() {
|
|
7600
7784
|
if (!this.isVisible) {
|
|
@@ -7603,7 +7787,8 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7603
7787
|
terminalConsoleCache.setCachingEnabled(false);
|
|
7604
7788
|
if (!this.frameBuffer) {
|
|
7605
7789
|
this.frameBuffer = OptimizedBuffer.create(this.consoleWidth, this.consoleHeight, this.renderer.widthMethod, {
|
|
7606
|
-
respectAlpha: this.backgroundColor.a < 1
|
|
7790
|
+
respectAlpha: this.backgroundColor.a < 1,
|
|
7791
|
+
id: "console framebuffer"
|
|
7607
7792
|
});
|
|
7608
7793
|
}
|
|
7609
7794
|
const logCount = terminalConsoleCache.cachedLogs.length;
|
|
@@ -7612,7 +7797,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7612
7797
|
this.scrollTopIndex = 0;
|
|
7613
7798
|
this._scrollToBottom(true);
|
|
7614
7799
|
this.focus();
|
|
7615
|
-
this.
|
|
7800
|
+
this.markNeedsRerender();
|
|
7616
7801
|
}
|
|
7617
7802
|
}
|
|
7618
7803
|
hide() {
|
|
@@ -7685,7 +7870,7 @@ class TerminalConsole extends EventEmitter5 {
|
|
|
7685
7870
|
this._debugModeEnabled = enabled;
|
|
7686
7871
|
terminalConsoleCache.setCollectCallerInfo(enabled);
|
|
7687
7872
|
if (this.isVisible) {
|
|
7688
|
-
this.
|
|
7873
|
+
this.markNeedsRerender();
|
|
7689
7874
|
}
|
|
7690
7875
|
}
|
|
7691
7876
|
toggleDebugMode() {
|
|
@@ -7950,7 +8135,7 @@ class CliRenderer extends EventEmitter6 {
|
|
|
7950
8135
|
realStdoutWrite;
|
|
7951
8136
|
captureCallback = () => {
|
|
7952
8137
|
if (this._splitHeight > 0) {
|
|
7953
|
-
this.
|
|
8138
|
+
this.requestRender();
|
|
7954
8139
|
}
|
|
7955
8140
|
};
|
|
7956
8141
|
_useConsole = true;
|
|
@@ -8074,8 +8259,8 @@ Error details:
|
|
|
8074
8259
|
writeOut(chunk, encoding, callback) {
|
|
8075
8260
|
return this.realStdoutWrite.call(this.stdout, chunk, encoding, callback);
|
|
8076
8261
|
}
|
|
8077
|
-
|
|
8078
|
-
if (!this.updateScheduled && !this._isRunning) {
|
|
8262
|
+
requestRender() {
|
|
8263
|
+
if (!this.rendering && !this.updateScheduled && !this._isRunning) {
|
|
8079
8264
|
this.updateScheduled = true;
|
|
8080
8265
|
process.nextTick(() => {
|
|
8081
8266
|
this.loop();
|
|
@@ -8177,13 +8362,13 @@ Error details:
|
|
|
8177
8362
|
this._console.resize(this.width, this.height);
|
|
8178
8363
|
this.root.resize(this.width, this.height);
|
|
8179
8364
|
this.emit("resize", this.width, this.height);
|
|
8180
|
-
this.
|
|
8365
|
+
this.requestRender();
|
|
8181
8366
|
}
|
|
8182
8367
|
interceptStdoutWrite = (chunk, encoding, callback) => {
|
|
8183
8368
|
const text = chunk.toString();
|
|
8184
8369
|
capture.write("stdout", text);
|
|
8185
8370
|
if (this._splitHeight > 0) {
|
|
8186
|
-
this.
|
|
8371
|
+
this.requestRender();
|
|
8187
8372
|
}
|
|
8188
8373
|
if (typeof callback === "function") {
|
|
8189
8374
|
process.nextTick(callback);
|
|
@@ -8355,7 +8540,7 @@ Error details:
|
|
|
8355
8540
|
this.lastOverRenderable = this.capturedRenderable;
|
|
8356
8541
|
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
8357
8542
|
this.capturedRenderable = undefined;
|
|
8358
|
-
this.
|
|
8543
|
+
this.requestRender();
|
|
8359
8544
|
}
|
|
8360
8545
|
if (maybeRenderable) {
|
|
8361
8546
|
if (mouseEvent.type === "drag" && mouseEvent.button === 0 /* LEFT */) {
|
|
@@ -8450,30 +8635,33 @@ Error details:
|
|
|
8450
8635
|
this._console.resize(this.width, this.height);
|
|
8451
8636
|
this.root.resize(this.width, this.height);
|
|
8452
8637
|
this.emit("resize", this.width, this.height);
|
|
8453
|
-
this.
|
|
8638
|
+
this.requestRender();
|
|
8454
8639
|
}
|
|
8455
8640
|
setBackgroundColor(color) {
|
|
8456
8641
|
const parsedColor = parseColor(color);
|
|
8457
8642
|
this.lib.setBackgroundColor(this.rendererPtr, parsedColor);
|
|
8458
8643
|
this.backgroundColor = parsedColor;
|
|
8459
8644
|
this.nextRenderBuffer.clear(parsedColor);
|
|
8460
|
-
this.
|
|
8645
|
+
this.requestRender();
|
|
8461
8646
|
}
|
|
8462
8647
|
toggleDebugOverlay() {
|
|
8463
8648
|
this.debugOverlay.enabled = !this.debugOverlay.enabled;
|
|
8464
8649
|
this.lib.setDebugOverlay(this.rendererPtr, this.debugOverlay.enabled, this.debugOverlay.corner);
|
|
8465
8650
|
this.emit("debugOverlay:toggle" /* DEBUG_OVERLAY_TOGGLE */, this.debugOverlay.enabled);
|
|
8466
|
-
this.
|
|
8651
|
+
this.requestRender();
|
|
8467
8652
|
}
|
|
8468
8653
|
configureDebugOverlay(options) {
|
|
8469
8654
|
this.debugOverlay.enabled = options.enabled ?? this.debugOverlay.enabled;
|
|
8470
8655
|
this.debugOverlay.corner = options.corner ?? this.debugOverlay.corner;
|
|
8471
8656
|
this.lib.setDebugOverlay(this.rendererPtr, this.debugOverlay.enabled, this.debugOverlay.corner);
|
|
8472
|
-
this.
|
|
8657
|
+
this.requestRender();
|
|
8473
8658
|
}
|
|
8474
8659
|
clearTerminal() {
|
|
8475
8660
|
this.lib.clearTerminal(this.rendererPtr);
|
|
8476
8661
|
}
|
|
8662
|
+
setTerminalTitle(title) {
|
|
8663
|
+
this.lib.setTerminalTitle(this.rendererPtr, title);
|
|
8664
|
+
}
|
|
8477
8665
|
dumpHitGrid() {
|
|
8478
8666
|
this.lib.dumpHitGrid(this.rendererPtr);
|
|
8479
8667
|
}
|
|
@@ -8546,6 +8734,9 @@ Error details:
|
|
|
8546
8734
|
this.controlState = "explicit_started" /* EXPLICIT_STARTED */;
|
|
8547
8735
|
this.internalStart();
|
|
8548
8736
|
}
|
|
8737
|
+
auto() {
|
|
8738
|
+
this.controlState = this._isRunning ? "auto_started" /* AUTO_STARTED */ : "idle" /* IDLE */;
|
|
8739
|
+
}
|
|
8549
8740
|
internalStart() {
|
|
8550
8741
|
if (!this._isRunning && !this.isDestroyed) {
|
|
8551
8742
|
this._isRunning = true;
|
|
@@ -8813,7 +9004,7 @@ Error details:
|
|
|
8813
9004
|
}
|
|
8814
9005
|
}
|
|
8815
9006
|
|
|
8816
|
-
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, TrackedNode, createTrackedNode, nonAlphanumericKeys, parseKeypress, KeyHandler, getKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, 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, tn, t, SyntaxStyle, hastToStyledText, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, TextSelectionHelper, ASCIIFontSelectionHelper, TextBuffer, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, ensureRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isValidPercentage, isMarginType, isPaddingType, isPositionType,
|
|
9007
|
+
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, TrackedNode, createTrackedNode, nonAlphanumericKeys, parseKeypress, KeyHandler, getKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, 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, tn, t, SyntaxStyle, hastToStyledText, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, TextSelectionHelper, ASCIIFontSelectionHelper, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, ensureRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isValidPercentage, isMarginType, isPaddingType, isPositionType, isPositionTypeType, isOverflowType, isDimensionType, isFlexBasisType, isSizeType, Renderable, RootRenderable, capture, ConsolePosition, TerminalConsole, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, CliRenderer };
|
|
8817
9008
|
|
|
8818
|
-
//# debugId=
|
|
8819
|
-
//# sourceMappingURL=index-
|
|
9009
|
+
//# debugId=ADDBBC6DB7FFCF1064756E2164756E21
|
|
9010
|
+
//# sourceMappingURL=index-rv93tneq.js.map
|