@opentui/core 0.6.8 → 0.8.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 (60) hide show
  1. package/NativeScene.d.ts +14 -29
  2. package/Renderable.d.ts +47 -34
  3. package/animation/Timeline.d.ts +9 -0
  4. package/audio.d.ts +1 -0
  5. package/buffer.d.ts +6 -2
  6. package/{chunk-bun-4e5bpeqh.js → chunk-bun-6kxdhkdc.js} +1243 -1034
  7. package/chunk-bun-6kxdhkdc.js.map +70 -0
  8. package/{chunk-bun-ehr9v0n8.js → chunk-bun-x6cz4jyg.js} +514 -84
  9. package/chunk-bun-x6cz4jyg.js.map +35 -0
  10. package/{chunk-node-yyjd8p1g.js → chunk-node-q5ccgbk5.js} +1243 -1034
  11. package/chunk-node-q5ccgbk5.js.map +70 -0
  12. package/{chunk-node-jhq62x0c.js → chunk-node-y0w0hq5m.js} +514 -84
  13. package/chunk-node-y0w0hq5m.js.map +34 -0
  14. package/edit-buffer.d.ts +4 -0
  15. package/index.bun.js +1086 -549
  16. package/index.bun.js.map +15 -13
  17. package/index.d.ts +1 -1
  18. package/index.node.js +1086 -549
  19. package/index.node.js.map +16 -12
  20. package/lib/detect-links.d.ts +2 -0
  21. package/lib/extmarks.d.ts +3 -1
  22. package/lib/parse.keypress-kitty.d.ts +2 -0
  23. package/lib/scroll-chain.d.ts +16 -0
  24. package/lib/stdin-parser-native.d.ts +90 -0
  25. package/lib/stdin-parser.d.ts +2 -0
  26. package/lib/terminal-capability-detection.d.ts +6 -1
  27. package/native-abi.generated.d.ts +700 -7
  28. package/package.json +9 -9
  29. package/renderables/Box.d.ts +2 -2
  30. package/renderables/Code.d.ts +2 -1
  31. package/renderables/Diff.d.ts +2 -2
  32. package/renderables/EditBufferRenderable.d.ts +2 -2
  33. package/renderables/EmbeddedTerminal.d.ts +2 -2
  34. package/renderables/FrameBuffer.d.ts +4 -3
  35. package/renderables/Image.d.ts +2 -2
  36. package/renderables/Markdown.d.ts +2 -2
  37. package/renderables/ScrollBar.d.ts +9 -3
  38. package/renderables/ScrollBox.d.ts +87 -44
  39. package/renderables/ScrollBoxParts.d.ts +165 -0
  40. package/renderables/Slider.d.ts +2 -2
  41. package/renderables/Text.d.ts +2 -2
  42. package/renderables/TextBufferRenderable.d.ts +2 -4
  43. package/renderables/index.d.ts +1 -1
  44. package/renderer-theme-mode.d.ts +1 -6
  45. package/renderer.d.ts +30 -7
  46. package/testing/test-renderer.d.ts +4 -0
  47. package/testing.bun.js +12 -4
  48. package/testing.bun.js.map +3 -3
  49. package/testing.js +12 -4
  50. package/testing.js.map +3 -3
  51. package/types.d.ts +11 -0
  52. package/yoga.bun.js +1 -1
  53. package/yoga.internal.d.ts +3 -3
  54. package/yoga.js +1 -1
  55. package/zig-structs.d.ts +26 -0
  56. package/zig.d.ts +96 -13
  57. package/chunk-bun-4e5bpeqh.js.map +0 -69
  58. package/chunk-bun-ehr9v0n8.js.map +0 -35
  59. package/chunk-node-jhq62x0c.js.map +0 -34
  60. package/chunk-node-yyjd8p1g.js.map +0 -69
@@ -1,3 +1,4 @@
1
+ import type { SyntaxStyle } from "../syntax-style.js";
1
2
  import type { TextChunk } from "../text-buffer.js";
2
3
  import type { SimpleHighlight } from "./tree-sitter/types.js";
3
4
  export declare function normalizeMarkdownLinkTarget(destination: string): string;
@@ -8,4 +9,5 @@ export declare function detectLinks(chunks: TextChunk[], context: {
8
9
  start: number;
9
10
  end: number;
10
11
  }>;
12
+ syntaxStyle?: SyntaxStyle;
11
13
  }): TextChunk[];
package/lib/extmarks.d.ts CHANGED
@@ -69,7 +69,9 @@ export declare class ExtmarksController {
69
69
  adjustExtmarksAfterDeletion(deleteOffset: number, length: number, updateHighlights?: boolean): void;
70
70
  private offsetToPosition;
71
71
  private positionToOffset;
72
- private getNextCursorOffset;
72
+ /** Cells an edit adds to the document, negative when it removes them. A grapheme rejoined across the edit changes widths, so measure the end. */
73
+ private measureChange;
74
+ private shiftExtmarks;
73
75
  private updateHighlights;
74
76
  private offsetExcludingNewlines;
75
77
  create(options: ExtmarkOptions): number;
@@ -1,3 +1,5 @@
1
1
  import type { ParsedKey } from "./parse.keypress.js";
2
+ export declare const kittyKeyMap: Record<number, string>;
2
3
  export declare const kittyNamedSingleStrokeKeys: string[];
4
+ export declare const printableKeypadText: Record<string, string>;
3
5
  export declare function parseKittyKeyboard(sequence: string): ParsedKey | null;
@@ -0,0 +1,16 @@
1
+ import type { ScrollInfo } from "./parse.mouse.js";
2
+ type Node = {
3
+ parent: Node | null;
4
+ };
5
+ /** The axis direction of a wheel step: Shift turns vertical steps sideways and sideways steps vertical. */
6
+ export declare function wheelDirection(event: {
7
+ scroll?: ScrollInfo;
8
+ modifiers?: {
9
+ shift: boolean;
10
+ };
11
+ }): ScrollInfo["direction"] | undefined;
12
+ /** A wheel step belongs to the innermost scroller on its path that can still move that way. Runs `scroll` unless a
13
+ * scroller inside `scroller` already took this event; `scroll` returns whether `scroller` takes it. Listeners further
14
+ * out still see the event; only scrolling stops. */
15
+ export declare function scrollOnce(event: object, scroller: Node, scroll: () => boolean): void;
16
+ export {};
@@ -0,0 +1,90 @@
1
+ import { type NativeContextHandle, type RenderLib, type SessionHandle } from "../zig.js";
2
+ import type { StdinEvent, StdinParserOptions, StdinParserProtocolContext } from "./stdin-parser.js";
3
+ export interface NativeInputSession {
4
+ lib: RenderLib;
5
+ context: NativeContextHandle;
6
+ session: SessionHandle;
7
+ }
8
+ export interface NativeStdinParserOptions extends Pick<StdinParserOptions, "armTimeouts" | "onTimeoutFlush" | "protocolContext" | "clock"> {
9
+ /** Parse through this Session's input parser. Without one, the parser owns a private Context and Session. */
10
+ session?: NativeInputSession;
11
+ }
12
+ /**
13
+ * Same surface as StdinParser for renderer.ts, without the hooks that coordinated
14
+ * parser and renderer state: a deferred reply has no deadline, so CPR aborts and
15
+ * pixel queries need no special handling; suspension needs only suspend and resume.
16
+ */
17
+ export declare class NativeStdinParser {
18
+ private readonly lib;
19
+ private readonly context;
20
+ private readonly session;
21
+ private readonly ownsContext;
22
+ private readonly records;
23
+ private readonly words;
24
+ private readonly halves;
25
+ private readonly payload;
26
+ private readonly events;
27
+ private readonly clock;
28
+ private readonly armTimeouts;
29
+ private readonly onTimeoutFlush;
30
+ private protocolContext;
31
+ private appliedExpectations;
32
+ private timeoutId;
33
+ private deadlineNs;
34
+ private lastNs;
35
+ private paste;
36
+ private suspended;
37
+ private sessionGone;
38
+ private destroyed;
39
+ constructor(options?: NativeStdinParserOptions);
40
+ updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
41
+ /** A bracketed paste has started and not yet ended. */
42
+ get pasting(): boolean;
43
+ push(data: Uint8Array): void;
44
+ read(): StdinEvent | null;
45
+ drain(onEvent: (event: StdinEvent) => void): void;
46
+ /** Resolves a partial unit whose deadline has passed at `nowMsValue`. */
47
+ flushTimeout(nowMsValue?: number): void;
48
+ /** Stops input time and the timer: a unit pending at suspension can still complete on resume. */
49
+ suspend(): void;
50
+ /**
51
+ * Call after feeding the input drained on resume. Input sent before suspension has
52
+ * arrived, so a unit still pending is stale (another process may have read its rest)
53
+ * and is dropped. Only the prefix of a reply the host still awaits keeps waiting.
54
+ */
55
+ resume(): void;
56
+ reset(): void;
57
+ destroy(): void;
58
+ private ensureAlive;
59
+ /** Runs a native call. A Session or Context that closed, failed, or was destroyed ends parsing quietly. */
60
+ private native;
61
+ private destroyContext;
62
+ private applyExpectations;
63
+ private toNs;
64
+ private nowNs;
65
+ private feed;
66
+ private reconcileTimeout;
67
+ private clearTimeout;
68
+ private span;
69
+ private translate;
70
+ }
71
+ /**
72
+ * Pairs the events of the delivering parser with the events of a parser that only
73
+ * sees the same input (OTUI_NATIVE_INPUT_SHADOW) and logs one line per difference.
74
+ * Events pair in order, so the parsers' separate timers cannot misalign them. After
75
+ * a difference, pairing resumes once each side has reported its next event.
76
+ */
77
+ export declare class StdinShadowComparator {
78
+ private readonly primaryName;
79
+ private readonly log;
80
+ private readonly delivered;
81
+ private readonly shadowed;
82
+ constructor(primaryName: "legacy" | "native", log: (line: string) => void);
83
+ primary(event: StdinEvent): void;
84
+ shadow(event: StdinEvent): void;
85
+ /** Reports every event still unpaired. Call when both parsers have stopped. */
86
+ flush(): void;
87
+ private queue;
88
+ private pair;
89
+ private report;
90
+ }
@@ -28,6 +28,8 @@ export interface StdinParserProtocolContext {
28
28
  pixelResolutionQueryActive: boolean;
29
29
  explicitWidthCprActive: boolean;
30
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;
31
33
  }
32
34
  export interface StdinParserOptions {
33
35
  timeoutMs?: number;
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * Detects various terminal capability response sequences:
5
5
  * - DECRPM (DEC Request Mode): ESC[?...;N$y where N is 0,1,2,3,4
6
- * - CPR (Cursor Position Report): ESC[row;colR (used for width detection)
7
6
  * - XTVersion: ESC P >| ... ESC \
8
7
  * - Kitty Graphics: ESC _ G ... ESC \
9
8
  * - Kitty Keyboard Query: ESC[?Nu where N is 0,1,2,etc
@@ -18,6 +17,12 @@
18
17
  * Returns true if the sequence matches any known capability response pattern.
19
18
  */
20
19
  export declare function isCapabilityResponse(sequence: string): boolean;
20
+ /**
21
+ * Check if a cursor position report answers the explicit width or scaled text probe: ESC[1;NR with N >= 2.
22
+ * ESC[1;1R means the cursor did not move, so the terminal has no width support. Shift, Alt and Ctrl+F3 send the
23
+ * same bytes, so only a report the parser classified as one may be checked.
24
+ */
25
+ export declare function isExplicitWidthReport(sequence: string): boolean;
21
26
  /**
22
27
  * Check if a sequence is a pixel resolution response.
23
28
  * Format: ESC[4;height;widtht