@opentui/core 0.1.87 → 0.1.89
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/ThreeRenderable.d.ts +4 -4
- package/3d/WGPURenderer.d.ts +4 -4
- package/3d/animation/ExplodingSpriteEffect.d.ts +2 -2
- package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +3 -3
- package/3d/animation/SpriteAnimator.d.ts +1 -1
- package/3d/animation/SpriteParticleGenerator.d.ts +1 -1
- package/3d/canvas.d.ts +2 -2
- package/3d/index.d.ts +12 -12
- package/3d/physics/PlanckPhysicsAdapter.d.ts +1 -1
- package/3d/physics/RapierPhysicsAdapter.d.ts +1 -1
- package/3d.d.ts +1 -1
- package/3d.js +1 -1
- package/3d.js.map +12 -12
- package/Renderable.d.ts +7 -7
- package/animation/Timeline.d.ts +1 -1
- package/buffer.d.ts +6 -4
- package/console.d.ts +7 -4
- package/edit-buffer.d.ts +4 -4
- package/editor-view.d.ts +3 -3
- package/{index-0wbvecnk.js → index-e89anq5x.js} +864 -175
- package/index-e89anq5x.js.map +64 -0
- package/index-rs5zwr4j.js +12373 -0
- package/index-rs5zwr4j.js.map +43 -0
- package/index-tae5jwnc.js +188 -0
- package/index-tae5jwnc.js.map +10 -0
- package/index.d.ts +20 -17
- package/index.js +86 -11596
- package/index.js.map +3 -35
- package/lib/KeyHandler.d.ts +7 -4
- package/lib/ascii.font.d.ts +2 -2
- package/lib/border.d.ts +1 -1
- package/lib/clipboard.d.ts +1 -1
- package/lib/clock.d.ts +4 -0
- package/lib/extmarks-history.d.ts +1 -1
- package/lib/extmarks.d.ts +2 -2
- package/lib/hast-styled-text.d.ts +3 -3
- package/lib/index.d.ts +21 -20
- package/lib/objects-in-viewport.d.ts +1 -1
- package/lib/parse.keypress-kitty.d.ts +1 -1
- package/lib/paste.d.ts +7 -0
- package/lib/renderable.validations.d.ts +2 -2
- package/lib/selection.d.ts +2 -2
- package/lib/stdin-parser.d.ts +14 -2
- package/lib/styled-text.d.ts +2 -2
- package/lib/terminal-palette.d.ts +4 -2
- package/lib/tree-sitter/client.d.ts +1 -1
- package/lib/tree-sitter/index.d.ts +7 -7
- package/lib/tree-sitter/parsers-config.d.ts +15 -0
- package/lib/tree-sitter/resolve-ft.d.ts +3 -0
- package/lib/tree-sitter/types.d.ts +1 -0
- package/lib/tree-sitter-styled-text.d.ts +5 -5
- package/package.json +17 -7
- package/parser.worker.js +52 -18
- package/parser.worker.js.map +3 -3
- package/plugins/core-slot.d.ts +72 -0
- package/plugins/registry.d.ts +38 -0
- package/plugins/types.d.ts +34 -0
- package/post/effects.d.ts +147 -0
- package/post/filters.d.ts +28 -68
- package/post/matrices.d.ts +20 -0
- package/renderables/ASCIIFont.d.ts +6 -6
- package/renderables/Box.d.ts +5 -5
- package/renderables/Code.d.ts +10 -8
- package/renderables/Diff.d.ts +7 -7
- package/renderables/EditBufferRenderable.d.ts +8 -8
- package/renderables/FrameBuffer.d.ts +3 -3
- package/renderables/Input.d.ts +3 -3
- package/renderables/LineNumberRenderable.d.ts +4 -4
- package/renderables/Markdown.d.ts +17 -9
- package/renderables/ScrollBar.d.ts +6 -6
- package/renderables/ScrollBox.d.ts +9 -8
- package/renderables/Select.d.ts +7 -7
- package/renderables/Slider.d.ts +1 -1
- package/renderables/TabSelect.d.ts +6 -6
- package/renderables/Text.d.ts +7 -7
- package/renderables/TextBufferRenderable.d.ts +9 -9
- package/renderables/TextNode.d.ts +6 -6
- package/renderables/Textarea.d.ts +7 -7
- package/renderables/__tests__/renderable-test-utils.d.ts +8 -3
- package/renderables/composition/VRenderable.d.ts +3 -3
- package/renderables/composition/constructs.d.ts +14 -14
- package/renderables/composition/vnode.d.ts +2 -2
- package/renderables/index.d.ts +22 -22
- package/renderer.d.ts +28 -16
- package/runtime-plugin-support.d.ts +3 -0
- package/runtime-plugin-support.js +29 -0
- package/runtime-plugin-support.js.map +10 -0
- package/runtime-plugin.d.ts +11 -0
- package/runtime-plugin.js +16 -0
- package/runtime-plugin.js.map +9 -0
- package/syntax-style.d.ts +2 -2
- package/testing/manual-clock.d.ts +1 -0
- package/testing/mock-keys.d.ts +2 -1
- package/testing/mock-mouse.d.ts +1 -1
- package/testing/mock-tree-sitter-client.d.ts +2 -2
- package/testing/test-recorder.d.ts +1 -1
- package/testing/test-renderer.d.ts +4 -4
- package/testing.d.ts +6 -6
- package/testing.js +12 -7
- package/testing.js.map +7 -7
- package/text-buffer-view.d.ts +3 -3
- package/text-buffer.d.ts +5 -5
- package/types.d.ts +9 -4
- package/utils.d.ts +1 -1
- package/zig-structs.d.ts +1 -1
- package/zig.d.ts +7 -5
- package/index-0wbvecnk.js.map +0 -63
package/lib/KeyHandler.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import { type KeyEventType, type ParsedKey } from "./parse.keypress";
|
|
2
|
+
import { type KeyEventType, type ParsedKey } from "./parse.keypress.js";
|
|
3
|
+
import type { PasteMetadata } from "./paste.js";
|
|
3
4
|
export declare class KeyEvent implements ParsedKey {
|
|
4
5
|
name: string;
|
|
5
6
|
ctrl: boolean;
|
|
@@ -27,10 +28,12 @@ export declare class KeyEvent implements ParsedKey {
|
|
|
27
28
|
stopPropagation(): void;
|
|
28
29
|
}
|
|
29
30
|
export declare class PasteEvent {
|
|
30
|
-
|
|
31
|
+
type: "paste";
|
|
32
|
+
bytes: Uint8Array;
|
|
33
|
+
metadata?: PasteMetadata;
|
|
31
34
|
private _defaultPrevented;
|
|
32
35
|
private _propagationStopped;
|
|
33
|
-
constructor(
|
|
36
|
+
constructor(bytes: Uint8Array, metadata?: PasteMetadata);
|
|
34
37
|
get defaultPrevented(): boolean;
|
|
35
38
|
get propagationStopped(): boolean;
|
|
36
39
|
preventDefault(): void;
|
|
@@ -43,7 +46,7 @@ export type KeyHandlerEventMap = {
|
|
|
43
46
|
};
|
|
44
47
|
export declare class KeyHandler extends EventEmitter<KeyHandlerEventMap> {
|
|
45
48
|
processParsedKey(parsedKey: ParsedKey): boolean;
|
|
46
|
-
processPaste(
|
|
49
|
+
processPaste(bytes: Uint8Array, metadata?: PasteMetadata): void;
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* This class is used internally by the renderer to ensure global handlers
|
package/lib/ascii.font.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OptimizedBuffer } from "../buffer";
|
|
2
|
-
import { type ColorInput } from "./RGBA";
|
|
1
|
+
import { OptimizedBuffer } from "../buffer.js";
|
|
2
|
+
import { type ColorInput } from "./RGBA.js";
|
|
3
3
|
export type ASCIIFontName = "tiny" | "block" | "shade" | "slick" | "huge" | "grid" | "pallet";
|
|
4
4
|
export declare const fonts: {
|
|
5
5
|
tiny: {
|
package/lib/border.d.ts
CHANGED
package/lib/clipboard.d.ts
CHANGED
package/lib/clock.d.ts
CHANGED
|
@@ -3,9 +3,13 @@ export interface Clock {
|
|
|
3
3
|
now(): number;
|
|
4
4
|
setTimeout(fn: () => void, delayMs: number): TimerHandle;
|
|
5
5
|
clearTimeout(handle: TimerHandle): void;
|
|
6
|
+
setInterval(fn: () => void, delayMs: number): TimerHandle;
|
|
7
|
+
clearInterval(handle: TimerHandle): void;
|
|
6
8
|
}
|
|
7
9
|
export declare class SystemClock implements Clock {
|
|
8
10
|
now(): number;
|
|
9
11
|
setTimeout(fn: () => void, delayMs: number): TimerHandle;
|
|
10
12
|
clearTimeout(handle: TimerHandle): void;
|
|
13
|
+
setInterval(fn: () => void, delayMs: number): TimerHandle;
|
|
14
|
+
clearInterval(handle: TimerHandle): void;
|
|
11
15
|
}
|
package/lib/extmarks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EditBuffer } from "../edit-buffer";
|
|
2
|
-
import type { EditorView } from "../editor-view";
|
|
1
|
+
import type { EditBuffer } from "../edit-buffer.js";
|
|
2
|
+
import type { EditorView } from "../editor-view.js";
|
|
3
3
|
export interface Extmark {
|
|
4
4
|
id: number;
|
|
5
5
|
start: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StyledText } from "./styled-text";
|
|
2
|
-
import { SyntaxStyle } from "../syntax-style";
|
|
1
|
+
import { StyledText } from "./styled-text.js";
|
|
2
|
+
import { SyntaxStyle } from "../syntax-style.js";
|
|
3
3
|
export interface HASTText {
|
|
4
4
|
type: "text";
|
|
5
5
|
value: string;
|
|
@@ -13,5 +13,5 @@ export interface HASTElement {
|
|
|
13
13
|
children: HASTNode[];
|
|
14
14
|
}
|
|
15
15
|
export type HASTNode = HASTText | HASTElement;
|
|
16
|
-
export type { StyleDefinition } from "../syntax-style";
|
|
16
|
+
export type { StyleDefinition } from "../syntax-style.js";
|
|
17
17
|
export declare function hastToStyledText(hast: HASTNode, syntaxStyle: SyntaxStyle): StyledText;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
export * from "./border";
|
|
2
|
-
export * from "./KeyHandler";
|
|
3
|
-
export * from "./ascii.font";
|
|
4
|
-
export * from "./hast-styled-text";
|
|
5
|
-
export * from "./RGBA";
|
|
6
|
-
export * from "./clock";
|
|
7
|
-
export * from "./parse.keypress";
|
|
8
|
-
export * from "./scroll-acceleration";
|
|
9
|
-
export * from "./styled-text";
|
|
10
|
-
export * from "./yoga.options";
|
|
11
|
-
export * from "./parse.mouse";
|
|
12
|
-
export * from "./selection";
|
|
13
|
-
export * from "./env";
|
|
14
|
-
export * from "./stdin-parser";
|
|
15
|
-
export * from "./tree-sitter-styled-text";
|
|
16
|
-
export * from "./tree-sitter";
|
|
17
|
-
export * from "./data-paths";
|
|
18
|
-
export * from "./extmarks";
|
|
19
|
-
export * from "./terminal-palette";
|
|
20
|
-
export
|
|
1
|
+
export * from "./border.js";
|
|
2
|
+
export * from "./KeyHandler.js";
|
|
3
|
+
export * from "./ascii.font.js";
|
|
4
|
+
export * from "./hast-styled-text.js";
|
|
5
|
+
export * from "./RGBA.js";
|
|
6
|
+
export * from "./clock.js";
|
|
7
|
+
export * from "./parse.keypress.js";
|
|
8
|
+
export * from "./scroll-acceleration.js";
|
|
9
|
+
export * from "./styled-text.js";
|
|
10
|
+
export * from "./yoga.options.js";
|
|
11
|
+
export * from "./parse.mouse.js";
|
|
12
|
+
export * from "./selection.js";
|
|
13
|
+
export * from "./env.js";
|
|
14
|
+
export * from "./stdin-parser.js";
|
|
15
|
+
export * from "./tree-sitter-styled-text.js";
|
|
16
|
+
export * from "./tree-sitter/index.js";
|
|
17
|
+
export * from "./data-paths.js";
|
|
18
|
+
export * from "./extmarks.js";
|
|
19
|
+
export * from "./terminal-palette.js";
|
|
20
|
+
export * from "./paste.js";
|
|
21
|
+
export { detectLinks } from "./detect-links.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ParsedKey } from "./parse.keypress";
|
|
1
|
+
import type { ParsedKey } from "./parse.keypress.js";
|
|
2
2
|
export declare function parseKittyKeyboard(sequence: string): ParsedKey | null;
|
package/lib/paste.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type PasteKind = "text" | "binary" | "unknown";
|
|
2
|
+
export interface PasteMetadata {
|
|
3
|
+
mimeType?: string;
|
|
4
|
+
kind?: PasteKind;
|
|
5
|
+
}
|
|
6
|
+
export declare function decodePasteBytes(bytes: Uint8Array): string;
|
|
7
|
+
export declare function stripAnsiSequences(text: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RenderableOptions, Renderable } from "../Renderable";
|
|
2
|
-
import type { PositionTypeString, OverflowString } from "./yoga.options";
|
|
1
|
+
import type { RenderableOptions, Renderable } from "../Renderable.js";
|
|
2
|
+
import type { PositionTypeString, OverflowString } from "./yoga.options.js";
|
|
3
3
|
export declare function validateOptions(id: string, options: RenderableOptions<Renderable>): void;
|
|
4
4
|
export declare function isValidPercentage(value: any): value is `${number}%`;
|
|
5
5
|
export declare function isMarginType(value: any): value is number | "auto" | `${number}%`;
|
package/lib/selection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Renderable, type ViewportBounds } from "
|
|
2
|
-
import { fonts } from "./ascii.font";
|
|
1
|
+
import { Renderable, type ViewportBounds } from "../index.js";
|
|
2
|
+
import { fonts } from "./ascii.font.js";
|
|
3
3
|
export declare class Selection {
|
|
4
4
|
private _anchor;
|
|
5
5
|
private _focus;
|
package/lib/stdin-parser.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Clock } from "./clock";
|
|
2
2
|
import { type ParsedKey } from "./parse.keypress";
|
|
3
3
|
import { type RawMouseEvent } from "./parse.mouse";
|
|
4
|
+
import type { PasteMetadata } from "./paste";
|
|
4
5
|
export { SystemClock, type Clock, type TimerHandle } from "./clock";
|
|
5
6
|
export type StdinResponseProtocol = "csi" | "osc" | "dcs" | "apc" | "unknown";
|
|
6
7
|
export type StdinEvent = {
|
|
@@ -14,18 +15,26 @@ export type StdinEvent = {
|
|
|
14
15
|
event: RawMouseEvent;
|
|
15
16
|
} | {
|
|
16
17
|
type: "paste";
|
|
17
|
-
|
|
18
|
+
bytes: Uint8Array;
|
|
19
|
+
metadata?: PasteMetadata;
|
|
18
20
|
} | {
|
|
19
21
|
type: "response";
|
|
20
22
|
protocol: StdinResponseProtocol;
|
|
21
23
|
sequence: string;
|
|
22
24
|
};
|
|
25
|
+
export interface StdinParserProtocolContext {
|
|
26
|
+
kittyKeyboardEnabled: boolean;
|
|
27
|
+
privateCapabilityRepliesActive: boolean;
|
|
28
|
+
pixelResolutionQueryActive: boolean;
|
|
29
|
+
explicitWidthCprActive: boolean;
|
|
30
|
+
}
|
|
23
31
|
export interface StdinParserOptions {
|
|
24
32
|
timeoutMs?: number;
|
|
25
33
|
maxPendingBytes?: number;
|
|
26
34
|
armTimeouts?: boolean;
|
|
27
35
|
onTimeoutFlush?: () => void;
|
|
28
36
|
useKittyKeyboard?: boolean;
|
|
37
|
+
protocolContext?: Partial<StdinParserProtocolContext>;
|
|
29
38
|
clock?: Clock;
|
|
30
39
|
}
|
|
31
40
|
export declare class StdinParser {
|
|
@@ -38,6 +47,7 @@ export declare class StdinParser {
|
|
|
38
47
|
private readonly useKittyKeyboard;
|
|
39
48
|
private readonly mouseParser;
|
|
40
49
|
private readonly clock;
|
|
50
|
+
private protocolContext;
|
|
41
51
|
private timeoutId;
|
|
42
52
|
private destroyed;
|
|
43
53
|
private pendingSinceMs;
|
|
@@ -49,6 +59,7 @@ export declare class StdinParser {
|
|
|
49
59
|
private paste;
|
|
50
60
|
constructor(options?: StdinParserOptions);
|
|
51
61
|
get bufferCapacity(): number;
|
|
62
|
+
updateProtocolContext(patch: Partial<StdinParserProtocolContext>): void;
|
|
52
63
|
push(data: Uint8Array): void;
|
|
53
64
|
read(): StdinEvent | null;
|
|
54
65
|
drain(onEvent: (event: StdinEvent) => void): void;
|
|
@@ -67,7 +78,8 @@ export declare class StdinParser {
|
|
|
67
78
|
private flushPendingOverflow;
|
|
68
79
|
private markPending;
|
|
69
80
|
private consumePasteBytes;
|
|
70
|
-
private
|
|
81
|
+
private pushPasteBytes;
|
|
82
|
+
private reconcileDeferredStateWithProtocolContext;
|
|
71
83
|
private reconcileTimeoutState;
|
|
72
84
|
private clearTimeout;
|
|
73
85
|
private resetState;
|
package/lib/styled-text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TextChunk } from "../text-buffer";
|
|
2
|
-
import { type ColorInput } from "./RGBA";
|
|
1
|
+
import type { TextChunk } from "../text-buffer.js";
|
|
2
|
+
import { type ColorInput } from "./RGBA.js";
|
|
3
3
|
declare const BrandedStyledText: unique symbol;
|
|
4
4
|
export type Color = ColorInput;
|
|
5
5
|
export interface StyleAttrs {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Clock } from "./clock";
|
|
1
2
|
type Hex = string | null;
|
|
2
3
|
export type WriteFunction = (data: string | Buffer) => boolean;
|
|
3
4
|
export interface TerminalColors {
|
|
@@ -31,7 +32,8 @@ export declare class TerminalPalette implements TerminalPaletteDetector {
|
|
|
31
32
|
private activeQuerySessions;
|
|
32
33
|
private inLegacyTmux;
|
|
33
34
|
private oscSource?;
|
|
34
|
-
|
|
35
|
+
private readonly clock;
|
|
36
|
+
constructor(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource, clock?: Clock);
|
|
35
37
|
/**
|
|
36
38
|
* Write an OSC sequence, wrapping for tmux if needed
|
|
37
39
|
*/
|
|
@@ -44,5 +46,5 @@ export declare class TerminalPalette implements TerminalPaletteDetector {
|
|
|
44
46
|
private querySpecialColors;
|
|
45
47
|
detect(options?: GetPaletteOptions): Promise<TerminalColors>;
|
|
46
48
|
}
|
|
47
|
-
export declare function createTerminalPalette(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource): TerminalPaletteDetector;
|
|
49
|
+
export declare function createTerminalPalette(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction, isLegacyTmux?: boolean, oscSource?: OscSubscriptionSource, clock?: Clock): TerminalPaletteDetector;
|
|
48
50
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "events";
|
|
2
|
-
import type { TreeSitterClientOptions, TreeSitterClientEvents, BufferState, FiletypeParserOptions, Edit, PerformanceStats, SimpleHighlight } from "./types";
|
|
2
|
+
import type { TreeSitterClientOptions, TreeSitterClientEvents, BufferState, FiletypeParserOptions, Edit, PerformanceStats, SimpleHighlight } from "./types.js";
|
|
3
3
|
declare global {
|
|
4
4
|
const OTUI_TREE_SITTER_WORKER_PATH: string;
|
|
5
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TreeSitterClient } from "./client";
|
|
2
|
-
export * from "./client";
|
|
3
|
-
export * from "../tree-sitter-styled-text";
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./resolve-ft";
|
|
6
|
-
export type { UpdateOptions } from "./assets/update";
|
|
7
|
-
export { updateAssets } from "./assets/update";
|
|
1
|
+
import { TreeSitterClient } from "./client.js";
|
|
2
|
+
export * from "./client.js";
|
|
3
|
+
export * from "../tree-sitter-styled-text.js";
|
|
4
|
+
export * from "./types.js";
|
|
5
|
+
export * from "./resolve-ft.js";
|
|
6
|
+
export type { UpdateOptions } from "./assets/update.js";
|
|
7
|
+
export { updateAssets } from "./assets/update.js";
|
|
8
8
|
export declare function getTreeSitterClient(): TreeSitterClient;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
parsers: ({
|
|
8
8
|
filetype: string;
|
|
9
|
+
aliases: string[];
|
|
9
10
|
wasm: string;
|
|
10
11
|
queries: {
|
|
11
12
|
highlights: string[];
|
|
@@ -27,12 +28,26 @@ declare const _default: {
|
|
|
27
28
|
infoStringMap: {
|
|
28
29
|
javascript: string;
|
|
29
30
|
js: string;
|
|
31
|
+
jsx: string;
|
|
32
|
+
javascriptreact: string;
|
|
30
33
|
typescript: string;
|
|
31
34
|
ts: string;
|
|
35
|
+
tsx: string;
|
|
36
|
+
typescriptreact: string;
|
|
32
37
|
markdown: string;
|
|
33
38
|
md: string;
|
|
34
39
|
};
|
|
35
40
|
};
|
|
41
|
+
aliases?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
filetype: string;
|
|
44
|
+
wasm: string;
|
|
45
|
+
queries: {
|
|
46
|
+
highlights: string[];
|
|
47
|
+
injections?: undefined;
|
|
48
|
+
};
|
|
49
|
+
aliases?: undefined;
|
|
50
|
+
injectionMapping?: undefined;
|
|
36
51
|
})[];
|
|
37
52
|
};
|
|
38
53
|
export default _default;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export declare const extensionToFiletype: Map<string, string>;
|
|
2
|
+
export declare const basenameToFiletype: Map<string, string>;
|
|
1
3
|
export declare function extToFiletype(extension: string): string | undefined;
|
|
2
4
|
export declare function pathToFiletype(path: string): string | undefined;
|
|
5
|
+
export declare function infoStringToFiletype(infoString: string): string | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TextChunk } from "../text-buffer";
|
|
2
|
-
import { StyledText } from "./styled-text";
|
|
3
|
-
import { SyntaxStyle } from "../syntax-style";
|
|
4
|
-
import { TreeSitterClient } from "./tree-sitter/client";
|
|
5
|
-
import type { SimpleHighlight } from "./tree-sitter/types";
|
|
1
|
+
import type { TextChunk } from "../text-buffer.js";
|
|
2
|
+
import { StyledText } from "./styled-text.js";
|
|
3
|
+
import { SyntaxStyle } from "../syntax-style.js";
|
|
4
|
+
import { TreeSitterClient } from "./tree-sitter/client.js";
|
|
5
|
+
import type { SimpleHighlight } from "./tree-sitter/types.js";
|
|
6
6
|
interface ConcealOptions {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.89",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -28,6 +28,16 @@
|
|
|
28
28
|
"require": "./testing.js",
|
|
29
29
|
"types": "./testing.d.ts"
|
|
30
30
|
},
|
|
31
|
+
"./runtime-plugin": {
|
|
32
|
+
"import": "./runtime-plugin.js",
|
|
33
|
+
"require": "./runtime-plugin.js",
|
|
34
|
+
"types": "./runtime-plugin.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./runtime-plugin-support": {
|
|
37
|
+
"import": "./runtime-plugin-support.js",
|
|
38
|
+
"require": "./runtime-plugin-support.js",
|
|
39
|
+
"types": "./runtime-plugin-support.d.ts"
|
|
40
|
+
},
|
|
31
41
|
"./parser.worker": {
|
|
32
42
|
"import": "./lib/tree-sitter/parser.worker.js",
|
|
33
43
|
"require": "./lib/tree-sitter/parser.worker.js",
|
|
@@ -57,11 +67,11 @@
|
|
|
57
67
|
"bun-webgpu": "0.1.5",
|
|
58
68
|
"planck": "^1.4.2",
|
|
59
69
|
"three": "0.177.0",
|
|
60
|
-
"@opentui/core-darwin-x64": "0.1.
|
|
61
|
-
"@opentui/core-darwin-arm64": "0.1.
|
|
62
|
-
"@opentui/core-linux-x64": "0.1.
|
|
63
|
-
"@opentui/core-linux-arm64": "0.1.
|
|
64
|
-
"@opentui/core-win32-x64": "0.1.
|
|
65
|
-
"@opentui/core-win32-arm64": "0.1.
|
|
70
|
+
"@opentui/core-darwin-x64": "0.1.89",
|
|
71
|
+
"@opentui/core-darwin-arm64": "0.1.89",
|
|
72
|
+
"@opentui/core-linux-x64": "0.1.89",
|
|
73
|
+
"@opentui/core-linux-arm64": "0.1.89",
|
|
74
|
+
"@opentui/core-win32-x64": "0.1.89",
|
|
75
|
+
"@opentui/core-win32-arm64": "0.1.89"
|
|
66
76
|
}
|
|
67
77
|
}
|
package/parser.worker.js
CHANGED
|
@@ -135,6 +135,7 @@ var self = globalThis;
|
|
|
135
135
|
class ParserWorker {
|
|
136
136
|
bufferParsers = new Map;
|
|
137
137
|
filetypeParserOptions = new Map;
|
|
138
|
+
filetypeAliases = new Map;
|
|
138
139
|
filetypeParsers = new Map;
|
|
139
140
|
filetypeParserPromises = new Map;
|
|
140
141
|
reusableParsers = new Map;
|
|
@@ -188,7 +189,38 @@ class ParserWorker {
|
|
|
188
189
|
return this.initializePromise;
|
|
189
190
|
}
|
|
190
191
|
addFiletypeParser(filetypeParser) {
|
|
191
|
-
this.filetypeParserOptions.
|
|
192
|
+
const previousAliases = this.filetypeParserOptions.get(filetypeParser.filetype)?.aliases ?? [];
|
|
193
|
+
for (const alias of previousAliases) {
|
|
194
|
+
if (this.filetypeAliases.get(alias) === filetypeParser.filetype) {
|
|
195
|
+
this.filetypeAliases.delete(alias);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const aliases = [...new Set((filetypeParser.aliases ?? []).filter((alias) => alias !== filetypeParser.filetype))];
|
|
199
|
+
this.filetypeAliases.delete(filetypeParser.filetype);
|
|
200
|
+
this.filetypeParserOptions.set(filetypeParser.filetype, {
|
|
201
|
+
...filetypeParser,
|
|
202
|
+
aliases
|
|
203
|
+
});
|
|
204
|
+
for (const alias of aliases) {
|
|
205
|
+
this.filetypeAliases.set(alias, filetypeParser.filetype);
|
|
206
|
+
}
|
|
207
|
+
this.invalidateParserCaches(filetypeParser.filetype);
|
|
208
|
+
}
|
|
209
|
+
resolveCanonicalFiletype(filetype) {
|
|
210
|
+
if (this.filetypeParserOptions.has(filetype)) {
|
|
211
|
+
return filetype;
|
|
212
|
+
}
|
|
213
|
+
return this.filetypeAliases.get(filetype) ?? filetype;
|
|
214
|
+
}
|
|
215
|
+
invalidateParserCaches(filetype) {
|
|
216
|
+
this.filetypeParsers.delete(filetype);
|
|
217
|
+
this.filetypeParserPromises.delete(filetype);
|
|
218
|
+
const reusableParser = this.reusableParsers.get(filetype);
|
|
219
|
+
if (reusableParser) {
|
|
220
|
+
reusableParser.parser.delete();
|
|
221
|
+
this.reusableParsers.delete(filetype);
|
|
222
|
+
}
|
|
223
|
+
this.reusableParserPromises.delete(filetype);
|
|
192
224
|
}
|
|
193
225
|
async createQueries(filetypeParser, language) {
|
|
194
226
|
try {
|
|
@@ -236,22 +268,23 @@ class ParserWorker {
|
|
|
236
268
|
}
|
|
237
269
|
}
|
|
238
270
|
async resolveFiletypeParser(filetype) {
|
|
239
|
-
|
|
240
|
-
|
|
271
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
272
|
+
if (this.filetypeParsers.has(canonicalFiletype)) {
|
|
273
|
+
return this.filetypeParsers.get(canonicalFiletype);
|
|
241
274
|
}
|
|
242
|
-
if (this.filetypeParserPromises.has(
|
|
243
|
-
return this.filetypeParserPromises.get(
|
|
275
|
+
if (this.filetypeParserPromises.has(canonicalFiletype)) {
|
|
276
|
+
return this.filetypeParserPromises.get(canonicalFiletype);
|
|
244
277
|
}
|
|
245
|
-
const loadingPromise = this.loadFiletypeParser(
|
|
246
|
-
this.filetypeParserPromises.set(
|
|
278
|
+
const loadingPromise = this.loadFiletypeParser(canonicalFiletype);
|
|
279
|
+
this.filetypeParserPromises.set(canonicalFiletype, loadingPromise);
|
|
247
280
|
try {
|
|
248
281
|
const result = await loadingPromise;
|
|
249
282
|
if (result) {
|
|
250
|
-
this.filetypeParsers.set(
|
|
283
|
+
this.filetypeParsers.set(canonicalFiletype, result);
|
|
251
284
|
}
|
|
252
285
|
return result;
|
|
253
286
|
} finally {
|
|
254
|
-
this.filetypeParserPromises.delete(
|
|
287
|
+
this.filetypeParserPromises.delete(canonicalFiletype);
|
|
255
288
|
}
|
|
256
289
|
}
|
|
257
290
|
async loadFiletypeParser(filetype) {
|
|
@@ -279,22 +312,23 @@ class ParserWorker {
|
|
|
279
312
|
return this.resolveFiletypeParser(filetype);
|
|
280
313
|
}
|
|
281
314
|
async getReusableParser(filetype) {
|
|
282
|
-
|
|
283
|
-
|
|
315
|
+
const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
|
|
316
|
+
if (this.reusableParsers.has(canonicalFiletype)) {
|
|
317
|
+
return this.reusableParsers.get(canonicalFiletype);
|
|
284
318
|
}
|
|
285
|
-
if (this.reusableParserPromises.has(
|
|
286
|
-
return this.reusableParserPromises.get(
|
|
319
|
+
if (this.reusableParserPromises.has(canonicalFiletype)) {
|
|
320
|
+
return this.reusableParserPromises.get(canonicalFiletype);
|
|
287
321
|
}
|
|
288
|
-
const creationPromise = this.createReusableParser(
|
|
289
|
-
this.reusableParserPromises.set(
|
|
322
|
+
const creationPromise = this.createReusableParser(canonicalFiletype);
|
|
323
|
+
this.reusableParserPromises.set(canonicalFiletype, creationPromise);
|
|
290
324
|
try {
|
|
291
325
|
const result = await creationPromise;
|
|
292
326
|
if (result) {
|
|
293
|
-
this.reusableParsers.set(
|
|
327
|
+
this.reusableParsers.set(canonicalFiletype, result);
|
|
294
328
|
}
|
|
295
329
|
return result;
|
|
296
330
|
} finally {
|
|
297
|
-
this.reusableParserPromises.delete(
|
|
331
|
+
this.reusableParserPromises.delete(canonicalFiletype);
|
|
298
332
|
}
|
|
299
333
|
}
|
|
300
334
|
async createReusableParser(filetype) {
|
|
@@ -858,5 +892,5 @@ if (!isMainThread) {
|
|
|
858
892
|
};
|
|
859
893
|
}
|
|
860
894
|
|
|
861
|
-
//# debugId=
|
|
895
|
+
//# debugId=181702D6D7C45F4964756E2164756E21
|
|
862
896
|
//# sourceMappingURL=parser.worker.js.map
|