@jitl/opentui-core 0.1.97-next.130245d
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/3d/SpriteResourceManager.d.ts +74 -0
- package/3d/SpriteUtils.d.ts +13 -0
- package/3d/TextureUtils.d.ts +24 -0
- package/3d/ThreeRenderable.d.ts +40 -0
- package/3d/WGPURenderer.d.ts +61 -0
- package/3d/animation/ExplodingSpriteEffect.d.ts +71 -0
- package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +76 -0
- package/3d/animation/SpriteAnimator.d.ts +124 -0
- package/3d/animation/SpriteParticleGenerator.d.ts +62 -0
- package/3d/canvas.d.ts +44 -0
- package/3d/index.d.ts +12 -0
- package/3d/physics/PlanckPhysicsAdapter.d.ts +19 -0
- package/3d/physics/RapierPhysicsAdapter.d.ts +19 -0
- package/3d/physics/physics-interface.d.ts +27 -0
- package/3d.d.ts +2 -0
- package/3d.js +33843 -0
- package/3d.js.map +155 -0
- package/LICENSE +21 -0
- package/NativeSpanFeed.d.ts +41 -0
- package/README.md +65 -0
- package/Renderable.d.ts +334 -0
- package/Worker-vajwjk0s.js +94 -0
- package/Worker-vajwjk0s.js.map +10 -0
- package/animation/Timeline.d.ts +126 -0
- package/ansi.d.ts +13 -0
- package/assets/javascript/highlights.scm +205 -0
- package/assets/javascript/tree-sitter-javascript.wasm +0 -0
- package/assets/markdown/highlights.scm +150 -0
- package/assets/markdown/injections.scm +27 -0
- package/assets/markdown/tree-sitter-markdown.wasm +0 -0
- package/assets/markdown_inline/highlights.scm +115 -0
- package/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
- package/assets/typescript/highlights.scm +604 -0
- package/assets/typescript/tree-sitter-typescript.wasm +0 -0
- package/assets/zig/highlights.scm +284 -0
- package/assets/zig/tree-sitter-zig.wasm +0 -0
- package/buffer.d.ts +111 -0
- package/compat/FFIType.d.ts +304 -0
- package/compat/Worker.d.ts +1 -0
- package/compat/bun-ffi-structs.d.ts +2 -0
- package/compat/ffi.d.ts +86 -0
- package/compat/nodejs/Worker.d.ts +16 -0
- package/compat/nodejs/bun-ffi-structs/index.d.ts +46 -0
- package/compat/nodejs/ffi.d.ts +21 -0
- package/compat/nodejs/registerBun.d.ts +1 -0
- package/compat/nodejs/registerResolveJs.d.ts +1 -0
- package/compat/nodejs/runtime.d.ts +7 -0
- package/compat/nodejs/test.d.ts +4 -0
- package/compat/nodejs/trampoline.worker.d.ts +1 -0
- package/compat/runtime.d.ts +8 -0
- package/compat/test.d.ts +1 -0
- package/compat/testHelpers.d.ts +18 -0
- package/console.d.ts +144 -0
- package/edit-buffer.d.ts +98 -0
- package/editor-view.d.ts +73 -0
- package/ffi-x3zvcksd.js +25 -0
- package/ffi-x3zvcksd.js.map +9 -0
- package/index-5yqvbmcz.js +220 -0
- package/index-5yqvbmcz.js.map +10 -0
- package/index-bnfz2g63.js +654 -0
- package/index-bnfz2g63.js.map +10 -0
- package/index-cbvybypy.js +43 -0
- package/index-cbvybypy.js.map +10 -0
- package/index-hjna9d1h.js +12074 -0
- package/index-hjna9d1h.js.map +42 -0
- package/index-jjp8mmgk.js +19991 -0
- package/index-jjp8mmgk.js.map +70 -0
- package/index-re3ntm60.js +51 -0
- package/index-re3ntm60.js.map +9 -0
- package/index-t16hn6zn.js +411 -0
- package/index-t16hn6zn.js.map +10 -0
- package/index-tkk6cmr2.js +650 -0
- package/index-tkk6cmr2.js.map +10 -0
- package/index.d.ts +23 -0
- package/index.js +480 -0
- package/index.js.map +9 -0
- package/lib/KeyHandler.d.ts +61 -0
- package/lib/RGBA.d.ts +26 -0
- package/lib/ascii.font.d.ts +508 -0
- package/lib/border.d.ts +51 -0
- package/lib/bunfs.d.ts +7 -0
- package/lib/clipboard.d.ts +17 -0
- package/lib/clock.d.ts +15 -0
- package/lib/data-paths.d.ts +26 -0
- package/lib/debounce.d.ts +42 -0
- package/lib/detect-links.d.ts +6 -0
- package/lib/env.d.ts +42 -0
- package/lib/extmarks-history.d.ts +17 -0
- package/lib/extmarks.d.ts +89 -0
- package/lib/hast-styled-text.d.ts +17 -0
- package/lib/index.d.ts +21 -0
- package/lib/keymapping.d.ts +25 -0
- package/lib/objects-in-viewport.d.ts +24 -0
- package/lib/output.capture.d.ts +24 -0
- package/lib/parse.keypress-kitty.d.ts +2 -0
- package/lib/parse.keypress.d.ts +26 -0
- package/lib/parse.mouse.d.ts +30 -0
- package/lib/paste.d.ts +7 -0
- package/lib/queue.d.ts +15 -0
- package/lib/renderable.validations.d.ts +12 -0
- package/lib/scroll-acceleration.d.ts +43 -0
- package/lib/selection.d.ts +64 -0
- package/lib/singleton.d.ts +7 -0
- package/lib/stdin-parser.d.ts +87 -0
- package/lib/styled-text.d.ts +63 -0
- package/lib/terminal-capability-detection.d.ts +30 -0
- package/lib/terminal-palette.d.ts +50 -0
- package/lib/tree-sitter/assets/update.d.ts +11 -0
- package/lib/tree-sitter/client.d.ts +47 -0
- package/lib/tree-sitter/default-parsers.d.ts +2 -0
- package/lib/tree-sitter/download-utils.d.ts +21 -0
- package/lib/tree-sitter/index.d.ts +8 -0
- package/lib/tree-sitter/parser.worker.d.ts +1 -0
- package/lib/tree-sitter/parsers-config.d.ts +53 -0
- package/lib/tree-sitter/resolve-ft.d.ts +5 -0
- package/lib/tree-sitter/types.d.ts +82 -0
- package/lib/tree-sitter-styled-text.d.ts +14 -0
- package/lib/validate-dir-name.d.ts +1 -0
- package/lib/yoga.options.d.ts +32 -0
- package/package.json +80 -0
- package/parser.worker.js +888 -0
- package/parser.worker.js.map +12 -0
- package/plugins/core-slot.d.ts +72 -0
- package/plugins/registry.d.ts +42 -0
- package/plugins/types.d.ts +34 -0
- package/post/effects.d.ts +147 -0
- package/post/filters.d.ts +65 -0
- package/post/matrices.d.ts +20 -0
- package/renderables/ASCIIFont.d.ts +52 -0
- package/renderables/Box.d.ts +81 -0
- package/renderables/Code.d.ts +78 -0
- package/renderables/Diff.d.ts +142 -0
- package/renderables/EditBufferRenderable.d.ts +237 -0
- package/renderables/FrameBuffer.d.ts +16 -0
- package/renderables/Input.d.ts +67 -0
- package/renderables/LineNumberRenderable.d.ts +78 -0
- package/renderables/Markdown.d.ts +181 -0
- package/renderables/ScrollBar.d.ts +77 -0
- package/renderables/ScrollBox.d.ts +124 -0
- package/renderables/Select.d.ts +115 -0
- package/renderables/Slider.d.ts +47 -0
- package/renderables/TabSelect.d.ts +96 -0
- package/renderables/Text.d.ts +36 -0
- package/renderables/TextBufferRenderable.d.ts +105 -0
- package/renderables/TextNode.d.ts +91 -0
- package/renderables/TextTable.d.ts +140 -0
- package/renderables/Textarea.d.ts +63 -0
- package/renderables/TimeToFirstDraw.d.ts +24 -0
- package/renderables/__tests__/renderable-test-utils.d.ts +12 -0
- package/renderables/composition/VRenderable.d.ts +16 -0
- package/renderables/composition/constructs.d.ts +35 -0
- package/renderables/composition/vnode.d.ts +46 -0
- package/renderables/index.d.ts +23 -0
- package/renderables/markdown-parser.d.ts +10 -0
- package/renderer.d.ts +419 -0
- package/runtime-hdpkc6qf.js +220 -0
- package/runtime-hdpkc6qf.js.map +17 -0
- package/runtime-plugin-support.d.ts +3 -0
- package/runtime-plugin-support.js +31 -0
- package/runtime-plugin-support.js.map +10 -0
- package/runtime-plugin.d.ts +19 -0
- package/runtime-plugin.js +18 -0
- package/runtime-plugin.js.map +9 -0
- package/syntax-style.d.ts +54 -0
- package/testing/manual-clock.d.ts +17 -0
- package/testing/mock-keys.d.ts +81 -0
- package/testing/mock-mouse.d.ts +38 -0
- package/testing/mock-tree-sitter-client.d.ts +23 -0
- package/testing/spy.d.ts +7 -0
- package/testing/test-recorder.d.ts +61 -0
- package/testing/test-renderer.d.ts +23 -0
- package/testing.d.ts +6 -0
- package/testing.js +699 -0
- package/testing.js.map +15 -0
- package/text-buffer-view.d.ts +42 -0
- package/text-buffer.d.ts +67 -0
- package/types.d.ts +139 -0
- package/utils.d.ts +14 -0
- package/zig-structs.d.ts +155 -0
- package/zig.d.ts +353 -0
package/compat/ffi.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { FFIType } from "./FFIType.js";
|
|
2
|
+
export { FFIType };
|
|
3
|
+
export type Pointer = number & {
|
|
4
|
+
__pointer__: null;
|
|
5
|
+
};
|
|
6
|
+
interface FFITypeStringToType {
|
|
7
|
+
["char"]: FFIType.char;
|
|
8
|
+
["int8_t"]: FFIType.int8_t;
|
|
9
|
+
["i8"]: FFIType.i8;
|
|
10
|
+
["uint8_t"]: FFIType.uint8_t;
|
|
11
|
+
["u8"]: FFIType.u8;
|
|
12
|
+
["int16_t"]: FFIType.int16_t;
|
|
13
|
+
["i16"]: FFIType.i16;
|
|
14
|
+
["uint16_t"]: FFIType.uint16_t;
|
|
15
|
+
["u16"]: FFIType.u16;
|
|
16
|
+
["int32_t"]: FFIType.int32_t;
|
|
17
|
+
["i32"]: FFIType.i32;
|
|
18
|
+
["int"]: FFIType.int;
|
|
19
|
+
["uint32_t"]: FFIType.uint32_t;
|
|
20
|
+
["u32"]: FFIType.u32;
|
|
21
|
+
["int64_t"]: FFIType.int64_t;
|
|
22
|
+
["i64"]: FFIType.i64;
|
|
23
|
+
["uint64_t"]: FFIType.uint64_t;
|
|
24
|
+
["u64"]: FFIType.u64;
|
|
25
|
+
["double"]: FFIType.double;
|
|
26
|
+
["f64"]: FFIType.f64;
|
|
27
|
+
["float"]: FFIType.float;
|
|
28
|
+
["f32"]: FFIType.f32;
|
|
29
|
+
["bool"]: FFIType.bool;
|
|
30
|
+
["ptr"]: FFIType.ptr;
|
|
31
|
+
["pointer"]: FFIType.pointer;
|
|
32
|
+
["void"]: FFIType.void;
|
|
33
|
+
["cstring"]: FFIType.cstring;
|
|
34
|
+
["function"]: FFIType.function;
|
|
35
|
+
["usize"]: FFIType.uint64_t;
|
|
36
|
+
["callback"]: FFIType.function;
|
|
37
|
+
["napi_env"]: FFIType.napi_env;
|
|
38
|
+
["napi_value"]: FFIType.napi_value;
|
|
39
|
+
["buffer"]: FFIType.buffer;
|
|
40
|
+
}
|
|
41
|
+
export type FFITypeOrString = FFIType | keyof FFITypeStringToType;
|
|
42
|
+
export interface FFIFunction {
|
|
43
|
+
readonly args?: readonly FFITypeOrString[];
|
|
44
|
+
readonly returns?: FFITypeOrString;
|
|
45
|
+
readonly ptr?: Pointer | bigint;
|
|
46
|
+
readonly threadsafe?: boolean;
|
|
47
|
+
}
|
|
48
|
+
type Symbols = Readonly<Record<string, FFIFunction>>;
|
|
49
|
+
type ToFFIType<T extends FFITypeOrString> = T extends FFIType ? T : T extends keyof FFITypeStringToType ? FFITypeStringToType[T] : never;
|
|
50
|
+
type NumericFFIType = FFIType.char | FFIType.int8_t | FFIType.i8 | FFIType.uint8_t | FFIType.u8 | FFIType.int16_t | FFIType.i16 | FFIType.uint16_t | FFIType.u16 | FFIType.int32_t | FFIType.i32 | FFIType.int | FFIType.uint32_t | FFIType.u32 | FFIType.double | FFIType.f64 | FFIType.float | FFIType.f32;
|
|
51
|
+
type BigIntArgFFIType = FFIType.int64_t | FFIType.i64 | FFIType.uint64_t | FFIType.u64 | FFIType.i64_fast | FFIType.u64_fast;
|
|
52
|
+
type BigIntReturnFFIType = FFIType.int64_t | FFIType.i64 | FFIType.uint64_t | FFIType.u64;
|
|
53
|
+
type PointerLike = NodeJS.TypedArray | DataView | Pointer | null;
|
|
54
|
+
type BufferLike = NodeJS.TypedArray | DataView;
|
|
55
|
+
type FFIArgValue<T extends FFIType> = T extends NumericFFIType ? number : T extends BigIntArgFFIType ? number | bigint : T extends FFIType.bool ? boolean : T extends FFIType.ptr | FFIType.pointer | FFIType.cstring ? PointerLike : T extends FFIType.void ? undefined : T extends FFIType.function ? Pointer | JSCallback : T extends FFIType.napi_env | FFIType.napi_value ? unknown : T extends FFIType.buffer ? BufferLike : never;
|
|
56
|
+
type FFIReturnValue<T extends FFIType> = T extends NumericFFIType ? number : T extends BigIntReturnFFIType ? bigint : T extends FFIType.i64_fast | FFIType.u64_fast ? number | bigint : T extends FFIType.bool ? boolean : T extends FFIType.ptr | FFIType.pointer | FFIType.cstring | FFIType.function ? Pointer | null : T extends FFIType.void ? undefined : T extends FFIType.napi_env | FFIType.napi_value ? unknown : T extends FFIType.buffer ? BufferLike : never;
|
|
57
|
+
declare const FFIFunctionCallableSymbol: unique symbol;
|
|
58
|
+
export type ConvertFns<Fns extends Symbols> = {
|
|
59
|
+
[K in keyof Fns]: {
|
|
60
|
+
(...args: Fns[K]["args"] extends infer A extends readonly FFITypeOrString[] ? {
|
|
61
|
+
[L in keyof A]: FFIArgValue<ToFFIType<A[L]>>;
|
|
62
|
+
} : [unknown] extends [Fns[K]["args"]] ? [] : never): [unknown] extends [Fns[K]["returns"]] ? undefined : FFIReturnValue<ToFFIType<NonNullable<Fns[K]["returns"]>>>;
|
|
63
|
+
__ffi_function_callable: typeof FFIFunctionCallableSymbol;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export interface Library<Fns extends Symbols> {
|
|
67
|
+
symbols: ConvertFns<Fns>;
|
|
68
|
+
close(): void;
|
|
69
|
+
}
|
|
70
|
+
export interface JSCallback {
|
|
71
|
+
readonly ptr: Pointer | null;
|
|
72
|
+
readonly threadsafe: boolean;
|
|
73
|
+
close(): void;
|
|
74
|
+
}
|
|
75
|
+
export interface JSCallbackConstructor {
|
|
76
|
+
new (callback: (...args: any[]) => any, definition: FFIFunction): JSCallback;
|
|
77
|
+
}
|
|
78
|
+
export type DlopenFunction = <Fns extends Record<string, FFIFunction>>(name: string | URL, symbols: Fns) => Library<Fns>;
|
|
79
|
+
export type PtrFunction = (value: ArrayBufferLike | ArrayBufferView) => Pointer;
|
|
80
|
+
export type ToArrayBufferFunction = (pointer: Pointer, offset: number | undefined, length: number) => ArrayBuffer;
|
|
81
|
+
export declare const JSCallback: JSCallbackConstructor;
|
|
82
|
+
export declare const dlopen: DlopenFunction;
|
|
83
|
+
export declare const ptr: PtrFunction;
|
|
84
|
+
export declare const suffix: string;
|
|
85
|
+
export declare const toArrayBuffer: ToArrayBufferFunction;
|
|
86
|
+
export declare const __url: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Worker as NodeWorker } from "node:worker_threads";
|
|
2
|
+
type MessageEventLike<T = unknown> = {
|
|
3
|
+
data: T;
|
|
4
|
+
};
|
|
5
|
+
type ErrorEventLike = {
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function resolveWorkerTarget(url: string | URL): string;
|
|
9
|
+
export declare function resolveWorkerEntrypoint(url: string | URL): string | URL;
|
|
10
|
+
export declare function resolveImportArg(url: string | URL): string;
|
|
11
|
+
export declare class Worker extends NodeWorker {
|
|
12
|
+
onmessage: ((event: MessageEventLike) => void) | null;
|
|
13
|
+
onerror: ((event: ErrorEventLike) => void) | null;
|
|
14
|
+
constructor(url: string | URL);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export var pointerSize: number;
|
|
2
|
+
export function packObjectArray(val: any): DataView<ArrayBuffer>;
|
|
3
|
+
export function objectPtr(): {
|
|
4
|
+
__type: string;
|
|
5
|
+
};
|
|
6
|
+
export function defineStruct(fields: any, structDefOptions: any): {
|
|
7
|
+
__type: string;
|
|
8
|
+
size: number;
|
|
9
|
+
align: number;
|
|
10
|
+
hasMapValue: boolean;
|
|
11
|
+
layoutByName: Map<any, {
|
|
12
|
+
name: any;
|
|
13
|
+
offset: number;
|
|
14
|
+
size: number;
|
|
15
|
+
align: number;
|
|
16
|
+
optional: boolean;
|
|
17
|
+
type: any;
|
|
18
|
+
lengthOf: any;
|
|
19
|
+
}>;
|
|
20
|
+
arrayFields: Map<string, any>;
|
|
21
|
+
pack(obj: any, options: any): ArrayBuffer;
|
|
22
|
+
packInto(obj: any, view: any, offset2: any, options: any): void;
|
|
23
|
+
unpack(buf: any): any;
|
|
24
|
+
packList(objects: any, options: any): ArrayBuffer;
|
|
25
|
+
unpackList(buf: any, count: any): any[];
|
|
26
|
+
describe(): {
|
|
27
|
+
name: any;
|
|
28
|
+
offset: number;
|
|
29
|
+
size: number;
|
|
30
|
+
align: number;
|
|
31
|
+
optional: boolean;
|
|
32
|
+
type: any;
|
|
33
|
+
lengthOf: any;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
export function defineEnum(mapping: any, base?: string): {
|
|
37
|
+
__type: string;
|
|
38
|
+
type: string;
|
|
39
|
+
to(value: any): any;
|
|
40
|
+
from(value: any): any;
|
|
41
|
+
enum: any;
|
|
42
|
+
};
|
|
43
|
+
export function allocStruct(structDef: any, options: any): {
|
|
44
|
+
buffer: ArrayBuffer;
|
|
45
|
+
view: DataView<ArrayBuffer>;
|
|
46
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DlopenFunction, FFIFunction, JSCallback as IJSCallback, Pointer, PtrFunction, ToArrayBufferFunction } from "../ffi.js";
|
|
2
|
+
import { FFIType } from "../FFIType.js";
|
|
3
|
+
export { FFIType };
|
|
4
|
+
export declare class JSCallback implements IJSCallback {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(callback: (...args: any[]) => any, definition: FFIFunction);
|
|
7
|
+
get ptr(): Pointer | null;
|
|
8
|
+
get threadsafe(): boolean;
|
|
9
|
+
close(): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get Pointer address of a TypedArray or ArrayBuffer
|
|
13
|
+
*/
|
|
14
|
+
export declare const ptr: PtrFunction;
|
|
15
|
+
/**
|
|
16
|
+
* Get an ArrayBuffer aliasing the memory at the given Pointer number
|
|
17
|
+
*/
|
|
18
|
+
export declare const toArrayBuffer: ToArrayBufferFunction;
|
|
19
|
+
export declare const suffix: string;
|
|
20
|
+
export declare const dlopen: DlopenFunction;
|
|
21
|
+
export declare const __url: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import stringWidthLib from "string-width";
|
|
2
|
+
import stripAnsiLib from "strip-ansi";
|
|
3
|
+
import type { WriteFileOptions } from "../runtime.js";
|
|
4
|
+
export declare function sleep(msOrDate: number | Date): Promise<void>;
|
|
5
|
+
export declare const stringWidth: typeof stringWidthLib;
|
|
6
|
+
export declare const stripANSI: typeof stripAnsiLib;
|
|
7
|
+
export declare function writeFile(destination: string | URL, data: string | ArrayBufferView, options?: WriteFileOptions): Promise<number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface WriteFileOptions {
|
|
2
|
+
createPath?: boolean;
|
|
3
|
+
mode?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const sleep: (msOrDate: number | Date) => Promise<void>;
|
|
6
|
+
export declare const stringWidth: (text: string) => number;
|
|
7
|
+
export declare const stripANSI: (text: string) => string;
|
|
8
|
+
export declare const writeFile: (destination: string | URL, data: string | ArrayBufferView, options?: WriteFileOptions) => Promise<number>;
|
package/compat/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nodejs/test.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SpawnSyncOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
env?: NodeJS.ProcessEnv;
|
|
4
|
+
stderr?: "ignore" | "pipe";
|
|
5
|
+
stdin?: "ignore" | "pipe";
|
|
6
|
+
stdout?: "ignore" | "pipe";
|
|
7
|
+
timeout?: number;
|
|
8
|
+
maxBuffer?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SpawnSyncResult {
|
|
11
|
+
stdout: Uint8Array;
|
|
12
|
+
stderr: Uint8Array;
|
|
13
|
+
exitCode: number;
|
|
14
|
+
success: boolean;
|
|
15
|
+
pid: number;
|
|
16
|
+
signalCode?: NodeJS.Signals | number;
|
|
17
|
+
}
|
|
18
|
+
export declare function spawnSync(cmd: string[], options?: SpawnSyncOptions): SpawnSyncResult;
|
package/console.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
import type { CliRenderer, MouseEvent } from "./renderer.js";
|
|
3
|
+
import type { ColorInput } from "./lib/RGBA.js";
|
|
4
|
+
import { OptimizedBuffer } from "./buffer.js";
|
|
5
|
+
import { type Clock } from "./lib/clock.js";
|
|
6
|
+
import { Capture } from "./lib/output.capture.js";
|
|
7
|
+
import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "./lib/keymapping.js";
|
|
8
|
+
export declare const capture: Capture;
|
|
9
|
+
export declare enum ConsolePosition {
|
|
10
|
+
TOP = "top",
|
|
11
|
+
BOTTOM = "bottom",
|
|
12
|
+
LEFT = "left",
|
|
13
|
+
RIGHT = "right"
|
|
14
|
+
}
|
|
15
|
+
export type ConsoleAction = "scroll-up" | "scroll-down" | "scroll-to-top" | "scroll-to-bottom" | "position-previous" | "position-next" | "size-increase" | "size-decrease" | "save-logs" | "copy-selection";
|
|
16
|
+
export type ConsoleKeyBinding = BaseKeyBinding<ConsoleAction>;
|
|
17
|
+
export interface ConsoleOptions {
|
|
18
|
+
position?: ConsolePosition;
|
|
19
|
+
sizePercent?: number;
|
|
20
|
+
zIndex?: number;
|
|
21
|
+
colorInfo?: ColorInput;
|
|
22
|
+
colorWarn?: ColorInput;
|
|
23
|
+
colorError?: ColorInput;
|
|
24
|
+
colorDebug?: ColorInput;
|
|
25
|
+
colorDefault?: ColorInput;
|
|
26
|
+
backgroundColor?: ColorInput;
|
|
27
|
+
startInDebugMode?: boolean;
|
|
28
|
+
title?: string;
|
|
29
|
+
titleBarColor?: ColorInput;
|
|
30
|
+
titleBarTextColor?: ColorInput;
|
|
31
|
+
cursorColor?: ColorInput;
|
|
32
|
+
maxStoredLogs?: number;
|
|
33
|
+
maxDisplayLines?: number;
|
|
34
|
+
onCopySelection?: (text: string) => void;
|
|
35
|
+
keyBindings?: ConsoleKeyBinding[];
|
|
36
|
+
keyAliasMap?: KeyAliasMap;
|
|
37
|
+
selectionColor?: ColorInput;
|
|
38
|
+
copyButtonColor?: ColorInput;
|
|
39
|
+
clock?: Clock;
|
|
40
|
+
}
|
|
41
|
+
export declare class TerminalConsole extends EventEmitter {
|
|
42
|
+
private isVisible;
|
|
43
|
+
private isFocused;
|
|
44
|
+
private renderer;
|
|
45
|
+
private keyHandler;
|
|
46
|
+
private options;
|
|
47
|
+
private _debugModeEnabled;
|
|
48
|
+
private frameBuffer;
|
|
49
|
+
private consoleX;
|
|
50
|
+
private consoleY;
|
|
51
|
+
private consoleWidth;
|
|
52
|
+
private consoleHeight;
|
|
53
|
+
private scrollTopIndex;
|
|
54
|
+
private isScrolledToBottom;
|
|
55
|
+
private currentLineIndex;
|
|
56
|
+
private _displayLines;
|
|
57
|
+
private _allLogEntries;
|
|
58
|
+
private _needsFrameBufferUpdate;
|
|
59
|
+
private _entryListener;
|
|
60
|
+
private _selectionStart;
|
|
61
|
+
private _selectionEnd;
|
|
62
|
+
private _isDragging;
|
|
63
|
+
private _copyButtonBounds;
|
|
64
|
+
private _autoScrollInterval;
|
|
65
|
+
private readonly clock;
|
|
66
|
+
private _keyBindingsMap;
|
|
67
|
+
private _keyAliasMap;
|
|
68
|
+
private _keyBindings;
|
|
69
|
+
private _mergedKeyBindings;
|
|
70
|
+
private _actionHandlers;
|
|
71
|
+
private markNeedsRerender;
|
|
72
|
+
private getCopyButtonLabel;
|
|
73
|
+
private _rgbaInfo;
|
|
74
|
+
private _rgbaWarn;
|
|
75
|
+
private _rgbaError;
|
|
76
|
+
private _rgbaDebug;
|
|
77
|
+
private _rgbaDefault;
|
|
78
|
+
private backgroundColor;
|
|
79
|
+
private _rgbaTitleBar;
|
|
80
|
+
private _rgbaTitleBarText;
|
|
81
|
+
private _title;
|
|
82
|
+
private _rgbaCursor;
|
|
83
|
+
private _rgbaSelection;
|
|
84
|
+
private _rgbaCopyButton;
|
|
85
|
+
private _positions;
|
|
86
|
+
constructor(renderer: CliRenderer, options?: ConsoleOptions);
|
|
87
|
+
private buildActionHandlers;
|
|
88
|
+
activate(): void;
|
|
89
|
+
deactivate(): void;
|
|
90
|
+
private _handleNewLog;
|
|
91
|
+
private _updateConsoleDimensions;
|
|
92
|
+
private handleKeyPress;
|
|
93
|
+
private scrollUp;
|
|
94
|
+
private scrollDown;
|
|
95
|
+
private scrollToTop;
|
|
96
|
+
private scrollToBottomAction;
|
|
97
|
+
private positionPrevious;
|
|
98
|
+
private positionNext;
|
|
99
|
+
private sizeIncrease;
|
|
100
|
+
private sizeDecrease;
|
|
101
|
+
private saveLogsAction;
|
|
102
|
+
private triggerCopyAction;
|
|
103
|
+
private attachStdin;
|
|
104
|
+
private detachStdin;
|
|
105
|
+
private formatTimestamp;
|
|
106
|
+
private formatArguments;
|
|
107
|
+
resize(width: number, height: number): void;
|
|
108
|
+
clear(): void;
|
|
109
|
+
toggle(): void;
|
|
110
|
+
focus(): void;
|
|
111
|
+
blur(): void;
|
|
112
|
+
show(): void;
|
|
113
|
+
hide(): void;
|
|
114
|
+
destroy(): void;
|
|
115
|
+
getCachedLogs(): string;
|
|
116
|
+
private updateFrameBuffer;
|
|
117
|
+
renderToBuffer(buffer: OptimizedBuffer): void;
|
|
118
|
+
setDebugMode(enabled: boolean): void;
|
|
119
|
+
toggleDebugMode(): void;
|
|
120
|
+
set keyBindings(bindings: ConsoleKeyBinding[]);
|
|
121
|
+
set keyAliasMap(aliases: KeyAliasMap);
|
|
122
|
+
set onCopySelection(callback: ((text: string) => void) | undefined);
|
|
123
|
+
get onCopySelection(): ((text: string) => void) | undefined;
|
|
124
|
+
private _scrollToBottom;
|
|
125
|
+
private _processLogEntry;
|
|
126
|
+
private _processCachedLogs;
|
|
127
|
+
private hasSelection;
|
|
128
|
+
private normalizeSelection;
|
|
129
|
+
private getSelectedText;
|
|
130
|
+
private clearSelection;
|
|
131
|
+
private stopAutoScroll;
|
|
132
|
+
private startAutoScroll;
|
|
133
|
+
private triggerCopy;
|
|
134
|
+
private getLineSelectionRange;
|
|
135
|
+
handleMouse(event: MouseEvent): boolean;
|
|
136
|
+
get visible(): boolean;
|
|
137
|
+
get bounds(): {
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
width: number;
|
|
141
|
+
height: number;
|
|
142
|
+
};
|
|
143
|
+
private saveLogsToFile;
|
|
144
|
+
}
|
package/edit-buffer.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type LogicalCursor, type RenderLib } from "./zig.js";
|
|
2
|
+
import { type Pointer } from "./compat/ffi.js";
|
|
3
|
+
import { type WidthMethod, type Highlight } from "./types.js";
|
|
4
|
+
import { RGBA } from "./lib/RGBA.js";
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
import type { SyntaxStyle } from "./syntax-style.js";
|
|
7
|
+
export type { LogicalCursor };
|
|
8
|
+
/**
|
|
9
|
+
* EditBuffer provides a text editing buffer with cursor management,
|
|
10
|
+
* incremental editing, and grapheme-aware operations.
|
|
11
|
+
*/
|
|
12
|
+
export declare class EditBuffer extends EventEmitter {
|
|
13
|
+
private static registry;
|
|
14
|
+
private static nativeEventsSubscribed;
|
|
15
|
+
private lib;
|
|
16
|
+
private bufferPtr;
|
|
17
|
+
private textBufferPtr;
|
|
18
|
+
readonly id: number;
|
|
19
|
+
private _destroyed;
|
|
20
|
+
private _textBytes;
|
|
21
|
+
private _singleTextBytes;
|
|
22
|
+
private _singleTextMemId;
|
|
23
|
+
private _syntaxStyle?;
|
|
24
|
+
constructor(lib: RenderLib, ptr: Pointer);
|
|
25
|
+
static create(widthMethod: WidthMethod): EditBuffer;
|
|
26
|
+
private static subscribeToNativeEvents;
|
|
27
|
+
private guard;
|
|
28
|
+
get ptr(): Pointer;
|
|
29
|
+
/**
|
|
30
|
+
* Set text and completely reset the buffer state (clears history, resets add_buffer).
|
|
31
|
+
* Use this for initial text setting or when you want a clean slate.
|
|
32
|
+
*/
|
|
33
|
+
setText(text: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Set text using owned memory and completely reset the buffer state (clears history, resets add_buffer).
|
|
36
|
+
* The native code takes ownership of the memory.
|
|
37
|
+
*/
|
|
38
|
+
setTextOwned(text: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Replace text while preserving undo history (creates an undo point).
|
|
41
|
+
* Use this when you want the setText operation to be undoable.
|
|
42
|
+
*/
|
|
43
|
+
replaceText(text: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Replace text using owned memory while preserving undo history (creates an undo point).
|
|
46
|
+
* The native code takes ownership of the memory.
|
|
47
|
+
*/
|
|
48
|
+
replaceTextOwned(text: string): void;
|
|
49
|
+
getLineCount(): number;
|
|
50
|
+
getText(): string;
|
|
51
|
+
insertChar(char: string): void;
|
|
52
|
+
insertText(text: string): void;
|
|
53
|
+
deleteChar(): void;
|
|
54
|
+
deleteCharBackward(): void;
|
|
55
|
+
deleteRange(startLine: number, startCol: number, endLine: number, endCol: number): void;
|
|
56
|
+
newLine(): void;
|
|
57
|
+
deleteLine(): void;
|
|
58
|
+
moveCursorLeft(): void;
|
|
59
|
+
moveCursorRight(): void;
|
|
60
|
+
moveCursorUp(): void;
|
|
61
|
+
moveCursorDown(): void;
|
|
62
|
+
gotoLine(line: number): void;
|
|
63
|
+
setCursor(line: number, col: number): void;
|
|
64
|
+
setCursorToLineCol(line: number, col: number): void;
|
|
65
|
+
setCursorByOffset(offset: number): void;
|
|
66
|
+
getCursorPosition(): LogicalCursor;
|
|
67
|
+
getNextWordBoundary(): LogicalCursor;
|
|
68
|
+
getPrevWordBoundary(): LogicalCursor;
|
|
69
|
+
getEOL(): LogicalCursor;
|
|
70
|
+
offsetToPosition(offset: number): {
|
|
71
|
+
row: number;
|
|
72
|
+
col: number;
|
|
73
|
+
} | null;
|
|
74
|
+
positionToOffset(row: number, col: number): number;
|
|
75
|
+
getLineStartOffset(row: number): number;
|
|
76
|
+
getTextRange(startOffset: number, endOffset: number): string;
|
|
77
|
+
getTextRangeByCoords(startRow: number, startCol: number, endRow: number, endCol: number): string;
|
|
78
|
+
debugLogRope(): void;
|
|
79
|
+
undo(): string | null;
|
|
80
|
+
redo(): string | null;
|
|
81
|
+
canUndo(): boolean;
|
|
82
|
+
canRedo(): boolean;
|
|
83
|
+
clearHistory(): void;
|
|
84
|
+
setDefaultFg(fg: RGBA | null): void;
|
|
85
|
+
setDefaultBg(bg: RGBA | null): void;
|
|
86
|
+
setDefaultAttributes(attributes: number | null): void;
|
|
87
|
+
resetDefaults(): void;
|
|
88
|
+
setSyntaxStyle(style: SyntaxStyle | null): void;
|
|
89
|
+
getSyntaxStyle(): SyntaxStyle | null;
|
|
90
|
+
addHighlight(lineIdx: number, highlight: Highlight): void;
|
|
91
|
+
addHighlightByCharRange(highlight: Highlight): void;
|
|
92
|
+
removeHighlightsByRef(hlRef: number): void;
|
|
93
|
+
clearLineHighlights(lineIdx: number): void;
|
|
94
|
+
clearAllHighlights(): void;
|
|
95
|
+
getLineHighlights(lineIdx: number): Array<Highlight>;
|
|
96
|
+
clear(): void;
|
|
97
|
+
destroy(): void;
|
|
98
|
+
}
|
package/editor-view.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { RGBA } from "./lib/RGBA.js";
|
|
2
|
+
import { type RenderLib, type VisualCursor, type LineInfo } from "./zig.js";
|
|
3
|
+
import { type Pointer } from "./compat/ffi.js";
|
|
4
|
+
import type { EditBuffer } from "./edit-buffer.js";
|
|
5
|
+
export interface Viewport {
|
|
6
|
+
offsetY: number;
|
|
7
|
+
offsetX: number;
|
|
8
|
+
height: number;
|
|
9
|
+
width: number;
|
|
10
|
+
}
|
|
11
|
+
export type { VisualCursor };
|
|
12
|
+
export declare class EditorView {
|
|
13
|
+
private lib;
|
|
14
|
+
private viewPtr;
|
|
15
|
+
private editBuffer;
|
|
16
|
+
private _destroyed;
|
|
17
|
+
private _extmarksController?;
|
|
18
|
+
private _textBufferViewPtr?;
|
|
19
|
+
constructor(lib: RenderLib, ptr: Pointer, editBuffer: EditBuffer);
|
|
20
|
+
static create(editBuffer: EditBuffer, viewportWidth: number, viewportHeight: number): EditorView;
|
|
21
|
+
private guard;
|
|
22
|
+
get ptr(): Pointer;
|
|
23
|
+
setViewportSize(width: number, height: number): void;
|
|
24
|
+
setViewport(x: number, y: number, width: number, height: number, moveCursor?: boolean): void;
|
|
25
|
+
getViewport(): Viewport;
|
|
26
|
+
setScrollMargin(margin: number): void;
|
|
27
|
+
setWrapMode(mode: "none" | "char" | "word"): void;
|
|
28
|
+
getVirtualLineCount(): number;
|
|
29
|
+
getTotalVirtualLineCount(): number;
|
|
30
|
+
setSelection(start: number, end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
31
|
+
updateSelection(end: number, bgColor?: RGBA, fgColor?: RGBA): void;
|
|
32
|
+
resetSelection(): void;
|
|
33
|
+
getSelection(): {
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
} | null;
|
|
37
|
+
hasSelection(): boolean;
|
|
38
|
+
setLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean): boolean;
|
|
39
|
+
updateLocalSelection(anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor?: RGBA, fgColor?: RGBA, updateCursor?: boolean, followCursor?: boolean): boolean;
|
|
40
|
+
resetLocalSelection(): void;
|
|
41
|
+
getSelectedText(): string;
|
|
42
|
+
getCursor(): {
|
|
43
|
+
row: number;
|
|
44
|
+
col: number;
|
|
45
|
+
};
|
|
46
|
+
getText(): string;
|
|
47
|
+
getVisualCursor(): VisualCursor;
|
|
48
|
+
moveUpVisual(): void;
|
|
49
|
+
moveDownVisual(): void;
|
|
50
|
+
deleteSelectedText(): void;
|
|
51
|
+
setCursorByOffset(offset: number): void;
|
|
52
|
+
getNextWordBoundary(): VisualCursor;
|
|
53
|
+
getPrevWordBoundary(): VisualCursor;
|
|
54
|
+
getEOL(): VisualCursor;
|
|
55
|
+
getVisualSOL(): VisualCursor;
|
|
56
|
+
getVisualEOL(): VisualCursor;
|
|
57
|
+
getLineInfo(): LineInfo;
|
|
58
|
+
getLogicalLineInfo(): LineInfo;
|
|
59
|
+
get extmarks(): any;
|
|
60
|
+
setPlaceholderStyledText(chunks: {
|
|
61
|
+
text: string;
|
|
62
|
+
fg?: RGBA;
|
|
63
|
+
bg?: RGBA;
|
|
64
|
+
attributes?: number;
|
|
65
|
+
}[]): void;
|
|
66
|
+
setTabIndicator(indicator: string | number): void;
|
|
67
|
+
setTabIndicatorColor(color: RGBA): void;
|
|
68
|
+
measureForDimensions(width: number, height: number): {
|
|
69
|
+
lineCount: number;
|
|
70
|
+
widthColsMax: number;
|
|
71
|
+
} | null;
|
|
72
|
+
destroy(): void;
|
|
73
|
+
}
|
package/ffi-x3zvcksd.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
JSCallback,
|
|
4
|
+
__url,
|
|
5
|
+
dlopen,
|
|
6
|
+
ptr,
|
|
7
|
+
suffix,
|
|
8
|
+
toArrayBuffer
|
|
9
|
+
} from "./index-5yqvbmcz.js";
|
|
10
|
+
import {
|
|
11
|
+
FFIType
|
|
12
|
+
} from "./index-cbvybypy.js";
|
|
13
|
+
import"./index-re3ntm60.js";
|
|
14
|
+
export {
|
|
15
|
+
toArrayBuffer,
|
|
16
|
+
suffix,
|
|
17
|
+
ptr,
|
|
18
|
+
dlopen,
|
|
19
|
+
__url,
|
|
20
|
+
JSCallback,
|
|
21
|
+
FFIType
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//# debugId=DDBA855A1CE9F93664756E2164756E21
|
|
25
|
+
//# sourceMappingURL=ffi-x3zvcksd.js.map
|