@opentui/core 0.9.0 → 0.9.1
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/NativeScene.d.ts +1 -1
- package/Renderable.d.ts +6 -0
- package/{chunk-bun-ywheza3e.js → chunk-bun-v1wzs0bj.js} +25 -12
- package/chunk-bun-v1wzs0bj.js.map +35 -0
- package/{chunk-bun-rgb7yx3r.js → chunk-bun-xartp4ps.js} +41 -19
- package/{chunk-bun-rgb7yx3r.js.map → chunk-bun-xartp4ps.js.map} +9 -9
- package/{chunk-node-fcberveq.js → chunk-node-5cqzgmq3.js} +41 -19
- package/{chunk-node-fcberveq.js.map → chunk-node-5cqzgmq3.js.map} +9 -9
- package/{chunk-node-k5s8s41v.js → chunk-node-mcdre3zn.js} +25 -12
- package/chunk-node-mcdre3zn.js.map +34 -0
- package/edit-buffer.d.ts +7 -1
- package/index.bun.js +108 -4
- package/index.bun.js.map +3 -3
- package/index.node.js +108 -4
- package/index.node.js.map +3 -3
- package/native-abi.generated.d.ts +9 -1
- package/package.json +9 -9
- package/renderables/TextBufferRenderable.d.ts +2 -0
- package/renderables/TextTable.d.ts +16 -0
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/text-buffer-view.d.ts +4 -0
- package/text-buffer.d.ts +12 -1
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +4 -1
- package/chunk-bun-ywheza3e.js.map +0 -35
- package/chunk-node-k5s8s41v.js.map +0 -34
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
PositionType2,
|
|
71
71
|
Unit2,
|
|
72
72
|
Wrap2
|
|
73
|
-
} from "./chunk-bun-
|
|
73
|
+
} from "./chunk-bun-v1wzs0bj.js";
|
|
74
74
|
|
|
75
75
|
// src/lib/border.ts
|
|
76
76
|
var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
|
|
@@ -8254,7 +8254,17 @@ class Renderable2 extends BaseRenderable2 {
|
|
|
8254
8254
|
this._ctx.requestRender();
|
|
8255
8255
|
}
|
|
8256
8256
|
_needsLifecyclePass() {
|
|
8257
|
-
return this.onLifecyclePass !== null;
|
|
8257
|
+
return this.onLifecyclePass !== null || this._builtinLifecyclePass !== null;
|
|
8258
|
+
}
|
|
8259
|
+
_builtinLifecyclePass = null;
|
|
8260
|
+
setBuiltinLifecyclePass(pass) {
|
|
8261
|
+
this._builtinLifecyclePass = pass;
|
|
8262
|
+
this.syncLifecyclePass();
|
|
8263
|
+
}
|
|
8264
|
+
_runLifecyclePass() {
|
|
8265
|
+
this._builtinLifecyclePass?.call(this);
|
|
8266
|
+
if (!this._isDestroyed)
|
|
8267
|
+
this._hooks.onLifecyclePass?.call(this);
|
|
8258
8268
|
}
|
|
8259
8269
|
get translateX() {
|
|
8260
8270
|
return this._translateX;
|
|
@@ -8991,7 +9001,7 @@ class Renderable2 extends BaseRenderable2 {
|
|
|
8991
9001
|
const passes = previous._ctx.getLifecyclePasses();
|
|
8992
9002
|
lifecycle = new Map([[passes, false]]);
|
|
8993
9003
|
}
|
|
8994
|
-
if (typeof child.onLifecyclePass === "function") {
|
|
9004
|
+
if (typeof child.onLifecyclePass === "function" || child._builtinLifecyclePass) {
|
|
8995
9005
|
const passes = target._ctx.getLifecyclePasses();
|
|
8996
9006
|
lifecycle ??= new Map;
|
|
8997
9007
|
lifecycle.set(passes, true);
|
|
@@ -9198,7 +9208,7 @@ class Renderable2 extends BaseRenderable2 {
|
|
|
9198
9208
|
this.syncLifecyclePass();
|
|
9199
9209
|
}
|
|
9200
9210
|
syncLifecyclePass() {
|
|
9201
|
-
if (!this.onLifecyclePass)
|
|
9211
|
+
if (!this.onLifecyclePass && !this._builtinLifecyclePass)
|
|
9202
9212
|
this._ctx.unregisterLifecyclePass(this);
|
|
9203
9213
|
else if (this.parent)
|
|
9204
9214
|
this._ctx.registerLifecyclePass(this);
|
|
@@ -9764,13 +9774,13 @@ class TextBuffer2 {
|
|
|
9764
9774
|
this.native = { owner, handle };
|
|
9765
9775
|
this.updateLengths();
|
|
9766
9776
|
}
|
|
9767
|
-
static create(widthMethod, source) {
|
|
9777
|
+
static create(widthMethod, source, followSessionWidth = false) {
|
|
9768
9778
|
const owner = source?.resourceContext;
|
|
9769
9779
|
if (!owner)
|
|
9770
9780
|
throw new Error("TextBuffer requires an explicit resource owner: pass renderer.nativeScene, or a ResourceContext when there is no renderer");
|
|
9771
9781
|
owner.assertAlive();
|
|
9772
9782
|
const lib = owner.renderLib;
|
|
9773
|
-
const handle = lib.createContextTextBuffer(owner.context, { widthMethod });
|
|
9783
|
+
const handle = lib.createContextTextBuffer(owner.context, { widthMethod, followSessionWidth });
|
|
9774
9784
|
try {
|
|
9775
9785
|
return new TextBuffer2(lib, handle, owner);
|
|
9776
9786
|
} catch (error) {
|
|
@@ -9963,6 +9973,10 @@ class TextBuffer2 {
|
|
|
9963
9973
|
this.updateLengths();
|
|
9964
9974
|
});
|
|
9965
9975
|
}
|
|
9976
|
+
setWidthMethod(widthMethod) {
|
|
9977
|
+
this.guard();
|
|
9978
|
+
this.lib.contextTextBufferSetWidthMethod(this.native.handle.context, this.native.handle, widthMethod);
|
|
9979
|
+
}
|
|
9966
9980
|
getTabWidth() {
|
|
9967
9981
|
this.guard();
|
|
9968
9982
|
return this.lib.contextTextBufferGetInfo(this.native.handle.context, this.native.handle).tabWidth;
|
|
@@ -10063,6 +10077,9 @@ class TextBufferView2 {
|
|
|
10063
10077
|
setSelection(start, end, bgColor, fgColor) {
|
|
10064
10078
|
this.select({ operation: 0 /* Set */, start, end, bg: bgColor, fg: fgColor });
|
|
10065
10079
|
}
|
|
10080
|
+
_selectCharacter(offset) {
|
|
10081
|
+
this.select({ operation: 8 /* Inclusive */, start: offset, end: offset });
|
|
10082
|
+
}
|
|
10066
10083
|
updateSelection(end, bgColor, fgColor) {
|
|
10067
10084
|
this.select({ operation: 1 /* Update */, end, bg: bgColor, fg: fgColor });
|
|
10068
10085
|
}
|
|
@@ -10104,6 +10121,9 @@ class TextBufferView2 {
|
|
|
10104
10121
|
resetLocalSelection() {
|
|
10105
10122
|
this.reset(true);
|
|
10106
10123
|
}
|
|
10124
|
+
setSelectionColors(bgColor, fgColor) {
|
|
10125
|
+
this.select({ operation: 9 /* Colors */, bg: bgColor, fg: fgColor });
|
|
10126
|
+
}
|
|
10107
10127
|
setSelectionOccupancy(occupancy) {
|
|
10108
10128
|
this.guard();
|
|
10109
10129
|
this.lib.contextTextBufferViewSelect(this.native.handle.context, this.native.handle, {
|
|
@@ -10228,13 +10248,13 @@ class EditBuffer2 extends EventEmitter5 {
|
|
|
10228
10248
|
this.emit(name);
|
|
10229
10249
|
});
|
|
10230
10250
|
}
|
|
10231
|
-
static create(widthMethod, source) {
|
|
10251
|
+
static create(widthMethod, source, followSessionWidth = false) {
|
|
10232
10252
|
const owner = source?.resourceContext;
|
|
10233
10253
|
if (!owner)
|
|
10234
10254
|
throw new Error("EditBuffer requires an explicit resource owner: pass renderer.nativeScene, or a ResourceContext when there is no renderer");
|
|
10235
10255
|
owner.assertAlive();
|
|
10236
10256
|
const lib = owner.renderLib;
|
|
10237
|
-
const handle = lib.createContextEditBuffer(owner.context, { widthMethod });
|
|
10257
|
+
const handle = lib.createContextEditBuffer(owner.context, { widthMethod, followSessionWidth });
|
|
10238
10258
|
try {
|
|
10239
10259
|
return new EditBuffer2(lib, handle, owner);
|
|
10240
10260
|
} catch (error) {
|
|
@@ -11653,7 +11673,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
11653
11673
|
this.setNativeSceneTextOptions();
|
|
11654
11674
|
return;
|
|
11655
11675
|
}
|
|
11656
|
-
textBuffer = TextBuffer2.create(this._ctx.widthMethod, ctx.nativeScene);
|
|
11676
|
+
textBuffer = TextBuffer2.create(this._ctx.widthMethod, ctx.nativeScene, true);
|
|
11657
11677
|
this.textBuffer = textBuffer;
|
|
11658
11678
|
textBufferView = TextBufferView2.create(textBuffer);
|
|
11659
11679
|
this.textBufferView = textBufferView;
|
|
@@ -11833,9 +11853,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
11833
11853
|
const newColor = value ? RGBA2.clone(parseColor2(value)) : undefined;
|
|
11834
11854
|
if (this._selectionBg !== newColor) {
|
|
11835
11855
|
this.runMutation(() => {
|
|
11836
|
-
|
|
11837
|
-
this.updateLocalSelection(this.lastLocalSelection, true, { bg: newColor, fg: this._selectionFg });
|
|
11838
|
-
}
|
|
11856
|
+
this.setSelectionColors(newColor, this._selectionFg);
|
|
11839
11857
|
this._selectionBg = newColor;
|
|
11840
11858
|
this.requestRender();
|
|
11841
11859
|
});
|
|
@@ -11848,9 +11866,7 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
11848
11866
|
const newColor = value ? RGBA2.clone(parseColor2(value)) : undefined;
|
|
11849
11867
|
if (this._selectionFg !== newColor) {
|
|
11850
11868
|
this.runMutation(() => {
|
|
11851
|
-
|
|
11852
|
-
this.updateLocalSelection(this.lastLocalSelection, true, { bg: this._selectionBg, fg: newColor });
|
|
11853
|
-
}
|
|
11869
|
+
this.setSelectionColors(this._selectionBg, newColor);
|
|
11854
11870
|
this._selectionFg = newColor;
|
|
11855
11871
|
this.requestRender();
|
|
11856
11872
|
});
|
|
@@ -11982,6 +11998,12 @@ class TextBufferRenderable2 extends Renderable2 {
|
|
|
11982
11998
|
}
|
|
11983
11999
|
return false;
|
|
11984
12000
|
}
|
|
12001
|
+
setSelectionColors(bg, fg) {
|
|
12002
|
+
if (this.nativeTextScene)
|
|
12003
|
+
this.nativeTextScene.setTextSelection(this, "colors", null, bg, fg);
|
|
12004
|
+
else
|
|
12005
|
+
this.textBufferView.setSelectionColors(bg, fg);
|
|
12006
|
+
}
|
|
11985
12007
|
updateLocalSelection(localSelection, isStart = true, colors) {
|
|
11986
12008
|
const bg = colors ? colors.bg : this._selectionBg;
|
|
11987
12009
|
const fg = colors ? colors.fg : this._selectionFg;
|
|
@@ -18087,7 +18109,7 @@ class EditBufferRenderable2 extends Renderable2 {
|
|
|
18087
18109
|
this._cursorStyle.color = RGBA2.clone(this._cursorStyle.color);
|
|
18088
18110
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
18089
18111
|
this._tabIndicatorColor = options.tabIndicatorColor ? RGBA2.clone(parseColor2(options.tabIndicatorColor)) : this._defaultOptions.tabIndicatorColor;
|
|
18090
|
-
editBuffer = EditBuffer2.create(this._ctx.widthMethod, this._ctx.nativeScene);
|
|
18112
|
+
editBuffer = EditBuffer2.create(this._ctx.widthMethod, this._ctx.nativeScene, true);
|
|
18091
18113
|
this.editBuffer = editBuffer;
|
|
18092
18114
|
editorView = EditorView2.create(editBuffer, Math.max(1, Math.trunc(this.width || 80)), Math.max(1, Math.trunc(this.height || 24)));
|
|
18093
18115
|
this.editorView = editorView;
|
|
@@ -19456,7 +19478,7 @@ class NativeScene {
|
|
|
19456
19478
|
if (++visits > maxHostRequests)
|
|
19457
19479
|
throw new Error("Native scene lifecycle work limit exceeded");
|
|
19458
19480
|
if (!renderable.isDestroyed) {
|
|
19459
|
-
renderable.
|
|
19481
|
+
renderable._runLifecyclePass();
|
|
19460
19482
|
}
|
|
19461
19483
|
}
|
|
19462
19484
|
}
|
|
@@ -24441,5 +24463,5 @@ Captured external output:
|
|
|
24441
24463
|
|
|
24442
24464
|
export { isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, hastToStyledText2, SystemClock2, kittyKeyMap, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseAlignContent2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLayoutMode2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, detectLinks2, acquireSessionBufferLease2, ResourceContext2, OptimizedBuffer2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBuffer2, TextBufferView2, EditBuffer2, measureEditText2, EditorView2, Timeline2, engine2, getTimelineEngine2, createTimeline2, ANSI, BoxRenderable2, TextBufferRenderable2, SliderRenderable2, ScrollBarRenderable2, ArrowRenderable2, scrollUnitSize2, ScrollBoxWrapper2, ScrollBoxViewport2, ScrollBoxContent2, ScrollBoxBar2, ScrollBoxRenderable2, CodeRenderable2, ImageLoadError2, ImageError2, imageInfo2, NativeImage2, NativeImagePool2, resolveImageRenderProtocol2, checkCrop2, sameCrop2, ImageRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSession2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
|
|
24443
24465
|
|
|
24444
|
-
//# debugId=
|
|
24445
|
-
//# sourceMappingURL=chunk-bun-
|
|
24466
|
+
//# debugId=4D4E6E5F22BE1D9064756E2164756E21
|
|
24467
|
+
//# sourceMappingURL=chunk-bun-xartp4ps.js.map
|