@opentui/core 0.8.3 → 0.9.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.
Files changed (87) hide show
  1. package/NativeScene.d.ts +13 -2
  2. package/Renderable.d.ts +16 -6
  3. package/ansi.d.ts +1 -1
  4. package/{chunk-bun-psdzwx7h.js → chunk-bun-rgb7yx3r.js} +8959 -9989
  5. package/chunk-bun-rgb7yx3r.js.map +68 -0
  6. package/{chunk-bun-12ttbayv.js → chunk-bun-ywheza3e.js} +664 -102
  7. package/chunk-bun-ywheza3e.js.map +35 -0
  8. package/{chunk-node-drh8dgw6.js → chunk-node-fcberveq.js} +8959 -9989
  9. package/chunk-node-fcberveq.js.map +68 -0
  10. package/{chunk-node-88t8pbzy.js → chunk-node-k5s8s41v.js} +664 -102
  11. package/chunk-node-k5s8s41v.js.map +34 -0
  12. package/edit-buffer.d.ts +40 -5
  13. package/editor-view.d.ts +28 -0
  14. package/index.bun.js +1252 -4790
  15. package/index.bun.js.map +18 -24
  16. package/index.node.js +1252 -4790
  17. package/index.node.js.map +19 -31
  18. package/lib/KeyHandler.d.ts +1 -1
  19. package/lib/extmarks.d.ts +15 -51
  20. package/lib/index.d.ts +1 -2
  21. package/lib/kitty-keys.d.ts +2 -0
  22. package/lib/parse.keypress.d.ts +8 -3
  23. package/lib/parse.mouse.d.ts +0 -13
  24. package/lib/stdin-parser-native.d.ts +36 -24
  25. package/lib/terminal-capability-detection.d.ts +3 -3
  26. package/lib/terminal-palette.d.ts +3 -0
  27. package/lib/tree-sitter/client.d.ts +14 -3
  28. package/lib/tree-sitter/types.d.ts +10 -0
  29. package/lib/tree-sitter-styled-text.d.ts +2 -0
  30. package/lib/yoga.options.d.ts +3 -0
  31. package/native-abi.generated.d.ts +1395 -0
  32. package/package.json +9 -10
  33. package/parser.worker.js +112 -29
  34. package/parser.worker.js.map +3 -3
  35. package/plugins/core-slot.d.ts +1 -1
  36. package/renderables/ASCIIFont.d.ts +5 -0
  37. package/renderables/Code.d.ts +25 -2
  38. package/renderables/Diff.d.ts +3 -1
  39. package/renderables/EditBufferRenderable.d.ts +30 -1
  40. package/renderables/EmbeddedTerminal.d.ts +1 -1
  41. package/renderables/Input.d.ts +6 -3
  42. package/renderables/LineNumberRenderable.d.ts +4 -0
  43. package/renderables/Markdown.d.ts +208 -124
  44. package/renderables/ScrollBox.d.ts +7 -2
  45. package/renderables/ScrollBoxParts.d.ts +4 -5
  46. package/renderables/Select.d.ts +2 -2
  47. package/renderables/TabSelect.d.ts +2 -2
  48. package/renderables/Text.d.ts +3 -1
  49. package/renderables/TextBufferRenderable.d.ts +2 -0
  50. package/renderables/TextTable.d.ts +6 -0
  51. package/renderables/Textarea.d.ts +2 -1
  52. package/renderables/__tests__/code-model-harness.d.ts +40 -0
  53. package/renderables/index.d.ts +1 -3
  54. package/renderables/markdown-document.d.ts +37 -0
  55. package/renderables/props.d.ts +10 -0
  56. package/renderer-theme-mode.d.ts +5 -1
  57. package/renderer.d.ts +23 -9
  58. package/runtime-plugin.js +32 -57
  59. package/runtime-plugin.js.map +1 -1
  60. package/syntax-style.d.ts +5 -0
  61. package/testing/mock-tree-sitter-client.d.ts +5 -0
  62. package/testing/model.d.ts +15 -0
  63. package/testing.bun.js +8 -31
  64. package/testing.bun.js.map +4 -4
  65. package/testing.js +8 -31
  66. package/testing.js.map +4 -4
  67. package/tests/shrink-same-check.d.ts +4 -0
  68. package/tests/yoga-upstream/tools/utils.d.ts +9 -2
  69. package/text-buffer.d.ts +4 -0
  70. package/types.d.ts +2 -2
  71. package/yoga.bun.js +1 -1
  72. package/yoga.internal.d.ts +1 -0
  73. package/yoga.js +1 -1
  74. package/zig.d.ts +104 -5
  75. package/chunk-bun-12ttbayv.js.map +0 -35
  76. package/chunk-bun-psdzwx7h.js.map +0 -70
  77. package/chunk-node-88t8pbzy.js.map +0 -34
  78. package/chunk-node-drh8dgw6.js.map +0 -70
  79. package/lib/debounce.d.ts +0 -42
  80. package/lib/extmarks-history.d.ts +0 -17
  81. package/lib/parse.keypress-kitty.d.ts +0 -5
  82. package/lib/queue.d.ts +0 -15
  83. package/lib/stdin-parser.d.ts +0 -97
  84. package/renderables/composition/VRenderable.d.ts +0 -16
  85. package/renderables/composition/constructs.d.ts +0 -35
  86. package/renderables/composition/vnode.d.ts +0 -46
  87. package/renderables/markdown-parser.d.ts +0 -12
package/lib/debounce.d.ts DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * Debounce controller that manages debounce instances for a specific scope
3
- */
4
- export declare class DebounceController {
5
- private scopeId;
6
- constructor(scopeId: string | number);
7
- /**
8
- * Debounces the provided function with the given ID
9
- *
10
- * @param id Unique identifier within this scope
11
- * @param ms Milliseconds to wait before executing
12
- * @param fn Function to execute
13
- */
14
- debounce<R>(id: string | number, ms: number, fn: () => Promise<R>): Promise<R>;
15
- /**
16
- * Clear a specific debounce timer in this scope
17
- *
18
- * @param id The debounce ID to clear
19
- */
20
- clearDebounce(id: string | number): void;
21
- /**
22
- * Clear all debounce timers in this scope
23
- */
24
- clear(): void;
25
- }
26
- /**
27
- * Creates a new debounce controller for a specific scope
28
- *
29
- * @param scopeId Unique identifier for this debounce scope
30
- * @returns A DebounceController for the specified scope
31
- */
32
- export declare function createDebounce(scopeId: string | number): DebounceController;
33
- /**
34
- * Clears all debounce timers for a specific scope
35
- *
36
- * @param scopeId The scope identifier
37
- */
38
- export declare function clearDebounceScope(scopeId: string | number): void;
39
- /**
40
- * Clears all active debounce timers across all scopes
41
- */
42
- export declare function clearAllDebounces(): void;
@@ -1,17 +0,0 @@
1
- import type { Extmark } from "./extmarks.js";
2
- export interface ExtmarksSnapshot {
3
- extmarks: Map<number, Extmark>;
4
- nextId: number;
5
- }
6
- export declare class ExtmarksHistory {
7
- private undoStack;
8
- private redoStack;
9
- saveSnapshot(extmarks: Map<number, Extmark>, nextId: number): void;
10
- undo(): ExtmarksSnapshot | null;
11
- redo(): ExtmarksSnapshot | null;
12
- pushRedo(snapshot: ExtmarksSnapshot): void;
13
- pushUndo(snapshot: ExtmarksSnapshot): void;
14
- clear(): void;
15
- canUndo(): boolean;
16
- canRedo(): boolean;
17
- }
@@ -1,5 +0,0 @@
1
- import type { ParsedKey } from "./parse.keypress.js";
2
- export declare const kittyKeyMap: Record<number, string>;
3
- export declare const kittyNamedSingleStrokeKeys: string[];
4
- export declare const printableKeypadText: Record<string, string>;
5
- export declare function parseKittyKeyboard(sequence: string): ParsedKey | null;
package/lib/queue.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * Generic processing queue that handles asynchronous job processing
3
- */
4
- export declare class ProcessQueue<T> {
5
- private processor;
6
- private queue;
7
- private processing;
8
- private autoProcess;
9
- constructor(processor: (item: T) => Promise<void> | void, autoProcess?: boolean);
10
- enqueue(item: T): void;
11
- private processQueue;
12
- clear(): void;
13
- isProcessing(): boolean;
14
- size(): number;
15
- }
@@ -1,97 +0,0 @@
1
- import { type Clock } from "./clock.js";
2
- import { type ParsedKey } from "./parse.keypress.js";
3
- import { type RawMouseEvent } from "./parse.mouse.js";
4
- import type { PasteMetadata } from "./paste.js";
5
- export { SystemClock, type Clock, type TimerHandle } from "./clock.js";
6
- export type StdinResponseProtocol = "csi" | "cpr" | "osc" | "dcs" | "apc" | "unknown";
7
- export type StdinEvent = {
8
- type: "key";
9
- raw: string;
10
- key: ParsedKey;
11
- } | {
12
- type: "mouse";
13
- raw: string;
14
- encoding: "sgr" | "x10";
15
- event: RawMouseEvent;
16
- } | {
17
- type: "paste";
18
- bytes: Uint8Array;
19
- metadata?: PasteMetadata;
20
- } | {
21
- type: "response";
22
- protocol: StdinResponseProtocol;
23
- sequence: string;
24
- };
25
- export interface StdinParserProtocolContext {
26
- kittyKeyboardEnabled: boolean;
27
- privateCapabilityRepliesActive: boolean;
28
- pixelResolutionQueryActive: boolean;
29
- explicitWidthCprActive: boolean;
30
- startupCursorCprActive: boolean;
31
- /** Native only: a query batch's DA1 reply is outstanding, so split replies wait for it without a deadline. */
32
- replySentinelActive: boolean;
33
- }
34
- export interface StdinParserOptions {
35
- timeoutMs?: number;
36
- maxPendingBytes?: number;
37
- armTimeouts?: boolean;
38
- onTimeoutFlush?: () => void;
39
- useKittyKeyboard?: boolean;
40
- protocolContext?: Partial<StdinParserProtocolContext>;
41
- clock?: Clock;
42
- }
43
- export declare class StdinParser {
44
- private readonly pending;
45
- private readonly events;
46
- private readonly timeoutMs;
47
- private readonly maxPendingBytes;
48
- private readonly armTimeouts;
49
- private readonly onTimeoutFlush;
50
- private readonly useKittyKeyboard;
51
- private readonly mouseParser;
52
- private readonly clock;
53
- private protocolContext;
54
- private timeoutId;
55
- private destroyed;
56
- private pendingSinceMs;
57
- private pendingTimeoutPaused;
58
- private suspendedPixelResolutionPrefixLength;
59
- private forceFlush;
60
- private justFlushedEsc;
61
- private state;
62
- private cursor;
63
- private unitStart;
64
- private paste;
65
- constructor(options?: StdinParserOptions);
66
- get bufferCapacity(): number;
67
- updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
68
- private getAbortableStartupCursorCprState;
69
- abortPendingStartupCursorCpr(): void;
70
- push(data: Uint8Array): void;
71
- read(): StdinEvent | null;
72
- drain(onEvent: (event: StdinEvent) => void): void;
73
- flushTimeout(nowMsValue?: number): void;
74
- private tryForceFlush;
75
- reset(): void;
76
- hasPendingPixelResolutionResponse(): boolean;
77
- pausePendingTimeout(): void;
78
- resumePendingTimeout(): void;
79
- resetMouseState(): void;
80
- destroy(): void;
81
- private ensureAlive;
82
- private scanPending;
83
- private emitKeyOrResponse;
84
- private emitMouse;
85
- private emitLegacyHighByte;
86
- private emitOpaqueResponse;
87
- private consumePrefix;
88
- private takePendingBytes;
89
- private flushPendingOverflow;
90
- private markPending;
91
- private consumePasteBytes;
92
- private pushPasteBytes;
93
- private reconcileDeferredStateWithProtocolContext;
94
- private reconcileTimeoutState;
95
- private clearTimeout;
96
- private resetState;
97
- }
@@ -1,16 +0,0 @@
1
- import { Renderable, type RenderableOptions } from "../../Renderable.js";
2
- import type { OptimizedBuffer } from "../../buffer.js";
3
- import type { RenderContext } from "../../types.js";
4
- export interface VRenderableOptions extends RenderableOptions<VRenderable> {
5
- render?: (this: VRenderable | VRenderableOptions, buffer: OptimizedBuffer, deltaTime: number, renderable: VRenderable) => void;
6
- }
7
- /**
8
- * A generic renderable that accepts a custom render function as a prop.
9
- * This allows functional constructs to specify custom rendering behavior
10
- * without needing to subclass Renderable.
11
- */
12
- export declare class VRenderable extends Renderable {
13
- private options;
14
- constructor(ctx: RenderContext, options: VRenderableOptions);
15
- protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
16
- }
@@ -1,35 +0,0 @@
1
- import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, InputRenderable, ScrollBoxRenderable, SelectRenderable, TabSelectRenderable, TextRenderable, VRenderable, FrameBufferRenderable, type ASCIIFontOptions, type BoxOptions, type CodeOptions, type TextOptions, type VRenderableOptions, type InputRenderableOptions, type ScrollBoxOptions, type SelectRenderableOptions, type TabSelectRenderableOptions, type FrameBufferOptions } from "..//index.js";
2
- import { TextNodeRenderable } from "../TextNode.js";
3
- import { type VChild } from "./vnode.js";
4
- import type { RGBA } from "../../lib/RGBA.js";
5
- export declare function Generic(props?: VRenderableOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof VRenderable>;
6
- export declare function Box(props?: BoxOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof BoxRenderable>;
7
- export declare function Text(props?: TextOptions & {
8
- content?: any;
9
- }, ...children: VChild[] | TextNodeRenderable[]): import("./vnode.js").ProxiedVNode<typeof TextRenderable>;
10
- export declare function ASCIIFont(props?: ASCIIFontOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof ASCIIFontRenderable>;
11
- export declare function Input(props?: InputRenderableOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof InputRenderable>;
12
- export declare function Select(props?: SelectRenderableOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof SelectRenderable>;
13
- export declare function TabSelect(props?: TabSelectRenderableOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof TabSelectRenderable>;
14
- export declare function FrameBuffer(props: FrameBufferOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof FrameBufferRenderable>;
15
- export declare function Code(props: CodeOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof CodeRenderable>;
16
- export declare function ScrollBox(props?: ScrollBoxOptions, ...children: VChild[]): import("./vnode.js").ProxiedVNode<typeof ScrollBoxRenderable>;
17
- export declare const vstyles: {
18
- bold: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
19
- italic: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
20
- underline: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
21
- dim: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
22
- blink: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
23
- inverse: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
24
- hidden: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
25
- strikethrough: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
26
- boldItalic: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
27
- boldUnderline: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
28
- italicUnderline: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
29
- boldItalicUnderline: (...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
30
- color: (color: string | RGBA, ...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
31
- bgColor: (bgColor: string | RGBA, ...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
32
- fg: (color: string | RGBA, ...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
33
- bg: (bgColor: string | RGBA, ...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
34
- styled: (attributes?: number, ...children: (string | TextNodeRenderable)[]) => TextNodeRenderable;
35
- };
@@ -1,46 +0,0 @@
1
- import { Renderable, type RenderableOptions } from "../../Renderable.js";
2
- import type { RenderContext } from "../../types.js";
3
- export type VChild = VNode | Renderable | VChild[] | null | undefined | false;
4
- export interface PendingCall {
5
- method: string;
6
- args: any[];
7
- isProperty?: boolean;
8
- }
9
- declare const BrandedVNode: unique symbol;
10
- export interface VNode<P = any, C = VChild[]> {
11
- [BrandedVNode]: true;
12
- type: Construct<P>;
13
- props?: P;
14
- children?: C;
15
- __delegateMap?: Record<string, string>;
16
- __pendingCalls?: PendingCall[];
17
- }
18
- export type ProxiedVNode<TCtor extends RenderableConstructor<any>> = VNode<TCtor extends RenderableConstructor<infer P> ? P : any> & {
19
- [K in keyof InstanceType<TCtor>]: InstanceType<TCtor>[K] extends (...args: infer Args) => any ? (...args: Args) => ProxiedVNode<TCtor> : InstanceType<TCtor>[K];
20
- };
21
- export interface RenderableConstructor<P extends RenderableOptions<any> = RenderableOptions<any>> {
22
- new (ctx: RenderContext, options: P): Renderable;
23
- }
24
- export type FunctionalConstruct<P = any> = (props: P, children?: VChild[]) => VNode;
25
- export type Construct<P = any> = RenderableConstructor<P extends RenderableOptions<any> ? P : never> | FunctionalConstruct<P>;
26
- export declare function h<TCtor extends RenderableConstructor<any>>(type: TCtor, props?: TCtor extends RenderableConstructor<infer P> ? P : never, ...children: VChild[]): ProxiedVNode<TCtor>;
27
- export declare function h<P>(type: FunctionalConstruct<P>, props?: P, ...children: VChild[]): VNode<P>;
28
- export declare function h<P>(type: Construct<P>, props?: P, ...children: VChild[]): VNode<P> | ProxiedVNode<any>;
29
- export declare function isVNode(node: any): node is VNode;
30
- export declare function maybeMakeRenderable(ctx: RenderContext, node: Renderable | VNode<any, any[]> | unknown): Renderable | null;
31
- export declare function wrapWithDelegates<T extends InstanceType<RenderableConstructor>>(instance: T, delegateMap: Record<string, string> | undefined): T;
32
- export type InstantiateFn<NodeType extends VNode | Renderable> = Renderable & {
33
- __node?: NodeType;
34
- };
35
- export declare function instantiate<NodeType extends VNode | Renderable>(ctx: RenderContext, node: NodeType): InstantiateFn<NodeType>;
36
- export type DelegateMap<T> = Partial<Record<keyof T, string>>;
37
- export type ValidateShape<Given, AllowedKeys> = {
38
- [K in keyof Given]: K extends keyof AllowedKeys ? NonNullable<Given[K]> : never;
39
- };
40
- type InferNode<T> = T extends InstantiateFn<infer U> ? U : never;
41
- export declare function delegate<Factory extends InstantiateFn<any>, InnerNode extends InferNode<Factory>, TargetMap extends Record<keyof InnerNode, string>, const Mapping extends Partial<TargetMap>>(mapping: ValidateShape<Mapping, TargetMap>, vnode: Factory): Renderable;
42
- export declare function delegate<ConstructorType extends RenderableConstructor<any>, TargetMap extends Record<keyof InstanceType<ConstructorType>, string>, const Mapping extends Partial<TargetMap>>(mapping: ValidateShape<Mapping, TargetMap>, vnode: ProxiedVNode<ConstructorType>): ProxiedVNode<ConstructorType>;
43
- export declare function delegate<ConstructorType extends RenderableConstructor<any>, const Mapping extends DelegateMap<InstanceType<ConstructorType>>>(mapping: ValidateShape<Mapping, string>, vnode: VNode & {
44
- type: ConstructorType;
45
- }): VNode;
46
- export {};
@@ -1,12 +0,0 @@
1
- import { type MarkedToken } from "marked";
2
- export interface ParseState {
3
- content: string;
4
- tokens: MarkedToken[];
5
- stableTokenCount?: number;
6
- }
7
- /**
8
- * Incrementally parse markdown, reusing unchanged tokens from previous parse.
9
- * Compares token.raw at each offset - matching tokens keep same object reference.
10
- * trailingUnstable 0 lexes it all unless nothing changed since a lex at 0: an edit can grow any block or add a link def.
11
- */
12
- export declare function parseMarkdownIncremental(newContent: string, prevState: ParseState | null, trailingUnstable?: number): ParseState;