@opentui/core 0.6.2 → 0.6.3
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/NativeSession.d.ts +3 -0
- package/{chunk-bun-b3p27aka.js → chunk-bun-e2gttx65.js} +90 -2
- package/chunk-bun-e2gttx65.js.map +35 -0
- package/{chunk-bun-ehstr7d7.js → chunk-bun-qphgryjx.js} +24 -3
- package/{chunk-bun-ehstr7d7.js.map → chunk-bun-qphgryjx.js.map} +5 -5
- package/{chunk-node-jt82vcf9.js → chunk-node-6rc18den.js} +90 -2
- package/chunk-node-6rc18den.js.map +34 -0
- package/{chunk-node-fs50qdd7.js → chunk-node-j1h89sfg.js} +24 -3
- package/{chunk-node-fs50qdd7.js.map → chunk-node-j1h89sfg.js.map} +5 -5
- package/index.bun.js +2 -2
- package/index.node.js +2 -2
- package/lib/terminal-capability-detection.d.ts +1 -0
- package/native-abi.generated.d.ts +66 -0
- package/package.json +9 -9
- package/renderer.d.ts +8 -1
- package/testing.bun.js +4 -3
- package/testing.bun.js.map +3 -3
- package/testing.js +4 -3
- package/testing.js.map +3 -3
- package/types.d.ts +32 -0
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +4 -1
- package/chunk-bun-b3p27aka.js.map +0 -35
- package/chunk-node-jt82vcf9.js.map +0 -34
package/NativeSession.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Writable } from "node:stream";
|
|
2
2
|
import { ResourceContext } from "./buffer.js";
|
|
3
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
|
+
import type { ProgramStatus } from "./types.js";
|
|
4
5
|
export interface NativeSessionScheduler {
|
|
5
6
|
/** Monotonic nanoseconds. */
|
|
6
7
|
now(): bigint;
|
|
@@ -89,6 +90,8 @@ export declare class NativeSession {
|
|
|
89
90
|
control(command: NativeSessionControl): void;
|
|
90
91
|
writeClipboard(target: number, bytes: Uint8Array): boolean;
|
|
91
92
|
triggerNotification(message: string, title?: string): boolean;
|
|
93
|
+
/** Returns false while the terminal is inactive or output is full. Invalid reports throw. */
|
|
94
|
+
setProgramStatus(status: ProgramStatus): boolean;
|
|
92
95
|
setKittyImageTransport(mode: number): void;
|
|
93
96
|
getKittyImageTransport(): NativeSessionKittyImageTransportStatus;
|
|
94
97
|
pollKittyImageTransport(): boolean;
|
|
@@ -1274,6 +1274,20 @@ var nativeLayouts = {
|
|
|
1274
1274
|
color: { offset: 16, size: 8, alignment: 2, type: "[4]u16" }
|
|
1275
1275
|
}
|
|
1276
1276
|
},
|
|
1277
|
+
ot_session_program_status: {
|
|
1278
|
+
size: 32,
|
|
1279
|
+
alignment: 4,
|
|
1280
|
+
fields: {
|
|
1281
|
+
state: { offset: 0, size: 4, alignment: 4, type: "u32" },
|
|
1282
|
+
kind: { offset: 4, size: 4, alignment: 4, type: "u32" },
|
|
1283
|
+
fields: { offset: 8, size: 4, alignment: 4, type: "u32" },
|
|
1284
|
+
progress: { offset: 12, size: 4, alignment: 4, type: "u32" },
|
|
1285
|
+
id_len: { offset: 16, size: 4, alignment: 4, type: "u32" },
|
|
1286
|
+
app_len: { offset: 20, size: 4, alignment: 4, type: "u32" },
|
|
1287
|
+
title_len: { offset: 24, size: 4, alignment: 4, type: "u32" },
|
|
1288
|
+
message_len: { offset: 28, size: 4, alignment: 4, type: "u32" }
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1277
1291
|
ot_session_capabilities: {
|
|
1278
1292
|
size: 144,
|
|
1279
1293
|
alignment: 4,
|
|
@@ -1914,11 +1928,22 @@ var nativeConstants = {
|
|
|
1914
1928
|
OT_CONTROL_CURSOR: 8,
|
|
1915
1929
|
OT_CONTROL_RESET_BACKGROUND: 9,
|
|
1916
1930
|
OT_CONTROL_PALETTE_QUERY: 10,
|
|
1931
|
+
OT_CONTROL_PROGRAM_STATUS: 11,
|
|
1917
1932
|
OT_CURSOR_POSITION: 1,
|
|
1918
1933
|
OT_CURSOR_STYLE: 2,
|
|
1919
1934
|
OT_CURSOR_BLINKING: 4,
|
|
1920
1935
|
OT_CURSOR_COLOR: 8,
|
|
1921
1936
|
OT_CURSOR_MOUSE_POINTER: 16,
|
|
1937
|
+
OT_PROGRAM_STATE_IDLE: 1,
|
|
1938
|
+
OT_PROGRAM_STATE_WORKING: 2,
|
|
1939
|
+
OT_PROGRAM_STATE_DONE: 3,
|
|
1940
|
+
OT_PROGRAM_STATE_BLOCKED: 4,
|
|
1941
|
+
OT_PROGRAM_STATE_ERROR: 5,
|
|
1942
|
+
OT_PROGRAM_STATE_CLEAR: 6,
|
|
1943
|
+
OT_PROGRAM_KIND_PERMISSION: 1,
|
|
1944
|
+
OT_PROGRAM_KIND_QUESTION: 2,
|
|
1945
|
+
OT_PROGRAM_KIND_AUTH: 3,
|
|
1946
|
+
OT_PROGRAM_STATUS_PROGRESS: 1,
|
|
1922
1947
|
OT_CAP_KITTY_KEYBOARD: 1,
|
|
1923
1948
|
OT_CAP_KITTY_GRAPHICS: 2,
|
|
1924
1949
|
OT_CAP_RGB: 4,
|
|
@@ -1936,6 +1961,7 @@ var nativeConstants = {
|
|
|
1936
1961
|
OT_CAP_NOTIFICATIONS: 16384,
|
|
1937
1962
|
OT_CAP_EXPLICIT_CURSOR_POSITIONING: 32768,
|
|
1938
1963
|
OT_CAP_REMOTE: 65536,
|
|
1964
|
+
OT_CAP_PROGRAM_STATUS: 131072,
|
|
1939
1965
|
OT_TERMINAL_UNINITIALIZED: 0,
|
|
1940
1966
|
OT_TERMINAL_SETTING_UP: 1,
|
|
1941
1967
|
OT_TERMINAL_ACTIVE: 2,
|
|
@@ -5762,6 +5788,19 @@ registerEnvVar2({
|
|
|
5762
5788
|
});
|
|
5763
5789
|
var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2, default: 3 };
|
|
5764
5790
|
var CURSOR_ID_TO_STYLE = ["block", "line", "underline", "default"];
|
|
5791
|
+
var PROGRAM_STATE_TO_ID = {
|
|
5792
|
+
idle: nativeConstants.OT_PROGRAM_STATE_IDLE,
|
|
5793
|
+
working: nativeConstants.OT_PROGRAM_STATE_WORKING,
|
|
5794
|
+
done: nativeConstants.OT_PROGRAM_STATE_DONE,
|
|
5795
|
+
blocked: nativeConstants.OT_PROGRAM_STATE_BLOCKED,
|
|
5796
|
+
error: nativeConstants.OT_PROGRAM_STATE_ERROR,
|
|
5797
|
+
clear: nativeConstants.OT_PROGRAM_STATE_CLEAR
|
|
5798
|
+
};
|
|
5799
|
+
var PROGRAM_KIND_TO_ID = {
|
|
5800
|
+
permission: nativeConstants.OT_PROGRAM_KIND_PERMISSION,
|
|
5801
|
+
question: nativeConstants.OT_PROGRAM_KIND_QUESTION,
|
|
5802
|
+
auth: nativeConstants.OT_PROGRAM_KIND_AUTH
|
|
5803
|
+
};
|
|
5765
5804
|
var MOUSE_STYLE_TO_ID = {
|
|
5766
5805
|
auto: nativeConstants.OT_MOUSE_POINTER_AUTO,
|
|
5767
5806
|
default: nativeConstants.OT_MOUSE_POINTER_DEFAULT,
|
|
@@ -5896,6 +5935,50 @@ function sessionBytes(bytes, label) {
|
|
|
5896
5935
|
}
|
|
5897
5936
|
return new Uint8Array(typedArrayAccessors.buffer.get.call(bytes), typedArrayAccessors.byteOffset.get.call(bytes), length);
|
|
5898
5937
|
}
|
|
5938
|
+
function programStatusPayload(status, encoder) {
|
|
5939
|
+
const layout = nativeLayouts.ot_session_program_status;
|
|
5940
|
+
const { state, kind, progress, id, app, title, message } = status;
|
|
5941
|
+
const stateId = typeof state === "string" ? PROGRAM_STATE_TO_ID[state] : undefined;
|
|
5942
|
+
if (typeof stateId !== "number")
|
|
5943
|
+
throw new TypeError("Unknown program status state");
|
|
5944
|
+
const header = new Uint32Array(layout.size / 4);
|
|
5945
|
+
header[layout.fields.state.offset / 4] = stateId;
|
|
5946
|
+
if (kind != null) {
|
|
5947
|
+
const kindId = typeof kind === "string" ? PROGRAM_KIND_TO_ID[kind] : undefined;
|
|
5948
|
+
if (typeof kindId !== "number")
|
|
5949
|
+
throw new TypeError("Unknown program status kind");
|
|
5950
|
+
header[layout.fields.kind.offset / 4] = kindId;
|
|
5951
|
+
}
|
|
5952
|
+
if (progress != null) {
|
|
5953
|
+
if (typeof progress !== "number")
|
|
5954
|
+
throw new TypeError("Program status progress must be a number");
|
|
5955
|
+
if (!isFFIU32(progress))
|
|
5956
|
+
throw new RangeError("Program status progress must be an integer percentage");
|
|
5957
|
+
header[layout.fields.fields.offset / 4] = nativeConstants.OT_PROGRAM_STATUS_PROGRESS;
|
|
5958
|
+
header[layout.fields.progress.offset / 4] = progress;
|
|
5959
|
+
}
|
|
5960
|
+
if (id === "")
|
|
5961
|
+
throw new RangeError("Program status id must not be empty; omit it for the root record");
|
|
5962
|
+
const text = { id, app, title, message };
|
|
5963
|
+
const parts = ["id", "app", "title", "message"].map((name) => {
|
|
5964
|
+
const value = text[name];
|
|
5965
|
+
if (value == null)
|
|
5966
|
+
return new Uint8Array(0);
|
|
5967
|
+
if (typeof value !== "string")
|
|
5968
|
+
throw new TypeError(`Program status ${name} must be a string`);
|
|
5969
|
+
const bytes = encoder.encode(value.slice(0, NATIVE_SESSION_CONTROL_PACKET_BYTES2 + 1));
|
|
5970
|
+
header[layout.fields[`${name}_len`].offset / 4] = bytes.byteLength;
|
|
5971
|
+
return bytes;
|
|
5972
|
+
});
|
|
5973
|
+
const payload = new Uint8Array(layout.size + parts.reduce((total, part) => total + part.byteLength, 0));
|
|
5974
|
+
payload.set(new Uint8Array(header.buffer));
|
|
5975
|
+
let offset = layout.size;
|
|
5976
|
+
for (const part of parts) {
|
|
5977
|
+
payload.set(part, offset);
|
|
5978
|
+
offset += part.byteLength;
|
|
5979
|
+
}
|
|
5980
|
+
return payload;
|
|
5981
|
+
}
|
|
5899
5982
|
function pixelInput(data, length) {
|
|
5900
5983
|
if (typeof data === "number" || typeof data === "bigint")
|
|
5901
5984
|
return toPointer(data);
|
|
@@ -9559,6 +9642,10 @@ class FFIRenderLib2 {
|
|
|
9559
9642
|
record[kind] = nativeConstants.OT_CONTROL_KITTY_KEYBOARD_FLAGS;
|
|
9560
9643
|
record[layout.fields.argument.offset / 4] = toSafeFFIU32Length(command.flags, "Session Kitty keyboard flags");
|
|
9561
9644
|
break;
|
|
9645
|
+
case "program-status":
|
|
9646
|
+
record[kind] = nativeConstants.OT_CONTROL_PROGRAM_STATUS;
|
|
9647
|
+
bytes = programStatusPayload(command.status, this.encoder);
|
|
9648
|
+
break;
|
|
9562
9649
|
case "restore-modes":
|
|
9563
9650
|
record[kind] = nativeConstants.OT_CONTROL_RESTORE_MODES;
|
|
9564
9651
|
break;
|
|
@@ -9692,6 +9779,7 @@ class FFIRenderLib2 {
|
|
|
9692
9779
|
notifications: flag(nativeConstants.OT_CAP_NOTIFICATIONS),
|
|
9693
9780
|
explicit_cursor_positioning: flag(nativeConstants.OT_CAP_EXPLICIT_CURSOR_POSITIONING),
|
|
9694
9781
|
remote: flag(nativeConstants.OT_CAP_REMOTE),
|
|
9782
|
+
program_status: flag(nativeConstants.OT_CAP_PROGRAM_STATUS),
|
|
9695
9783
|
unicode: widthMethodFromCode(output[layout.fields.width_method.offset / 4]),
|
|
9696
9784
|
multiplexer: ["none", "tmux", "zellij", "screen", "unknown"][output[layout.fields.multiplexer.offset / 4]],
|
|
9697
9785
|
image_protocol: ["auto", "kitty", "sixel", "blocks"][output[layout.fields.image_protocol.offset / 4]],
|
|
@@ -12534,5 +12622,5 @@ var yoga_default = Yoga;
|
|
|
12534
12622
|
|
|
12535
12623
|
export { nativeConstants, toArrayBuffer, singleton, getSingleton, destroySingleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, stringWidth, resolveBundledFilePath2, Worker, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, createTextAttributes2, attributesWithLink2, getLinkId2, visualizeRenderableTree2, isStyledText2, StyledText2, stringToStyledText2, black2, red2, green2, yellow2, blue2, magenta2, cyan2, white2, brightBlack2, brightRed2, brightGreen2, brightYellow2, brightBlue2, brightMagenta2, brightCyan2, brightWhite2, bgBlack2, bgRed2, bgGreen2, bgYellow2, bgBlue2, bgMagenta2, bgCyan2, bgWhite2, bold2, italic2, underline2, strikethrough2, dim2, reverse2, blink2, fg2, bg2, link2, t2, YogaEnumKind, YogaFloatKind, YogaValueKind, sceneSetEnum, sceneGetEnum, sceneSetFloat, sceneSetValue, sceneGetValue, sceneSetDimension, UNDEFINED_VALUE, parseYogaValue, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, isBunfsPath, normalizeBunfsPath, resolveDefaultParserAsset, resolveDefaultTreeSitterWorkerPath, resolveTreeSitterWasm, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeTextViewCommand2, NativeEditCommand2, NativeEditPositionQuery2, NativeEditorStyleMask2, NativeEditHighlightOperation2, NativeEditorCommand2, NativeEditorSelectionOperation2, NativeEditorPositionQuery2, NativeEditEvent2, NativeStyleGroup, NativeStyleFlags, NATIVE_EDGE_NONE2, NativeBorder2, NativeSceneHook2, NativeSceneFrame2, NativeScenePaintPhase2, NATIVE_BUFFER_TEXT_BYTES_MAX2, NativeSessionState2, NativeSessionRenderStatus2, NATIVE_SESSION_CONTROL_PACKET_BYTES2, NativeSessionTerminalPhase2, NativeSessionPumpStatus2, NativeStatus2, NativeError2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, SceneStaging, NativePaintRecorder, LogLevel2, FFIRenderLib2, setRenderLibPath2, resolveRenderLib2, Align2, BoxSizing2, Dimension2, Direction2, Display2, Edge2, Errata2, ExperimentalFeature2, FlexDirection2, Gutter2, Justify2, LogLevel3, MeasureMode2, NodeType2, Overflow2, PositionType2, Unit2, Wrap2, ALIGN_AUTO2, ALIGN_FLEX_START2, ALIGN_CENTER2, ALIGN_FLEX_END2, ALIGN_STRETCH2, ALIGN_BASELINE2, ALIGN_SPACE_BETWEEN2, ALIGN_SPACE_AROUND2, ALIGN_SPACE_EVENLY2, BOX_SIZING_BORDER_BOX2, BOX_SIZING_CONTENT_BOX2, DIMENSION_WIDTH2, DIMENSION_HEIGHT2, DIRECTION_INHERIT2, DIRECTION_LTR2, DIRECTION_RTL2, DISPLAY_FLEX2, DISPLAY_NONE2, DISPLAY_CONTENTS2, EDGE_LEFT2, EDGE_TOP2, EDGE_RIGHT2, EDGE_BOTTOM2, EDGE_START2, EDGE_END2, EDGE_HORIZONTAL2, EDGE_VERTICAL2, EDGE_ALL2, ERRATA_NONE2, ERRATA_STRETCH_FLEX_BASIS2, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2, ERRATA_ALL2, ERRATA_CLASSIC2, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2, FLEX_DIRECTION_COLUMN2, FLEX_DIRECTION_COLUMN_REVERSE2, FLEX_DIRECTION_ROW2, FLEX_DIRECTION_ROW_REVERSE2, GUTTER_COLUMN2, GUTTER_ROW2, GUTTER_ALL2, JUSTIFY_FLEX_START2, JUSTIFY_CENTER2, JUSTIFY_FLEX_END2, JUSTIFY_SPACE_BETWEEN2, JUSTIFY_SPACE_AROUND2, JUSTIFY_SPACE_EVENLY2, LOG_LEVEL_ERROR2, LOG_LEVEL_WARN2, LOG_LEVEL_INFO2, LOG_LEVEL_DEBUG2, LOG_LEVEL_VERBOSE2, LOG_LEVEL_FATAL2, MEASURE_MODE_UNDEFINED2, MEASURE_MODE_EXACTLY2, MEASURE_MODE_AT_MOST2, NODE_TYPE_DEFAULT2, NODE_TYPE_TEXT2, OVERFLOW_VISIBLE2, OVERFLOW_HIDDEN2, OVERFLOW_SCROLL2, POSITION_TYPE_STATIC2, POSITION_TYPE_RELATIVE2, POSITION_TYPE_ABSOLUTE2, UNIT_UNDEFINED2, UNIT_POINT2, UNIT_PERCENT2, UNIT_AUTO2, WRAP_NO_WRAP2, WRAP_WRAP2, WRAP_WRAP_REVERSE2, YogaStatus2, YogaError2, Config2, Node2, exports_yoga, yoga_default };
|
|
12536
12624
|
|
|
12537
|
-
//# debugId=
|
|
12538
|
-
//# sourceMappingURL=chunk-bun-
|
|
12625
|
+
//# debugId=F20A9528ED9106B664756E2164756E21
|
|
12626
|
+
//# sourceMappingURL=chunk-bun-e2gttx65.js.map
|