@opentui/core 0.1.26 → 0.1.28
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 +140 -140
- package/3d.js.map +2 -2
- package/{index-pxa2sv92.js → index-phjxdb6g.js} +97 -43
- package/{index-pxa2sv92.js.map → index-phjxdb6g.js.map} +6 -6
- package/index.js +2060 -2052
- package/index.js.map +12 -12
- package/lib/KeyHandler.d.ts +3 -0
- package/package.json +8 -7
- package/renderables/ScrollBox.d.ts +2 -0
- package/renderables/TextNode.d.ts +2 -1
- package/renderables/index.d.ts +10 -9
- package/renderer.d.ts +14 -1
- package/testing.js +1 -1
|
@@ -27,7 +27,7 @@ var __export = (target, all) => {
|
|
|
27
27
|
};
|
|
28
28
|
var __require = import.meta.require;
|
|
29
29
|
|
|
30
|
-
// ../../node_modules/yoga-layout/dist/src/index.js
|
|
30
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
|
|
31
31
|
var exports_src = {};
|
|
32
32
|
__export(exports_src, {
|
|
33
33
|
default: () => src_default,
|
|
@@ -51,7 +51,7 @@ __export(exports_src, {
|
|
|
51
51
|
Align: () => Align
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
// ../../node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
|
|
54
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
|
|
55
55
|
var loadYoga = (() => {
|
|
56
56
|
var _scriptDir = import.meta.url;
|
|
57
57
|
return function(loadYoga2) {
|
|
@@ -1356,7 +1356,7 @@ var loadYoga = (() => {
|
|
|
1356
1356
|
})();
|
|
1357
1357
|
var yoga_wasm_base64_esm_default = loadYoga;
|
|
1358
1358
|
|
|
1359
|
-
// ../../node_modules/yoga-layout/dist/src/generated/YGEnums.js
|
|
1359
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/generated/YGEnums.js
|
|
1360
1360
|
var Align = /* @__PURE__ */ function(Align2) {
|
|
1361
1361
|
Align2[Align2["Auto"] = 0] = "Auto";
|
|
1362
1362
|
Align2[Align2["FlexStart"] = 1] = "FlexStart";
|
|
@@ -1559,7 +1559,7 @@ var constants = {
|
|
|
1559
1559
|
};
|
|
1560
1560
|
var YGEnums_default = constants;
|
|
1561
1561
|
|
|
1562
|
-
// ../../node_modules/yoga-layout/dist/src/wrapAssembly.js
|
|
1562
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/wrapAssembly.js
|
|
1563
1563
|
function wrapAssembly(lib) {
|
|
1564
1564
|
function patch(prototype, name, fn) {
|
|
1565
1565
|
const original = prototype[name];
|
|
@@ -1661,7 +1661,7 @@ function wrapAssembly(lib) {
|
|
|
1661
1661
|
};
|
|
1662
1662
|
}
|
|
1663
1663
|
|
|
1664
|
-
// ../../node_modules/yoga-layout/dist/src/index.js
|
|
1664
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
|
|
1665
1665
|
var Yoga = wrapAssembly(await yoga_wasm_base64_esm_default());
|
|
1666
1666
|
var src_default = Yoga;
|
|
1667
1667
|
|
|
@@ -2257,6 +2257,7 @@ class KeyHandler extends EventEmitter {
|
|
|
2257
2257
|
listener;
|
|
2258
2258
|
pasteMode = false;
|
|
2259
2259
|
pasteBuffer = [];
|
|
2260
|
+
suspended = false;
|
|
2260
2261
|
constructor(stdin, useKittyKeyboard = false) {
|
|
2261
2262
|
super();
|
|
2262
2263
|
this.stdin = stdin || process.stdin;
|
|
@@ -2296,6 +2297,18 @@ class KeyHandler extends EventEmitter {
|
|
|
2296
2297
|
destroy() {
|
|
2297
2298
|
this.stdin.removeListener("data", this.listener);
|
|
2298
2299
|
}
|
|
2300
|
+
suspend() {
|
|
2301
|
+
if (!this.suspended) {
|
|
2302
|
+
this.suspended = true;
|
|
2303
|
+
this.stdin.removeListener("data", this.listener);
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
resume() {
|
|
2307
|
+
if (this.suspended) {
|
|
2308
|
+
this.suspended = false;
|
|
2309
|
+
this.stdin.on("data", this.listener);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2299
2312
|
}
|
|
2300
2313
|
|
|
2301
2314
|
class InternalKeyHandler extends KeyHandler {
|
|
@@ -8377,34 +8390,31 @@ class Renderable extends BaseRenderable {
|
|
|
8377
8390
|
}
|
|
8378
8391
|
return -1;
|
|
8379
8392
|
}
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
this.
|
|
8393
|
+
const anchorRenderable = index !== undefined ? this._childrenInLayoutOrder[index] : undefined;
|
|
8394
|
+
if (anchorRenderable) {
|
|
8395
|
+
return this.insertBefore(renderable, anchorRenderable);
|
|
8383
8396
|
}
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
if (index !== undefined) {
|
|
8388
|
-
insertedIndex = Math.max(0, Math.min(index, this._childrenInLayoutOrder.length));
|
|
8389
|
-
this._childrenInLayoutOrder.splice(index, 0, renderable);
|
|
8390
|
-
this._forceLayoutUpdateFor = this._childrenInLayoutOrder.slice(index);
|
|
8391
|
-
this.yogaNode.insertChild(childLayoutNode, insertedIndex);
|
|
8397
|
+
if (renderable.parent === this) {
|
|
8398
|
+
this.yogaNode.removeChild(renderable.getLayoutNode());
|
|
8399
|
+
this._childrenInLayoutOrder.splice(this._childrenInLayoutOrder.indexOf(renderable), 1);
|
|
8392
8400
|
} else {
|
|
8393
|
-
|
|
8394
|
-
this.
|
|
8395
|
-
this.
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8401
|
+
this.replaceParent(renderable);
|
|
8402
|
+
this.needsZIndexSort = true;
|
|
8403
|
+
this.renderableMapById.set(renderable.id, renderable);
|
|
8404
|
+
this._childrenInZIndexOrder.push(renderable);
|
|
8405
|
+
if (typeof renderable.onLifecyclePass === "function") {
|
|
8406
|
+
this._ctx.registerLifecyclePass(renderable);
|
|
8407
|
+
}
|
|
8408
|
+
if (renderable._liveCount > 0) {
|
|
8409
|
+
this.propagateLiveCount(renderable._liveCount);
|
|
8410
|
+
}
|
|
8403
8411
|
}
|
|
8404
8412
|
this._newChildren.push(renderable);
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8413
|
+
const childLayoutNode = renderable.getLayoutNode();
|
|
8414
|
+
const insertedIndex = this._childrenInLayoutOrder.length;
|
|
8415
|
+
this._childrenInLayoutOrder.push(renderable);
|
|
8416
|
+
this.yogaNode.insertChild(childLayoutNode, insertedIndex);
|
|
8417
|
+
this.childrenPrimarySortDirty = true;
|
|
8408
8418
|
this.requestRender();
|
|
8409
8419
|
return insertedIndex;
|
|
8410
8420
|
}
|
|
@@ -8459,6 +8469,7 @@ class Renderable extends BaseRenderable {
|
|
|
8459
8469
|
this._forceLayoutUpdateFor = this._childrenInLayoutOrder.slice(insertedIndex);
|
|
8460
8470
|
this._childrenInLayoutOrder.splice(insertedIndex, 0, renderable);
|
|
8461
8471
|
this.yogaNode.insertChild(renderable.getLayoutNode(), insertedIndex);
|
|
8472
|
+
this.requestRender();
|
|
8462
8473
|
return insertedIndex;
|
|
8463
8474
|
}
|
|
8464
8475
|
getRenderable(id) {
|
|
@@ -9815,6 +9826,16 @@ var CliRenderEvents;
|
|
|
9815
9826
|
((CliRenderEvents2) => {
|
|
9816
9827
|
CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debugOverlay:toggle";
|
|
9817
9828
|
})(CliRenderEvents ||= {});
|
|
9829
|
+
var RendererControlState;
|
|
9830
|
+
((RendererControlState2) => {
|
|
9831
|
+
RendererControlState2["IDLE"] = "idle";
|
|
9832
|
+
RendererControlState2["AUTO_STARTED"] = "auto_started";
|
|
9833
|
+
RendererControlState2["EXPLICIT_STARTED"] = "explicit_started";
|
|
9834
|
+
RendererControlState2["EXPLICIT_PAUSED"] = "explicit_paused";
|
|
9835
|
+
RendererControlState2["EXPLICIT_SUSPENDED"] = "explicit_suspended";
|
|
9836
|
+
RendererControlState2["EXPLICIT_STOPPED"] = "explicit_stopped";
|
|
9837
|
+
})(RendererControlState ||= {});
|
|
9838
|
+
|
|
9818
9839
|
class CliRenderer extends EventEmitter7 {
|
|
9819
9840
|
static animationFrameId = 0;
|
|
9820
9841
|
lib;
|
|
@@ -9856,7 +9877,7 @@ class CliRenderer extends EventEmitter7 {
|
|
|
9856
9877
|
immediateRerenderRequested = false;
|
|
9857
9878
|
updateScheduled = false;
|
|
9858
9879
|
liveRequestCounter = 0;
|
|
9859
|
-
|
|
9880
|
+
_controlState = "idle" /* IDLE */;
|
|
9860
9881
|
frameCallbacks = [];
|
|
9861
9882
|
renderStats = {
|
|
9862
9883
|
frameCount: 0,
|
|
@@ -9877,6 +9898,8 @@ class CliRenderer extends EventEmitter7 {
|
|
|
9877
9898
|
enableMouseMovement = false;
|
|
9878
9899
|
_useMouse = true;
|
|
9879
9900
|
_useAlternateScreen = env.OTUI_USE_ALTERNATE_SCREEN;
|
|
9901
|
+
_suspendedMouseEnabled = false;
|
|
9902
|
+
_previousControlState = "idle" /* IDLE */;
|
|
9880
9903
|
capturedRenderable;
|
|
9881
9904
|
lastOverRenderableNum = 0;
|
|
9882
9905
|
lastOverRenderable;
|
|
@@ -9960,6 +9983,9 @@ Captured output:
|
|
|
9960
9983
|
warningHandler = ((warning) => {
|
|
9961
9984
|
console.warn(JSON.stringify(warning.message, null, 2));
|
|
9962
9985
|
}).bind(this);
|
|
9986
|
+
get controlState() {
|
|
9987
|
+
return this._controlState;
|
|
9988
|
+
}
|
|
9963
9989
|
constructor(lib, rendererPtr, stdin, stdout, width, height, config = {}) {
|
|
9964
9990
|
super();
|
|
9965
9991
|
rendererTracker.addRenderer(this);
|
|
@@ -10066,7 +10092,7 @@ Captured output:
|
|
|
10066
10092
|
return this.realStdoutWrite.call(this.stdout, chunk, encoding, callback);
|
|
10067
10093
|
}
|
|
10068
10094
|
requestRender() {
|
|
10069
|
-
if (!this.rendering && !this.updateScheduled && !this._isRunning) {
|
|
10095
|
+
if (!this.rendering && !this.updateScheduled && !this._isRunning && this._controlState !== "explicit_suspended" /* EXPLICIT_SUSPENDED */) {
|
|
10070
10096
|
this.updateScheduled = true;
|
|
10071
10097
|
process.nextTick(() => {
|
|
10072
10098
|
this.loop();
|
|
@@ -10129,7 +10155,7 @@ Captured output:
|
|
|
10129
10155
|
return this.liveRequestCounter;
|
|
10130
10156
|
}
|
|
10131
10157
|
get currentControlState() {
|
|
10132
|
-
return this.
|
|
10158
|
+
return this._controlState;
|
|
10133
10159
|
}
|
|
10134
10160
|
get capabilities() {
|
|
10135
10161
|
return this._capabilities;
|
|
@@ -10209,9 +10235,11 @@ Captured output:
|
|
|
10209
10235
|
return true;
|
|
10210
10236
|
}
|
|
10211
10237
|
enableMouse() {
|
|
10238
|
+
this._useMouse = true;
|
|
10212
10239
|
this.lib.enableMouse(this.rendererPtr, this.enableMouseMovement);
|
|
10213
10240
|
}
|
|
10214
10241
|
disableMouse() {
|
|
10242
|
+
this._useMouse = false;
|
|
10215
10243
|
this.capturedRenderable = undefined;
|
|
10216
10244
|
this.mouseParser.reset();
|
|
10217
10245
|
this.lib.disableMouse(this.rendererPtr);
|
|
@@ -10568,24 +10596,24 @@ Captured output:
|
|
|
10568
10596
|
}
|
|
10569
10597
|
requestLive() {
|
|
10570
10598
|
this.liveRequestCounter++;
|
|
10571
|
-
if (this.
|
|
10572
|
-
this.
|
|
10599
|
+
if (this._controlState === "idle" /* IDLE */ && this.liveRequestCounter > 0) {
|
|
10600
|
+
this._controlState = "auto_started" /* AUTO_STARTED */;
|
|
10573
10601
|
this.internalStart();
|
|
10574
10602
|
}
|
|
10575
10603
|
}
|
|
10576
10604
|
dropLive() {
|
|
10577
10605
|
this.liveRequestCounter = Math.max(0, this.liveRequestCounter - 1);
|
|
10578
|
-
if (this.
|
|
10579
|
-
this.
|
|
10606
|
+
if (this._controlState === "auto_started" /* AUTO_STARTED */ && this.liveRequestCounter === 0) {
|
|
10607
|
+
this._controlState = "idle" /* IDLE */;
|
|
10580
10608
|
this.internalPause();
|
|
10581
10609
|
}
|
|
10582
10610
|
}
|
|
10583
10611
|
start() {
|
|
10584
|
-
this.
|
|
10612
|
+
this._controlState = "explicit_started" /* EXPLICIT_STARTED */;
|
|
10585
10613
|
this.internalStart();
|
|
10586
10614
|
}
|
|
10587
10615
|
auto() {
|
|
10588
|
-
this.
|
|
10616
|
+
this._controlState = this._isRunning ? "auto_started" /* AUTO_STARTED */ : "idle" /* IDLE */;
|
|
10589
10617
|
}
|
|
10590
10618
|
internalStart() {
|
|
10591
10619
|
if (!this._isRunning && !this._isDestroyed) {
|
|
@@ -10597,14 +10625,40 @@ Captured output:
|
|
|
10597
10625
|
}
|
|
10598
10626
|
}
|
|
10599
10627
|
pause() {
|
|
10600
|
-
this.
|
|
10628
|
+
this._controlState = "explicit_paused" /* EXPLICIT_PAUSED */;
|
|
10629
|
+
this.internalPause();
|
|
10630
|
+
}
|
|
10631
|
+
suspend() {
|
|
10632
|
+
this._previousControlState = this._controlState;
|
|
10633
|
+
this._controlState = "explicit_suspended" /* EXPLICIT_SUSPENDED */;
|
|
10601
10634
|
this.internalPause();
|
|
10635
|
+
this._suspendedMouseEnabled = this._useMouse;
|
|
10636
|
+
this.disableMouse();
|
|
10637
|
+
this._keyHandler.suspend();
|
|
10638
|
+
if (this.stdin.setRawMode) {
|
|
10639
|
+
this.stdin.setRawMode(false);
|
|
10640
|
+
}
|
|
10641
|
+
this.stdin.pause();
|
|
10642
|
+
}
|
|
10643
|
+
resume() {
|
|
10644
|
+
if (this.stdin.setRawMode) {
|
|
10645
|
+
this.stdin.setRawMode(true);
|
|
10646
|
+
}
|
|
10647
|
+
this.stdin.resume();
|
|
10648
|
+
this._keyHandler.resume();
|
|
10649
|
+
if (this._suspendedMouseEnabled) {
|
|
10650
|
+
this.enableMouse();
|
|
10651
|
+
}
|
|
10652
|
+
this._controlState = this._previousControlState;
|
|
10653
|
+
if (this._previousControlState === "auto_started" /* AUTO_STARTED */ || this._previousControlState === "explicit_started" /* EXPLICIT_STARTED */) {
|
|
10654
|
+
this.internalStart();
|
|
10655
|
+
}
|
|
10602
10656
|
}
|
|
10603
10657
|
internalPause() {
|
|
10604
10658
|
this._isRunning = false;
|
|
10605
10659
|
}
|
|
10606
10660
|
stop() {
|
|
10607
|
-
this.
|
|
10661
|
+
this._controlState = "explicit_stopped" /* EXPLICIT_STOPPED */;
|
|
10608
10662
|
this.internalStop();
|
|
10609
10663
|
}
|
|
10610
10664
|
internalStop() {
|
|
@@ -10881,7 +10935,7 @@ Captured output:
|
|
|
10881
10935
|
}
|
|
10882
10936
|
}
|
|
10883
10937
|
|
|
10884
|
-
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, convertThemeToStyles, SyntaxStyle, 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, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, CliRenderer };
|
|
10938
|
+
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, convertThemeToStyles, SyntaxStyle, 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, 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 };
|
|
10885
10939
|
|
|
10886
|
-
//# debugId=
|
|
10887
|
-
//# sourceMappingURL=index-
|
|
10940
|
+
//# debugId=0DCF9A9D3C7B24F664756E2164756E21
|
|
10941
|
+
//# sourceMappingURL=index-phjxdb6g.js.map
|