@opentui/core 0.6.8 → 0.7.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 +5 -26
- package/Renderable.d.ts +27 -32
- package/audio.d.ts +1 -0
- package/{chunk-bun-ehr9v0n8.js → chunk-bun-qkpm62w1.js} +257 -69
- package/chunk-bun-qkpm62w1.js.map +35 -0
- package/{chunk-bun-4e5bpeqh.js → chunk-bun-zevtbcf6.js} +846 -785
- package/chunk-bun-zevtbcf6.js.map +70 -0
- package/{chunk-node-yyjd8p1g.js → chunk-node-7bcmqh18.js} +846 -785
- package/chunk-node-7bcmqh18.js.map +70 -0
- package/{chunk-node-jhq62x0c.js → chunk-node-mzgnr3sw.js} +257 -69
- package/chunk-node-mzgnr3sw.js.map +34 -0
- package/index.bun.js +313 -91
- package/index.bun.js.map +12 -11
- package/index.node.js +313 -91
- package/index.node.js.map +12 -10
- package/lib/detect-links.d.ts +2 -0
- package/lib/parse.keypress-kitty.d.ts +2 -0
- package/lib/scroll-chain.d.ts +16 -0
- package/lib/stdin-parser-native.d.ts +88 -0
- package/native-abi.generated.d.ts +394 -5
- package/package.json +9 -9
- package/renderables/Box.d.ts +2 -2
- package/renderables/Code.d.ts +2 -1
- package/renderables/Diff.d.ts +2 -2
- package/renderables/EditBufferRenderable.d.ts +2 -2
- package/renderables/EmbeddedTerminal.d.ts +2 -2
- package/renderables/FrameBuffer.d.ts +3 -3
- package/renderables/Image.d.ts +2 -2
- package/renderables/Markdown.d.ts +2 -2
- package/renderables/ScrollBar.d.ts +3 -3
- package/renderables/ScrollBox.d.ts +6 -3
- package/renderables/Slider.d.ts +2 -2
- package/renderables/Text.d.ts +2 -2
- package/renderables/TextBufferRenderable.d.ts +2 -4
- package/renderer.d.ts +8 -4
- package/testing/test-renderer.d.ts +2 -0
- package/testing.bun.js +11 -4
- package/testing.bun.js.map +3 -3
- package/testing.js +11 -4
- package/testing.js.map +3 -3
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig-structs.d.ts +25 -0
- package/zig.d.ts +20 -7
- package/chunk-bun-4e5bpeqh.js.map +0 -69
- package/chunk-bun-ehr9v0n8.js.map +0 -35
- package/chunk-node-jhq62x0c.js.map +0 -34
- package/chunk-node-yyjd8p1g.js.map +0 -69
package/NativeScene.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ declare class NativeLifecyclePasses extends Set<Renderable> {
|
|
|
25
25
|
export declare class NativeScene {
|
|
26
26
|
readonly driver: NativeSession;
|
|
27
27
|
private readonly renderer;
|
|
28
|
-
private readonly workBudget?;
|
|
29
28
|
get resourceContext(): import("./buffer.js").ResourceContext;
|
|
30
29
|
readonly lifecyclePasses: NativeLifecyclePasses;
|
|
31
30
|
/** @internal Renderables whose destroy walk is still running; renderer finalization waits for them. */
|
|
@@ -33,27 +32,21 @@ export declare class NativeScene {
|
|
|
33
32
|
private readonly nodes;
|
|
34
33
|
private paintedFrame;
|
|
35
34
|
private paintRecording?;
|
|
36
|
-
private cancelPaintYield;
|
|
37
35
|
private destroyed;
|
|
38
36
|
private destroying;
|
|
39
|
-
private geometryRevision;
|
|
40
37
|
private layoutRevision;
|
|
41
38
|
private readonly staging;
|
|
42
|
-
private hookScans;
|
|
43
|
-
private scanningHooks;
|
|
44
39
|
private readonly yogaHost;
|
|
45
|
-
constructor(driver: NativeSession, renderer: Pick<CliRenderer, "root" | "isDestroyed" | "controlState" | "unregisterLifecyclePass"
|
|
40
|
+
constructor(driver: NativeSession, renderer: Pick<CliRenderer, "root" | "isDestroyed" | "controlState" | "unregisterLifecyclePass">);
|
|
46
41
|
/** @internal Buffer wrappers borrow the completed paint ticket. */
|
|
47
42
|
get frame(): NativeSceneFrameRequest | null;
|
|
48
|
-
/** @internal Accepted geometry mutations invalidate hook-local layout observations. */
|
|
49
|
-
get currentGeometryRevision(): number;
|
|
50
43
|
/** @internal Layout reads return the same values until this changes. Undefined while callbacks run inside
|
|
51
44
|
* native layout, because that layout is still being computed. */
|
|
52
45
|
get observedLayoutRevision(): number | undefined;
|
|
53
46
|
/** The scene does no more hook or frame work once it, its Session, or its renderer is gone or going. */
|
|
54
47
|
private get stopped();
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
/** Frames, moves, destroys, and translations are the only changes a layout read can see. Measurement and cancels
|
|
49
|
+
* change none today; they bump so that a native solve or observation outside a frame step stays covered. */
|
|
57
50
|
private changeLayout;
|
|
58
51
|
/** @internal Whether style or paint writes await native acceptance. */
|
|
59
52
|
get hasStagedMutations(): boolean;
|
|
@@ -65,15 +58,6 @@ export declare class NativeScene {
|
|
|
65
58
|
* thrown once by whichever call flushes, which may belong to another node.
|
|
66
59
|
* A closing Session paints no more frames, so like a disposed one it drops staged writes. */
|
|
67
60
|
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
61
|
/** @internal Detached settlement visits owned controllers, not the render tree. */
|
|
78
62
|
getRenderables(): IterableIterator<Renderable>;
|
|
79
63
|
/** @internal Reject stale scene operations before accessing their Context. */
|
|
@@ -161,11 +145,10 @@ export declare class NativeScene {
|
|
|
161
145
|
}, rawYoga?: boolean | "paint"): NativeSceneLayout;
|
|
162
146
|
/** @internal Measure a snapshot using its existing scene root, without preparing a frame. */
|
|
163
147
|
measureSnapshot(root: Renderable): number;
|
|
164
|
-
paint(deltaTime: number, getPaintOptions: PaintOptions): void
|
|
148
|
+
paint(deltaTime: number, getPaintOptions: PaintOptions): void;
|
|
165
149
|
private runLifecyclePasses;
|
|
166
|
-
private resumePaint;
|
|
167
150
|
private advancePaint;
|
|
168
|
-
/** Destruction
|
|
151
|
+
/** Destruction or Session shutdown may have cancelled the attempt already; keep the caller's failure. */
|
|
169
152
|
private cancelAttempt;
|
|
170
153
|
/** Run every slot's paint hooks in paint order before native code paints the frame. */
|
|
171
154
|
private recordPaint;
|
|
@@ -175,10 +158,6 @@ export declare class NativeScene {
|
|
|
175
158
|
commitSplit(commits: Parameters<NativeSession["renderSplit"]>[1], pinnedRenderOffset: number, force: boolean): ReturnType<NativeSession["renderSplit"]>;
|
|
176
159
|
/** @internal Called after active effects and captures unwind, never during synchronous node destruction. */
|
|
177
160
|
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
161
|
hitTest(x: number, y: number): number;
|
|
183
162
|
destroy(): void;
|
|
184
163
|
}
|
package/Renderable.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ import { type AlignString, type FlexDirectionString, type JustifyString, type Ov
|
|
|
8
8
|
import { type VNode } from "./renderables/composition/vnode.js";
|
|
9
9
|
import type { MouseEvent } from "./renderer.js";
|
|
10
10
|
import type { RenderContext } from "./types.js";
|
|
11
|
-
import { type NativePaintRecorder, type NativeSceneFrameRequest, type NativeScenePaint, type NativeScenePaintSlot, type SceneNodeHandle } from "./zig.js";
|
|
11
|
+
import { type NativePaintRecorder, type NativeSceneFrameRequest, type NativeSceneLayout, type NativeScenePaint, type NativeScenePaintSlot, type SceneNodeHandle } from "./zig.js";
|
|
12
12
|
declare const BrandedRenderable: unique symbol;
|
|
13
|
+
type PaintHook = (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
|
|
13
14
|
export declare enum LayoutEvents {
|
|
14
15
|
LAYOUT_CHANGED = "layout-changed",
|
|
15
16
|
RESIZED = "resized"
|
|
@@ -87,8 +88,8 @@ export interface RenderableOptions<T extends BaseRenderable = BaseRenderable> ex
|
|
|
87
88
|
onKeyDown?: (key: KeyEvent) => void;
|
|
88
89
|
onSizeChange?: (this: T) => void;
|
|
89
90
|
}
|
|
90
|
-
/** Class-owned native integration, declared
|
|
91
|
-
* identify work performed by native; overrides use the ordinary host hook dispatcher. */
|
|
91
|
+
/** Class-owned native integration, declared as the class's static `nativeIntegration`. Method
|
|
92
|
+
* identities identify work performed by native; overrides use the ordinary host hook dispatcher. */
|
|
92
93
|
export interface NativeRenderableIntegration {
|
|
93
94
|
readonly kind: Parameters<NativeScene["driver"]["renderLib"]["sceneCreateNode"]>[2];
|
|
94
95
|
readonly body: "host" | {
|
|
@@ -109,8 +110,6 @@ export interface NativeRenderableIntegration {
|
|
|
109
110
|
readonly bufferComposition?: "native";
|
|
110
111
|
readonly lineInfo?: boolean;
|
|
111
112
|
readonly measure?: (this: Renderable, ...constraints: Parameters<MeasureFunction>) => ReturnType<MeasureFunction>;
|
|
112
|
-
/** Only an own description can promise that construction adds no hook class fields. */
|
|
113
|
-
readonly construction?: "prototype" | "fields";
|
|
114
113
|
}
|
|
115
114
|
export declare function isRenderable(obj: any): obj is Renderable;
|
|
116
115
|
export declare abstract class BaseRenderable extends EventEmitter {
|
|
@@ -145,6 +144,7 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
145
144
|
protected static readonly defaultFocusable: boolean;
|
|
146
145
|
static renderablesByNumber: Map<number, Renderable>;
|
|
147
146
|
static readonly nativeIntegration: NativeRenderableIntegration;
|
|
147
|
+
private static readonly baseHooks;
|
|
148
148
|
/** @internal Stable class description shared by creation, hook registration, and dispatch. */
|
|
149
149
|
readonly nativeIntegration: NativeRenderableIntegration;
|
|
150
150
|
protected _isDestroyed: boolean;
|
|
@@ -172,18 +172,14 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
172
172
|
private _live;
|
|
173
173
|
protected _liveCount: number;
|
|
174
174
|
private _sizeChangeListener;
|
|
175
|
-
private
|
|
175
|
+
private _hooks;
|
|
176
176
|
protected _nativeSceneHookGeneration: bigint;
|
|
177
177
|
private _nativeSceneHooksRegistered;
|
|
178
178
|
private _nativeSceneResize;
|
|
179
|
-
private
|
|
180
|
-
private _nativeSceneHookLayout?;
|
|
179
|
+
private _paintLayout?;
|
|
181
180
|
private _observedLayout?;
|
|
182
181
|
private _observedLayoutRevision;
|
|
183
|
-
private
|
|
184
|
-
private _computedLayoutRevision;
|
|
185
|
-
private _nativeSceneMethods?;
|
|
186
|
-
private _nativeSceneMethodsPending;
|
|
182
|
+
private _selectable;
|
|
187
183
|
private _mouseListener;
|
|
188
184
|
private _mouseListeners;
|
|
189
185
|
private _pasteListener;
|
|
@@ -195,9 +191,12 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
195
191
|
private _flexShrink;
|
|
196
192
|
protected _childrenInLayoutOrder: Renderable[];
|
|
197
193
|
parent: Renderable | null;
|
|
198
|
-
onLifecyclePass: (() => void) | null;
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
get onLifecyclePass(): (() => void) | null;
|
|
195
|
+
set onLifecyclePass(value: (() => void) | null | undefined);
|
|
196
|
+
get renderBefore(): PaintHook | undefined;
|
|
197
|
+
set renderBefore(value: PaintHook | null | undefined);
|
|
198
|
+
get renderAfter(): PaintHook | undefined;
|
|
199
|
+
set renderAfter(value: PaintHook | null | undefined);
|
|
201
200
|
constructor(ctx: RenderContext, options: RenderableOptions<any>);
|
|
202
201
|
protected abortConstruction(error: unknown, cleanup?: (run: (step: () => void) => void) => void): never;
|
|
203
202
|
/** Completed base layers need full cleanup even before a subclass destroy override can run. */
|
|
@@ -240,7 +239,8 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
240
239
|
get screenY(): number;
|
|
241
240
|
protected get _screenX(): number;
|
|
242
241
|
protected get _screenY(): number;
|
|
243
|
-
|
|
242
|
+
protected get _paintWidth(): number;
|
|
243
|
+
protected get _paintHeight(): number;
|
|
244
244
|
get x(): number;
|
|
245
245
|
set x(value: number);
|
|
246
246
|
get top(): number | "auto" | `${number}%` | undefined;
|
|
@@ -260,6 +260,8 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
260
260
|
protected defaultDimension(_kind: "width" | "height"): number | "auto" | `${number}%`;
|
|
261
261
|
private styledDimension;
|
|
262
262
|
private getNativeSceneLayout;
|
|
263
|
+
/** Caches a layout that native returned since the last frame, move, destroy, or translation. */
|
|
264
|
+
private observeLayout;
|
|
263
265
|
set height(value: number | "auto" | `${number}%` | null | undefined);
|
|
264
266
|
private setDimension;
|
|
265
267
|
get zIndex(): number;
|
|
@@ -381,32 +383,25 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
381
383
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
382
384
|
protected getNativeScenePaint(): NativeScenePaint;
|
|
383
385
|
protected setNativeScenePaint(paint?: Partial<NativeScenePaint>): void;
|
|
384
|
-
private static
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
/** Snapshot reflective hook replacements and restore normal callback assignment.
|
|
390
|
-
* Call after defineProperty/delete, or to finalize fields after early constructor attachment.
|
|
391
|
-
* Ordinary paint and style changes do not discover hooks. */
|
|
386
|
+
private static normalizeHook;
|
|
387
|
+
private setHook;
|
|
388
|
+
private syncLifecyclePass;
|
|
389
|
+
/** Adopt hooks that an instance class field, `Object.defineProperty`, or an instance assignment of a
|
|
390
|
+
* protected hook method supplied. Until this call, the node runs the hooks of its class. */
|
|
392
391
|
refreshHooks(): void;
|
|
393
|
-
/** @internal Snapshot hooks for construction, explicit refresh, or retry. */
|
|
394
|
-
_scanNativeSceneHooks(): void;
|
|
395
|
-
private ensureNativeSceneMethods;
|
|
396
|
-
private nativeSceneNeedsHookPublish;
|
|
397
392
|
private usesNativeDrawing;
|
|
398
393
|
private needsHostResize;
|
|
399
394
|
private hostUpdateFlags;
|
|
400
|
-
private refreshNativeSceneMethods;
|
|
401
395
|
protected refreshNativeSceneHooks(): void;
|
|
402
|
-
/** @internal Retained surfaces restore their binding accessor
|
|
396
|
+
/** @internal Retained surfaces restore their binding accessor when hooks are refreshed. */
|
|
403
397
|
_refreshNativeSceneSurface(): void;
|
|
404
|
-
|
|
398
|
+
/** Publish the flags for `hooks`, then adopt them. `pending` carries listener changes that are about to apply. */
|
|
399
|
+
private publishHooks;
|
|
405
400
|
/** @internal Refresh only requested host hooks, never walk wrappers to collect layout. */
|
|
406
401
|
_runNativeSceneHook(request: NativeSceneFrameRequest, deltaTime: number): void;
|
|
407
402
|
/** @internal Record this node's paint hooks for one slot. Native code paints the
|
|
408
403
|
* recording at the slot's prepared position after every slot has recorded. */
|
|
409
|
-
_recordNativeScenePaint(slot: NativeScenePaintSlot, index: number, deltaTime: number, frame: OptimizedBuffer, recorder: NativePaintRecorder,
|
|
404
|
+
_recordNativeScenePaint(slot: NativeScenePaintSlot, index: number, deltaTime: number, frame: OptimizedBuffer, recorder: NativePaintRecorder, publicLayout: NativeSceneLayout | undefined): void;
|
|
410
405
|
protected _invokeNativePaint(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
411
406
|
get isDestroyed(): boolean;
|
|
412
407
|
destroy(): void;
|
package/audio.d.ts
CHANGED
|
@@ -294,6 +294,7 @@ export declare class AudioStream<M = AudioStreamMetadata> extends EventEmitter<A
|
|
|
294
294
|
private pumpSource;
|
|
295
295
|
private processDemuxOutput;
|
|
296
296
|
private writeStreamChunk;
|
|
297
|
+
private nativeCallError;
|
|
297
298
|
private resolveConnection;
|
|
298
299
|
private beginResourceAcquisition;
|
|
299
300
|
private cleanupAttempt;
|