@opentui/core 0.7.0 → 0.8.0
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 +9 -3
- package/Renderable.d.ts +20 -2
- package/animation/Timeline.d.ts +9 -0
- package/buffer.d.ts +6 -2
- package/{chunk-bun-zevtbcf6.js → chunk-bun-6kxdhkdc.js} +407 -259
- package/chunk-bun-6kxdhkdc.js.map +70 -0
- package/{chunk-bun-qkpm62w1.js → chunk-bun-x6cz4jyg.js} +263 -21
- package/chunk-bun-x6cz4jyg.js.map +35 -0
- package/{chunk-node-7bcmqh18.js → chunk-node-q5ccgbk5.js} +407 -259
- package/{chunk-bun-zevtbcf6.js.map → chunk-node-q5ccgbk5.js.map} +15 -15
- package/{chunk-node-mzgnr3sw.js → chunk-node-y0w0hq5m.js} +263 -21
- package/chunk-node-y0w0hq5m.js.map +34 -0
- package/edit-buffer.d.ts +4 -0
- package/index.bun.js +788 -473
- package/index.bun.js.map +11 -10
- package/index.d.ts +1 -1
- package/index.node.js +788 -473
- package/index.node.js.map +11 -9
- package/lib/extmarks.d.ts +3 -1
- package/lib/stdin-parser-native.d.ts +2 -0
- package/lib/stdin-parser.d.ts +2 -0
- package/lib/terminal-capability-detection.d.ts +6 -1
- package/native-abi.generated.d.ts +307 -3
- package/package.json +9 -9
- package/renderables/FrameBuffer.d.ts +1 -0
- package/renderables/ScrollBar.d.ts +6 -0
- package/renderables/ScrollBox.d.ts +83 -43
- package/renderables/ScrollBoxParts.d.ts +165 -0
- package/renderables/index.d.ts +1 -1
- package/renderer-theme-mode.d.ts +1 -6
- package/renderer.d.ts +22 -3
- package/testing/test-renderer.d.ts +2 -0
- package/testing.bun.js +7 -6
- package/testing.bun.js.map +3 -3
- package/testing.js +7 -6
- package/testing.js.map +3 -3
- package/types.d.ts +11 -0
- package/yoga.bun.js +1 -1
- package/yoga.internal.d.ts +3 -3
- package/yoga.js +1 -1
- package/zig-structs.d.ts +1 -0
- package/zig.d.ts +78 -8
- package/chunk-bun-qkpm62w1.js.map +0 -35
- package/chunk-node-7bcmqh18.js.map +0 -70
- package/chunk-node-mzgnr3sw.js.map +0 -34
package/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RGBA } from "./lib/RGBA.js";
|
|
2
|
+
import type { Clock } from "./lib/clock.js";
|
|
2
3
|
import type { EventEmitter } from "events";
|
|
3
4
|
import type { Selection } from "./lib/selection.js";
|
|
4
5
|
import type { Renderable } from "./Renderable.js";
|
|
@@ -131,6 +132,13 @@ export interface RendererEvents {
|
|
|
131
132
|
"debugOverlay:toggle": (enabled: boolean) => void;
|
|
132
133
|
theme_mode: (mode: ThemeMode) => void;
|
|
133
134
|
}
|
|
135
|
+
/** `deltaTime` is the time since this subscriber's previous tick, `ticks` the due times the frame covers (1 unless
|
|
136
|
+
* frames stalled), and `time` the frame's clock time. A tick may run up to its tolerance before its due time. */
|
|
137
|
+
export type AnimationTickCallback = (deltaTime: number, ticks: number, time: number) => void;
|
|
138
|
+
export interface AnimationTickOptions {
|
|
139
|
+
/** How early a tick may run to share a frame, in ms, below the interval. Default: half the interval. */
|
|
140
|
+
tolerance?: number;
|
|
141
|
+
}
|
|
134
142
|
export interface RenderContext extends EventEmitter {
|
|
135
143
|
readonly nativeScene: NativeScene;
|
|
136
144
|
width: number;
|
|
@@ -143,6 +151,8 @@ export interface RenderContext extends EventEmitter {
|
|
|
143
151
|
} | null;
|
|
144
152
|
/** Monotonic, bumped once per `loop()` iteration. Lets renderables dedupe per-frame work. */
|
|
145
153
|
frameId: number;
|
|
154
|
+
/** Schedules renderable timers; a test renderer can take a `ManualClock`. */
|
|
155
|
+
clock: Clock;
|
|
146
156
|
requestRender: () => void;
|
|
147
157
|
requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
148
158
|
cancelAnimationFrame: (handle: number) => void;
|
|
@@ -154,6 +164,7 @@ export interface RenderContext extends EventEmitter {
|
|
|
154
164
|
capabilities: TerminalCapabilities | null;
|
|
155
165
|
requestLive: () => void;
|
|
156
166
|
dropLive: () => void;
|
|
167
|
+
onAnimationTick: (fps: number, callback: AnimationTickCallback, options?: AnimationTickOptions) => () => void;
|
|
157
168
|
hasSelection: boolean;
|
|
158
169
|
getSelection: () => Selection | null;
|
|
159
170
|
requestSelectionUpdate: () => void;
|
package/yoga.bun.js
CHANGED
package/yoga.internal.d.ts
CHANGED
|
@@ -41,11 +41,11 @@ export type YogaValueKindId = (typeof YogaValueKind)[keyof typeof YogaValueKind]
|
|
|
41
41
|
type SceneStyleNode = {
|
|
42
42
|
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
43
43
|
};
|
|
44
|
-
export declare function sceneSetEnum(scene: NativeScene, node: SceneStyleNode, kind: YogaEnumKindId, value: number): void;
|
|
44
|
+
export declare function sceneSetEnum(scene: NativeScene, node: SceneStyleNode, kind: YogaEnumKindId, value: number, flags?: number): void;
|
|
45
45
|
export declare function sceneGetEnum(scene: NativeScene, node: SceneStyleNode, kind: YogaEnumKindId): number;
|
|
46
|
-
export declare function sceneSetFloat(scene: NativeScene, node: SceneStyleNode, kind: YogaFloatKindId, value: number | undefined): void;
|
|
46
|
+
export declare function sceneSetFloat(scene: NativeScene, node: SceneStyleNode, kind: YogaFloatKindId, value: number | undefined, flags?: number): void;
|
|
47
47
|
export declare function sceneGetFloat(scene: NativeScene, node: SceneStyleNode, kind: YogaFloatKindId): number;
|
|
48
|
-
export declare function sceneSetValue(scene: NativeScene, node: SceneStyleNode, kind: YogaValueKindId, edge: number, valueInput: ValueInput): void;
|
|
48
|
+
export declare function sceneSetValue(scene: NativeScene, node: SceneStyleNode, kind: YogaValueKindId, edge: number, valueInput: ValueInput, flags?: number): void;
|
|
49
49
|
export declare function sceneGetValue(scene: NativeScene, node: SceneStyleNode, kind: YogaValueKindId, edge: number): Value;
|
|
50
50
|
export declare function sceneSetDimension(scene: NativeScene, node: SceneStyleNode, dimension: Dimension, input: ValueInput, disableFlexShrink?: boolean): void;
|
|
51
51
|
export declare const UNDEFINED_VALUE: Value;
|
package/yoga.js
CHANGED
package/zig-structs.d.ts
CHANGED
package/zig.d.ts
CHANGED
|
@@ -141,7 +141,9 @@ export declare enum NativeEditPositionQuery {
|
|
|
141
141
|
Eol = 3,
|
|
142
142
|
Offset = 4,
|
|
143
143
|
Coords = 5,
|
|
144
|
-
LineStart = 6
|
|
144
|
+
LineStart = 6,
|
|
145
|
+
End = 7,
|
|
146
|
+
PrevChar = 8
|
|
145
147
|
}
|
|
146
148
|
export declare enum NativeEditorStyleMask {
|
|
147
149
|
Foreground = 1,
|
|
@@ -270,7 +272,8 @@ export declare enum NativeStyleGroup {
|
|
|
270
272
|
}
|
|
271
273
|
export declare enum NativeStyleFlags {
|
|
272
274
|
None,
|
|
273
|
-
DisableFlexShrink
|
|
275
|
+
DisableFlexShrink,
|
|
276
|
+
Content
|
|
274
277
|
}
|
|
275
278
|
/** ENUM/FLOAT/DIMENSION writes occupy this unused-edge slot. */
|
|
276
279
|
export declare const NATIVE_EDGE_NONE: 0;
|
|
@@ -307,14 +310,16 @@ export declare enum NativeSceneHook {
|
|
|
307
310
|
RenderBefore,
|
|
308
311
|
RenderAfter,
|
|
309
312
|
RenderSelf,
|
|
310
|
-
IdleUpdate
|
|
313
|
+
IdleUpdate,
|
|
314
|
+
Scroll
|
|
311
315
|
}
|
|
312
316
|
export declare enum NativeSceneFrame {
|
|
313
317
|
Done,
|
|
314
318
|
Update,
|
|
315
319
|
Resize,
|
|
316
320
|
LayoutChanged,
|
|
317
|
-
Record
|
|
321
|
+
Record,
|
|
322
|
+
Scroll
|
|
318
323
|
}
|
|
319
324
|
export declare enum NativeScenePaintPhase {
|
|
320
325
|
Before,
|
|
@@ -506,6 +511,51 @@ export interface NativeSceneArrowOptions {
|
|
|
506
511
|
backgroundColor: RGBA;
|
|
507
512
|
text?: string;
|
|
508
513
|
}
|
|
514
|
+
export interface NativeSceneScrollBarOptions {
|
|
515
|
+
policy: "auto" | "always" | "never";
|
|
516
|
+
overlay: boolean;
|
|
517
|
+
thickness: number;
|
|
518
|
+
gap: number;
|
|
519
|
+
arrows: boolean;
|
|
520
|
+
foregroundColor: RGBA;
|
|
521
|
+
backgroundColor: RGBA;
|
|
522
|
+
}
|
|
523
|
+
/** Viewport padding is left, top, right, bottom; bars are horizontal, vertical. */
|
|
524
|
+
export interface NativeSceneScrollOptions {
|
|
525
|
+
scrollX: boolean;
|
|
526
|
+
scrollY: boolean;
|
|
527
|
+
follow: "none" | "top" | "bottom" | "left" | "right";
|
|
528
|
+
culling: boolean;
|
|
529
|
+
padding: readonly number[];
|
|
530
|
+
fills: readonly (RGBA | undefined)[];
|
|
531
|
+
bars: readonly NativeSceneScrollBarOptions[];
|
|
532
|
+
}
|
|
533
|
+
export interface NativeSceneRect {
|
|
534
|
+
x: number;
|
|
535
|
+
y: number;
|
|
536
|
+
width: number;
|
|
537
|
+
height: number;
|
|
538
|
+
}
|
|
539
|
+
export interface NativeSceneScrollBarState {
|
|
540
|
+
visible: boolean;
|
|
541
|
+
track: NativeSceneRect;
|
|
542
|
+
startArrow: NativeSceneRect;
|
|
543
|
+
endArrow: NativeSceneRect;
|
|
544
|
+
thumbStart: number;
|
|
545
|
+
thumbSize: number;
|
|
546
|
+
}
|
|
547
|
+
/** Axis 0 is x, axis 1 is y. `content` is local to the box; the other rects are screen cells. `changes` holds the
|
|
548
|
+
* OT_SCENE_SCROLL_CHANGED_* bits of the last SCROLL request. */
|
|
549
|
+
export interface NativeSceneScrollState {
|
|
550
|
+
changes: number;
|
|
551
|
+
offset: [number, number];
|
|
552
|
+
max: [number, number];
|
|
553
|
+
content: NativeSceneRect;
|
|
554
|
+
viewport: NativeSceneRect;
|
|
555
|
+
bars: [NativeSceneScrollBarState, NativeSceneScrollBarState];
|
|
556
|
+
}
|
|
557
|
+
/** The state of a scroll node before its first frame. */
|
|
558
|
+
export declare function emptySceneScrollState(): NativeSceneScrollState;
|
|
509
559
|
export interface NativeSessionBufferLease {
|
|
510
560
|
handle: ContextObjectHandle;
|
|
511
561
|
width: number;
|
|
@@ -577,7 +627,15 @@ export interface NativeSessionTerminalOptions {
|
|
|
577
627
|
mouseMovement?: boolean;
|
|
578
628
|
kittyKeyboardFlags?: number;
|
|
579
629
|
clearOnClose?: boolean;
|
|
580
|
-
|
|
630
|
+
/** End the startup query batch with DA1 (the reply sentinel). Defaults to false. */
|
|
631
|
+
replySentinel?: boolean;
|
|
632
|
+
/** Wrap frames in synchronized output (DEC mode 2026). Defaults to "auto". */
|
|
633
|
+
synchronizedOutput?: SynchronizedOutput;
|
|
634
|
+
/** The output passes through tmux, screen or Zellij on this host. Defaults to false. */
|
|
635
|
+
hostMultiplexer?: boolean;
|
|
636
|
+
}
|
|
637
|
+
/** "auto" leaves synchronized output out for a remote terminal without mode 2026 or under a multiplexer on the app's host. */
|
|
638
|
+
export type SynchronizedOutput = "auto" | "always" | "never";
|
|
581
639
|
export declare enum NativeSessionTerminalPhase {
|
|
582
640
|
Uninitialized = 0,
|
|
583
641
|
SettingUp = 1,
|
|
@@ -626,7 +684,10 @@ export type NativeSessionControl = {
|
|
|
626
684
|
kind: "program-status";
|
|
627
685
|
status: ProgramStatus;
|
|
628
686
|
} | {
|
|
629
|
-
kind: "
|
|
687
|
+
kind: "query-pixel-resolution";
|
|
688
|
+
sentinel?: boolean;
|
|
689
|
+
} | {
|
|
690
|
+
kind: "restore-modes" | "query-theme-colors" | "reset-background";
|
|
630
691
|
};
|
|
631
692
|
export interface NativeSessionCursorOptions extends CursorStyleOptions {
|
|
632
693
|
position?: {
|
|
@@ -866,7 +927,7 @@ export declare class NativePaintRecorder {
|
|
|
866
927
|
supersample(data: Uint8Array | PointerInput, byteLength: number, x: number, y: number, format: "rgba8unorm" | "bgra8unorm", stride: number): void;
|
|
867
928
|
grayscale(data: Float32Array, x: number, y: number, width: number, height: number, foreground: RGBA | null, background: RGBA | null, supersampled: boolean): void;
|
|
868
929
|
colorMatrix(matrix: Float32Array, mask: Float32Array | null, strength: number, channel: number): void;
|
|
869
|
-
/** Draw a text-buffer view, editor view, or scene
|
|
930
|
+
/** Draw a text-buffer view, editor view, or scene node body. */
|
|
870
931
|
view(operation: "text" | "editor" | "scene", source: ContextObjectHandle, x: number, y: number): void;
|
|
871
932
|
image(source: ContextImageHandle, options: NativeContextImageDraw): void;
|
|
872
933
|
unicode(source: ContextUnicodeHandle, index: number, x: number, y: number, foreground: RGBA, background: RGBA, attributes: number): void;
|
|
@@ -1069,7 +1130,7 @@ export declare class FFIRenderLib {
|
|
|
1069
1130
|
sceneSetTextViewPaint(context: NativeContextHandle, node: SceneNodeHandle, enabled: boolean): void;
|
|
1070
1131
|
contextDrawTextBufferView({ context, target, frame }: NativeDrawingTarget, view: ContextTextBufferViewHandle, x: number, y: number): void;
|
|
1071
1132
|
contextDrawEditorView({ context, target, frame }: NativeDrawingTarget, view: ContextEditorViewHandle, x: number, y: number): void;
|
|
1072
|
-
|
|
1133
|
+
contextDrawSceneBody({ context, target, frame }: NativeDrawingTarget, node: SceneNodeHandle, x: number, y: number): void;
|
|
1073
1134
|
createContextEditBuffer(context: NativeContextHandle, options?: NativeContextEditBufferOptions): ContextEditBufferHandle;
|
|
1074
1135
|
destroyContextEditBuffer(context: NativeContextHandle, editBuffer: ContextEditBufferHandle): void;
|
|
1075
1136
|
createContextEditorView(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, width: number, height: number): ContextEditorViewHandle;
|
|
@@ -1208,6 +1269,15 @@ export declare class FFIRenderLib {
|
|
|
1208
1269
|
start: number;
|
|
1209
1270
|
};
|
|
1210
1271
|
sceneSetArrow(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneArrowOptions): void;
|
|
1272
|
+
sceneSetScroll(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneScrollOptions): void;
|
|
1273
|
+
/** `axis` is 0 for the horizontal bar and 1 for the vertical bar; `end` is 0 for the start arrow. */
|
|
1274
|
+
sceneSetScrollArrow(context: NativeContextHandle, node: SceneNodeHandle, axis: number, end: number, options: Omit<NativeSceneArrowOptions, "direction">): void;
|
|
1275
|
+
/** An explicit scroll; a relative axis adds its value to the offset, and `reapply` applies the targets again after
|
|
1276
|
+
* the next frame's layout. Returns the state after it. */
|
|
1277
|
+
sceneScrollTo(context: NativeContextHandle, node: SceneNodeHandle, x: number, y: number, relativeX: boolean, relativeY: boolean, reapply?: boolean): NativeSceneScrollState;
|
|
1278
|
+
/** An into-view, anchor, or layout request (see `ot_scene_scroll_request`). Returns the state after it. */
|
|
1279
|
+
sceneScrollRequest(context: NativeContextHandle, node: SceneNodeHandle, kind: "into-view" | "anchor" | "layout", target: SceneNodeHandle | null, align?: "nearest" | "start" | "end", inset?: number): NativeSceneScrollState;
|
|
1280
|
+
sceneGetScroll(context: NativeContextHandle, node: SceneNodeHandle): NativeSceneScrollState;
|
|
1211
1281
|
sceneSetTextOptions(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneTextOptions): void;
|
|
1212
1282
|
sceneSetTextSelection(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneTextSelectionOptions): boolean;
|
|
1213
1283
|
sceneGetTextSelection(context: NativeContextHandle, node: SceneNodeHandle): {
|