@opentui/core 0.5.11 → 0.5.13
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/{chunk-bun-bwjmgnxw.js → chunk-bun-awdjbppg.js} +49 -8
- package/{chunk-bun-bwjmgnxw.js.map → chunk-bun-awdjbppg.js.map} +8 -8
- package/{chunk-bun-37s3zwb6.js → chunk-bun-sjw2d9bq.js} +78 -14
- package/{chunk-bun-37s3zwb6.js.map → chunk-bun-sjw2d9bq.js.map} +5 -5
- package/{chunk-node-70eg2nhg.js → chunk-node-80p7e6t6.js} +78 -14
- package/{chunk-node-70eg2nhg.js.map → chunk-node-80p7e6t6.js.map} +5 -5
- package/{chunk-node-54dhb2fr.js → chunk-node-fz19wge8.js} +49 -8
- package/{chunk-node-54dhb2fr.js.map → chunk-node-fz19wge8.js.map} +8 -8
- package/editor-view.d.ts +1 -0
- package/index.bun.js +35 -3
- package/index.bun.js.map +5 -5
- package/index.node.js +35 -3
- package/index.node.js.map +5 -5
- package/node-assets.js +6 -2
- package/node-assets.js.map +3 -3
- package/package.json +9 -9
- package/parser.worker.js +1 -3
- package/parser.worker.js.map +3 -3
- package/renderables/EmbeddedTerminal.d.ts +4 -0
- package/renderables/TextBufferRenderable.d.ts +5 -0
- package/renderables/TextTable.d.ts +2 -0
- package/runtime-plugin.js +15 -4
- package/runtime-plugin.js.map +1 -1
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/text-buffer-view.d.ts +2 -0
- package/types.d.ts +1 -1
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +2 -0
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
NativeMeasureTargetKind2,
|
|
43
43
|
resolveRenderLib2,
|
|
44
44
|
yoga_default
|
|
45
|
-
} from "./chunk-bun-
|
|
45
|
+
} from "./chunk-bun-sjw2d9bq.js";
|
|
46
46
|
|
|
47
47
|
// src/syntax-style.ts
|
|
48
48
|
function convertThemeToStyles2(theme) {
|
|
@@ -1111,8 +1111,8 @@ class Renderable2 extends BaseRenderable2 {
|
|
|
1111
1111
|
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
1112
1112
|
this._screenX = parentScreenX + this._x + this._translateX;
|
|
1113
1113
|
this._screenY = parentScreenY + this._y + this._translateY;
|
|
1114
|
-
const newWidth = Math.max(layout.width, 1);
|
|
1115
|
-
const newHeight = Math.max(layout.height, 1);
|
|
1114
|
+
const newWidth = Number.isNaN(layout.width) ? oldWidth : Math.max(layout.width, 1);
|
|
1115
|
+
const newHeight = Number.isNaN(layout.height) ? oldHeight : Math.max(layout.height, 1);
|
|
1116
1116
|
const sizeChanged = oldWidth !== newWidth || oldHeight !== newHeight;
|
|
1117
1117
|
this._widthValue = newWidth;
|
|
1118
1118
|
this._heightValue = newHeight;
|
|
@@ -1844,6 +1844,7 @@ class TextBufferView2 {
|
|
|
1844
1844
|
viewPtr;
|
|
1845
1845
|
textBuffer;
|
|
1846
1846
|
_destroyed = false;
|
|
1847
|
+
selectionClear = true;
|
|
1847
1848
|
constructor(lib, ptr, textBuffer) {
|
|
1848
1849
|
this.lib = lib;
|
|
1849
1850
|
this.viewPtr = ptr;
|
|
@@ -1864,15 +1865,20 @@ class TextBufferView2 {
|
|
|
1864
1865
|
}
|
|
1865
1866
|
setSelection(start, end, bgColor, fgColor) {
|
|
1866
1867
|
this.guard();
|
|
1868
|
+
this.selectionClear = false;
|
|
1867
1869
|
this.lib.textBufferViewSetSelection(this.viewPtr, start, end, bgColor || null, fgColor || null);
|
|
1868
1870
|
}
|
|
1869
1871
|
updateSelection(end, bgColor, fgColor) {
|
|
1870
1872
|
this.guard();
|
|
1873
|
+
this.selectionClear = false;
|
|
1871
1874
|
this.lib.textBufferViewUpdateSelection(this.viewPtr, end, bgColor || null, fgColor || null);
|
|
1872
1875
|
}
|
|
1873
1876
|
resetSelection() {
|
|
1874
1877
|
this.guard();
|
|
1878
|
+
if (this.selectionClear)
|
|
1879
|
+
return;
|
|
1875
1880
|
this.lib.textBufferViewResetSelection(this.viewPtr);
|
|
1881
|
+
this.selectionClear = true;
|
|
1876
1882
|
}
|
|
1877
1883
|
getSelection() {
|
|
1878
1884
|
this.guard();
|
|
@@ -1884,15 +1890,20 @@ class TextBufferView2 {
|
|
|
1884
1890
|
}
|
|
1885
1891
|
setLocalSelection(anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior = "cell") {
|
|
1886
1892
|
this.guard();
|
|
1893
|
+
this.selectionClear = false;
|
|
1887
1894
|
return this.lib.textBufferViewSetLocalSelection(this.viewPtr, anchorX, anchorY, focusX, focusY, bgColor || null, fgColor || null, behavior);
|
|
1888
1895
|
}
|
|
1889
1896
|
updateLocalSelection(anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior = "cell") {
|
|
1890
1897
|
this.guard();
|
|
1898
|
+
this.selectionClear = false;
|
|
1891
1899
|
return this.lib.textBufferViewUpdateLocalSelection(this.viewPtr, anchorX, anchorY, focusX, focusY, bgColor || null, fgColor || null, behavior);
|
|
1892
1900
|
}
|
|
1893
1901
|
resetLocalSelection() {
|
|
1894
1902
|
this.guard();
|
|
1903
|
+
if (this.selectionClear)
|
|
1904
|
+
return;
|
|
1895
1905
|
this.lib.textBufferViewResetLocalSelection(this.viewPtr);
|
|
1906
|
+
this.selectionClear = true;
|
|
1896
1907
|
}
|
|
1897
1908
|
setSelectionOccupancy(occupancy) {
|
|
1898
1909
|
this.guard();
|
|
@@ -1910,6 +1921,10 @@ class TextBufferView2 {
|
|
|
1910
1921
|
this.guard();
|
|
1911
1922
|
this.lib.textBufferViewSetWrapMode(this.viewPtr, mode);
|
|
1912
1923
|
}
|
|
1924
|
+
setTextAlign(alignment) {
|
|
1925
|
+
this.guard();
|
|
1926
|
+
this.lib.textBufferViewSetTextAlign(this.viewPtr, alignment);
|
|
1927
|
+
}
|
|
1913
1928
|
setFirstLineOffset(offset) {
|
|
1914
1929
|
this.guard();
|
|
1915
1930
|
this.lib.textBufferViewSetFirstLineOffset(this.viewPtr, offset);
|
|
@@ -2322,6 +2337,9 @@ class EditorView2 {
|
|
|
2322
2337
|
const viewPtr = lib.createEditorView(editBuffer.ptr, viewportWidth, viewportHeight);
|
|
2323
2338
|
return new EditorView2(lib, viewPtr, editBuffer);
|
|
2324
2339
|
}
|
|
2340
|
+
get isDestroyed() {
|
|
2341
|
+
return this._destroyed;
|
|
2342
|
+
}
|
|
2325
2343
|
guard() {
|
|
2326
2344
|
if (this._destroyed)
|
|
2327
2345
|
throw new Error("EditorView is destroyed");
|
|
@@ -2794,6 +2812,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
2794
2812
|
_selectionBg;
|
|
2795
2813
|
_selectionFg;
|
|
2796
2814
|
_wrapMode = "word";
|
|
2815
|
+
_textAlign = "left";
|
|
2797
2816
|
lastLocalSelection = null;
|
|
2798
2817
|
_tabIndicator;
|
|
2799
2818
|
_tabIndicatorColor;
|
|
@@ -2813,6 +2832,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
2813
2832
|
selectable: true,
|
|
2814
2833
|
attributes: 0,
|
|
2815
2834
|
wrapMode: "word",
|
|
2835
|
+
textAlign: "left",
|
|
2816
2836
|
tabIndicator: undefined,
|
|
2817
2837
|
tabIndicatorColor: undefined,
|
|
2818
2838
|
truncate: false
|
|
@@ -2826,6 +2846,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
2826
2846
|
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
2827
2847
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
2828
2848
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
2849
|
+
this._textAlign = options.textAlign ?? this._defaultOptions.textAlign;
|
|
2829
2850
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
2830
2851
|
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
2831
2852
|
this._truncate = options.truncate ?? this._defaultOptions.truncate;
|
|
@@ -2835,6 +2856,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
2835
2856
|
this._textBufferSyntaxStyle = SyntaxStyle2.create();
|
|
2836
2857
|
this.textBuffer.setSyntaxStyle(this._textBufferSyntaxStyle);
|
|
2837
2858
|
this.textBufferView.setWrapMode(this._wrapMode);
|
|
2859
|
+
this.textBufferView.setTextAlign(this._textAlign);
|
|
2838
2860
|
this.textBufferView.setFirstLineOffset(this._firstLineOffset);
|
|
2839
2861
|
this.setupNativeRenderable();
|
|
2840
2862
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
@@ -3025,6 +3047,16 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
3025
3047
|
this.requestRender();
|
|
3026
3048
|
}
|
|
3027
3049
|
}
|
|
3050
|
+
get textAlign() {
|
|
3051
|
+
return this._textAlign;
|
|
3052
|
+
}
|
|
3053
|
+
set textAlign(value) {
|
|
3054
|
+
if (this._textAlign !== value) {
|
|
3055
|
+
this._textAlign = value;
|
|
3056
|
+
this.textBufferView.setTextAlign(this._textAlign);
|
|
3057
|
+
this.requestRender();
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3028
3060
|
get tabIndicator() {
|
|
3029
3061
|
return this._tabIndicator;
|
|
3030
3062
|
}
|
|
@@ -5533,6 +5565,13 @@ class TerminalConsole2 extends EventEmitter4 {
|
|
|
5533
5565
|
|
|
5534
5566
|
// src/renderables/EditBufferRenderable.ts
|
|
5535
5567
|
var BrandedEditBufferRenderable = Symbol.for("@opentui/core/EditBufferRenderable");
|
|
5568
|
+
var emptyVisualCursor = Object.freeze({
|
|
5569
|
+
visualRow: 0,
|
|
5570
|
+
visualCol: 0,
|
|
5571
|
+
logicalRow: 0,
|
|
5572
|
+
logicalCol: 0,
|
|
5573
|
+
offset: 0
|
|
5574
|
+
});
|
|
5536
5575
|
var EditBufferRenderableEvents2;
|
|
5537
5576
|
((EditBufferRenderableEvents) => {
|
|
5538
5577
|
EditBufferRenderableEvents["TRAITS_CHANGED"] = "traits-changed";
|
|
@@ -5677,10 +5716,12 @@ class EditBufferRenderable2 extends Renderable2 {
|
|
|
5677
5716
|
return this.editBuffer.getCursorPosition();
|
|
5678
5717
|
}
|
|
5679
5718
|
get visualCursor() {
|
|
5719
|
+
if (this.editorView.isDestroyed)
|
|
5720
|
+
return emptyVisualCursor;
|
|
5680
5721
|
return this.editorView.getVisualCursor();
|
|
5681
5722
|
}
|
|
5682
5723
|
get cursorOffset() {
|
|
5683
|
-
return this.
|
|
5724
|
+
return this.visualCursor.offset;
|
|
5684
5725
|
}
|
|
5685
5726
|
set cursorOffset(offset) {
|
|
5686
5727
|
this.clearSelection();
|
|
@@ -6315,7 +6356,7 @@ class EditBufferRenderable2 extends Renderable2 {
|
|
|
6315
6356
|
renderCursor(buffer) {
|
|
6316
6357
|
if (!this._showCursor || !this._focused)
|
|
6317
6358
|
return;
|
|
6318
|
-
const visualCursor = this.
|
|
6359
|
+
const visualCursor = this.visualCursor;
|
|
6319
6360
|
const screenX = this._screenX;
|
|
6320
6361
|
const screenY = this._screenY;
|
|
6321
6362
|
const cursorX = screenX + visualCursor.visualCol + 1;
|
|
@@ -9508,7 +9549,7 @@ Captured external output:
|
|
|
9508
9549
|
if (splitFooterActive) {
|
|
9509
9550
|
let clearStart = null;
|
|
9510
9551
|
if (width < prevWidth && visiblePreviousSplitHeight > 0) {
|
|
9511
|
-
clearStart = Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1);
|
|
9552
|
+
clearStart = Math.min(this.renderOffset + 1, Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1));
|
|
9512
9553
|
}
|
|
9513
9554
|
if (pendingSplitFooterTransition !== null) {
|
|
9514
9555
|
clearStart = clearStart === null ? pendingSplitFooterTransition.sourceTopLine : Math.min(clearStart, pendingSplitFooterTransition.sourceTopLine);
|
|
@@ -10473,5 +10514,5 @@ Captured external output:
|
|
|
10473
10514
|
|
|
10474
10515
|
export { convertThemeToStyles2, SyntaxStyle2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBufferView2, EditBuffer2, EditorView2, ANSI, BoxRenderable2, TextBufferRenderable2, CodeRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSpanFeed2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, getObjectsInViewport, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
|
|
10475
10516
|
|
|
10476
|
-
//# debugId=
|
|
10477
|
-
//# sourceMappingURL=chunk-bun-
|
|
10517
|
+
//# debugId=A0D29EC1353CA6F964756E2164756E21
|
|
10518
|
+
//# sourceMappingURL=chunk-bun-awdjbppg.js.map
|