@opentui/core 0.5.17 → 0.6.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 +185 -0
- package/NativeSession.d.ts +134 -0
- package/NativeSpanFeed.d.ts +1 -4
- package/README.md +5 -3
- package/Renderable.d.ts +162 -67
- package/animation/Timeline.d.ts +11 -1
- package/assets/typescriptreact/highlights.scm +758 -0
- package/assets/typescriptreact/tree-sitter-tsx.wasm +0 -0
- package/buffer.d.ts +76 -36
- package/chunk-bun-wsqkxxm5.js +12523 -0
- package/chunk-bun-wsqkxxm5.js.map +35 -0
- package/chunk-bun-ww65h9av.js +24868 -0
- package/chunk-bun-ww65h9av.js.map +69 -0
- package/chunk-node-f7c1g447.js +12503 -0
- package/chunk-node-f7c1g447.js.map +34 -0
- package/chunk-node-jh6t3wnm.js +24867 -0
- package/chunk-node-jh6t3wnm.js.map +69 -0
- package/edit-buffer.d.ts +23 -20
- package/editor-view.d.ts +13 -5
- package/image.d.ts +18 -7
- package/index.bun.js +2385 -2898
- package/index.bun.js.map +20 -22
- package/index.d.ts +6 -2
- package/index.node.js +2385 -2898
- package/index.node.js.map +20 -24
- package/lib/buffer-access.d.ts +6 -0
- package/lib/clipboard.d.ts +0 -9
- package/lib/extmarks.d.ts +4 -1
- package/lib/tree-sitter/parsers-config.d.ts +9 -9
- package/native-abi.generated.d.ts +5500 -0
- package/node-assets.js +6 -2
- package/node-assets.js.map +3 -3
- package/package.json +11 -12
- package/parser.worker.js +14 -2
- package/parser.worker.js.map +3 -3
- package/platform/runtime.d.ts +0 -1
- package/renderables/ASCIIFont.d.ts +5 -5
- package/renderables/Box.d.ts +8 -8
- package/renderables/Code.d.ts +6 -2
- package/renderables/Diff.d.ts +4 -2
- package/renderables/EditBufferRenderable.d.ts +8 -10
- package/renderables/EmbeddedTerminal.d.ts +4 -2
- package/renderables/FrameBuffer.d.ts +3 -1
- package/renderables/Image.d.ts +3 -1
- package/renderables/Input.d.ts +0 -5
- package/renderables/LineNumberRenderable.d.ts +3 -1
- package/renderables/Markdown.d.ts +5 -2
- package/renderables/ScrollBar.d.ts +7 -1
- package/renderables/ScrollBox.d.ts +4 -6
- package/renderables/Select.d.ts +2 -1
- package/renderables/Slider.d.ts +7 -5
- package/renderables/TabSelect.d.ts +2 -1
- package/renderables/Text.d.ts +5 -4
- package/renderables/TextBufferRenderable.d.ts +10 -9
- package/renderables/TextNode.d.ts +8 -0
- package/renderables/TextTable.d.ts +1 -1
- package/renderables/Textarea.d.ts +1 -1
- package/renderables/index.d.ts +1 -1
- package/renderer.d.ts +90 -67
- package/session-buffer.d.ts +4 -0
- package/syntax-style.d.ts +9 -7
- package/testing/harness.d.ts +33 -0
- package/testing/manual-clock.d.ts +2 -0
- package/testing/test-renderer.d.ts +3 -0
- package/testing/test-streams.d.ts +20 -2
- package/testing.bun.js +60 -49
- package/testing.bun.js.map +6 -6
- package/testing.js +60 -49
- package/testing.js.map +6 -6
- package/tests/native-log-worker-child.d.ts +1 -0
- package/tests/native-symbol-stubs.d.ts +5 -0
- package/tests/yoga-callback-boundary-child.d.ts +1 -0
- package/tests/yoga-default-config-worker-child.d.ts +1 -0
- package/text-buffer-view.d.ts +11 -4
- package/text-buffer.d.ts +24 -9
- package/types.d.ts +4 -4
- package/yoga.bun.js +6 -2
- package/yoga.bun.js.map +1 -1
- package/yoga.d.ts +91 -56
- package/yoga.internal.d.ts +78 -0
- package/yoga.js +6 -2
- package/yoga.js.map +1 -1
- package/zig-structs.d.ts +13 -98
- package/zig.d.ts +1305 -583
- package/chunk-bun-6rvkxs1v.js +0 -18862
- package/chunk-bun-6rvkxs1v.js.map +0 -64
- package/chunk-bun-h3ggawd9.js +0 -10533
- package/chunk-bun-h3ggawd9.js.map +0 -32
- package/chunk-node-kc1sqq2a.js +0 -10532
- package/chunk-node-kc1sqq2a.js.map +0 -32
- package/chunk-node-tfvyz31s.js +0 -18844
- package/chunk-node-tfvyz31s.js.map +0 -63
package/NativeScene.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { NativeSession } from "./NativeSession.js";
|
|
2
|
+
import type { Renderable, RenderableOptions } from "./Renderable.js";
|
|
3
|
+
import type { ImageFit } from "./renderables/Image.js";
|
|
4
|
+
import type { NativeImage } from "./image.js";
|
|
5
|
+
import { OptimizedBuffer } from "./buffer.js";
|
|
6
|
+
import type { ImageRenderProtocol } from "./types.js";
|
|
7
|
+
import { type CliRenderer } from "./renderer.js";
|
|
8
|
+
import type { StyledText } from "./lib/styled-text.js";
|
|
9
|
+
import type { RGBA } from "./lib/RGBA.js";
|
|
10
|
+
import type { LocalSelectionBounds } from "./lib/selection.js";
|
|
11
|
+
import { type Value, type MeasureFunction } from "./yoga.js";
|
|
12
|
+
import { NativeSessionRenderStatus, type NativeSceneFrameOptions, type NativeSceneFrameRequest, type NativeSceneLayout, type NativeScenePaint, type NativeScenePaintUpdate, type NativeSceneBoxDetails, type NativeSceneTextOptions, type NativeSceneSliderOptions, type NativeSceneArrowOptions, type NativeSceneEditorOptions, type ContextEditorViewHandle, type ContextTextBufferViewHandle, type SceneNodeHandle } from "./zig.js";
|
|
13
|
+
type PaintOptions = () => Pick<NativeSceneFrameOptions, "background" | "useMouse" | "excludedHitNum" | "preserveUnwritten">;
|
|
14
|
+
declare class NativeLifecyclePasses extends Set<Renderable> {
|
|
15
|
+
private order;
|
|
16
|
+
private nextOrder;
|
|
17
|
+
private work?;
|
|
18
|
+
add(renderable: Renderable): this;
|
|
19
|
+
refresh(renderable: Renderable): void;
|
|
20
|
+
delete(renderable: Renderable): boolean;
|
|
21
|
+
clear(): void;
|
|
22
|
+
iteratePending(): IterableIterator<Renderable>;
|
|
23
|
+
}
|
|
24
|
+
/** Retained built-in scene with sparse owner-thread hooks. */
|
|
25
|
+
export declare class NativeScene {
|
|
26
|
+
readonly driver: NativeSession;
|
|
27
|
+
private readonly renderer;
|
|
28
|
+
private readonly workBudget?;
|
|
29
|
+
get resourceContext(): import("./buffer.js").ResourceContext;
|
|
30
|
+
readonly lifecyclePasses: NativeLifecyclePasses;
|
|
31
|
+
/** @internal Renderables whose destroy walk is still running; renderer finalization waits for them. */
|
|
32
|
+
readonly cleanupOwners: Set<Renderable>;
|
|
33
|
+
private readonly nodes;
|
|
34
|
+
private paintedFrame;
|
|
35
|
+
private paintRecording?;
|
|
36
|
+
private cancelPaintYield;
|
|
37
|
+
private destroyed;
|
|
38
|
+
private destroying;
|
|
39
|
+
private geometryRevision;
|
|
40
|
+
private layoutRevision;
|
|
41
|
+
private readonly staging;
|
|
42
|
+
private hookScans;
|
|
43
|
+
private scanningHooks;
|
|
44
|
+
private readonly yogaHost;
|
|
45
|
+
constructor(driver: NativeSession, renderer: Pick<CliRenderer, "root" | "isDestroyed" | "controlState" | "unregisterLifecyclePass">, workBudget?: number | undefined);
|
|
46
|
+
/** @internal Buffer wrappers borrow the completed paint ticket. */
|
|
47
|
+
get frame(): NativeSceneFrameRequest | null;
|
|
48
|
+
/** @internal Accepted geometry mutations invalidate hook-local layout observations. */
|
|
49
|
+
get currentGeometryRevision(): number;
|
|
50
|
+
/** @internal Layout reads return the same values until this changes. Undefined while callbacks run inside
|
|
51
|
+
* native layout, because that layout is still being computed. */
|
|
52
|
+
get observedLayoutRevision(): number | undefined;
|
|
53
|
+
/** The scene does no more hook or frame work once it, its Session, or its renderer is gone or going. */
|
|
54
|
+
private get stopped();
|
|
55
|
+
private changeGeometry;
|
|
56
|
+
/** Native layout and frame calls can publish new observations without a host write. */
|
|
57
|
+
private changeLayout;
|
|
58
|
+
/** @internal Whether style or paint writes await native acceptance. */
|
|
59
|
+
get hasStagedMutations(): boolean;
|
|
60
|
+
/** @internal Apply staged style/paint writes. Runs before every native scene call
|
|
61
|
+
* except node creation, moves, and hit tests, which observe no style or paint.
|
|
62
|
+
* Failed flushes retain their unaccepted suffix for retry, except a record that native
|
|
63
|
+
* rejects for its node (InvalidArgument, WrongKind, StaleHandle). That record is dropped,
|
|
64
|
+
* including other paint fields the node staged since the last flush, and the error is
|
|
65
|
+
* thrown once by whichever call flushes, which may belong to another node.
|
|
66
|
+
* A closing Session paints no more frames, so like a disposed one it drops staged writes. */
|
|
67
|
+
flushStaged(): void;
|
|
68
|
+
/** @internal Keep construction pending until a boundary after derived class fields have run. */
|
|
69
|
+
scheduleHookScan(renderable: Renderable): void;
|
|
70
|
+
/** @internal Restore assignment accessors at attachment, but keep discovery pending:
|
|
71
|
+
* an intermediate constructor can attach before the most-derived fields run. */
|
|
72
|
+
refreshPendingHooks(renderable: Renderable): void;
|
|
73
|
+
/** Scans may publish hooks natively or register lifecycle passes, so this runs
|
|
74
|
+
* before lifecycle passes and native resumes. Reentrant scheduling drains in
|
|
75
|
+
* bounded batches without walking the scene. */
|
|
76
|
+
private drainHookScans;
|
|
77
|
+
/** @internal Detached settlement visits owned controllers, not the render tree. */
|
|
78
|
+
getRenderables(): IterableIterator<Renderable>;
|
|
79
|
+
/** @internal Reject stale scene operations before accessing their Context. */
|
|
80
|
+
assertAlive(): void;
|
|
81
|
+
/** @internal Scene nodes retain native ownership even when their body is a host hook. */
|
|
82
|
+
createNode(renderable: Renderable, options: RenderableOptions): void;
|
|
83
|
+
/** @internal Native acceptance precedes all wrapper topology changes. */
|
|
84
|
+
moveNode(child: Renderable, parent: Renderable | null, index: number): void;
|
|
85
|
+
setViewport(content: Renderable, viewport: Renderable | null): void;
|
|
86
|
+
setFocus(renderable: Renderable, focused: boolean): void;
|
|
87
|
+
/** @internal The wrapper's existing cleanup walk releases nodes child-first. Staged
|
|
88
|
+
* writes flush first so no entry outlives its handle; a flush failure must not
|
|
89
|
+
* leave the native node alive behind a destroyed wrapper. */
|
|
90
|
+
destroyNode(renderable: Renderable): void;
|
|
91
|
+
/** @internal Hook identities publish only after native acceptance. Geometry remains native-owned. */
|
|
92
|
+
setHooks(renderable: Renderable, flags: number, generation: bigint, initialWidth: number, initialHeight: number): void;
|
|
93
|
+
/** @internal Shared Yoga normalization stages through the checked scene style boundary. */
|
|
94
|
+
setStyle(node: {
|
|
95
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
96
|
+
}, group: number, kind: number, edge: number, unit: number, value: number, flags?: number): void;
|
|
97
|
+
/** @internal Accept this scene's staged prefix before reading native style.
|
|
98
|
+
* This boundary does not run layout; geometry remains the completed observation. */
|
|
99
|
+
getStyle(node: {
|
|
100
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
101
|
+
}, group: number, kind: number, edge: number): Value;
|
|
102
|
+
setMeasureFunc(node: {
|
|
103
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
104
|
+
}, measure: MeasureFunction | null): void;
|
|
105
|
+
hasMeasureFunc(node: {
|
|
106
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
107
|
+
}): boolean;
|
|
108
|
+
markDirty(node: {
|
|
109
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
110
|
+
}): void;
|
|
111
|
+
/** @internal Masked position edges stage as ordinary Yoga position values.
|
|
112
|
+
* Every masked value is validated before the first edge is staged so a rejected edge
|
|
113
|
+
* leaves no partial position behind. */
|
|
114
|
+
setPositions(node: {
|
|
115
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
116
|
+
}, mask: number, units: Uint32Array, values: Float32Array): void;
|
|
117
|
+
/** @internal Partial visual writes stage before requested wrapper state is published.
|
|
118
|
+
* Border appearance and Yoga widths are accepted atomically by native. */
|
|
119
|
+
setPaint(renderable: Renderable, paint: NativeScenePaintUpdate): void;
|
|
120
|
+
setBackground(renderable: Renderable, color: RGBA): void;
|
|
121
|
+
setBoxDetails(renderable: Renderable, details: NativeSceneBoxDetails): void;
|
|
122
|
+
/** Border style clears custom glyphs in the same staged record as border widths. */
|
|
123
|
+
setBoxBorderStyle(renderable: Renderable, style: NativeScenePaint["borderStyle"], sides: number): void;
|
|
124
|
+
/** @internal Native copies bytes and styles before the wrapper publishes caller identity. */
|
|
125
|
+
setText(renderable: Renderable, content: string | StyledText): void;
|
|
126
|
+
/** @internal Text options commit together without exposing the node-owned buffer or view. */
|
|
127
|
+
setTextOptions(renderable: Renderable, options: NativeSceneTextOptions): void;
|
|
128
|
+
/** @internal Native owns slider drawing and thumb geometry; the host retains input callbacks. */
|
|
129
|
+
setSlider(renderable: Renderable, options: NativeSceneSliderOptions): void;
|
|
130
|
+
/** @internal Input-time query only, never a per-node frame pass. */
|
|
131
|
+
getSliderThumb(renderable: Renderable): {
|
|
132
|
+
size: number;
|
|
133
|
+
start: number;
|
|
134
|
+
};
|
|
135
|
+
/** @internal Standard arrow paint commits before its wrapper projection. */
|
|
136
|
+
setArrow(renderable: Renderable, options: NativeSceneArrowOptions): void;
|
|
137
|
+
setImage(renderable: Renderable, image: NativeImage | null, fit: ImageFit, protocol: ImageRenderProtocol, buffer: OptimizedBuffer | null): void;
|
|
138
|
+
setEditorView(renderable: Renderable, view: ContextEditorViewHandle): void;
|
|
139
|
+
setSurface(renderable: Renderable, buffer: OptimizedBuffer | null): void;
|
|
140
|
+
setTextView(renderable: Renderable, view: ContextTextBufferViewHandle | null): void;
|
|
141
|
+
setTextViewPaint(renderable: Renderable, enabled: boolean): void;
|
|
142
|
+
setEditorOptions(renderable: Renderable, options: NativeSceneEditorOptions): void;
|
|
143
|
+
/** @internal Query native text metrics only when requested, never during JS frame traversal. */
|
|
144
|
+
getText(renderable: Renderable): string;
|
|
145
|
+
/** @internal Inherited Text drawing records or draws at the caller's position. */
|
|
146
|
+
drawText(renderable: Renderable, buffer: OptimizedBuffer, x: number, y: number): void;
|
|
147
|
+
setTextSelection(renderable: Renderable, operation: "set" | "update" | "reset", bounds: LocalSelectionBounds | null, bg?: RGBA, fg?: RGBA): boolean;
|
|
148
|
+
getTextSelection(renderable: Renderable): {
|
|
149
|
+
start: number;
|
|
150
|
+
end: number;
|
|
151
|
+
} | null;
|
|
152
|
+
getSelectedText(renderable: Renderable): string;
|
|
153
|
+
/** @internal Line arrays are copied only for explicit line-info queries. */
|
|
154
|
+
getTextLineInfo(renderable: Renderable, firstLine?: number, lineCount?: number): import("./types.js").LineInfo;
|
|
155
|
+
/** @internal Scalar metrics do not copy the document or its line arrays. */
|
|
156
|
+
getTextMetrics(renderable: Renderable): import("./zig.js").NativeSceneTextMetrics;
|
|
157
|
+
/** @internal Accept staging, then read completed geometry without running layout.
|
|
158
|
+
* Native owns callback-time projections and composes accepted ancestor translations. */
|
|
159
|
+
getLayout(node: {
|
|
160
|
+
_getSceneHandle(owner: NativeScene): SceneNodeHandle;
|
|
161
|
+
}, rawYoga?: boolean | "paint"): NativeSceneLayout;
|
|
162
|
+
/** @internal Measure a snapshot using its existing scene root, without preparing a frame. */
|
|
163
|
+
measureSnapshot(root: Renderable): number;
|
|
164
|
+
paint(deltaTime: number, getPaintOptions: PaintOptions): void | Promise<void>;
|
|
165
|
+
private runLifecyclePasses;
|
|
166
|
+
private resumePaint;
|
|
167
|
+
private advancePaint;
|
|
168
|
+
/** Destruction, Session shutdown, or a resize may have cancelled the attempt already; keep the caller's failure. */
|
|
169
|
+
private cancelAttempt;
|
|
170
|
+
/** Run every slot's paint hooks in paint order before native code paints the frame. */
|
|
171
|
+
private recordPaint;
|
|
172
|
+
private createPaintRecording;
|
|
173
|
+
commit(force?: boolean): NativeSessionRenderStatus;
|
|
174
|
+
/** @internal Split output uses the same painted ticket and presentation endpoint. */
|
|
175
|
+
commitSplit(commits: Parameters<NativeSession["renderSplit"]>[1], pinnedRenderOffset: number, force: boolean): ReturnType<NativeSession["renderSplit"]>;
|
|
176
|
+
/** @internal Called after active effects and captures unwind, never during synchronous node destruction. */
|
|
177
|
+
cancelFrame(): void;
|
|
178
|
+
/** @internal Wake a parked turn without revoking active synchronous framebuffer scopes. */
|
|
179
|
+
interruptPaint(): void;
|
|
180
|
+
/** @internal An accepted native resize cancels only a parked attempt, not a synchronous hook scope. */
|
|
181
|
+
restartPaint(): void;
|
|
182
|
+
hitTest(x: number, y: number): number;
|
|
183
|
+
destroy(): void;
|
|
184
|
+
}
|
|
185
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Writable } from "node:stream";
|
|
2
|
+
import { ResourceContext } from "./buffer.js";
|
|
3
|
+
import { NativeSessionRenderStatus, type NativeContextHandle, type NativeContextOptions, type NativeSceneFrameRequest, type NativeSessionCapabilities, type NativeSessionControl, type NativeSessionKittyImageTransportStatus, type NativeSessionOptions, type NativeSessionRendererOptions, type NativeSessionTerminalOptions, type RenderLib, type SessionHandle, type NativeSplitSnapshot } from "./zig.js";
|
|
4
|
+
export interface NativeSessionScheduler {
|
|
5
|
+
/** Monotonic nanoseconds. */
|
|
6
|
+
now(): bigint;
|
|
7
|
+
/** Schedule a later event-loop turn, never an inline callback or microtask. */
|
|
8
|
+
schedule(callback: () => void, delayMs?: number): () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface NativeSessionDriverOptions {
|
|
11
|
+
context?: NativeContextOptions;
|
|
12
|
+
output?: NativeSessionOptions;
|
|
13
|
+
/** Copy-buffer size for custom Writable destinations. Native stdout needs no buffer. */
|
|
14
|
+
outputBufferSize?: number;
|
|
15
|
+
/** Cancel if graceful close has not completed within this finite interval. */
|
|
16
|
+
closeTimeoutMs?: number;
|
|
17
|
+
scheduler?: NativeSessionScheduler;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Owns one checked Session and optionally its Context. Borrows a Writable without
|
|
21
|
+
* ending or destroying it. If emitClose is false, the owner must call dispose() again
|
|
22
|
+
* after silent asynchronous destruction completes; no notification is available.
|
|
23
|
+
*/
|
|
24
|
+
export declare class NativeSession {
|
|
25
|
+
private readonly sink;
|
|
26
|
+
private readonly owner?;
|
|
27
|
+
private readonly lib;
|
|
28
|
+
private attachmentCleanup?;
|
|
29
|
+
readonly resourceContext: ResourceContext;
|
|
30
|
+
private readonly nativeSession;
|
|
31
|
+
private buffer;
|
|
32
|
+
private readonly outputBufferSize;
|
|
33
|
+
private readonly sinkWrite;
|
|
34
|
+
/** @internal Shared later-turn scheduler; frame and output cancellations remain independent. */
|
|
35
|
+
readonly scheduler: NativeSessionScheduler;
|
|
36
|
+
/** Configured output capacity, including reserved control storage; raw admission can fail earlier. */
|
|
37
|
+
readonly maxWriteBytes: bigint;
|
|
38
|
+
/** Maximum raw write in an empty queue, excluding reserved control storage and span slots. */
|
|
39
|
+
readonly maxAtomicWriteBytes: bigint;
|
|
40
|
+
private readonly closeTimeoutNs;
|
|
41
|
+
private readonly closeWait;
|
|
42
|
+
private idleWait;
|
|
43
|
+
private presentationWait;
|
|
44
|
+
private transition;
|
|
45
|
+
private scheduled;
|
|
46
|
+
private output;
|
|
47
|
+
private blocked;
|
|
48
|
+
private sinkErrorSeen;
|
|
49
|
+
private detached;
|
|
50
|
+
private closeDeadlineNs;
|
|
51
|
+
private closeRequested;
|
|
52
|
+
private closeInterruption;
|
|
53
|
+
private stopped;
|
|
54
|
+
private exiting;
|
|
55
|
+
private finishing;
|
|
56
|
+
private _disposed;
|
|
57
|
+
private _error;
|
|
58
|
+
private readonly detachedSessions;
|
|
59
|
+
/** Resolves after graceful native close and owned resource cleanup; failure or cancellation rejects. */
|
|
60
|
+
readonly closed: Promise<void>;
|
|
61
|
+
constructor(sink: Writable, options?: NativeSessionDriverOptions, owner?: NativeSession | undefined);
|
|
62
|
+
get context(): NativeContextHandle;
|
|
63
|
+
get renderLib(): RenderLib;
|
|
64
|
+
get session(): Readonly<SessionHandle>;
|
|
65
|
+
/** Native Session teardown is complete; pending sink I/O can still retain listeners. */
|
|
66
|
+
get disposed(): boolean;
|
|
67
|
+
get contextDisposed(): boolean;
|
|
68
|
+
get error(): Error | null;
|
|
69
|
+
usesOutput(sink: Writable): boolean;
|
|
70
|
+
/** The optional attachment cleanup is installed only after checked native acceptance. */
|
|
71
|
+
attachRenderer(options: NativeSessionRendererOptions, beforeDispose?: () => void): void;
|
|
72
|
+
/** @internal Independent scene/frame ownership, sharing only the parent's Context resources. */
|
|
73
|
+
createDetached(options: NativeSessionRendererOptions, beforeDispose: () => void): NativeSession;
|
|
74
|
+
/** Repeated calls share pending setup; the first call supplies its options. */
|
|
75
|
+
setupTerminal(options?: NativeSessionTerminalOptions): Promise<void>;
|
|
76
|
+
suspend(): Promise<void>;
|
|
77
|
+
resume(): Promise<void>;
|
|
78
|
+
/** The painted frame is consumed on every returned status. */
|
|
79
|
+
render(force: boolean, frame: NativeSceneFrameRequest): NativeSessionRenderStatus;
|
|
80
|
+
/** @internal One checked admission for a complete split frame. */
|
|
81
|
+
renderSplit(frame: NativeSceneFrameRequest | null, commits: readonly NativeSplitSnapshot[], pinnedRenderOffset: number, force: boolean): {
|
|
82
|
+
status: NativeSessionRenderStatus;
|
|
83
|
+
};
|
|
84
|
+
/** @internal Screen changes join the same ordered output queue as frames and controls. */
|
|
85
|
+
setScreen(alternate: boolean, width: number, height: number, trailingOutput?: Uint8Array): void;
|
|
86
|
+
/** Waits for the current frame's endpoint, not later output or sink drain. Calls share one pending wait. */
|
|
87
|
+
whenPresented(): Promise<void>;
|
|
88
|
+
resize(width: number, height: number): void;
|
|
89
|
+
control(command: NativeSessionControl): void;
|
|
90
|
+
writeClipboard(target: number, bytes: Uint8Array): boolean;
|
|
91
|
+
triggerNotification(message: string, title?: string): boolean;
|
|
92
|
+
setKittyImageTransport(mode: number): void;
|
|
93
|
+
getKittyImageTransport(): NativeSessionKittyImageTransportStatus;
|
|
94
|
+
pollKittyImageTransport(): boolean;
|
|
95
|
+
cancelKittyImageTransport(failed: boolean): void;
|
|
96
|
+
processKittyImageReply(bytes: Uint8Array): number;
|
|
97
|
+
startKittyFileProbe(): void;
|
|
98
|
+
getCapabilities(): NativeSessionCapabilities;
|
|
99
|
+
/** Copies all bytes or returns false under queue pressure. Capacity-exceeding writes throw RangeError;
|
|
100
|
+
* lifecycle errors take precedence while writing is unavailable. */
|
|
101
|
+
write(bytes: Uint8Array): boolean;
|
|
102
|
+
/** Waits for accepted output, terminal work, and sink pressure to settle. Calls share one wait. */
|
|
103
|
+
idle(): Promise<void>;
|
|
104
|
+
/** Release external Context leases first. A busy close rejects; dispose() can retry cleanup after release. */
|
|
105
|
+
close(): Promise<void>;
|
|
106
|
+
/** @internal Bound required snapshot flushing by the same graceful-close deadline. */
|
|
107
|
+
armCloseTimeout(): void;
|
|
108
|
+
/** Identifies this driver's close interruption, not transport or restoration success. */
|
|
109
|
+
isCloseInterruption(error: unknown): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Cancels immediately without claiming restoration. Release external Context
|
|
112
|
+
* leases first; if disposed remains false, release them and call dispose again.
|
|
113
|
+
*/
|
|
114
|
+
dispose(): void;
|
|
115
|
+
/** @internal Restore before exit callbacks can terminate the process. The caller
|
|
116
|
+
* must still dispose after wrapper cleanup; this does not release the Context.
|
|
117
|
+
* Only real stdout supports direct synchronous delivery. In-flight writes cannot
|
|
118
|
+
* be replayed, and arbitrary borrowed sinks cannot finish asynchronously at exit. */
|
|
119
|
+
restoreOnExit(): boolean;
|
|
120
|
+
private checkOpen;
|
|
121
|
+
private changeTerminal;
|
|
122
|
+
private onError;
|
|
123
|
+
private onClose;
|
|
124
|
+
private onFinish;
|
|
125
|
+
private onDrain;
|
|
126
|
+
private schedule;
|
|
127
|
+
private turn;
|
|
128
|
+
private writeOutput;
|
|
129
|
+
private writeSink;
|
|
130
|
+
private completePresentation;
|
|
131
|
+
private detach;
|
|
132
|
+
private canDetach;
|
|
133
|
+
private finish;
|
|
134
|
+
}
|
package/NativeSpanFeed.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { GrowthPolicy, NativeSpanFeedOptions, NativeSpanFeedStats } from ".
|
|
|
4
4
|
export type DataHandler = (data: Uint8Array) => void | Promise<void>;
|
|
5
5
|
/**
|
|
6
6
|
* Zero-copy wrapper over Zig memory; not a full stream interface.
|
|
7
|
-
*
|
|
7
|
+
* Data views are borrowed until all handlers for a span have completed.
|
|
8
8
|
*/
|
|
9
9
|
export declare class NativeSpanFeed {
|
|
10
10
|
static create(options?: NativeSpanFeedOptions): NativeSpanFeed;
|
|
@@ -13,11 +13,9 @@ export declare class NativeSpanFeed {
|
|
|
13
13
|
private readonly lib;
|
|
14
14
|
private readonly eventHandler;
|
|
15
15
|
private chunkMap;
|
|
16
|
-
private chunkSizes;
|
|
17
16
|
private dataHandlers;
|
|
18
17
|
private errorHandlers;
|
|
19
18
|
private drainBuffer;
|
|
20
|
-
private stateBuffer;
|
|
21
19
|
private closed;
|
|
22
20
|
private destroyed;
|
|
23
21
|
private draining;
|
|
@@ -44,7 +42,6 @@ export declare class NativeSpanFeed {
|
|
|
44
42
|
private resolveIdleIfNeeded;
|
|
45
43
|
idle(): Promise<void>;
|
|
46
44
|
private handleEvent;
|
|
47
|
-
private decrementRefcount;
|
|
48
45
|
private queuePendingHandlerError;
|
|
49
46
|
private throwPendingHandlerError;
|
|
50
47
|
private drainOnce;
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Then build your first app with the [quickstart](https://opentui.com/docs/getting
|
|
|
49
49
|
|
|
50
50
|
## Runtime and platform support
|
|
51
51
|
|
|
52
|
-
`@opentui/core` runs on Bun 1.3.
|
|
52
|
+
`@opentui/core` runs on Bun 1.3.14 or later, or on Node.js 26.4.0 or later with ECMAScript modules (ESM) and
|
|
53
53
|
`--experimental-ffi`.
|
|
54
54
|
|
|
55
55
|
Use Bun 1.4.0 or later on native Windows arm64.
|
|
@@ -62,10 +62,12 @@ surfaces, not application APIs.
|
|
|
62
62
|
Install the OpenTUI documentation as a skill for your AI coding assistant with [`npx skills`](https://skills.sh):
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
npx skills add
|
|
65
|
+
npx skills add https://opentui.com --skill opentui
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Add `-g` to install the skill globally.
|
|
68
|
+
Add `-g` to install the skill globally. The skill matches the latest release, and `npx skills update` moves it to each
|
|
69
|
+
new release. Install from `https://opentui.com/docs/next` to follow the main branch. A skill installed with
|
|
70
|
+
`npx skills add anomalyco/opentui` follows the main branch; run the command above to switch it to releases.
|
|
69
71
|
|
|
70
72
|
## License
|
|
71
73
|
|