@opentui/core 0.8.0 → 0.8.2
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 +10 -2
- package/NativeSession.d.ts +22 -2
- package/buffer.d.ts +2 -0
- package/{chunk-bun-6kxdhkdc.js → chunk-bun-vd3rj9kv.js} +451 -74
- package/{chunk-bun-6kxdhkdc.js.map → chunk-bun-vd3rj9kv.js.map} +10 -10
- package/{chunk-bun-x6cz4jyg.js → chunk-bun-wdetc10w.js} +222 -10
- package/chunk-bun-wdetc10w.js.map +35 -0
- package/{chunk-node-y0w0hq5m.js → chunk-node-m8mjyx7h.js} +222 -10
- package/chunk-node-m8mjyx7h.js.map +34 -0
- package/{chunk-node-q5ccgbk5.js → chunk-node-s9be55eh.js} +451 -74
- package/{chunk-node-q5ccgbk5.js.map → chunk-node-s9be55eh.js.map} +10 -10
- package/index.bun.js +684 -415
- package/index.bun.js.map +13 -12
- package/index.d.ts +1 -1
- package/index.node.js +684 -415
- package/index.node.js.map +13 -11
- package/native-abi.generated.d.ts +171 -3
- package/package.json +9 -9
- package/renderables/Image.d.ts +13 -1
- package/renderables/LineNumberRenderable.d.ts +1 -1
- package/renderables/Markdown.d.ts +1 -6
- package/renderables/ScrollBox.d.ts +1 -1
- package/renderables/Select.d.ts +0 -2
- package/renderables/TabSelect.d.ts +0 -3
- package/renderables/TextTable.d.ts +1 -8
- package/renderables/Video.d.ts +126 -0
- package/renderables/index.d.ts +1 -0
- package/renderables/markdown-parser.d.ts +1 -0
- package/renderer.d.ts +23 -2
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +54 -2
- package/chunk-bun-x6cz4jyg.js.map +0 -35
- package/chunk-node-y0w0hq5m.js.map +0 -34
|
@@ -503,6 +503,58 @@ export declare const nativeSymbols: {
|
|
|
503
503
|
readonly args: readonly ["ptr", "buffer", "ptr", "u32", "u32", "ptr"];
|
|
504
504
|
readonly returns: "i32";
|
|
505
505
|
};
|
|
506
|
+
readonly ot_scene_set_crop: {
|
|
507
|
+
readonly args: readonly ["ptr", "buffer", "u32", "u32", "u32", "u32"];
|
|
508
|
+
readonly returns: "i32";
|
|
509
|
+
};
|
|
510
|
+
readonly ot_scene_set_video: {
|
|
511
|
+
readonly args: readonly ["ptr", "buffer", "u32", "ptr"];
|
|
512
|
+
readonly returns: "i32";
|
|
513
|
+
};
|
|
514
|
+
readonly ot_video_open: {
|
|
515
|
+
readonly args: readonly ["ptr", "buffer", "ptr", "u32", "u32", "buffer"];
|
|
516
|
+
readonly returns: "i32";
|
|
517
|
+
};
|
|
518
|
+
readonly ot_video_play: {
|
|
519
|
+
readonly args: readonly ["ptr", "buffer"];
|
|
520
|
+
readonly returns: "i32";
|
|
521
|
+
};
|
|
522
|
+
readonly ot_video_pause: {
|
|
523
|
+
readonly args: readonly ["ptr", "buffer"];
|
|
524
|
+
readonly returns: "i32";
|
|
525
|
+
};
|
|
526
|
+
readonly ot_video_seek: {
|
|
527
|
+
readonly args: readonly ["ptr", "buffer", "i64"];
|
|
528
|
+
readonly returns: "i32";
|
|
529
|
+
};
|
|
530
|
+
readonly ot_video_set_loop: {
|
|
531
|
+
readonly args: readonly ["ptr", "buffer", "u32"];
|
|
532
|
+
readonly returns: "i32";
|
|
533
|
+
};
|
|
534
|
+
readonly ot_video_set_muted: {
|
|
535
|
+
readonly args: readonly ["ptr", "buffer", "u32"];
|
|
536
|
+
readonly returns: "i32";
|
|
537
|
+
};
|
|
538
|
+
readonly ot_video_set_volume: {
|
|
539
|
+
readonly args: readonly ["ptr", "buffer", "f32"];
|
|
540
|
+
readonly returns: "i32";
|
|
541
|
+
};
|
|
542
|
+
readonly ot_video_set_av_sync_offset: {
|
|
543
|
+
readonly args: readonly ["ptr", "buffer", "i64"];
|
|
544
|
+
readonly returns: "i32";
|
|
545
|
+
};
|
|
546
|
+
readonly ot_video_set_max_fps: {
|
|
547
|
+
readonly args: readonly ["ptr", "buffer", "u32"];
|
|
548
|
+
readonly returns: "i32";
|
|
549
|
+
};
|
|
550
|
+
readonly ot_video_get_state: {
|
|
551
|
+
readonly args: readonly ["ptr", "buffer", "buffer"];
|
|
552
|
+
readonly returns: "i32";
|
|
553
|
+
};
|
|
554
|
+
readonly ot_video_get_error: {
|
|
555
|
+
readonly args: readonly ["ptr", "buffer", "ptr", "u32", "buffer"];
|
|
556
|
+
readonly returns: "i32";
|
|
557
|
+
};
|
|
506
558
|
readonly ot_buffer_draw_image: {
|
|
507
559
|
readonly args: readonly ["ptr", "buffer", "ptr", "buffer", "buffer", "buffer"];
|
|
508
560
|
readonly returns: "i32";
|
|
@@ -875,6 +927,10 @@ export declare const nativeSymbols: {
|
|
|
875
927
|
readonly args: readonly ["ptr", "buffer", "u32", "buffer"];
|
|
876
928
|
readonly returns: "i32";
|
|
877
929
|
};
|
|
930
|
+
readonly ot_session_post_stdout: {
|
|
931
|
+
readonly args: readonly ["ptr", "buffer", "u32", "u32", "buffer", "buffer"];
|
|
932
|
+
readonly returns: "i32";
|
|
933
|
+
};
|
|
878
934
|
readonly ot_session_complete_output: {
|
|
879
935
|
readonly args: readonly ["ptr", "buffer", "buffer", "u32"];
|
|
880
936
|
readonly returns: "i32";
|
|
@@ -883,6 +939,10 @@ export declare const nativeSymbols: {
|
|
|
883
939
|
readonly args: readonly ["ptr", "buffer"];
|
|
884
940
|
readonly returns: "i32";
|
|
885
941
|
};
|
|
942
|
+
readonly ot_session_drop_output: {
|
|
943
|
+
readonly args: readonly ["ptr", "buffer"];
|
|
944
|
+
readonly returns: "i32";
|
|
945
|
+
};
|
|
886
946
|
readonly ot_session_pump_exit: {
|
|
887
947
|
readonly args: readonly ["ptr", "buffer", "buffer"];
|
|
888
948
|
readonly returns: "i32";
|
|
@@ -2846,7 +2906,7 @@ export declare const nativeLayouts: {
|
|
|
2846
2906
|
};
|
|
2847
2907
|
};
|
|
2848
2908
|
readonly ot_session_renderer_state: {
|
|
2849
|
-
readonly size:
|
|
2909
|
+
readonly size: 40;
|
|
2850
2910
|
readonly alignment: 8;
|
|
2851
2911
|
readonly fields: {
|
|
2852
2912
|
readonly struct_size: {
|
|
@@ -2885,12 +2945,24 @@ export declare const nativeLayouts: {
|
|
|
2885
2945
|
readonly alignment: 4;
|
|
2886
2946
|
readonly type: "u32";
|
|
2887
2947
|
};
|
|
2888
|
-
readonly
|
|
2948
|
+
readonly image_uploads_pending: {
|
|
2889
2949
|
readonly offset: 28;
|
|
2890
2950
|
readonly size: 4;
|
|
2891
2951
|
readonly alignment: 4;
|
|
2892
2952
|
readonly type: "u32";
|
|
2893
2953
|
};
|
|
2954
|
+
readonly dropped_frames: {
|
|
2955
|
+
readonly offset: 32;
|
|
2956
|
+
readonly size: 4;
|
|
2957
|
+
readonly alignment: 4;
|
|
2958
|
+
readonly type: "u32";
|
|
2959
|
+
};
|
|
2960
|
+
readonly dropped_frame_bytes: {
|
|
2961
|
+
readonly offset: 36;
|
|
2962
|
+
readonly size: 4;
|
|
2963
|
+
readonly alignment: 4;
|
|
2964
|
+
readonly type: "u32";
|
|
2965
|
+
};
|
|
2894
2966
|
};
|
|
2895
2967
|
};
|
|
2896
2968
|
readonly ot_buffer_options: {
|
|
@@ -3829,6 +3901,84 @@ export declare const nativeLayouts: {
|
|
|
3829
3901
|
};
|
|
3830
3902
|
};
|
|
3831
3903
|
};
|
|
3904
|
+
readonly ot_video_info: {
|
|
3905
|
+
readonly size: 32;
|
|
3906
|
+
readonly alignment: 8;
|
|
3907
|
+
readonly fields: {
|
|
3908
|
+
readonly duration_us: {
|
|
3909
|
+
readonly offset: 0;
|
|
3910
|
+
readonly size: 8;
|
|
3911
|
+
readonly alignment: 8;
|
|
3912
|
+
readonly type: "i64";
|
|
3913
|
+
};
|
|
3914
|
+
readonly width: {
|
|
3915
|
+
readonly offset: 8;
|
|
3916
|
+
readonly size: 4;
|
|
3917
|
+
readonly alignment: 4;
|
|
3918
|
+
readonly type: "u32";
|
|
3919
|
+
};
|
|
3920
|
+
readonly height: {
|
|
3921
|
+
readonly offset: 12;
|
|
3922
|
+
readonly size: 4;
|
|
3923
|
+
readonly alignment: 4;
|
|
3924
|
+
readonly type: "u32";
|
|
3925
|
+
};
|
|
3926
|
+
readonly fps_num: {
|
|
3927
|
+
readonly offset: 16;
|
|
3928
|
+
readonly size: 4;
|
|
3929
|
+
readonly alignment: 4;
|
|
3930
|
+
readonly type: "u32";
|
|
3931
|
+
};
|
|
3932
|
+
readonly fps_den: {
|
|
3933
|
+
readonly offset: 20;
|
|
3934
|
+
readonly size: 4;
|
|
3935
|
+
readonly alignment: 4;
|
|
3936
|
+
readonly type: "u32";
|
|
3937
|
+
};
|
|
3938
|
+
readonly has_audio: {
|
|
3939
|
+
readonly offset: 24;
|
|
3940
|
+
readonly size: 4;
|
|
3941
|
+
readonly alignment: 4;
|
|
3942
|
+
readonly type: "u32";
|
|
3943
|
+
};
|
|
3944
|
+
readonly reserved: {
|
|
3945
|
+
readonly offset: 28;
|
|
3946
|
+
readonly size: 4;
|
|
3947
|
+
readonly alignment: 4;
|
|
3948
|
+
readonly type: "u32";
|
|
3949
|
+
};
|
|
3950
|
+
};
|
|
3951
|
+
};
|
|
3952
|
+
readonly ot_video_state: {
|
|
3953
|
+
readonly size: 24;
|
|
3954
|
+
readonly alignment: 8;
|
|
3955
|
+
readonly fields: {
|
|
3956
|
+
readonly current_time_us: {
|
|
3957
|
+
readonly offset: 0;
|
|
3958
|
+
readonly size: 8;
|
|
3959
|
+
readonly alignment: 8;
|
|
3960
|
+
readonly type: "i64";
|
|
3961
|
+
};
|
|
3962
|
+
readonly frame_pts_us: {
|
|
3963
|
+
readonly offset: 8;
|
|
3964
|
+
readonly size: 8;
|
|
3965
|
+
readonly alignment: 8;
|
|
3966
|
+
readonly type: "i64";
|
|
3967
|
+
};
|
|
3968
|
+
readonly flags: {
|
|
3969
|
+
readonly offset: 16;
|
|
3970
|
+
readonly size: 4;
|
|
3971
|
+
readonly alignment: 4;
|
|
3972
|
+
readonly type: "u32";
|
|
3973
|
+
};
|
|
3974
|
+
readonly quality_tier: {
|
|
3975
|
+
readonly offset: 20;
|
|
3976
|
+
readonly size: 4;
|
|
3977
|
+
readonly alignment: 4;
|
|
3978
|
+
readonly type: "u32";
|
|
3979
|
+
};
|
|
3980
|
+
};
|
|
3981
|
+
};
|
|
3832
3982
|
readonly ot_image_draw_options: {
|
|
3833
3983
|
readonly size: 64;
|
|
3834
3984
|
readonly alignment: 4;
|
|
@@ -4202,7 +4352,7 @@ export declare const nativeLayouts: {
|
|
|
4202
4352
|
};
|
|
4203
4353
|
};
|
|
4204
4354
|
readonly ot_buffer_draw_text_record: {
|
|
4205
|
-
readonly size:
|
|
4355
|
+
readonly size: 48;
|
|
4206
4356
|
readonly alignment: 4;
|
|
4207
4357
|
readonly fields: {
|
|
4208
4358
|
readonly header: {
|
|
@@ -4241,6 +4391,12 @@ export declare const nativeLayouts: {
|
|
|
4241
4391
|
readonly alignment: 2;
|
|
4242
4392
|
readonly type: "[4]u16";
|
|
4243
4393
|
};
|
|
4394
|
+
readonly max_width: {
|
|
4395
|
+
readonly offset: 44;
|
|
4396
|
+
readonly size: 4;
|
|
4397
|
+
readonly alignment: 4;
|
|
4398
|
+
readonly type: "u32";
|
|
4399
|
+
};
|
|
4244
4400
|
};
|
|
4245
4401
|
};
|
|
4246
4402
|
readonly ot_buffer_draw_cell: {
|
|
@@ -5609,6 +5765,7 @@ export declare const nativeConstants: {
|
|
|
5609
5765
|
readonly OT_IMAGE_OUTPUT_TOO_SMALL: -45;
|
|
5610
5766
|
readonly OT_IMAGE_UNSUPPORTED_FEATURE: -46;
|
|
5611
5767
|
readonly OT_IMAGE_BUSY: -47;
|
|
5768
|
+
readonly OT_VIDEO_FAILED: -60;
|
|
5612
5769
|
readonly OT_SCENE_ROOT: 0;
|
|
5613
5770
|
readonly OT_SCENE_BOX: 1;
|
|
5614
5771
|
readonly OT_SCENE_TEXT: 2;
|
|
@@ -5618,6 +5775,7 @@ export declare const nativeConstants: {
|
|
|
5618
5775
|
readonly OT_SCENE_CUSTOM: 6;
|
|
5619
5776
|
readonly OT_SCENE_TEXT_VIEW: 7;
|
|
5620
5777
|
readonly OT_SCENE_IMAGE: 8;
|
|
5778
|
+
readonly OT_SCENE_VIDEO: 9;
|
|
5621
5779
|
readonly OT_SCENE_WRAP_NONE: 0;
|
|
5622
5780
|
readonly OT_SCENE_WRAP_CHAR: 1;
|
|
5623
5781
|
readonly OT_SCENE_WRAP_WORD: 2;
|
|
@@ -5993,6 +6151,13 @@ export declare const nativeConstants: {
|
|
|
5993
6151
|
readonly OT_IMAGE_BLEND_SOURCE_OVER: 0;
|
|
5994
6152
|
readonly OT_IMAGE_BLEND_SOURCE: 1;
|
|
5995
6153
|
readonly OT_IMAGE_BLEND_DESTINATION_OVER: 2;
|
|
6154
|
+
readonly OT_VIDEO_OPEN_NO_AUDIO: 1;
|
|
6155
|
+
readonly OT_VIDEO_PLAYING: 1;
|
|
6156
|
+
readonly OT_VIDEO_ENDED: 2;
|
|
6157
|
+
readonly OT_VIDEO_BUFFERING: 4;
|
|
6158
|
+
readonly OT_VIDEO_AUDIO: 8;
|
|
6159
|
+
readonly OT_VIDEO_HAS_FRAME: 16;
|
|
6160
|
+
readonly OT_VIDEO_ERROR: 32;
|
|
5996
6161
|
readonly OT_TEXT_VIEW_WRAP_WIDTH: 0;
|
|
5997
6162
|
readonly OT_TEXT_VIEW_WRAP_MODE: 1;
|
|
5998
6163
|
readonly OT_TEXT_VIEW_FIRST_LINE_OFFSET: 2;
|
|
@@ -6016,6 +6181,7 @@ export declare const nativeConstants: {
|
|
|
6016
6181
|
readonly OT_BUFFER_DRAW_HAS_BACKGROUND: 1;
|
|
6017
6182
|
readonly OT_BUFFER_DRAW_HAS_SOURCE_WIDTH: 2;
|
|
6018
6183
|
readonly OT_BUFFER_DRAW_HAS_SOURCE_HEIGHT: 4;
|
|
6184
|
+
readonly OT_BUFFER_DRAW_FIT_ELLIPSIS: 16;
|
|
6019
6185
|
readonly OT_BUFFER_STACK_DEPTH_MAX: 256;
|
|
6020
6186
|
readonly OT_BUFFER_STACK_GET_OPACITY: 0;
|
|
6021
6187
|
readonly OT_BUFFER_STACK_PUSH_SCISSOR: 1;
|
|
@@ -6094,6 +6260,8 @@ export declare const nativeConstants: {
|
|
|
6094
6260
|
readonly OT_PUMP_OUTPUT_PENDING: 2;
|
|
6095
6261
|
readonly OT_PUMP_WAIT_UNTIL: 3;
|
|
6096
6262
|
readonly OT_PUMP_CLOSED: 4;
|
|
6263
|
+
readonly OT_STDOUT_IDLE: 0;
|
|
6264
|
+
readonly OT_STDOUT_IN_FLIGHT: 1;
|
|
6097
6265
|
readonly OT_INPUT_KEY: 1;
|
|
6098
6266
|
readonly OT_INPUT_MOUSE: 2;
|
|
6099
6267
|
readonly OT_INPUT_PASTE: 3;
|
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.8.
|
|
7
|
+
"version": "0.8.2",
|
|
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": {
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
"web-tree-sitter": "0.25.10"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
|
-
"@opentui/core-darwin-x64": "0.8.
|
|
82
|
-
"@opentui/core-darwin-arm64": "0.8.
|
|
83
|
-
"@opentui/core-linux-x64": "0.8.
|
|
84
|
-
"@opentui/core-linux-arm64": "0.8.
|
|
85
|
-
"@opentui/core-win32-x64": "0.8.
|
|
86
|
-
"@opentui/core-win32-arm64": "0.8.
|
|
87
|
-
"@opentui/core-linux-x64-musl": "0.8.
|
|
88
|
-
"@opentui/core-linux-arm64-musl": "0.8.
|
|
81
|
+
"@opentui/core-darwin-x64": "0.8.2",
|
|
82
|
+
"@opentui/core-darwin-arm64": "0.8.2",
|
|
83
|
+
"@opentui/core-linux-x64": "0.8.2",
|
|
84
|
+
"@opentui/core-linux-arm64": "0.8.2",
|
|
85
|
+
"@opentui/core-win32-x64": "0.8.2",
|
|
86
|
+
"@opentui/core-win32-arm64": "0.8.2",
|
|
87
|
+
"@opentui/core-linux-x64-musl": "0.8.2",
|
|
88
|
+
"@opentui/core-linux-arm64-musl": "0.8.2"
|
|
89
89
|
}
|
|
90
90
|
}
|
package/renderables/Image.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Renderable, type RenderableOptions, type NativeRenderableIntegration } from "../Renderable.js";
|
|
2
|
-
import { NativeImage, type ImageSource } from "../image.js";
|
|
2
|
+
import { NativeImage, type ExtractOptions, type ImageSource } from "../image.js";
|
|
3
3
|
import type { OptimizedBuffer } from "../buffer.js";
|
|
4
4
|
import type { ImageRenderProtocol, RenderContext, TerminalCapabilities } from "../types.js";
|
|
5
5
|
export type ImageFit = "fit" | "cover" | "fill";
|
|
@@ -7,11 +7,17 @@ export type ImageRenderableSource = ImageSource | NativeImage;
|
|
|
7
7
|
export interface ImageRenderableOptions extends RenderableOptions<ImageRenderable> {
|
|
8
8
|
source?: ImageRenderableSource;
|
|
9
9
|
fit?: ImageFit;
|
|
10
|
+
/** The region of the source to show, in source pixels; `fit` applies to it. */
|
|
11
|
+
crop?: ExtractOptions;
|
|
10
12
|
protocol?: ImageRenderProtocol;
|
|
11
13
|
onLoad?: (image: NativeImage) => void;
|
|
12
14
|
onError?: (error: unknown) => void;
|
|
13
15
|
}
|
|
14
16
|
export declare function resolveImageRenderProtocol(requested: ImageRenderProtocol, capabilities: TerminalCapabilities | null, hasResolution: boolean): Exclude<ImageRenderProtocol, "auto">;
|
|
17
|
+
/** @internal Copies a crop of u32 pixels with a positive size that lies inside a width x height source, or throws. */
|
|
18
|
+
export declare function checkCrop(crop: ExtractOptions, width?: number, height?: number): ExtractOptions;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare function sameCrop(a: ExtractOptions | undefined, b: ExtractOptions | undefined): boolean;
|
|
15
21
|
export declare class ImageRenderable extends Renderable {
|
|
16
22
|
static readonly nativeIntegration: NativeRenderableIntegration;
|
|
17
23
|
private _source;
|
|
@@ -22,6 +28,7 @@ export declare class ImageRenderable extends Renderable {
|
|
|
22
28
|
onLoad?: (image: NativeImage) => void;
|
|
23
29
|
onError?: (error: unknown) => void;
|
|
24
30
|
private _fit;
|
|
31
|
+
private _crop;
|
|
25
32
|
private _protocol;
|
|
26
33
|
loadPromise: Promise<void> | null;
|
|
27
34
|
constructor(ctx: RenderContext, options: ImageRenderableOptions);
|
|
@@ -30,6 +37,9 @@ export declare class ImageRenderable extends Renderable {
|
|
|
30
37
|
get image(): NativeImage | null;
|
|
31
38
|
get fit(): ImageFit;
|
|
32
39
|
set fit(value: ImageFit | null | undefined);
|
|
40
|
+
get crop(): ExtractOptions | undefined;
|
|
41
|
+
/** A crop that is not whole pixels, or lies outside the loaded image, reports through onError and keeps the previous one. */
|
|
42
|
+
set crop(value: ExtractOptions | null | undefined);
|
|
33
43
|
get protocol(): ImageRenderProtocol;
|
|
34
44
|
set protocol(value: ImageRenderProtocol | null | undefined);
|
|
35
45
|
get effectiveProtocol(): Exclude<ImageRenderProtocol, "auto">;
|
|
@@ -43,6 +53,8 @@ export declare class ImageRenderable extends Renderable {
|
|
|
43
53
|
protected createFrameBuffer(): void;
|
|
44
54
|
protected renderSelf(buffer: OptimizedBuffer): void;
|
|
45
55
|
private load;
|
|
56
|
+
private region;
|
|
57
|
+
private acceptCrop;
|
|
46
58
|
private setNativeSceneImage;
|
|
47
59
|
protected destroySelf(): void;
|
|
48
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Renderable, type BaseRenderable, type RenderableOptions } from "../Renderable.js";
|
|
2
|
-
import { OptimizedBuffer } from "../buffer.js";
|
|
2
|
+
import type { OptimizedBuffer } from "../buffer.js";
|
|
3
3
|
import type { RenderContext, LineInfoProvider } from "../types.js";
|
|
4
4
|
import { RGBA } from "../lib/RGBA.js";
|
|
5
5
|
export interface LineSign {
|
|
@@ -205,6 +205,7 @@ export declare class MarkdownRenderable extends Renderable {
|
|
|
205
205
|
private destroyListItemChildrenAfter;
|
|
206
206
|
private applyListItemMarker;
|
|
207
207
|
private createListChildRenderable;
|
|
208
|
+
private getHorizontalRuleColor;
|
|
208
209
|
private createHorizontalRuleRenderable;
|
|
209
210
|
private createCodeRenderable;
|
|
210
211
|
private applyMarkdownCodeRenderable;
|
|
@@ -247,14 +248,8 @@ export declare class MarkdownRenderable extends Renderable {
|
|
|
247
248
|
private destroyUnusedDefaultRenderable;
|
|
248
249
|
private updateBlockRenderable;
|
|
249
250
|
private updateTopLevelBlocks;
|
|
250
|
-
private canUpdateBlockRenderable;
|
|
251
251
|
private updateBlocks;
|
|
252
252
|
private clearBlockStates;
|
|
253
|
-
/**
|
|
254
|
-
* Re-render existing blocks without rebuilding the parse state or block structure.
|
|
255
|
-
* Used when only style/conceal changes - much faster than full rebuild.
|
|
256
|
-
*/
|
|
257
|
-
private rerenderBlocks;
|
|
258
253
|
clearCache(): void;
|
|
259
254
|
refreshStyles(): void;
|
|
260
255
|
private markStyleDirty;
|
|
@@ -35,7 +35,7 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
|
|
|
35
35
|
readonly horizontalScrollBar: ScrollBoxBar;
|
|
36
36
|
readonly verticalScrollBar: ScrollBoxBar;
|
|
37
37
|
protected static readonly defaultFocusable = true;
|
|
38
|
-
private selectionListener
|
|
38
|
+
private readonly selectionListener;
|
|
39
39
|
private autoScrollMouseX;
|
|
40
40
|
private autoScrollMouseY;
|
|
41
41
|
private readonly autoScrollThresholdVertical;
|
package/renderables/Select.d.ts
CHANGED
|
@@ -83,8 +83,6 @@ export declare class SelectRenderable extends Renderable {
|
|
|
83
83
|
};
|
|
84
84
|
constructor(ctx: RenderContext, options: SelectRenderableOptions);
|
|
85
85
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
86
|
-
private refreshFrameBuffer;
|
|
87
|
-
private renderScrollIndicatorToFrameBuffer;
|
|
88
86
|
get options(): SelectOption[];
|
|
89
87
|
set options(options: SelectOption[]);
|
|
90
88
|
getSelectedOption(): SelectOption | null;
|
|
@@ -60,9 +60,6 @@ export declare class TabSelectRenderable extends Renderable {
|
|
|
60
60
|
private calculateDynamicHeight;
|
|
61
61
|
protected defaultDimension(kind: "width" | "height"): number | "auto" | `${number}%`;
|
|
62
62
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
63
|
-
private refreshFrameBuffer;
|
|
64
|
-
private truncateText;
|
|
65
|
-
private renderScrollArrowsToFrameBuffer;
|
|
66
63
|
setOptions(options: TabSelectOption[]): void;
|
|
67
64
|
getSelectedOption(): TabSelectOption | null;
|
|
68
65
|
getSelectedIndex(): number;
|
|
@@ -61,7 +61,6 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
61
61
|
private _columnCount;
|
|
62
62
|
private _layout;
|
|
63
63
|
private _layoutDirty;
|
|
64
|
-
private _rasterDirty;
|
|
65
64
|
private _cachedMeasureLayout;
|
|
66
65
|
private _cachedMeasureWidth;
|
|
67
66
|
private readonly _defaultOptions;
|
|
@@ -130,9 +129,6 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
130
129
|
private getHorizontalBorderCount;
|
|
131
130
|
private drawBorders;
|
|
132
131
|
private drawCells;
|
|
133
|
-
private drawCellRange;
|
|
134
|
-
private redrawSelectionRows;
|
|
135
|
-
private clearCellRange;
|
|
136
132
|
private ensureLayoutReady;
|
|
137
133
|
private getCellAtLocalPosition;
|
|
138
134
|
private applySelectionToCells;
|
|
@@ -140,8 +136,6 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
140
136
|
private getColumnAtLocalX;
|
|
141
137
|
private getFullCellSelectionCoords;
|
|
142
138
|
private findRowForLocalY;
|
|
143
|
-
private getSelectionRowRange;
|
|
144
|
-
private getDirtySelectionRowRange;
|
|
145
139
|
private resetRowSelection;
|
|
146
140
|
private resetCellSelections;
|
|
147
141
|
private createEmptyLayout;
|
|
@@ -151,6 +145,5 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
151
145
|
private resolveColumnFitter;
|
|
152
146
|
private resolveCellPadding;
|
|
153
147
|
private resolveColumnGap;
|
|
154
|
-
private
|
|
155
|
-
private invalidateRasterOnly;
|
|
148
|
+
private invalidateLayout;
|
|
156
149
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { OptimizedBuffer } from "../buffer.js";
|
|
2
|
+
import { Renderable, type NativeRenderableIntegration, type RenderableOptions } from "../Renderable.js";
|
|
3
|
+
import type { RenderContext } from "../types.js";
|
|
4
|
+
import type { ExtractOptions } from "../image.js";
|
|
5
|
+
import { type ImageFit } from "./Image.js";
|
|
6
|
+
export interface VideoMetadata {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
fps: number;
|
|
10
|
+
duration: number;
|
|
11
|
+
hasAudio: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface VideoRenderableOptions extends RenderableOptions<VideoRenderable> {
|
|
14
|
+
/** Path of an MP4 (H.264/AAC) file. */
|
|
15
|
+
source?: string;
|
|
16
|
+
fit?: ImageFit;
|
|
17
|
+
/** The region of the source to show, in source pixels; `fit` applies to it, and only the region is scaled. */
|
|
18
|
+
crop?: ExtractOptions;
|
|
19
|
+
/** Plays each source once it opens. */
|
|
20
|
+
autoplay?: boolean;
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
/** Opens the audio track. With false, playback opens no audio device and follows the wall clock. Defaults to true. */
|
|
23
|
+
audio?: boolean;
|
|
24
|
+
muted?: boolean;
|
|
25
|
+
volume?: number;
|
|
26
|
+
/** Positive values show frames earlier relative to the audio. */
|
|
27
|
+
avSyncOffsetMs?: number;
|
|
28
|
+
/** Upper bound of the presentation rate, an integer from 1 to 120. Defaults to 30. */
|
|
29
|
+
maxFps?: number;
|
|
30
|
+
onReady?: (metadata: VideoMetadata) => void;
|
|
31
|
+
onError?: (error: Error) => void;
|
|
32
|
+
onEnd?: () => void;
|
|
33
|
+
onPlay?: () => void;
|
|
34
|
+
onPause?: () => void;
|
|
35
|
+
onSeek?: (time: number) => void;
|
|
36
|
+
onTimeUpdate?: (time: number) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Plays a video file in a native scene node. Decoding, the media clock, and frame drawing stay native;
|
|
40
|
+
* this wrapper sends control calls and reads playback state on the animation clock while playing.
|
|
41
|
+
*/
|
|
42
|
+
export declare class VideoRenderable extends Renderable {
|
|
43
|
+
static readonly nativeIntegration: NativeRenderableIntegration;
|
|
44
|
+
private _source;
|
|
45
|
+
private _fit;
|
|
46
|
+
private _crop;
|
|
47
|
+
private _loop;
|
|
48
|
+
private _audio;
|
|
49
|
+
private _muted;
|
|
50
|
+
private _volume;
|
|
51
|
+
private _avSyncOffsetMs;
|
|
52
|
+
private _maxFps;
|
|
53
|
+
private _autoplay;
|
|
54
|
+
private _metadata;
|
|
55
|
+
private _playRequested;
|
|
56
|
+
private stopTick?;
|
|
57
|
+
private _opens;
|
|
58
|
+
onReady?: (metadata: VideoMetadata) => void;
|
|
59
|
+
onError?: (error: Error) => void;
|
|
60
|
+
onEnd?: () => void;
|
|
61
|
+
onPlay?: () => void;
|
|
62
|
+
onPause?: () => void;
|
|
63
|
+
onSeek?: (time: number) => void;
|
|
64
|
+
onTimeUpdate?: (time: number) => void;
|
|
65
|
+
constructor(ctx: RenderContext, options: VideoRenderableOptions);
|
|
66
|
+
get source(): string | undefined;
|
|
67
|
+
/** Opens a new source; playback intent carries over to it. */
|
|
68
|
+
set source(value: string | null | undefined);
|
|
69
|
+
private open;
|
|
70
|
+
get fit(): ImageFit;
|
|
71
|
+
set fit(value: ImageFit | null | undefined);
|
|
72
|
+
get crop(): ExtractOptions | undefined;
|
|
73
|
+
/** A crop that is not whole pixels, or lies outside the open source, reports through onError and keeps the previous one. */
|
|
74
|
+
set crop(value: ExtractOptions | null | undefined);
|
|
75
|
+
get loop(): boolean;
|
|
76
|
+
set loop(value: boolean | null | undefined);
|
|
77
|
+
get audio(): boolean;
|
|
78
|
+
set audio(value: boolean | null | undefined);
|
|
79
|
+
get muted(): boolean;
|
|
80
|
+
set muted(value: boolean | null | undefined);
|
|
81
|
+
get volume(): number;
|
|
82
|
+
set volume(value: number | null | undefined);
|
|
83
|
+
get avSyncOffsetMs(): number;
|
|
84
|
+
set avSyncOffsetMs(value: number | null | undefined);
|
|
85
|
+
get maxFps(): number;
|
|
86
|
+
set maxFps(value: number | null | undefined);
|
|
87
|
+
/** Applies to the next source that opens, and to an open source that has not started yet. */
|
|
88
|
+
get autoplay(): boolean;
|
|
89
|
+
set autoplay(value: boolean | null | undefined);
|
|
90
|
+
get ready(): boolean;
|
|
91
|
+
get videoMetadata(): Readonly<VideoMetadata> | null;
|
|
92
|
+
get playing(): boolean;
|
|
93
|
+
get paused(): boolean;
|
|
94
|
+
get ended(): boolean;
|
|
95
|
+
get duration(): number;
|
|
96
|
+
get durationMs(): number;
|
|
97
|
+
get currentTime(): number;
|
|
98
|
+
/** Seeks; a nullish write is ignored. */
|
|
99
|
+
set currentTime(value: number | null | undefined);
|
|
100
|
+
/** Adaptive quality tier: 0 decodes at full size; higher tiers decode smaller while output cannot keep up. */
|
|
101
|
+
get qualityTier(): number;
|
|
102
|
+
get currentTimeMs(): number;
|
|
103
|
+
play(): void;
|
|
104
|
+
resume(): void;
|
|
105
|
+
pause(): void;
|
|
106
|
+
toggle(): void;
|
|
107
|
+
seek(time: number): void;
|
|
108
|
+
seekBy(delta: number): void;
|
|
109
|
+
seekToMs(milliseconds: number): void;
|
|
110
|
+
protected createFrameBuffer(): void;
|
|
111
|
+
protected renderSelf(_buffer: OptimizedBuffer): void;
|
|
112
|
+
private poll;
|
|
113
|
+
private native;
|
|
114
|
+
private readState;
|
|
115
|
+
private failed;
|
|
116
|
+
private errorDetail;
|
|
117
|
+
private applyOption;
|
|
118
|
+
private control;
|
|
119
|
+
private syncPlayback;
|
|
120
|
+
private setNativeSceneVideo;
|
|
121
|
+
private acceptCrop;
|
|
122
|
+
private startRequested;
|
|
123
|
+
private afterOpen;
|
|
124
|
+
private reportError;
|
|
125
|
+
protected destroySelf(): void;
|
|
126
|
+
}
|
package/renderables/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./EmbeddedTerminal.js";
|
|
|
10
10
|
export * from "./FrameBuffer.js";
|
|
11
11
|
export * from "./Input.js";
|
|
12
12
|
export * from "./Image.js";
|
|
13
|
+
export * from "./Video.js";
|
|
13
14
|
export * from "./LineNumberRenderable.js";
|
|
14
15
|
export * from "./Markdown.js";
|
|
15
16
|
export * from "./ScrollBar.js";
|
|
@@ -7,5 +7,6 @@ export interface ParseState {
|
|
|
7
7
|
/**
|
|
8
8
|
* Incrementally parse markdown, reusing unchanged tokens from previous parse.
|
|
9
9
|
* Compares token.raw at each offset - matching tokens keep same object reference.
|
|
10
|
+
* trailingUnstable 0 lexes it all unless nothing changed since a lex at 0: an edit can grow any block or add a link def.
|
|
10
11
|
*/
|
|
11
12
|
export declare function parseMarkdownIncremental(newContent: string, prevState: ParseState | null, trailingUnstable?: number): ParseState;
|
package/renderer.d.ts
CHANGED
|
@@ -92,6 +92,13 @@ export interface CliRendererErrorEvent {
|
|
|
92
92
|
error: Error;
|
|
93
93
|
renderable: Renderable | undefined;
|
|
94
94
|
}
|
|
95
|
+
/** A frame whose output, without image uploads, is larger than one frame of Session output. */
|
|
96
|
+
export interface CliRendererFrameDroppedEvent {
|
|
97
|
+
/** The frame's encoded size in bytes. */
|
|
98
|
+
bytes: number;
|
|
99
|
+
/** The most bytes one frame can write. */
|
|
100
|
+
limit: number;
|
|
101
|
+
}
|
|
95
102
|
export interface RendererSchedulerState {
|
|
96
103
|
isRunning: boolean;
|
|
97
104
|
isRendering: boolean;
|
|
@@ -204,6 +211,7 @@ export declare enum CliRenderEvents {
|
|
|
204
211
|
RESIZE = "resize",
|
|
205
212
|
FRAME = "frame",
|
|
206
213
|
RENDER_ERROR = "render:error",
|
|
214
|
+
FRAME_DROPPED = "frame:dropped",
|
|
207
215
|
HANDLER_ERROR = "handler:error",
|
|
208
216
|
EXTERNAL_OUTPUT = "external_output",
|
|
209
217
|
FOCUS = "focus",
|
|
@@ -344,11 +352,16 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
344
352
|
private pendingSplitFooterTransition;
|
|
345
353
|
private forceFullRepaintRequested;
|
|
346
354
|
private readonly maxSplitCommitsPerFrame;
|
|
355
|
+
private splitCommitLimit;
|
|
356
|
+
private droppedFrames;
|
|
357
|
+
private dropRetried;
|
|
347
358
|
private _terminalWidth;
|
|
348
359
|
private _terminalHeight;
|
|
349
360
|
private _terminalIsSetup;
|
|
350
361
|
private externalOutputQueue;
|
|
351
362
|
private pendingExternalOutputMode;
|
|
363
|
+
private readonly stdoutDecoder;
|
|
364
|
+
private stdoutEscape;
|
|
352
365
|
private realStdoutWrite;
|
|
353
366
|
private _useConsole;
|
|
354
367
|
private sigwinchHandler;
|
|
@@ -477,8 +490,8 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
477
490
|
/**
|
|
478
491
|
* Report program status with OSC 7501. Terminals that do not implement the
|
|
479
492
|
* protocol ignore it, so this does not wait for `capabilities.program_status`.
|
|
480
|
-
* Returns false when the report is not queued: the
|
|
481
|
-
* terminal is not active, or output is full. Invalid reports throw.
|
|
493
|
+
* Returns false when the report is not queued: the session failed or is closing (from the
|
|
494
|
+
* microtask after `destroy()`), the terminal is not active, or output is full. Invalid reports throw.
|
|
482
495
|
*/
|
|
483
496
|
setProgramStatus(status: ProgramStatus): boolean;
|
|
484
497
|
get themeMode(): ThemeMode | null;
|
|
@@ -500,9 +513,12 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
500
513
|
private getPendingSplitTailColumn;
|
|
501
514
|
private enqueueRenderedScrollbackCommit;
|
|
502
515
|
private enqueueSplitCommits;
|
|
516
|
+
private emitExternalOutput;
|
|
503
517
|
private splitStdoutRows;
|
|
504
518
|
private createStdoutSnapshotCommits;
|
|
519
|
+
private flushStdoutDecoder;
|
|
505
520
|
private interceptStdoutWrite;
|
|
521
|
+
private createDroppedRowCommit;
|
|
506
522
|
private getSplitPinnedRenderOffset;
|
|
507
523
|
private getSplitCursorSeedRows;
|
|
508
524
|
private isSplitCursorSeedFrameBlocked;
|
|
@@ -650,6 +666,11 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
650
666
|
* `nativeTerminalTransition` first, so a frame without a transition does not yield. */
|
|
651
667
|
private waitForTerminalTransition;
|
|
652
668
|
intermediateRender(): void;
|
|
669
|
+
/**
|
|
670
|
+
* After a failed frame: false unless the frame was dropped for its size. A dropped scrollback batch goes again one
|
|
671
|
+
* commit at a time, and a single commit is dropped. Each dropped content is reported once.
|
|
672
|
+
*/
|
|
673
|
+
private handleDroppedFrame;
|
|
653
674
|
private presentNativeScene;
|
|
654
675
|
private completeNativeSplitCommits;
|
|
655
676
|
private flushNativeSplitOutput;
|
package/testing.bun.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
TreeSitterClient2,
|
|
5
5
|
ANSI,
|
|
6
6
|
CliRenderer2
|
|
7
|
-
} from "./chunk-bun-
|
|
7
|
+
} from "./chunk-bun-vd3rj9kv.js";
|
|
8
8
|
import {
|
|
9
9
|
nativeConstants
|
|
10
|
-
} from "./chunk-bun-
|
|
10
|
+
} from "./chunk-bun-wdetc10w.js";
|
|
11
11
|
|
|
12
12
|
// src/testing/mock-keys.ts
|
|
13
13
|
import { Buffer as Buffer2 } from "buffer";
|