@opentui/core 0.1.69 → 0.1.70
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 +2 -0
- package/{index-zj0wwh9d.js → index-cr95zpf8.js} +191 -74
- package/{index-zj0wwh9d.js.map → index-cr95zpf8.js.map} +7 -7
- package/index.js +4 -3
- package/index.js.map +3 -3
- package/lib/KeyHandler.d.ts +6 -0
- package/package.json +7 -7
- package/renderer.d.ts +9 -0
- package/testing.js +1 -1
- package/testing.js.map +1 -1
- package/types.d.ts +3 -0
- package/zig.d.ts +5 -0
package/3d.js
CHANGED
package/Renderable.d.ts
CHANGED
|
@@ -296,6 +296,8 @@ interface RenderCommandPushScissorRect extends RenderCommandBase {
|
|
|
296
296
|
y: number;
|
|
297
297
|
width: number;
|
|
298
298
|
height: number;
|
|
299
|
+
screenX: number;
|
|
300
|
+
screenY: number;
|
|
299
301
|
}
|
|
300
302
|
interface RenderCommandPopScissorRect extends RenderCommandBase {
|
|
301
303
|
action: "popScissorRect";
|
|
@@ -2368,6 +2368,7 @@ class KeyEvent {
|
|
|
2368
2368
|
baseCode;
|
|
2369
2369
|
repeated;
|
|
2370
2370
|
_defaultPrevented = false;
|
|
2371
|
+
_propagationStopped = false;
|
|
2371
2372
|
constructor(key) {
|
|
2372
2373
|
this.name = key.name;
|
|
2373
2374
|
this.ctrl = key.ctrl;
|
|
@@ -2390,23 +2391,36 @@ class KeyEvent {
|
|
|
2390
2391
|
get defaultPrevented() {
|
|
2391
2392
|
return this._defaultPrevented;
|
|
2392
2393
|
}
|
|
2394
|
+
get propagationStopped() {
|
|
2395
|
+
return this._propagationStopped;
|
|
2396
|
+
}
|
|
2393
2397
|
preventDefault() {
|
|
2394
2398
|
this._defaultPrevented = true;
|
|
2395
2399
|
}
|
|
2400
|
+
stopPropagation() {
|
|
2401
|
+
this._propagationStopped = true;
|
|
2402
|
+
}
|
|
2396
2403
|
}
|
|
2397
2404
|
|
|
2398
2405
|
class PasteEvent {
|
|
2399
2406
|
text;
|
|
2400
2407
|
_defaultPrevented = false;
|
|
2408
|
+
_propagationStopped = false;
|
|
2401
2409
|
constructor(text) {
|
|
2402
2410
|
this.text = text;
|
|
2403
2411
|
}
|
|
2404
2412
|
get defaultPrevented() {
|
|
2405
2413
|
return this._defaultPrevented;
|
|
2406
2414
|
}
|
|
2415
|
+
get propagationStopped() {
|
|
2416
|
+
return this._propagationStopped;
|
|
2417
|
+
}
|
|
2407
2418
|
preventDefault() {
|
|
2408
2419
|
this._defaultPrevented = true;
|
|
2409
2420
|
}
|
|
2421
|
+
stopPropagation() {
|
|
2422
|
+
this._propagationStopped = true;
|
|
2423
|
+
}
|
|
2410
2424
|
}
|
|
2411
2425
|
|
|
2412
2426
|
class KeyHandler extends EventEmitter {
|
|
@@ -2458,10 +2472,22 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2458
2472
|
}
|
|
2459
2473
|
emitWithPriority(event, ...args) {
|
|
2460
2474
|
let hasGlobalListeners = false;
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2475
|
+
const globalListeners = this.listeners(event);
|
|
2476
|
+
if (globalListeners.length > 0) {
|
|
2477
|
+
hasGlobalListeners = true;
|
|
2478
|
+
for (const listener of globalListeners) {
|
|
2479
|
+
try {
|
|
2480
|
+
listener(...args);
|
|
2481
|
+
} catch (error) {
|
|
2482
|
+
console.error(`[KeyHandler] Error in global ${event} handler:`, error);
|
|
2483
|
+
}
|
|
2484
|
+
if (event === "keypress" || event === "keyrelease" || event === "paste") {
|
|
2485
|
+
const keyEvent = args[0];
|
|
2486
|
+
if (keyEvent.propagationStopped) {
|
|
2487
|
+
return hasGlobalListeners;
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2465
2491
|
}
|
|
2466
2492
|
const renderableSet = this.renderableHandlers.get(event);
|
|
2467
2493
|
const renderableHandlers = renderableSet && renderableSet.size > 0 ? [...renderableSet] : [];
|
|
@@ -2472,6 +2498,8 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2472
2498
|
const keyEvent = args[0];
|
|
2473
2499
|
if (keyEvent.defaultPrevented)
|
|
2474
2500
|
return hasGlobalListeners || hasRenderableListeners;
|
|
2501
|
+
if (keyEvent.propagationStopped)
|
|
2502
|
+
return hasGlobalListeners || hasRenderableListeners;
|
|
2475
2503
|
}
|
|
2476
2504
|
for (const handler of renderableHandlers) {
|
|
2477
2505
|
try {
|
|
@@ -2479,6 +2507,12 @@ class InternalKeyHandler extends KeyHandler {
|
|
|
2479
2507
|
} catch (error) {
|
|
2480
2508
|
console.error(`[KeyHandler] Error in renderable ${event} handler:`, error);
|
|
2481
2509
|
}
|
|
2510
|
+
if (event === "keypress" || event === "keyrelease" || event === "paste") {
|
|
2511
|
+
const keyEvent = args[0];
|
|
2512
|
+
if (keyEvent.propagationStopped) {
|
|
2513
|
+
return hasGlobalListeners || hasRenderableListeners;
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2482
2516
|
}
|
|
2483
2517
|
}
|
|
2484
2518
|
return hasGlobalListeners || hasRenderableListeners;
|
|
@@ -10444,6 +10478,26 @@ function getOpenTUILib(libPath) {
|
|
|
10444
10478
|
args: ["ptr", "i32", "i32", "u32", "u32", "u32"],
|
|
10445
10479
|
returns: "void"
|
|
10446
10480
|
},
|
|
10481
|
+
clearCurrentHitGrid: {
|
|
10482
|
+
args: ["ptr"],
|
|
10483
|
+
returns: "void"
|
|
10484
|
+
},
|
|
10485
|
+
hitGridPushScissorRect: {
|
|
10486
|
+
args: ["ptr", "i32", "i32", "u32", "u32"],
|
|
10487
|
+
returns: "void"
|
|
10488
|
+
},
|
|
10489
|
+
hitGridPopScissorRect: {
|
|
10490
|
+
args: ["ptr"],
|
|
10491
|
+
returns: "void"
|
|
10492
|
+
},
|
|
10493
|
+
hitGridClearScissorRects: {
|
|
10494
|
+
args: ["ptr"],
|
|
10495
|
+
returns: "void"
|
|
10496
|
+
},
|
|
10497
|
+
addToCurrentHitGridClipped: {
|
|
10498
|
+
args: ["ptr", "i32", "i32", "u32", "u32", "u32"],
|
|
10499
|
+
returns: "void"
|
|
10500
|
+
},
|
|
10447
10501
|
checkHit: {
|
|
10448
10502
|
args: ["ptr", "u32", "u32"],
|
|
10449
10503
|
returns: "u32"
|
|
@@ -11540,6 +11594,21 @@ class FFIRenderLib {
|
|
|
11540
11594
|
addToHitGrid(renderer, x, y, width, height, id) {
|
|
11541
11595
|
this.opentui.symbols.addToHitGrid(renderer, x, y, width, height, id);
|
|
11542
11596
|
}
|
|
11597
|
+
clearCurrentHitGrid(renderer) {
|
|
11598
|
+
this.opentui.symbols.clearCurrentHitGrid(renderer);
|
|
11599
|
+
}
|
|
11600
|
+
hitGridPushScissorRect(renderer, x, y, width, height) {
|
|
11601
|
+
this.opentui.symbols.hitGridPushScissorRect(renderer, x, y, width, height);
|
|
11602
|
+
}
|
|
11603
|
+
hitGridPopScissorRect(renderer) {
|
|
11604
|
+
this.opentui.symbols.hitGridPopScissorRect(renderer);
|
|
11605
|
+
}
|
|
11606
|
+
hitGridClearScissorRects(renderer) {
|
|
11607
|
+
this.opentui.symbols.hitGridClearScissorRects(renderer);
|
|
11608
|
+
}
|
|
11609
|
+
addToCurrentHitGridClipped(renderer, x, y, width, height, id) {
|
|
11610
|
+
this.opentui.symbols.addToCurrentHitGridClipped(renderer, x, y, width, height, id);
|
|
11611
|
+
}
|
|
11543
11612
|
checkHit(renderer, x, y) {
|
|
11544
11613
|
return this.opentui.symbols.checkHit(renderer, x, y);
|
|
11545
11614
|
}
|
|
@@ -12934,9 +13003,9 @@ class Renderable extends BaseRenderable {
|
|
|
12934
13003
|
if (this._translateX === value)
|
|
12935
13004
|
return;
|
|
12936
13005
|
this._translateX = value;
|
|
12937
|
-
this.requestRender();
|
|
12938
13006
|
if (this.parent)
|
|
12939
13007
|
this.parent.childrenPrimarySortDirty = true;
|
|
13008
|
+
this.requestRender();
|
|
12940
13009
|
}
|
|
12941
13010
|
get translateY() {
|
|
12942
13011
|
return this._translateY;
|
|
@@ -12945,9 +13014,9 @@ class Renderable extends BaseRenderable {
|
|
|
12945
13014
|
if (this._translateY === value)
|
|
12946
13015
|
return;
|
|
12947
13016
|
this._translateY = value;
|
|
12948
|
-
this.requestRender();
|
|
12949
13017
|
if (this.parent)
|
|
12950
13018
|
this.parent.childrenPrimarySortDirty = true;
|
|
13019
|
+
this.requestRender();
|
|
12951
13020
|
}
|
|
12952
13021
|
get x() {
|
|
12953
13022
|
if (this.parent) {
|
|
@@ -13580,7 +13649,9 @@ class Renderable extends BaseRenderable {
|
|
|
13580
13649
|
x: scissorRect.x,
|
|
13581
13650
|
y: scissorRect.y,
|
|
13582
13651
|
width: scissorRect.width,
|
|
13583
|
-
height: scissorRect.height
|
|
13652
|
+
height: scissorRect.height,
|
|
13653
|
+
screenX: this.x,
|
|
13654
|
+
screenY: this.y
|
|
13584
13655
|
});
|
|
13585
13656
|
}
|
|
13586
13657
|
const visibleChildren = this._getVisibleChildren();
|
|
@@ -13796,6 +13867,7 @@ class RootRenderable extends Renderable {
|
|
|
13796
13867
|
}
|
|
13797
13868
|
this.renderList.length = 0;
|
|
13798
13869
|
this.updateLayout(deltaTime, this.renderList);
|
|
13870
|
+
this._ctx.clearHitGridScissorRects();
|
|
13799
13871
|
for (let i = 1;i < this.renderList.length; i++) {
|
|
13800
13872
|
const command = this.renderList[i];
|
|
13801
13873
|
switch (command.action) {
|
|
@@ -13806,9 +13878,11 @@ class RootRenderable extends Renderable {
|
|
|
13806
13878
|
break;
|
|
13807
13879
|
case "pushScissorRect":
|
|
13808
13880
|
buffer.pushScissorRect(command.x, command.y, command.width, command.height);
|
|
13881
|
+
this._ctx.pushHitGridScissorRect(command.screenX, command.screenY, command.width, command.height);
|
|
13809
13882
|
break;
|
|
13810
13883
|
case "popScissorRect":
|
|
13811
13884
|
buffer.popScissorRect();
|
|
13885
|
+
this._ctx.popHitGridScissorRect();
|
|
13812
13886
|
break;
|
|
13813
13887
|
case "pushOpacity":
|
|
13814
13888
|
buffer.pushOpacity(command.opacity);
|
|
@@ -15409,6 +15483,8 @@ class CliRenderer extends EventEmitter9 {
|
|
|
15409
15483
|
exitSignals;
|
|
15410
15484
|
_exitListenersAdded = false;
|
|
15411
15485
|
_isDestroyed = false;
|
|
15486
|
+
_destroyPending = false;
|
|
15487
|
+
_destroyFinalized = false;
|
|
15412
15488
|
nextRenderBuffer;
|
|
15413
15489
|
currentRenderBuffer;
|
|
15414
15490
|
_isRunning = false;
|
|
@@ -15494,6 +15570,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
15494
15570
|
}).bind(this);
|
|
15495
15571
|
_capabilities = null;
|
|
15496
15572
|
_latestPointer = { x: 0, y: 0 };
|
|
15573
|
+
_hasPointer = false;
|
|
15497
15574
|
_currentFocusedRenderable = null;
|
|
15498
15575
|
lifecyclePasses = new Set;
|
|
15499
15576
|
_openConsoleOnError = true;
|
|
@@ -15675,11 +15752,26 @@ Captured output:
|
|
|
15675
15752
|
}
|
|
15676
15753
|
this._currentFocusedRenderable = renderable;
|
|
15677
15754
|
}
|
|
15755
|
+
setCapturedRenderable(renderable) {
|
|
15756
|
+
if (this.capturedRenderable === renderable) {
|
|
15757
|
+
return;
|
|
15758
|
+
}
|
|
15759
|
+
this.capturedRenderable = renderable;
|
|
15760
|
+
}
|
|
15678
15761
|
addToHitGrid(x, y, width, height, id) {
|
|
15679
15762
|
if (id !== this.capturedRenderable?.num) {
|
|
15680
15763
|
this.lib.addToHitGrid(this.rendererPtr, x, y, width, height, id);
|
|
15681
15764
|
}
|
|
15682
15765
|
}
|
|
15766
|
+
pushHitGridScissorRect(x, y, width, height) {
|
|
15767
|
+
this.lib.hitGridPushScissorRect(this.rendererPtr, x, y, width, height);
|
|
15768
|
+
}
|
|
15769
|
+
popHitGridScissorRect() {
|
|
15770
|
+
this.lib.hitGridPopScissorRect(this.rendererPtr);
|
|
15771
|
+
}
|
|
15772
|
+
clearHitGridScissorRects() {
|
|
15773
|
+
this.lib.hitGridClearScissorRects(this.rendererPtr);
|
|
15774
|
+
}
|
|
15683
15775
|
get widthMethod() {
|
|
15684
15776
|
const caps = this.capabilities;
|
|
15685
15777
|
return caps?.unicode === "wcwidth" ? "wcwidth" : "unicode";
|
|
@@ -15874,7 +15966,11 @@ Captured output:
|
|
|
15874
15966
|
const backgroundColor = this.backgroundColor.toInts();
|
|
15875
15967
|
const newlines = " ".repeat(this.width) + `
|
|
15876
15968
|
`.repeat(space);
|
|
15877
|
-
|
|
15969
|
+
if (backgroundColor[3] === 0) {
|
|
15970
|
+
clear = newlines;
|
|
15971
|
+
} else {
|
|
15972
|
+
clear = ANSI.setRgbBackground(backgroundColor[0], backgroundColor[1], backgroundColor[2]) + newlines + ANSI.resetBackground;
|
|
15973
|
+
}
|
|
15878
15974
|
}
|
|
15879
15975
|
this.writeOut(flush + move + output + clear);
|
|
15880
15976
|
return true;
|
|
@@ -15885,7 +15981,7 @@ Captured output:
|
|
|
15885
15981
|
}
|
|
15886
15982
|
disableMouse() {
|
|
15887
15983
|
this._useMouse = false;
|
|
15888
|
-
this.
|
|
15984
|
+
this.setCapturedRenderable(undefined);
|
|
15889
15985
|
this.mouseParser.reset();
|
|
15890
15986
|
this.lib.disableMouse(this.rendererPtr);
|
|
15891
15987
|
}
|
|
@@ -16003,6 +16099,7 @@ Captured output:
|
|
|
16003
16099
|
}
|
|
16004
16100
|
this._latestPointer.x = mouseEvent.x;
|
|
16005
16101
|
this._latestPointer.y = mouseEvent.y;
|
|
16102
|
+
this._hasPointer = true;
|
|
16006
16103
|
if (this._console.visible) {
|
|
16007
16104
|
const consoleBounds = this._console.bounds;
|
|
16008
16105
|
if (mouseEvent.x >= consoleBounds.x && mouseEvent.x < consoleBounds.x + consoleBounds.width && mouseEvent.y >= consoleBounds.y && mouseEvent.y < consoleBounds.y + consoleBounds.height) {
|
|
@@ -16013,7 +16110,7 @@ Captured output:
|
|
|
16013
16110
|
}
|
|
16014
16111
|
}
|
|
16015
16112
|
if (mouseEvent.type === "scroll") {
|
|
16016
|
-
const maybeRenderableId2 = this.
|
|
16113
|
+
const maybeRenderableId2 = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
16017
16114
|
const maybeRenderable2 = Renderable.renderablesByNumber.get(maybeRenderableId2);
|
|
16018
16115
|
if (maybeRenderable2) {
|
|
16019
16116
|
const event2 = new MouseEvent(maybeRenderable2, mouseEvent);
|
|
@@ -16021,7 +16118,7 @@ Captured output:
|
|
|
16021
16118
|
}
|
|
16022
16119
|
return true;
|
|
16023
16120
|
}
|
|
16024
|
-
const maybeRenderableId = this.
|
|
16121
|
+
const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
16025
16122
|
const sameElement = maybeRenderableId === this.lastOverRenderableNum;
|
|
16026
16123
|
this.lastOverRenderableNum = maybeRenderableId;
|
|
16027
16124
|
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
@@ -16090,20 +16187,20 @@ Captured output:
|
|
|
16090
16187
|
}
|
|
16091
16188
|
this.lastOverRenderable = this.capturedRenderable;
|
|
16092
16189
|
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
16093
|
-
this.
|
|
16190
|
+
this.setCapturedRenderable(undefined);
|
|
16094
16191
|
this.requestRender();
|
|
16095
16192
|
}
|
|
16096
16193
|
let event = undefined;
|
|
16097
16194
|
if (maybeRenderable) {
|
|
16098
16195
|
if (mouseEvent.type === "drag" && mouseEvent.button === 0 /* LEFT */) {
|
|
16099
|
-
this.
|
|
16196
|
+
this.setCapturedRenderable(maybeRenderable);
|
|
16100
16197
|
} else {
|
|
16101
|
-
this.
|
|
16198
|
+
this.setCapturedRenderable(undefined);
|
|
16102
16199
|
}
|
|
16103
16200
|
event = new MouseEvent(maybeRenderable, mouseEvent);
|
|
16104
16201
|
maybeRenderable.processMouseEvent(event);
|
|
16105
16202
|
} else {
|
|
16106
|
-
this.
|
|
16203
|
+
this.setCapturedRenderable(undefined);
|
|
16107
16204
|
this.lastOverRenderable = undefined;
|
|
16108
16205
|
}
|
|
16109
16206
|
if (!event?.defaultPrevented && mouseEvent.type === "down" && this.currentSelection) {
|
|
@@ -16113,6 +16210,9 @@ Captured output:
|
|
|
16113
16210
|
}
|
|
16114
16211
|
return false;
|
|
16115
16212
|
}
|
|
16213
|
+
hitTest(x, y) {
|
|
16214
|
+
return this.lib.checkHit(this.rendererPtr, x, y);
|
|
16215
|
+
}
|
|
16116
16216
|
takeMemorySnapshot() {
|
|
16117
16217
|
if (this._isDestroyed)
|
|
16118
16218
|
return;
|
|
@@ -16173,7 +16273,7 @@ Captured output:
|
|
|
16173
16273
|
this._terminalWidth = width;
|
|
16174
16274
|
this._terminalHeight = height;
|
|
16175
16275
|
this.queryPixelResolution();
|
|
16176
|
-
this.
|
|
16276
|
+
this.setCapturedRenderable(undefined);
|
|
16177
16277
|
this.mouseParser.reset();
|
|
16178
16278
|
if (this._splitHeight > 0) {
|
|
16179
16279
|
if (width < prevWidth) {
|
|
@@ -16385,6 +16485,17 @@ Captured output:
|
|
|
16385
16485
|
if (this._isDestroyed)
|
|
16386
16486
|
return;
|
|
16387
16487
|
this._isDestroyed = true;
|
|
16488
|
+
this._destroyPending = true;
|
|
16489
|
+
if (this.rendering) {
|
|
16490
|
+
return;
|
|
16491
|
+
}
|
|
16492
|
+
this.finalizeDestroy();
|
|
16493
|
+
}
|
|
16494
|
+
finalizeDestroy() {
|
|
16495
|
+
if (this._destroyFinalized)
|
|
16496
|
+
return;
|
|
16497
|
+
this._destroyFinalized = true;
|
|
16498
|
+
this._destroyPending = false;
|
|
16388
16499
|
process.removeListener("SIGWINCH", this.sigwinchHandler);
|
|
16389
16500
|
process.removeListener("uncaughtException", this.handleError);
|
|
16390
16501
|
process.removeListener("unhandledRejection", this.handleError);
|
|
@@ -16416,7 +16527,7 @@ Captured output:
|
|
|
16416
16527
|
}
|
|
16417
16528
|
this._isRunning = false;
|
|
16418
16529
|
this.waitingForPixelResolution = false;
|
|
16419
|
-
this.
|
|
16530
|
+
this.setCapturedRenderable(undefined);
|
|
16420
16531
|
try {
|
|
16421
16532
|
this.root.destroyRecursively();
|
|
16422
16533
|
} catch (e) {
|
|
@@ -16461,65 +16572,71 @@ Captured output:
|
|
|
16461
16572
|
clearTimeout(this.renderTimeout);
|
|
16462
16573
|
this.renderTimeout = null;
|
|
16463
16574
|
}
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
this.
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
this.renderStats.frameCount++;
|
|
16475
|
-
this.renderStats.fps = this.currentFps;
|
|
16476
|
-
const overallStart = performance.now();
|
|
16477
|
-
const frameRequests = Array.from(this.animationRequest.values());
|
|
16478
|
-
this.animationRequest.clear();
|
|
16479
|
-
const animationRequestStart = performance.now();
|
|
16480
|
-
frameRequests.forEach((callback) => {
|
|
16481
|
-
callback(deltaTime);
|
|
16482
|
-
this.dropLive();
|
|
16483
|
-
});
|
|
16484
|
-
const animationRequestEnd = performance.now();
|
|
16485
|
-
const animationRequestTime = animationRequestEnd - animationRequestStart;
|
|
16486
|
-
const start = performance.now();
|
|
16487
|
-
for (const frameCallback of this.frameCallbacks) {
|
|
16488
|
-
try {
|
|
16489
|
-
await frameCallback(deltaTime);
|
|
16490
|
-
} catch (error) {
|
|
16491
|
-
console.error("Error in frame callback:", error);
|
|
16575
|
+
try {
|
|
16576
|
+
const now = Date.now();
|
|
16577
|
+
const elapsed = now - this.lastTime;
|
|
16578
|
+
const deltaTime = elapsed;
|
|
16579
|
+
this.lastTime = now;
|
|
16580
|
+
this.frameCount++;
|
|
16581
|
+
if (now - this.lastFpsTime >= 1000) {
|
|
16582
|
+
this.currentFps = this.frameCount;
|
|
16583
|
+
this.frameCount = 0;
|
|
16584
|
+
this.lastFpsTime = now;
|
|
16492
16585
|
}
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
const
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16586
|
+
this.renderStats.frameCount++;
|
|
16587
|
+
this.renderStats.fps = this.currentFps;
|
|
16588
|
+
const overallStart = performance.now();
|
|
16589
|
+
const frameRequests = Array.from(this.animationRequest.values());
|
|
16590
|
+
this.animationRequest.clear();
|
|
16591
|
+
const animationRequestStart = performance.now();
|
|
16592
|
+
for (const callback of frameRequests) {
|
|
16593
|
+
callback(deltaTime);
|
|
16594
|
+
this.dropLive();
|
|
16595
|
+
}
|
|
16596
|
+
const animationRequestEnd = performance.now();
|
|
16597
|
+
const animationRequestTime = animationRequestEnd - animationRequestStart;
|
|
16598
|
+
const start = performance.now();
|
|
16599
|
+
for (const frameCallback of this.frameCallbacks) {
|
|
16600
|
+
try {
|
|
16601
|
+
await frameCallback(deltaTime);
|
|
16602
|
+
} catch (error) {
|
|
16603
|
+
console.error("Error in frame callback:", error);
|
|
16604
|
+
}
|
|
16605
|
+
}
|
|
16606
|
+
const end = performance.now();
|
|
16607
|
+
this.renderStats.frameCallbackTime = end - start;
|
|
16608
|
+
this.root.render(this.nextRenderBuffer, deltaTime);
|
|
16609
|
+
for (const postProcessFn of this.postProcessFns) {
|
|
16610
|
+
postProcessFn(this.nextRenderBuffer, deltaTime);
|
|
16507
16611
|
}
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
|
|
16511
|
-
|
|
16512
|
-
this.
|
|
16612
|
+
this._console.renderToBuffer(this.nextRenderBuffer);
|
|
16613
|
+
if (!this._isDestroyed) {
|
|
16614
|
+
this.renderNative();
|
|
16615
|
+
const overallFrameTime = performance.now() - overallStart;
|
|
16616
|
+
this.lib.updateStats(this.rendererPtr, overallFrameTime, this.renderStats.fps, this.renderStats.frameCallbackTime);
|
|
16617
|
+
if (this.gatherStats) {
|
|
16618
|
+
this.collectStatSample(overallFrameTime);
|
|
16619
|
+
}
|
|
16620
|
+
if (this._isRunning || this.immediateRerenderRequested) {
|
|
16621
|
+
const targetFrameTime = this.immediateRerenderRequested ? this.minTargetFrameTime : this.targetFrameTime;
|
|
16622
|
+
const delay = Math.max(1, targetFrameTime - Math.floor(overallFrameTime));
|
|
16623
|
+
this.immediateRerenderRequested = false;
|
|
16624
|
+
this.renderTimeout = setTimeout(() => {
|
|
16625
|
+
this.renderTimeout = null;
|
|
16626
|
+
this.loop();
|
|
16627
|
+
}, delay);
|
|
16628
|
+
} else {
|
|
16629
|
+
clearTimeout(this.renderTimeout);
|
|
16513
16630
|
this.renderTimeout = null;
|
|
16514
|
-
|
|
16515
|
-
}, delay);
|
|
16516
|
-
} else {
|
|
16517
|
-
clearTimeout(this.renderTimeout);
|
|
16518
|
-
this.renderTimeout = null;
|
|
16631
|
+
}
|
|
16519
16632
|
}
|
|
16633
|
+
} finally {
|
|
16634
|
+
this.rendering = false;
|
|
16635
|
+
if (this._destroyPending) {
|
|
16636
|
+
this.finalizeDestroy();
|
|
16637
|
+
}
|
|
16638
|
+
this.resolveIdleIfNeeded();
|
|
16520
16639
|
}
|
|
16521
|
-
this.rendering = false;
|
|
16522
|
-
this.resolveIdleIfNeeded();
|
|
16523
16640
|
}
|
|
16524
16641
|
intermediateRender() {
|
|
16525
16642
|
this.immediateRerenderRequested = true;
|
|
@@ -16624,7 +16741,7 @@ Captured output:
|
|
|
16624
16741
|
requestSelectionUpdate() {
|
|
16625
16742
|
if (this.currentSelection?.isSelecting) {
|
|
16626
16743
|
const pointer = this._latestPointer;
|
|
16627
|
-
const maybeRenderableId = this.
|
|
16744
|
+
const maybeRenderableId = this.hitTest(pointer.x, pointer.y);
|
|
16628
16745
|
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
16629
16746
|
this.updateSelection(maybeRenderable, pointer.x, pointer.y);
|
|
16630
16747
|
}
|
|
@@ -16714,5 +16831,5 @@ Captured output:
|
|
|
16714
16831
|
|
|
16715
16832
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, createTextAttributes, attributesWithLink, getLinkId, 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, link, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseAlignItems, 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, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
16716
16833
|
|
|
16717
|
-
//# debugId=
|
|
16718
|
-
//# sourceMappingURL=index-
|
|
16834
|
+
//# debugId=FF2A8CAC839E289564756E2164756E21
|
|
16835
|
+
//# sourceMappingURL=index-cr95zpf8.js.map
|