@opentui/core 0.1.61 → 0.1.63
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/editor-view.d.ts +4 -1
- package/{index-rysm4rsr.js → index-689t9q65.js} +102 -34
- package/{index-rysm4rsr.js.map → index-689t9q65.js.map} +8 -8
- package/index.js +126 -52
- package/index.js.map +6 -6
- package/lib/selection.d.ts +4 -4
- package/package.json +7 -7
- package/renderables/EditBufferRenderable.d.ts +10 -1
- package/renderer.d.ts +18 -6
- package/testing/test-recorder.d.ts +16 -1
- package/testing.js +21 -5
- package/testing.js.map +3 -3
- package/text-buffer-view.d.ts +2 -0
- package/zig.d.ts +6 -1
package/3d.js
CHANGED
package/editor-view.d.ts
CHANGED
|
@@ -21,19 +21,22 @@ export declare class EditorView {
|
|
|
21
21
|
private guard;
|
|
22
22
|
get ptr(): Pointer;
|
|
23
23
|
setViewportSize(width: number, height: number): void;
|
|
24
|
+
setViewport(x: number, y: number, width: number, height: number, moveCursor?: boolean): void;
|
|
24
25
|
getViewport(): Viewport;
|
|
25
26
|
setScrollMargin(margin: number): void;
|
|
26
27
|
setWrapMode(mode: "none" | "char" | "word"): void;
|
|
27
28
|
getVirtualLineCount(): number;
|
|
28
29
|
getTotalVirtualLineCount(): number;
|
|
29
30
|
setSelection(start: number, end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
31
|
+
updateSelection(end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
30
32
|
resetSelection(): void;
|
|
31
33
|
getSelection(): {
|
|
32
34
|
start: number;
|
|
33
35
|
end: number;
|
|
34
36
|
} | null;
|
|
35
37
|
hasSelection(): boolean;
|
|
36
|
-
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA): boolean;
|
|
38
|
+
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean): boolean;
|
|
39
|
+
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean): boolean;
|
|
37
40
|
resetLocalSelection(): void;
|
|
38
41
|
getSelectedText(): string;
|
|
39
42
|
getCursor(): {
|
|
@@ -6480,37 +6480,30 @@ class SelectionAnchor {
|
|
|
6480
6480
|
|
|
6481
6481
|
class Selection {
|
|
6482
6482
|
_anchor;
|
|
6483
|
-
|
|
6484
|
-
_normalizedAnchor;
|
|
6485
|
-
_normalizedFocus;
|
|
6483
|
+
_focus;
|
|
6486
6484
|
_selectedRenderables = [];
|
|
6487
6485
|
_touchedRenderables = [];
|
|
6488
6486
|
_isActive = true;
|
|
6489
6487
|
_isSelecting = true;
|
|
6488
|
+
_isStart = false;
|
|
6490
6489
|
constructor(anchorRenderable, anchor, focus) {
|
|
6491
6490
|
this._anchor = new SelectionAnchor(anchorRenderable, anchor.x, anchor.y);
|
|
6492
|
-
this.
|
|
6493
|
-
|
|
6491
|
+
this._focus = { ...focus };
|
|
6492
|
+
}
|
|
6493
|
+
get isStart() {
|
|
6494
|
+
return this._isStart;
|
|
6495
|
+
}
|
|
6496
|
+
set isStart(value) {
|
|
6497
|
+
this._isStart = value;
|
|
6494
6498
|
}
|
|
6495
6499
|
get anchor() {
|
|
6496
|
-
return {
|
|
6500
|
+
return { x: this._anchor.x, y: this._anchor.y };
|
|
6497
6501
|
}
|
|
6498
6502
|
get focus() {
|
|
6499
|
-
return { ...this.
|
|
6503
|
+
return { ...this._focus };
|
|
6500
6504
|
}
|
|
6501
6505
|
set focus(value) {
|
|
6502
|
-
this.
|
|
6503
|
-
this._updateNormalizedSelection();
|
|
6504
|
-
}
|
|
6505
|
-
_updateNormalizedSelection() {
|
|
6506
|
-
const anchorBeforeFocus = this._anchor.y < this._originalFocus.y || this._anchor.y === this._originalFocus.y && this._anchor.x <= this._originalFocus.x;
|
|
6507
|
-
if (anchorBeforeFocus) {
|
|
6508
|
-
this._normalizedAnchor = { x: this._anchor.x, y: this._anchor.y };
|
|
6509
|
-
this._normalizedFocus = { ...this._originalFocus };
|
|
6510
|
-
} else {
|
|
6511
|
-
this._normalizedAnchor = { ...this._originalFocus };
|
|
6512
|
-
this._normalizedFocus = { x: this._anchor.x + 1, y: this._anchor.y };
|
|
6513
|
-
}
|
|
6506
|
+
this._focus = { ...value };
|
|
6514
6507
|
}
|
|
6515
6508
|
get isActive() {
|
|
6516
6509
|
return this._isActive;
|
|
@@ -6525,11 +6518,17 @@ class Selection {
|
|
|
6525
6518
|
this._isSelecting = value;
|
|
6526
6519
|
}
|
|
6527
6520
|
get bounds() {
|
|
6521
|
+
const minX = Math.min(this._anchor.x, this._focus.x);
|
|
6522
|
+
const maxX = Math.max(this._anchor.x, this._focus.x);
|
|
6523
|
+
const minY = Math.min(this._anchor.y, this._focus.y);
|
|
6524
|
+
const maxY = Math.max(this._anchor.y, this._focus.y);
|
|
6525
|
+
const width = maxX - minX + 1;
|
|
6526
|
+
const height = maxY - minY + 1;
|
|
6528
6527
|
return {
|
|
6529
|
-
x:
|
|
6530
|
-
y:
|
|
6531
|
-
width
|
|
6532
|
-
height
|
|
6528
|
+
x: minX,
|
|
6529
|
+
y: minY,
|
|
6530
|
+
width,
|
|
6531
|
+
height
|
|
6533
6532
|
};
|
|
6534
6533
|
}
|
|
6535
6534
|
updateSelectedRenderables(selectedRenderables) {
|
|
@@ -7606,6 +7605,7 @@ class TreeSitterClient extends EventEmitter3 {
|
|
|
7606
7605
|
async destroy() {
|
|
7607
7606
|
if (this.initializeResolvers) {
|
|
7608
7607
|
clearTimeout(this.initializeResolvers.timeoutId);
|
|
7608
|
+
this.initializeResolvers.reject(new Error("Client destroyed during initialization"));
|
|
7609
7609
|
this.initializeResolvers = undefined;
|
|
7610
7610
|
}
|
|
7611
7611
|
for (const [messageId, callback] of this.messageCallbacks.entries()) {
|
|
@@ -10567,6 +10567,14 @@ function getOpenTUILib(libPath) {
|
|
|
10567
10567
|
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10568
10568
|
returns: "bool"
|
|
10569
10569
|
},
|
|
10570
|
+
textBufferViewUpdateSelection: {
|
|
10571
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
10572
|
+
returns: "void"
|
|
10573
|
+
},
|
|
10574
|
+
textBufferViewUpdateLocalSelection: {
|
|
10575
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10576
|
+
returns: "bool"
|
|
10577
|
+
},
|
|
10570
10578
|
textBufferViewResetLocalSelection: {
|
|
10571
10579
|
args: ["ptr"],
|
|
10572
10580
|
returns: "void"
|
|
@@ -10639,6 +10647,10 @@ function getOpenTUILib(libPath) {
|
|
|
10639
10647
|
args: ["ptr", "u32", "u32"],
|
|
10640
10648
|
returns: "void"
|
|
10641
10649
|
},
|
|
10650
|
+
editorViewSetViewport: {
|
|
10651
|
+
args: ["ptr", "u32", "u32", "u32", "u32", "bool"],
|
|
10652
|
+
returns: "void"
|
|
10653
|
+
},
|
|
10642
10654
|
editorViewGetViewport: {
|
|
10643
10655
|
args: ["ptr", "ptr", "ptr", "ptr", "ptr"],
|
|
10644
10656
|
returns: "void"
|
|
@@ -10844,7 +10856,15 @@ function getOpenTUILib(libPath) {
|
|
|
10844
10856
|
returns: "u64"
|
|
10845
10857
|
},
|
|
10846
10858
|
editorViewSetLocalSelection: {
|
|
10847
|
-
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
10859
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
10860
|
+
returns: "bool"
|
|
10861
|
+
},
|
|
10862
|
+
editorViewUpdateSelection: {
|
|
10863
|
+
args: ["ptr", "u32", "ptr", "ptr"],
|
|
10864
|
+
returns: "void"
|
|
10865
|
+
},
|
|
10866
|
+
editorViewUpdateLocalSelection: {
|
|
10867
|
+
args: ["ptr", "i32", "i32", "i32", "i32", "ptr", "ptr", "bool"],
|
|
10848
10868
|
returns: "bool"
|
|
10849
10869
|
},
|
|
10850
10870
|
editorViewResetLocalSelection: {
|
|
@@ -11593,6 +11613,16 @@ class FFIRenderLib {
|
|
|
11593
11613
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11594
11614
|
return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
11595
11615
|
}
|
|
11616
|
+
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
11617
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11618
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11619
|
+
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
|
|
11620
|
+
}
|
|
11621
|
+
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
11622
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11623
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11624
|
+
return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
|
|
11625
|
+
}
|
|
11596
11626
|
textBufferViewResetLocalSelection(view) {
|
|
11597
11627
|
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
11598
11628
|
}
|
|
@@ -11740,6 +11770,9 @@ class FFIRenderLib {
|
|
|
11740
11770
|
editorViewSetViewportSize(view, width, height) {
|
|
11741
11771
|
this.opentui.symbols.editorViewSetViewportSize(view, width, height);
|
|
11742
11772
|
}
|
|
11773
|
+
editorViewSetViewport(view, x, y, width, height, moveCursor) {
|
|
11774
|
+
this.opentui.symbols.editorViewSetViewport(view, x, y, width, height, moveCursor);
|
|
11775
|
+
}
|
|
11743
11776
|
editorViewGetViewport(view) {
|
|
11744
11777
|
const x = new Uint32Array(1);
|
|
11745
11778
|
const y = new Uint32Array(1);
|
|
@@ -11982,10 +12015,20 @@ class FFIRenderLib {
|
|
|
11982
12015
|
const end = Number(packedInfo & 0xffff_ffffn);
|
|
11983
12016
|
return { start, end };
|
|
11984
12017
|
}
|
|
11985
|
-
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
12018
|
+
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
12019
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12020
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12021
|
+
return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
12022
|
+
}
|
|
12023
|
+
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
11986
12024
|
const bg2 = bgColor ? bgColor.buffer : null;
|
|
11987
12025
|
const fg2 = fgColor ? fgColor.buffer : null;
|
|
11988
|
-
|
|
12026
|
+
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
12027
|
+
}
|
|
12028
|
+
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor) {
|
|
12029
|
+
const bg2 = bgColor ? bgColor.buffer : null;
|
|
12030
|
+
const fg2 = fgColor ? fgColor.buffer : null;
|
|
12031
|
+
return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor);
|
|
11989
12032
|
}
|
|
11990
12033
|
editorViewResetLocalSelection(view) {
|
|
11991
12034
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
@@ -14942,8 +14985,15 @@ import { EventEmitter as EventEmitter9 } from "events";
|
|
|
14942
14985
|
|
|
14943
14986
|
// src/lib/objects-in-viewport.ts
|
|
14944
14987
|
function getObjectsInViewport(viewport, objects, direction = "column", padding = 10, minTriggerSize = 16) {
|
|
14945
|
-
if (
|
|
14988
|
+
if (viewport.width <= 0 || viewport.height <= 0) {
|
|
14989
|
+
return [];
|
|
14990
|
+
}
|
|
14991
|
+
if (objects.length === 0) {
|
|
14992
|
+
return [];
|
|
14993
|
+
}
|
|
14994
|
+
if (objects.length < minTriggerSize) {
|
|
14946
14995
|
return objects;
|
|
14996
|
+
}
|
|
14947
14997
|
const viewportTop = viewport.y - padding;
|
|
14948
14998
|
const viewportBottom = viewport.y + viewport.height + padding;
|
|
14949
14999
|
const viewportLeft = viewport.x - padding;
|
|
@@ -15097,16 +15147,31 @@ registerEnvVar({
|
|
|
15097
15147
|
type: "boolean",
|
|
15098
15148
|
default: false
|
|
15099
15149
|
});
|
|
15100
|
-
var
|
|
15150
|
+
var KITTY_FLAG_DISAMBIGUATE = 1;
|
|
15101
15151
|
var KITTY_FLAG_EVENT_TYPES = 2;
|
|
15152
|
+
var KITTY_FLAG_ALTERNATE_KEYS = 4;
|
|
15153
|
+
var KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8;
|
|
15154
|
+
var KITTY_FLAG_REPORT_TEXT = 16;
|
|
15102
15155
|
function buildKittyKeyboardFlags(config) {
|
|
15103
15156
|
if (!config) {
|
|
15104
15157
|
return 0;
|
|
15105
15158
|
}
|
|
15106
|
-
let flags =
|
|
15107
|
-
if (config.
|
|
15159
|
+
let flags = 0;
|
|
15160
|
+
if (config.disambiguate !== false) {
|
|
15161
|
+
flags |= KITTY_FLAG_DISAMBIGUATE;
|
|
15162
|
+
}
|
|
15163
|
+
if (config.alternateKeys !== false) {
|
|
15164
|
+
flags |= KITTY_FLAG_ALTERNATE_KEYS;
|
|
15165
|
+
}
|
|
15166
|
+
if (config.events === true) {
|
|
15108
15167
|
flags |= KITTY_FLAG_EVENT_TYPES;
|
|
15109
15168
|
}
|
|
15169
|
+
if (config.allKeysAsEscapes === true) {
|
|
15170
|
+
flags |= KITTY_FLAG_ALL_KEYS_AS_ESCAPES;
|
|
15171
|
+
}
|
|
15172
|
+
if (config.reportText === true) {
|
|
15173
|
+
flags |= KITTY_FLAG_REPORT_TEXT;
|
|
15174
|
+
}
|
|
15110
15175
|
return flags;
|
|
15111
15176
|
}
|
|
15112
15177
|
|
|
@@ -15618,7 +15683,7 @@ Captured output:
|
|
|
15618
15683
|
return this.lib.getKittyKeyboardFlags(this.rendererPtr) > 0;
|
|
15619
15684
|
}
|
|
15620
15685
|
set useKittyKeyboard(use) {
|
|
15621
|
-
const flags = use ? KITTY_FLAG_ALTERNATE_KEYS : 0;
|
|
15686
|
+
const flags = use ? KITTY_FLAG_DISAMBIGUATE | KITTY_FLAG_ALTERNATE_KEYS : 0;
|
|
15622
15687
|
this.lib.setKittyKeyboardFlags(this.rendererPtr, flags);
|
|
15623
15688
|
}
|
|
15624
15689
|
set experimental_splitHeight(splitHeight) {
|
|
@@ -16408,10 +16473,12 @@ Captured output:
|
|
|
16408
16473
|
this.clearSelection();
|
|
16409
16474
|
this.selectionContainers.push(renderable.parent || this.root);
|
|
16410
16475
|
this.currentSelection = new Selection(renderable, { x, y }, { x, y });
|
|
16476
|
+
this.currentSelection.isStart = true;
|
|
16411
16477
|
this.notifySelectablesOfSelectionChange();
|
|
16412
16478
|
}
|
|
16413
16479
|
updateSelection(currentRenderable, x, y) {
|
|
16414
16480
|
if (this.currentSelection) {
|
|
16481
|
+
this.currentSelection.isStart = false;
|
|
16415
16482
|
this.currentSelection.focus = { x, y };
|
|
16416
16483
|
if (this.selectionContainers.length > 0) {
|
|
16417
16484
|
const currentContainer = this.selectionContainers[this.selectionContainers.length - 1];
|
|
@@ -16453,6 +16520,7 @@ Captured output:
|
|
|
16453
16520
|
if (this.currentSelection) {
|
|
16454
16521
|
this.currentSelection.isSelecting = false;
|
|
16455
16522
|
this.emit("selection", this.currentSelection);
|
|
16523
|
+
this.notifySelectablesOfSelectionChange();
|
|
16456
16524
|
}
|
|
16457
16525
|
}
|
|
16458
16526
|
notifySelectablesOfSelectionChange() {
|
|
@@ -16471,7 +16539,7 @@ Captured output:
|
|
|
16471
16539
|
}
|
|
16472
16540
|
}
|
|
16473
16541
|
walkSelectableRenderables(container, selectionBounds, selectedRenderables, touchedRenderables) {
|
|
16474
|
-
const children = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0);
|
|
16542
|
+
const children = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0, 0);
|
|
16475
16543
|
for (const child of children) {
|
|
16476
16544
|
if (child.selectable) {
|
|
16477
16545
|
const hasSelection = child.onSelectionChanged(this.currentSelection);
|
|
@@ -16524,5 +16592,5 @@ Captured output:
|
|
|
16524
16592
|
|
|
16525
16593
|
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, 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, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, 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, 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 };
|
|
16526
16594
|
|
|
16527
|
-
//# debugId=
|
|
16528
|
-
//# sourceMappingURL=index-
|
|
16595
|
+
//# debugId=C92528FA268EFFA664756E2164756E21
|
|
16596
|
+
//# sourceMappingURL=index-689t9q65.js.map
|