@opentui/core 0.0.0-20260820-e69cf0cc → 0.0.0-20260825-6c02af05
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/README.md +44 -37
- package/{chunk-bun-9335djz2.js → chunk-bun-fj2atf6d.js} +132 -64
- package/{chunk-bun-9335djz2.js.map → chunk-bun-fj2atf6d.js.map} +9 -9
- package/{chunk-bun-da1keqyp.js → chunk-bun-z2t4ck7x.js} +136 -59
- package/chunk-bun-z2t4ck7x.js.map +32 -0
- package/{chunk-node-ks0581vk.js → chunk-node-5pe5sv1d.js} +136 -59
- package/chunk-node-5pe5sv1d.js.map +32 -0
- package/{chunk-node-2h23nsbj.js → chunk-node-kajdr580.js} +132 -64
- package/{chunk-node-2h23nsbj.js.map → chunk-node-kajdr580.js.map} +9 -9
- package/editor-view.d.ts +9 -2
- package/index.bun.js +43 -7
- package/index.bun.js.map +5 -5
- package/index.node.js +43 -7
- package/index.node.js.map +5 -5
- package/lib/selection.d.ts +4 -2
- package/package.json +9 -9
- package/post/effects.d.ts +2 -0
- package/renderables/EditBufferRenderable.d.ts +5 -1
- package/renderer.d.ts +5 -2
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/text-buffer-view.d.ts +5 -2
- package/text-buffer.d.ts +0 -1
- package/types.d.ts +11 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig-structs.d.ts +1 -0
- package/zig.d.ts +12 -5
- package/chunk-bun-da1keqyp.js.map +0 -32
- package/chunk-node-ks0581vk.js.map +0 -32
package/README.md
CHANGED
|
@@ -1,63 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- Keep the project introduction aligned with the repository README and opentui.com. -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://opentui.com">
|
|
5
|
+
<img alt="OpenTUI logo" src="https://opentui.com/opentui-logo-auto.svg" width="270" />
|
|
6
|
+
</a>
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
<div align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@opentui/core"><img alt="npm version" src="https://img.shields.io/npm/v/@opentui/core?style=flat-square" /></a>
|
|
11
|
+
<a href="https://github.com/anomalyco/opentui/actions/workflows/build-core.yml"><img alt="Core build status" src="https://img.shields.io/github/actions/workflow/status/anomalyco/opentui/build-core.yml?style=flat-square&branch=main" /></a>
|
|
12
|
+
</div>
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
- [Development Guide](docs/development.md) - Building, testing, and contributing
|
|
9
|
-
- [Tree-Sitter](https://opentui.com/docs/reference/tree-sitter) - Syntax highlighting integration
|
|
10
|
-
- [Renderables](https://opentui.com/docs/core-concepts/renderables) - Understanding the component model
|
|
11
|
-
- [Environment Variables](https://opentui.com/docs/reference/env-vars) - Configuration options
|
|
14
|
+
OpenTUI is a library to build terminal user interfaces.
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
- It is written in Zig.
|
|
17
|
+
- You write TypeScript directly or through React and Solid.
|
|
18
|
+
- You arrange boxes and text with flexbox.
|
|
19
|
+
- You add selects, inputs, and scroll boxes with keyboard and mouse controls.
|
|
20
|
+
- You can play sounds, show images, and render 3D graphics.
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
bun install @opentui/core
|
|
17
|
-
```
|
|
22
|
+
OpenCode uses OpenTUI in production for millions of users.
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
[Website](https://opentui.com) | [Documentation](https://opentui.com/docs) | [Packages](https://opentui.com/packages)
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
bun run build
|
|
23
|
-
```
|
|
26
|
+
## OpenTUI Core
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
`@opentui/core` supplies the renderer and TypeScript API. You use imperative renderables and events directly. The
|
|
29
|
+
TypeScript packages call native Zig through an internal foreign function interface (FFI) boundary.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
```typescript
|
|
32
|
+
import { TextRenderable, createCliRenderer } from "@opentui/core"
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
bun run dev
|
|
34
|
+
const renderer = await createCliRenderer({ exitOnCtrlC: true })
|
|
35
|
+
|
|
36
|
+
renderer.root.add(new TextRenderable(renderer, { content: "Hello, OpenTUI!" }))
|
|
33
37
|
```
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
`exitOnCtrlC: true` calls `renderer.destroy()` when the user presses Ctrl+C. The code that creates the renderer must
|
|
40
|
+
call `renderer.destroy()` on every other shutdown path.
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
Install the package:
|
|
38
43
|
|
|
39
44
|
```bash
|
|
40
|
-
bun
|
|
45
|
+
bun add @opentui/core
|
|
41
46
|
```
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
Then build your first app with the [quickstart](https://opentui.com/docs/getting-started/quickstart).
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
## Runtime and platform support
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
`@opentui/core` runs on Bun 1.3.0 or later, or on Node.js 26.4.0 or later with ECMAScript modules (ESM) and
|
|
53
|
+
`--experimental-ffi`.
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
The native ABI and the generated platform packages, such as `@opentui/core-linux-x64`, are internal distribution
|
|
56
|
+
surfaces, not application APIs.
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
## AI agent skill
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
Install the OpenTUI documentation as a skill for your AI coding assistant with [`npx skills`](https://skills.sh):
|
|
54
61
|
|
|
55
|
-
```
|
|
56
|
-
|
|
62
|
+
```bash
|
|
63
|
+
npx skills add anomalyco/opentui --skill opentui
|
|
64
|
+
```
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
Add `-g` to install the skill globally.
|
|
59
67
|
|
|
60
|
-
|
|
68
|
+
## License
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
```
|
|
70
|
+
OpenTUI is licensed under the [MIT License](https://github.com/anomalyco/opentui/blob/main/LICENSE).
|
|
@@ -5965,7 +5965,7 @@ class MouseParser {
|
|
|
5965
5965
|
if (type === "down" && button !== 3) {
|
|
5966
5966
|
this.mouseButtonsPressed.add(button);
|
|
5967
5967
|
} else if (type === "up") {
|
|
5968
|
-
this.mouseButtonsPressed.
|
|
5968
|
+
this.mouseButtonsPressed.delete(button);
|
|
5969
5969
|
}
|
|
5970
5970
|
}
|
|
5971
5971
|
return {
|
|
@@ -6040,9 +6040,11 @@ class Selection {
|
|
|
6040
6040
|
_isActive = true;
|
|
6041
6041
|
_isDragging = true;
|
|
6042
6042
|
_isStart = false;
|
|
6043
|
-
|
|
6043
|
+
behavior;
|
|
6044
|
+
constructor(anchorRenderable, anchor, focus, behavior = "cell") {
|
|
6044
6045
|
this._anchor = new SelectionAnchor(anchorRenderable, anchor.x, anchor.y);
|
|
6045
6046
|
this._focus = { ...focus };
|
|
6047
|
+
this.behavior = behavior;
|
|
6046
6048
|
}
|
|
6047
6049
|
get isStart() {
|
|
6048
6050
|
return this._isStart;
|
|
@@ -6133,7 +6135,8 @@ function convertGlobalToLocalSelection(globalSelection, localX, localY) {
|
|
|
6133
6135
|
anchorY: globalSelection.anchor.y - localY,
|
|
6134
6136
|
focusX: globalSelection.focus.x - localX,
|
|
6135
6137
|
focusY: globalSelection.focus.y - localY,
|
|
6136
|
-
isActive: true
|
|
6138
|
+
isActive: true,
|
|
6139
|
+
behavior: globalSelection.behavior
|
|
6137
6140
|
};
|
|
6138
6141
|
}
|
|
6139
6142
|
|
|
@@ -6168,36 +6171,37 @@ class ASCIIFontSelectionHelper {
|
|
|
6168
6171
|
}
|
|
6169
6172
|
const text = this.getText();
|
|
6170
6173
|
const font = this.getFont();
|
|
6171
|
-
const
|
|
6172
|
-
const
|
|
6173
|
-
|
|
6174
|
+
const positions = getCharacterPositions(text, font);
|
|
6175
|
+
const minY = Math.min(localSelection.anchorY, localSelection.focusY);
|
|
6176
|
+
const maxY = Math.max(localSelection.anchorY, localSelection.focusY);
|
|
6177
|
+
if (maxY < 0 || minY > height - 1) {
|
|
6174
6178
|
this.localSelection = null;
|
|
6175
6179
|
return previousSelection !== null;
|
|
6176
6180
|
}
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6181
|
+
const indexAt = (x, y) => {
|
|
6182
|
+
if (y < 0)
|
|
6183
|
+
return 0;
|
|
6184
|
+
if (y > height - 1)
|
|
6185
|
+
return text.length;
|
|
6186
|
+
if (x < 0)
|
|
6187
|
+
return 0;
|
|
6188
|
+
if (x >= width)
|
|
6189
|
+
return text.length;
|
|
6190
|
+
for (let index = 1;index < positions.length; index += 1) {
|
|
6191
|
+
if (x < positions[index])
|
|
6192
|
+
return index - 1;
|
|
6185
6193
|
}
|
|
6186
|
-
|
|
6187
|
-
|
|
6194
|
+
return text.length;
|
|
6195
|
+
};
|
|
6196
|
+
const anchorIndex = indexAt(localSelection.anchorX, localSelection.anchorY);
|
|
6197
|
+
const focusIndex = indexAt(localSelection.focusX, localSelection.focusY);
|
|
6198
|
+
const start = Math.min(anchorIndex, focusIndex);
|
|
6199
|
+
const end = Math.min(Math.max(anchorIndex, focusIndex) + 1, text.length);
|
|
6200
|
+
const samePoint = localSelection.anchorX === localSelection.focusX && localSelection.anchorY === localSelection.focusY;
|
|
6201
|
+
if (samePoint || start >= end) {
|
|
6188
6202
|
this.localSelection = null;
|
|
6189
|
-
return previousSelection !== null;
|
|
6190
|
-
} else if (selEnd.y >= 0 && selEnd.y <= height - 1) {
|
|
6191
|
-
if (selEnd.x >= 0) {
|
|
6192
|
-
endCharIndex = coordinateToCharacterIndex(selEnd.x, text, font);
|
|
6193
|
-
} else {
|
|
6194
|
-
endCharIndex = 0;
|
|
6195
|
-
}
|
|
6196
|
-
}
|
|
6197
|
-
if (startCharIndex < endCharIndex && startCharIndex >= 0 && endCharIndex <= text.length) {
|
|
6198
|
-
this.localSelection = { start: startCharIndex, end: endCharIndex };
|
|
6199
6203
|
} else {
|
|
6200
|
-
this.localSelection =
|
|
6204
|
+
this.localSelection = { start, end };
|
|
6201
6205
|
}
|
|
6202
6206
|
return previousSelection?.start !== this.localSelection?.start || previousSelection?.end !== this.localSelection?.end;
|
|
6203
6207
|
}
|
|
@@ -11572,7 +11576,6 @@ class TextBuffer {
|
|
|
11572
11576
|
bufferPtr;
|
|
11573
11577
|
_length = 0;
|
|
11574
11578
|
_byteSize = 0;
|
|
11575
|
-
_lineInfo;
|
|
11576
11579
|
_destroyed = false;
|
|
11577
11580
|
_syntaxStyle;
|
|
11578
11581
|
_textBytes;
|
|
@@ -11601,7 +11604,6 @@ class TextBuffer {
|
|
|
11601
11604
|
this.lib.textBufferSetTextFromMem(this.bufferPtr, this._memId);
|
|
11602
11605
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11603
11606
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11604
|
-
this._lineInfo = undefined;
|
|
11605
11607
|
this._appendedChunks = [];
|
|
11606
11608
|
}
|
|
11607
11609
|
append(text) {
|
|
@@ -11611,7 +11613,6 @@ class TextBuffer {
|
|
|
11611
11613
|
this.lib.textBufferAppend(this.bufferPtr, textBytes);
|
|
11612
11614
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11613
11615
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11614
|
-
this._lineInfo = undefined;
|
|
11615
11616
|
}
|
|
11616
11617
|
loadFile(path3) {
|
|
11617
11618
|
this.guard();
|
|
@@ -11621,7 +11622,6 @@ class TextBuffer {
|
|
|
11621
11622
|
}
|
|
11622
11623
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11623
11624
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11624
|
-
this._lineInfo = undefined;
|
|
11625
11625
|
this._textBytes = undefined;
|
|
11626
11626
|
}
|
|
11627
11627
|
setStyledText(text) {
|
|
@@ -11629,7 +11629,6 @@ class TextBuffer {
|
|
|
11629
11629
|
this.lib.textBufferSetStyledText(this.bufferPtr, text.chunks);
|
|
11630
11630
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11631
11631
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
11632
|
-
this._lineInfo = undefined;
|
|
11633
11632
|
}
|
|
11634
11633
|
setDefaultFg(fg2) {
|
|
11635
11634
|
this.guard();
|
|
@@ -11724,6 +11723,7 @@ class TextBuffer {
|
|
|
11724
11723
|
setTabWidth(width) {
|
|
11725
11724
|
this.guard();
|
|
11726
11725
|
this.lib.textBufferSetTabWidth(this.bufferPtr, width);
|
|
11726
|
+
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
11727
11727
|
}
|
|
11728
11728
|
getTabWidth() {
|
|
11729
11729
|
this.guard();
|
|
@@ -11734,7 +11734,6 @@ class TextBuffer {
|
|
|
11734
11734
|
this.lib.textBufferClear(this.bufferPtr);
|
|
11735
11735
|
this._length = 0;
|
|
11736
11736
|
this._byteSize = 0;
|
|
11737
|
-
this._lineInfo = undefined;
|
|
11738
11737
|
this._textBytes = undefined;
|
|
11739
11738
|
this._appendedChunks = [];
|
|
11740
11739
|
}
|
|
@@ -11743,7 +11742,6 @@ class TextBuffer {
|
|
|
11743
11742
|
this.lib.textBufferReset(this.bufferPtr);
|
|
11744
11743
|
this._length = 0;
|
|
11745
11744
|
this._byteSize = 0;
|
|
11746
|
-
this._lineInfo = undefined;
|
|
11747
11745
|
this._textBytes = undefined;
|
|
11748
11746
|
this._memId = undefined;
|
|
11749
11747
|
this._appendedChunks = [];
|
|
@@ -13116,7 +13114,7 @@ var VisualCursorStruct = defineStruct([
|
|
|
13116
13114
|
["logicalCol", "u32"],
|
|
13117
13115
|
["offset", "u32"]
|
|
13118
13116
|
]);
|
|
13119
|
-
var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1 }, "u8");
|
|
13117
|
+
var UnicodeMethodEnum = defineEnum({ wcwidth: 0, unicode: 1, "unicode-wide": 3 }, "u8");
|
|
13120
13118
|
var TerminalMultiplexerEnum = defineEnum({ none: 0, tmux: 1, zellij: 2, screen: 3, unknown: 4 }, "u8");
|
|
13121
13119
|
var Osc52SupportEnum = defineEnum({ unknown: 0, supported: 1, unsupported: 2 }, "u8");
|
|
13122
13120
|
var ImageProtocolEnum = defineEnum({ auto: 0, kitty: 1, sixel: 2, blocks: 3 }, "u8");
|
|
@@ -13584,6 +13582,20 @@ function rgbaBuffer(value) {
|
|
|
13584
13582
|
function optionalRgbaBuffer(value) {
|
|
13585
13583
|
return value ? rgbaBuffer(value) : null;
|
|
13586
13584
|
}
|
|
13585
|
+
function selectionBehaviorByte(behavior) {
|
|
13586
|
+
return behavior === "word" ? 1 : behavior === "line" ? 2 : 0;
|
|
13587
|
+
}
|
|
13588
|
+
function editorLocalSelectionFlags(updateCursor, followCursor, behavior) {
|
|
13589
|
+
return ffiBool(updateCursor) | ffiBool(followCursor) << 1 | selectionBehaviorByte(behavior) << 2;
|
|
13590
|
+
}
|
|
13591
|
+
function widthMethodCode(widthMethod) {
|
|
13592
|
+
return widthMethod === "wcwidth" ? 0 : widthMethod === "unicode-wide" ? 3 : 1;
|
|
13593
|
+
}
|
|
13594
|
+
function widthMethodFromCode(code) {
|
|
13595
|
+
if (code === 0)
|
|
13596
|
+
return "wcwidth";
|
|
13597
|
+
return code === 3 ? "unicode-wide" : "unicode";
|
|
13598
|
+
}
|
|
13587
13599
|
function getOpenTUILib(libPath) {
|
|
13588
13600
|
const resolvedLibPath = libPath || targetLibPath;
|
|
13589
13601
|
if (!resolvedLibPath) {
|
|
@@ -13751,7 +13763,7 @@ function getOpenTUILib(libPath) {
|
|
|
13751
13763
|
returns: "u64"
|
|
13752
13764
|
},
|
|
13753
13765
|
commitSplitFooterSnapshot: {
|
|
13754
|
-
args: ["u32", "u32", "u32", "
|
|
13766
|
+
args: ["u32", "u32", "u32", "u8", "u32"],
|
|
13755
13767
|
returns: "u64"
|
|
13756
13768
|
},
|
|
13757
13769
|
getNextBuffer: {
|
|
@@ -13775,7 +13787,7 @@ function getOpenTUILib(libPath) {
|
|
|
13775
13787
|
returns: "void"
|
|
13776
13788
|
},
|
|
13777
13789
|
createOptimizedBuffer: {
|
|
13778
|
-
args: ["u32", "u32", "
|
|
13790
|
+
args: ["u32", "u32", "u8", "u8", "buffer", "u32"],
|
|
13779
13791
|
returns: "u32"
|
|
13780
13792
|
},
|
|
13781
13793
|
destroyOptimizedBuffer: {
|
|
@@ -13794,6 +13806,10 @@ function getOpenTUILib(libPath) {
|
|
|
13794
13806
|
args: ["u32"],
|
|
13795
13807
|
returns: "u32"
|
|
13796
13808
|
},
|
|
13809
|
+
getBufferWidthMethod: {
|
|
13810
|
+
args: ["u32"],
|
|
13811
|
+
returns: "u8"
|
|
13812
|
+
},
|
|
13797
13813
|
bufferClear: {
|
|
13798
13814
|
args: ["u32", "buffer"],
|
|
13799
13815
|
returns: "void"
|
|
@@ -13899,7 +13915,7 @@ function getOpenTUILib(libPath) {
|
|
|
13899
13915
|
returns: "void"
|
|
13900
13916
|
},
|
|
13901
13917
|
setDebugOverlay: {
|
|
13902
|
-
args: ["u32", "
|
|
13918
|
+
args: ["u32", "u8", "u8"],
|
|
13903
13919
|
returns: "void"
|
|
13904
13920
|
},
|
|
13905
13921
|
clearTerminal: {
|
|
@@ -14306,7 +14322,7 @@ function getOpenTUILib(libPath) {
|
|
|
14306
14322
|
returns: "u64"
|
|
14307
14323
|
},
|
|
14308
14324
|
textBufferViewSetLocalSelection: {
|
|
14309
|
-
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
14325
|
+
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "u8"],
|
|
14310
14326
|
returns: "bool"
|
|
14311
14327
|
},
|
|
14312
14328
|
textBufferViewUpdateSelection: {
|
|
@@ -14314,13 +14330,21 @@ function getOpenTUILib(libPath) {
|
|
|
14314
14330
|
returns: "void"
|
|
14315
14331
|
},
|
|
14316
14332
|
textBufferViewUpdateLocalSelection: {
|
|
14317
|
-
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr"],
|
|
14333
|
+
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "u8"],
|
|
14318
14334
|
returns: "bool"
|
|
14319
14335
|
},
|
|
14320
14336
|
textBufferViewResetLocalSelection: {
|
|
14321
14337
|
args: ["u32"],
|
|
14322
14338
|
returns: "void"
|
|
14323
14339
|
},
|
|
14340
|
+
textBufferViewSetSelectionOccupancy: {
|
|
14341
|
+
args: ["u32", "u8"],
|
|
14342
|
+
returns: "void"
|
|
14343
|
+
},
|
|
14344
|
+
textBufferViewGetSelectionOccupancy: {
|
|
14345
|
+
args: ["u32"],
|
|
14346
|
+
returns: "u8"
|
|
14347
|
+
},
|
|
14324
14348
|
textBufferViewSetWrapWidth: {
|
|
14325
14349
|
args: ["u32", "u32"],
|
|
14326
14350
|
returns: "void"
|
|
@@ -14606,7 +14630,7 @@ function getOpenTUILib(libPath) {
|
|
|
14606
14630
|
returns: "u64"
|
|
14607
14631
|
},
|
|
14608
14632
|
editorViewSetLocalSelection: {
|
|
14609
|
-
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "
|
|
14633
|
+
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "u8"],
|
|
14610
14634
|
returns: "bool"
|
|
14611
14635
|
},
|
|
14612
14636
|
editorViewUpdateSelection: {
|
|
@@ -14614,13 +14638,29 @@ function getOpenTUILib(libPath) {
|
|
|
14614
14638
|
returns: "void"
|
|
14615
14639
|
},
|
|
14616
14640
|
editorViewUpdateLocalSelection: {
|
|
14617
|
-
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "
|
|
14641
|
+
args: ["u32", "i32", "i32", "i32", "i32", "ptr", "ptr", "u8"],
|
|
14618
14642
|
returns: "bool"
|
|
14619
14643
|
},
|
|
14620
14644
|
editorViewResetLocalSelection: {
|
|
14621
14645
|
args: ["u32"],
|
|
14622
14646
|
returns: "void"
|
|
14623
14647
|
},
|
|
14648
|
+
editorViewConvertSelectionToCell: {
|
|
14649
|
+
args: ["u32"],
|
|
14650
|
+
returns: "bool"
|
|
14651
|
+
},
|
|
14652
|
+
editorViewSetSelectionOccupancy: {
|
|
14653
|
+
args: ["u32", "u8"],
|
|
14654
|
+
returns: "void"
|
|
14655
|
+
},
|
|
14656
|
+
editorViewSetSelectionInclusive: {
|
|
14657
|
+
args: ["u32", "u32", "u32", "ptr", "ptr"],
|
|
14658
|
+
returns: "void"
|
|
14659
|
+
},
|
|
14660
|
+
editorViewSetSelectionColors: {
|
|
14661
|
+
args: ["u32", "ptr", "ptr"],
|
|
14662
|
+
returns: "void"
|
|
14663
|
+
},
|
|
14624
14664
|
editorViewGetSelectedTextBytes: {
|
|
14625
14665
|
args: ["u32", "ptr", "u32"],
|
|
14626
14666
|
returns: "u32"
|
|
@@ -14673,6 +14713,10 @@ function getOpenTUILib(libPath) {
|
|
|
14673
14713
|
args: ["u32", "ptr"],
|
|
14674
14714
|
returns: "void"
|
|
14675
14715
|
},
|
|
14716
|
+
editorViewGotoVisualLineEnd: {
|
|
14717
|
+
args: ["u32"],
|
|
14718
|
+
returns: "void"
|
|
14719
|
+
},
|
|
14676
14720
|
editorViewSetPlaceholderStyledText: {
|
|
14677
14721
|
args: ["u32", "ptr", "u32"],
|
|
14678
14722
|
returns: "void"
|
|
@@ -15117,7 +15161,7 @@ function getOpenTUILib(libPath) {
|
|
|
15117
15161
|
returns: "i32"
|
|
15118
15162
|
},
|
|
15119
15163
|
audioEnableTap: {
|
|
15120
|
-
args: ["u32", "
|
|
15164
|
+
args: ["u32", "u8", "u32"],
|
|
15121
15165
|
returns: "i32"
|
|
15122
15166
|
},
|
|
15123
15167
|
audioReadTap: {
|
|
@@ -15742,7 +15786,8 @@ class FFIRenderLib {
|
|
|
15742
15786
|
}
|
|
15743
15787
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15744
15788
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15745
|
-
|
|
15789
|
+
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15790
|
+
return new OptimizedBuffer(this, bufferPtr, width, height, { id: "next buffer", widthMethod });
|
|
15746
15791
|
}
|
|
15747
15792
|
getCurrentBuffer(renderer) {
|
|
15748
15793
|
const bufferPtr = this.opentui.symbols.getCurrentBuffer(renderer);
|
|
@@ -15751,7 +15796,8 @@ class FFIRenderLib {
|
|
|
15751
15796
|
}
|
|
15752
15797
|
const width = this.opentui.symbols.getBufferWidth(bufferPtr);
|
|
15753
15798
|
const height = this.opentui.symbols.getBufferHeight(bufferPtr);
|
|
15754
|
-
|
|
15799
|
+
const widthMethod = widthMethodFromCode(this.opentui.symbols.getBufferWidthMethod(bufferPtr));
|
|
15800
|
+
return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod });
|
|
15755
15801
|
}
|
|
15756
15802
|
rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
|
|
15757
15803
|
const paletteBuffer = new Uint16Array(palette.length * 4);
|
|
@@ -15948,16 +15994,16 @@ class FFIRenderLib {
|
|
|
15948
15994
|
return this.unpackRenderOperationResult(this.opentui.symbols.repaintSplitFooter(renderer, pinnedRenderOffset, ffiBool(force)));
|
|
15949
15995
|
}
|
|
15950
15996
|
commitSplitFooterSnapshot(renderer, snapshot, rowColumns, startOnNewLine, trailingNewline, pinnedRenderOffset, force, beginFrame = true, finalizeFrame = true) {
|
|
15951
|
-
|
|
15997
|
+
const flags = ffiBool(startOnNewLine) | ffiBool(trailingNewline) << 1 | ffiBool(force) << 2 | ffiBool(beginFrame) << 3 | ffiBool(finalizeFrame) << 4;
|
|
15998
|
+
return this.unpackRenderOperationResult(this.opentui.symbols.commitSplitFooterSnapshot(renderer, snapshot.ptr, rowColumns, flags, pinnedRenderOffset));
|
|
15952
15999
|
}
|
|
15953
16000
|
createOptimizedBuffer(width, height, widthMethod, respectAlpha = false, id) {
|
|
15954
16001
|
if (Number.isNaN(width) || Number.isNaN(height)) {
|
|
15955
16002
|
console.error(new Error(`Invalid dimensions for OptimizedBuffer: ${width}x${height}`).stack);
|
|
15956
16003
|
}
|
|
15957
|
-
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
15958
16004
|
const idToUse = id || "unnamed buffer";
|
|
15959
16005
|
const idBytes = this.encoder.encode(idToUse);
|
|
15960
|
-
const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode, idBytes, idBytes.byteLength);
|
|
16006
|
+
const bufferPtr = this.opentui.symbols.createOptimizedBuffer(width, height, ffiBool(respectAlpha), widthMethodCode(widthMethod), idBytes, idBytes.byteLength);
|
|
15961
16007
|
if (!bufferPtr) {
|
|
15962
16008
|
throw new Error(`Failed to create optimized buffer: ${width}x${height}`);
|
|
15963
16009
|
}
|
|
@@ -16347,8 +16393,7 @@ class FFIRenderLib {
|
|
|
16347
16393
|
});
|
|
16348
16394
|
}
|
|
16349
16395
|
createTextBuffer(widthMethod) {
|
|
16350
|
-
const
|
|
16351
|
-
const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode);
|
|
16396
|
+
const bufferPtr = this.opentui.symbols.createTextBuffer(widthMethodCode(widthMethod));
|
|
16352
16397
|
if (!bufferPtr) {
|
|
16353
16398
|
throw new Error(`Failed to create TextBuffer`);
|
|
16354
16399
|
}
|
|
@@ -16486,24 +16531,30 @@ class FFIRenderLib {
|
|
|
16486
16531
|
textBufferViewGetSelectionInfo(view) {
|
|
16487
16532
|
return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
|
|
16488
16533
|
}
|
|
16489
|
-
textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
16534
|
+
textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior) {
|
|
16490
16535
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16491
16536
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16492
|
-
return Boolean(this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2));
|
|
16537
|
+
return Boolean(this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, selectionBehaviorByte(behavior)));
|
|
16493
16538
|
}
|
|
16494
16539
|
textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
16495
16540
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16496
16541
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16497
16542
|
this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
|
|
16498
16543
|
}
|
|
16499
|
-
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
|
|
16544
|
+
textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, behavior) {
|
|
16500
16545
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16501
16546
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16502
|
-
return Boolean(this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2));
|
|
16547
|
+
return Boolean(this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, selectionBehaviorByte(behavior)));
|
|
16503
16548
|
}
|
|
16504
16549
|
textBufferViewResetLocalSelection(view) {
|
|
16505
16550
|
this.opentui.symbols.textBufferViewResetLocalSelection(view);
|
|
16506
16551
|
}
|
|
16552
|
+
textBufferViewSetSelectionOccupancy(view, occupancy) {
|
|
16553
|
+
this.opentui.symbols.textBufferViewSetSelectionOccupancy(view, occupancy === "boundary" ? 1 : 0);
|
|
16554
|
+
}
|
|
16555
|
+
textBufferViewGetSelectionOccupancy(view) {
|
|
16556
|
+
return this.opentui.symbols.textBufferViewGetSelectionOccupancy(view) === 1 ? "boundary" : "cell";
|
|
16557
|
+
}
|
|
16507
16558
|
textBufferViewSetWrapWidth(view, width) {
|
|
16508
16559
|
this.opentui.symbols.textBufferViewSetWrapWidth(view, width);
|
|
16509
16560
|
}
|
|
@@ -16744,8 +16795,7 @@ class FFIRenderLib {
|
|
|
16744
16795
|
};
|
|
16745
16796
|
}
|
|
16746
16797
|
createEditBuffer(widthMethod) {
|
|
16747
|
-
const
|
|
16748
|
-
const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode, this.eventSinkPtr ?? 0);
|
|
16798
|
+
const bufferPtr = this.opentui.symbols.createEditBuffer(widthMethodCode(widthMethod), this.eventSinkPtr ?? 0);
|
|
16749
16799
|
if (!bufferPtr) {
|
|
16750
16800
|
throw new Error("Failed to create EditBuffer");
|
|
16751
16801
|
}
|
|
@@ -16933,24 +16983,40 @@ class FFIRenderLib {
|
|
|
16933
16983
|
const end = Number(packedInfo & 0xffff_ffffn);
|
|
16934
16984
|
return { start, end };
|
|
16935
16985
|
}
|
|
16936
|
-
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
16986
|
+
editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor, behavior) {
|
|
16937
16987
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16938
16988
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16939
|
-
return Boolean(this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2,
|
|
16989
|
+
return Boolean(this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
16940
16990
|
}
|
|
16941
16991
|
editorViewUpdateSelection(view, end, bgColor, fgColor) {
|
|
16942
16992
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16943
16993
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16944
16994
|
this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
|
|
16945
16995
|
}
|
|
16946
|
-
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
|
|
16996
|
+
editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor, behavior) {
|
|
16947
16997
|
const bg2 = optionalRgbaBuffer(bgColor);
|
|
16948
16998
|
const fg2 = optionalRgbaBuffer(fgColor);
|
|
16949
|
-
return Boolean(this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2,
|
|
16999
|
+
return Boolean(this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, editorLocalSelectionFlags(updateCursor, followCursor, behavior)));
|
|
16950
17000
|
}
|
|
16951
17001
|
editorViewResetLocalSelection(view) {
|
|
16952
17002
|
this.opentui.symbols.editorViewResetLocalSelection(view);
|
|
16953
17003
|
}
|
|
17004
|
+
editorViewConvertSelectionToCell(view) {
|
|
17005
|
+
return Boolean(this.opentui.symbols.editorViewConvertSelectionToCell(view));
|
|
17006
|
+
}
|
|
17007
|
+
editorViewSetSelectionOccupancy(view, occupancy) {
|
|
17008
|
+
this.opentui.symbols.editorViewSetSelectionOccupancy(view, occupancy === "boundary" ? 1 : 0);
|
|
17009
|
+
}
|
|
17010
|
+
editorViewSetSelectionInclusive(view, start, end, bgColor, fgColor) {
|
|
17011
|
+
const bg2 = optionalRgbaBuffer(bgColor);
|
|
17012
|
+
const fg2 = optionalRgbaBuffer(fgColor);
|
|
17013
|
+
this.opentui.symbols.editorViewSetSelectionInclusive(view, start, end, bg2, fg2);
|
|
17014
|
+
}
|
|
17015
|
+
editorViewSetSelectionColors(view, bgColor, fgColor) {
|
|
17016
|
+
const bg2 = optionalRgbaBuffer(bgColor);
|
|
17017
|
+
const fg2 = optionalRgbaBuffer(fgColor);
|
|
17018
|
+
this.opentui.symbols.editorViewSetSelectionColors(view, bg2, fg2);
|
|
17019
|
+
}
|
|
16954
17020
|
editorViewGetSelectedTextBytes(view, maxLength) {
|
|
16955
17021
|
const outBuffer = new Uint8Array(maxLength);
|
|
16956
17022
|
const actualLen = this.opentui.symbols.editorViewGetSelectedTextBytes(view, viewOrNull(outBuffer), maxLength);
|
|
@@ -17021,6 +17087,9 @@ class FFIRenderLib {
|
|
|
17021
17087
|
const cursor = VisualCursorStruct.unpackInto(storage.view, storage.result);
|
|
17022
17088
|
return { ...cursor };
|
|
17023
17089
|
}
|
|
17090
|
+
editorViewGotoVisualLineEnd(view) {
|
|
17091
|
+
this.opentui.symbols.editorViewGotoVisualLineEnd(view);
|
|
17092
|
+
}
|
|
17024
17093
|
bufferPushScissorRect(buffer, x, y, width, height) {
|
|
17025
17094
|
this.opentui.symbols.bufferPushScissorRect(buffer, x, y, width, height);
|
|
17026
17095
|
}
|
|
@@ -17081,10 +17150,9 @@ class FFIRenderLib {
|
|
|
17081
17150
|
}
|
|
17082
17151
|
encodeUnicode(text, widthMethod) {
|
|
17083
17152
|
const textBytes = this.encoder.encode(text);
|
|
17084
|
-
const widthMethodCode = widthMethod === "wcwidth" ? 0 : 1;
|
|
17085
17153
|
const outPtrBuffer = new ArrayBuffer(8);
|
|
17086
17154
|
const outLenBuffer = new ArrayBuffer(8);
|
|
17087
|
-
const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode);
|
|
17155
|
+
const success = this.opentui.symbols.encodeUnicode(viewOrNull(textBytes), textBytes.byteLength, outPtrBuffer, outLenBuffer, widthMethodCode(widthMethod));
|
|
17088
17156
|
if (!success) {
|
|
17089
17157
|
return null;
|
|
17090
17158
|
}
|
|
@@ -18535,5 +18603,5 @@ var yoga_default = Yoga;
|
|
|
18535
18603
|
|
|
18536
18604
|
export { toArrayBuffer, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, sleep, stringWidth2 as stringWidth, resolveBundledFilePath, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, 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, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, createHostClipboard, createClipboard, ClipboardTarget, createRendererClipboardAdapter, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, NativeAudioStreamFormat, NativeAudioStreamState, NativeAudioStreamStateNames, NativeAudioStreamCloseReason, NativeAudioStreamState2 as NativeAudioStreamState1, NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason1, NativeAudioStreamFormat2 as NativeAudioStreamFormat1, NativeClipboardOperationStatus, NativeClipboardStartStatus, NativeClipboardCancelStatus, NativeClipboardCopyStatus, NativeClipboardDestroyStatus, NativeClipboardShutdownStatus, LogLevel2 as LogLevel, NativeMeasureTargetKind, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
|
|
18537
18605
|
|
|
18538
|
-
//# debugId=
|
|
18539
|
-
//# sourceMappingURL=chunk-bun-
|
|
18606
|
+
//# debugId=A46EB1E65ED4B0B864756E2164756E21
|
|
18607
|
+
//# sourceMappingURL=chunk-bun-fj2atf6d.js.map
|