@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
|
@@ -231,6 +231,7 @@ export declare const OT_ATTR_LINK_MASK = 16777215;
|
|
|
231
231
|
export declare const OT_SCENE_TEXT_SELECTION_RESET = 0;
|
|
232
232
|
export declare const OT_SCENE_TEXT_SELECTION_SET = 1;
|
|
233
233
|
export declare const OT_SCENE_TEXT_SELECTION_UPDATE = 2;
|
|
234
|
+
export declare const OT_SCENE_TEXT_SELECTION_COLORS = 3;
|
|
234
235
|
export declare const OT_SCENE_TEXT_SELECTION_CELL = 0;
|
|
235
236
|
export declare const OT_SCENE_TEXT_SELECTION_WORD = 1;
|
|
236
237
|
export declare const OT_SCENE_TEXT_SELECTION_LINE = 2;
|
|
@@ -367,6 +368,7 @@ export declare const OT_EMBEDDED_TERMINAL_SCROLL = 1;
|
|
|
367
368
|
export declare const OT_EMBEDDED_TERMINAL_CLEAR_SELECTION = 2;
|
|
368
369
|
export declare const OT_EMBEDDED_TERMINAL_SET_TRANSPARENT_BACKGROUND = 3;
|
|
369
370
|
export declare const OT_EMBEDDED_TERMINAL_RESPONSE_BYTES_MAX = 1048576;
|
|
371
|
+
export declare const OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH = 1;
|
|
370
372
|
export declare const OT_EDIT_CURSOR_CHANGED = 1;
|
|
371
373
|
export declare const OT_EDIT_CONTENT_CHANGED = 2;
|
|
372
374
|
export declare const OT_EDIT_HISTORY_CURSOR_CHANGED = 4;
|
|
@@ -1624,6 +1626,10 @@ export declare const nativeSymbols: {
|
|
|
1624
1626
|
readonly args: readonly ["ptr", "buffer", "u32"];
|
|
1625
1627
|
readonly returns: "i32";
|
|
1626
1628
|
};
|
|
1629
|
+
readonly ot_text_buffer_set_width_method: {
|
|
1630
|
+
readonly args: readonly ["ptr", "buffer", "u32"];
|
|
1631
|
+
readonly returns: "i32";
|
|
1632
|
+
};
|
|
1627
1633
|
readonly ot_text_buffer_highlight: {
|
|
1628
1634
|
readonly args: readonly ["ptr", "buffer", "u32", "u32", "ptr"];
|
|
1629
1635
|
readonly returns: "i32";
|
|
@@ -4310,7 +4316,7 @@ export declare const nativeLayouts: {
|
|
|
4310
4316
|
readonly alignment: 4;
|
|
4311
4317
|
readonly type: "u32";
|
|
4312
4318
|
};
|
|
4313
|
-
readonly
|
|
4319
|
+
readonly flags: {
|
|
4314
4320
|
readonly offset: 12;
|
|
4315
4321
|
readonly size: 4;
|
|
4316
4322
|
readonly alignment: 4;
|
|
@@ -7289,6 +7295,7 @@ export declare const nativeConstants: {
|
|
|
7289
7295
|
readonly OT_SCENE_TEXT_SELECTION_RESET: 0;
|
|
7290
7296
|
readonly OT_SCENE_TEXT_SELECTION_SET: 1;
|
|
7291
7297
|
readonly OT_SCENE_TEXT_SELECTION_UPDATE: 2;
|
|
7298
|
+
readonly OT_SCENE_TEXT_SELECTION_COLORS: 3;
|
|
7292
7299
|
readonly OT_SCENE_TEXT_SELECTION_CELL: 0;
|
|
7293
7300
|
readonly OT_SCENE_TEXT_SELECTION_WORD: 1;
|
|
7294
7301
|
readonly OT_SCENE_TEXT_SELECTION_LINE: 2;
|
|
@@ -7425,6 +7432,7 @@ export declare const nativeConstants: {
|
|
|
7425
7432
|
readonly OT_EMBEDDED_TERMINAL_CLEAR_SELECTION: 2;
|
|
7426
7433
|
readonly OT_EMBEDDED_TERMINAL_SET_TRANSPARENT_BACKGROUND: 3;
|
|
7427
7434
|
readonly OT_EMBEDDED_TERMINAL_RESPONSE_BYTES_MAX: 1048576;
|
|
7435
|
+
readonly OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH: 1;
|
|
7428
7436
|
readonly OT_EDIT_CURSOR_CHANGED: 1;
|
|
7429
7437
|
readonly OT_EDIT_CONTENT_CHANGED: 2;
|
|
7430
7438
|
readonly OT_EDIT_HISTORY_CURSOR_CHANGED: 4;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.node.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.9.
|
|
7
|
+
"version": "0.9.1",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"web-tree-sitter": "0.25.10"
|
|
78
78
|
},
|
|
79
79
|
"optionalDependencies": {
|
|
80
|
-
"@opentui/core-darwin-x64": "0.9.
|
|
81
|
-
"@opentui/core-darwin-arm64": "0.9.
|
|
82
|
-
"@opentui/core-linux-x64": "0.9.
|
|
83
|
-
"@opentui/core-linux-arm64": "0.9.
|
|
84
|
-
"@opentui/core-win32-x64": "0.9.
|
|
85
|
-
"@opentui/core-win32-arm64": "0.9.
|
|
86
|
-
"@opentui/core-linux-x64-musl": "0.9.
|
|
87
|
-
"@opentui/core-linux-arm64-musl": "0.9.
|
|
80
|
+
"@opentui/core-darwin-x64": "0.9.1",
|
|
81
|
+
"@opentui/core-darwin-arm64": "0.9.1",
|
|
82
|
+
"@opentui/core-linux-x64": "0.9.1",
|
|
83
|
+
"@opentui/core-linux-arm64": "0.9.1",
|
|
84
|
+
"@opentui/core-win32-x64": "0.9.1",
|
|
85
|
+
"@opentui/core-win32-arm64": "0.9.1",
|
|
86
|
+
"@opentui/core-linux-x64-musl": "0.9.1",
|
|
87
|
+
"@opentui/core-linux-arm64-musl": "0.9.1"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -94,6 +94,8 @@ export declare abstract class TextBufferRenderable extends Renderable implements
|
|
|
94
94
|
set truncate(value: boolean);
|
|
95
95
|
protected onResize(width: number, height: number): void;
|
|
96
96
|
protected refreshLocalSelection(): boolean;
|
|
97
|
+
/** Restyles the accepted selection; replaying its cells would select other text after a width change. */
|
|
98
|
+
private setSelectionColors;
|
|
97
99
|
private updateLocalSelection;
|
|
98
100
|
protected updateTextInfo(): void;
|
|
99
101
|
shouldStartSelection(x: number, y: number): boolean;
|
|
@@ -37,6 +37,16 @@ export interface TextTableOptions extends RenderableOptions<TextTableRenderable>
|
|
|
37
37
|
}
|
|
38
38
|
export declare class TextTableRenderable extends Renderable {
|
|
39
39
|
private _content;
|
|
40
|
+
/** The width method the cells measure with; a terminal reply can change the renderer's. */
|
|
41
|
+
private _cellWidthMethod?;
|
|
42
|
+
/** The cells hold the accepted selection in document offsets; its cells no longer name its text. */
|
|
43
|
+
private _selectionInCells;
|
|
44
|
+
/** The cell a press without a drag pinned, which the gesture's first drag keeps as its anchor. */
|
|
45
|
+
private _pressedCell;
|
|
46
|
+
/** The pressed cell's view still holds the press as its anchor. */
|
|
47
|
+
private _pressPinned;
|
|
48
|
+
private _pressAnchor;
|
|
49
|
+
private _pressMoved;
|
|
40
50
|
private _wrapMode;
|
|
41
51
|
private _columnWidthMode;
|
|
42
52
|
private _columnFitter;
|
|
@@ -69,6 +79,8 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
69
79
|
private _cachedMeasureWidth;
|
|
70
80
|
private readonly _defaultOptions;
|
|
71
81
|
constructor(ctx: RenderContext, options?: TextTableOptions);
|
|
82
|
+
/** Cells re-measure in place: their views keep their selections on the same text. */
|
|
83
|
+
private followWidthMethod;
|
|
72
84
|
get content(): TextTableContent;
|
|
73
85
|
set content(value: TextTableContent);
|
|
74
86
|
get wrapMode(): "none" | "char" | "word";
|
|
@@ -138,6 +150,10 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
138
150
|
private ensureLayoutReady;
|
|
139
151
|
private getCellAtLocalPosition;
|
|
140
152
|
private applySelectionToCells;
|
|
153
|
+
/** The table-local cell where the moved press's character lies now. */
|
|
154
|
+
private movedAnchor;
|
|
155
|
+
/** The character offset of the press `view` pins: a drag from it to below the text starts there. */
|
|
156
|
+
private pressOffset;
|
|
141
157
|
private resolveSelectionResolution;
|
|
142
158
|
private getColumnAtLocalX;
|
|
143
159
|
private getFullCellSelectionCoords;
|
package/testing.bun.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
TreeSitterClient2,
|
|
6
6
|
ANSI,
|
|
7
7
|
CliRenderer2
|
|
8
|
-
} from "./chunk-bun-
|
|
8
|
+
} from "./chunk-bun-xartp4ps.js";
|
|
9
9
|
import {
|
|
10
10
|
nativeConstants
|
|
11
|
-
} from "./chunk-bun-
|
|
11
|
+
} from "./chunk-bun-v1wzs0bj.js";
|
|
12
12
|
|
|
13
13
|
// src/testing/mock-keys.ts
|
|
14
14
|
import { Buffer as Buffer2 } from "buffer";
|
package/testing.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
TreeSitterClient2,
|
|
5
5
|
ANSI,
|
|
6
6
|
CliRenderer2
|
|
7
|
-
} from "./chunk-node-
|
|
7
|
+
} from "./chunk-node-5cqzgmq3.js";
|
|
8
8
|
import {
|
|
9
9
|
nativeConstants
|
|
10
|
-
} from "./chunk-node-
|
|
10
|
+
} from "./chunk-node-mcdre3zn.js";
|
|
11
11
|
|
|
12
12
|
// src/testing/mock-keys.ts
|
|
13
13
|
import { Buffer as Buffer2 } from "node:buffer";
|
package/text-buffer-view.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare class TextBufferView {
|
|
|
19
19
|
private select;
|
|
20
20
|
private reset;
|
|
21
21
|
setSelection(start: number, end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
22
|
+
/** @internal Selects the whole character that starts at `offset`. */
|
|
23
|
+
_selectCharacter(offset: number): void;
|
|
22
24
|
updateSelection(end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
23
25
|
resetSelection(): void;
|
|
24
26
|
getSelection(): {
|
|
@@ -29,6 +31,8 @@ export declare class TextBufferView {
|
|
|
29
31
|
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, behavior?: SelectionBehavior): boolean;
|
|
30
32
|
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, behavior?: SelectionBehavior): boolean;
|
|
31
33
|
resetLocalSelection(): void;
|
|
34
|
+
/** Restyles the current selection without moving it. */
|
|
35
|
+
setSelectionColors(bgColor?: RGBA, fgColor?: RGBA): void;
|
|
32
36
|
setSelectionOccupancy(occupancy: SelectionOccupancy): void;
|
|
33
37
|
getSelectionOccupancy(): SelectionOccupancy;
|
|
34
38
|
private command;
|
package/text-buffer.d.ts
CHANGED
|
@@ -23,7 +23,13 @@ export declare class TextBuffer {
|
|
|
23
23
|
private _destroyed;
|
|
24
24
|
private _syntaxStyle?;
|
|
25
25
|
constructor(lib: RenderLib, handle: ContextTextBufferHandle, source: NativeResourceOwner);
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* With `followSessionWidth`, the buffer measures with the width method of the renderer whose scene shows it,
|
|
28
|
+
* including when the terminal's replies change that method, and selections keep their text; otherwise it keeps
|
|
29
|
+
* `widthMethod`. One renderer at a time may show such a buffer: showing it in another one throws until the first
|
|
30
|
+
* stops showing it (`NativeError` with `status === NativeStatus.WrongSession`).
|
|
31
|
+
*/
|
|
32
|
+
static create(widthMethod: WidthMethod, source: NativeResourceOwner, followSessionWidth?: boolean): TextBuffer;
|
|
27
33
|
private guard;
|
|
28
34
|
/** @internal Dependent views must use the buffer's library and Context. */
|
|
29
35
|
_getOwner(): ResourceContext;
|
|
@@ -77,6 +83,11 @@ export declare class TextBuffer {
|
|
|
77
83
|
setSyntaxStyle(style: SyntaxStyle | null): void;
|
|
78
84
|
getSyntaxStyle(): SyntaxStyle | null;
|
|
79
85
|
setTabWidth(width: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Measures with `widthMethod` from now on; views keep their selections on the same text. For buffers created without
|
|
88
|
+
* `followSessionWidth` and drawn outside a scene; a following buffer throws.
|
|
89
|
+
*/
|
|
90
|
+
setWidthMethod(widthMethod: WidthMethod): void;
|
|
80
91
|
getTabWidth(): number;
|
|
81
92
|
clear(): void;
|
|
82
93
|
reset(): void;
|
package/yoga.bun.js
CHANGED
package/yoga.js
CHANGED
package/zig.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ export type ContextEmbeddedTerminalHandle = ContextObjectHandle & {
|
|
|
123
123
|
export type SessionBuffer = "current" | "next";
|
|
124
124
|
export interface NativeContextEditBufferOptions {
|
|
125
125
|
widthMethod?: WidthMethod | "no-zwj";
|
|
126
|
+
/** Measure with the width method of the session whose scene shows the buffer. */
|
|
127
|
+
followSessionWidth?: boolean;
|
|
126
128
|
}
|
|
127
129
|
export interface NativeEditBufferInfo {
|
|
128
130
|
contentEpoch: bigint;
|
|
@@ -538,7 +540,7 @@ export interface NativeContextImageDraw {
|
|
|
538
540
|
protocol?: ImageRenderProtocol;
|
|
539
541
|
}
|
|
540
542
|
export interface NativeSceneTextSelectionOptions {
|
|
541
|
-
operation: "reset" | "set" | "update";
|
|
543
|
+
operation: "reset" | "set" | "update" | "colors";
|
|
542
544
|
anchorX: number;
|
|
543
545
|
anchorY: number;
|
|
544
546
|
focusX: number;
|
|
@@ -1214,6 +1216,7 @@ export declare class FFIRenderLib {
|
|
|
1214
1216
|
contextTextBufferGetRange(context: NativeContextHandle, text: ContextTextBufferHandle, start: number, end: number): string;
|
|
1215
1217
|
contextTextBufferSetDefaults(context: NativeContextHandle, text: ContextTextBufferHandle, mask: NativeEditorStyleMask, style: NativeEditorStyle): void;
|
|
1216
1218
|
contextTextBufferSetTabWidth(context: NativeContextHandle, text: ContextTextBufferHandle, width: number): void;
|
|
1219
|
+
contextTextBufferSetWidthMethod(context: NativeContextHandle, text: ContextTextBufferHandle, widthMethod: WidthMethod): void;
|
|
1217
1220
|
contextTextBufferHighlight(context: NativeContextHandle, text: ContextTextBufferHandle, operation: NativeEditHighlightOperation, argument?: number, highlight?: Highlight): void;
|
|
1218
1221
|
/** The Context's id for an ordered list of style names (`ot_context_group_set`). */
|
|
1219
1222
|
contextGroupSet(context: NativeContextHandle, names: readonly string[]): number;
|