@opentui/core 0.8.4 → 0.9.1
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/NativeScene.d.ts +11 -3
- package/Renderable.d.ts +22 -6
- package/ansi.d.ts +1 -1
- package/{chunk-bun-dsfc571f.js → chunk-bun-v1wzs0bj.js} +679 -112
- package/chunk-bun-v1wzs0bj.js.map +35 -0
- package/{chunk-bun-83k2gdpc.js → chunk-bun-xartp4ps.js} +8718 -9733
- package/chunk-bun-xartp4ps.js.map +68 -0
- package/{chunk-node-3ssb37vb.js → chunk-node-5cqzgmq3.js} +8718 -9733
- package/chunk-node-5cqzgmq3.js.map +68 -0
- package/{chunk-node-5nvhjp1a.js → chunk-node-mcdre3zn.js} +679 -112
- package/chunk-node-mcdre3zn.js.map +34 -0
- package/edit-buffer.d.ts +47 -6
- package/editor-view.d.ts +28 -0
- package/index.bun.js +1355 -4789
- package/index.bun.js.map +18 -24
- package/index.node.js +1355 -4789
- package/index.node.js.map +19 -31
- package/lib/KeyHandler.d.ts +1 -1
- package/lib/extmarks.d.ts +15 -51
- package/lib/index.d.ts +1 -2
- package/lib/kitty-keys.d.ts +2 -0
- package/lib/parse.keypress.d.ts +8 -3
- package/lib/parse.mouse.d.ts +0 -13
- package/lib/stdin-parser-native.d.ts +36 -24
- package/lib/terminal-capability-detection.d.ts +3 -3
- package/lib/terminal-palette.d.ts +3 -0
- package/lib/tree-sitter/client.d.ts +14 -3
- package/lib/tree-sitter/types.d.ts +10 -0
- package/lib/tree-sitter-styled-text.d.ts +2 -0
- package/lib/yoga.options.d.ts +3 -0
- package/native-abi.generated.d.ts +1400 -1
- package/package.json +9 -10
- package/parser.worker.js +112 -29
- package/parser.worker.js.map +3 -3
- package/plugins/core-slot.d.ts +1 -1
- package/renderables/ASCIIFont.d.ts +5 -0
- package/renderables/Code.d.ts +25 -2
- package/renderables/Diff.d.ts +3 -1
- package/renderables/EditBufferRenderable.d.ts +30 -1
- package/renderables/EmbeddedTerminal.d.ts +1 -1
- package/renderables/Input.d.ts +6 -3
- package/renderables/LineNumberRenderable.d.ts +4 -0
- package/renderables/Markdown.d.ts +208 -124
- package/renderables/ScrollBox.d.ts +7 -2
- package/renderables/ScrollBoxParts.d.ts +4 -5
- package/renderables/Select.d.ts +2 -2
- package/renderables/TabSelect.d.ts +2 -2
- package/renderables/Text.d.ts +3 -1
- package/renderables/TextBufferRenderable.d.ts +4 -0
- package/renderables/TextTable.d.ts +22 -0
- package/renderables/Textarea.d.ts +2 -1
- package/renderables/__tests__/code-model-harness.d.ts +40 -0
- package/renderables/index.d.ts +1 -3
- package/renderables/markdown-document.d.ts +37 -0
- package/renderables/props.d.ts +10 -0
- package/renderer-theme-mode.d.ts +5 -1
- package/renderer.d.ts +23 -9
- package/runtime-plugin.js +32 -57
- package/runtime-plugin.js.map +1 -1
- package/syntax-style.d.ts +5 -0
- package/testing/mock-tree-sitter-client.d.ts +5 -0
- package/testing/model.d.ts +15 -0
- package/testing.bun.js +8 -31
- package/testing.bun.js.map +4 -4
- package/testing.js +8 -31
- package/testing.js.map +4 -4
- package/tests/shrink-same-check.d.ts +4 -0
- package/tests/yoga-upstream/tools/utils.d.ts +9 -2
- package/text-buffer-view.d.ts +4 -0
- package/text-buffer.d.ts +16 -1
- package/types.d.ts +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.internal.d.ts +1 -0
- package/yoga.js +1 -1
- package/zig.d.ts +107 -6
- package/chunk-bun-83k2gdpc.js.map +0 -70
- package/chunk-bun-dsfc571f.js.map +0 -35
- package/chunk-node-3ssb37vb.js.map +0 -70
- package/chunk-node-5nvhjp1a.js.map +0 -34
- package/lib/debounce.d.ts +0 -42
- package/lib/extmarks-history.d.ts +0 -17
- package/lib/parse.keypress-kitty.d.ts +0 -5
- package/lib/queue.d.ts +0 -15
- package/lib/stdin-parser.d.ts +0 -97
- package/renderables/composition/VRenderable.d.ts +0 -16
- package/renderables/composition/constructs.d.ts +0 -35
- package/renderables/composition/vnode.d.ts +0 -46
- package/renderables/markdown-parser.d.ts +0 -12
|
@@ -3,18 +3,14 @@ import { type RenderContext } from "../types.js";
|
|
|
3
3
|
import { SyntaxStyle } from "../syntax-style.js";
|
|
4
4
|
import type { BorderStyle } from "../lib/border.js";
|
|
5
5
|
import { RGBA, type ColorInput } from "../lib/RGBA.js";
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
8
|
-
import type { TreeSitterClient } from "../lib/tree-sitter/index.js";
|
|
9
|
-
import { type ParseState } from "./markdown-parser.js";
|
|
6
|
+
import { type TextTableColumnFitter, type TextTableColumnWidthMode } from "./TextTable.js";
|
|
7
|
+
import { type TreeSitterClient } from "../lib/tree-sitter/index.js";
|
|
10
8
|
export type MarkdownTableStyle = "grid" | "columns";
|
|
11
9
|
export interface MarkdownTableOptions {
|
|
12
10
|
/**
|
|
13
11
|
* Visual style preset for markdown tables.
|
|
14
|
-
* - "grid": boxed table with visible borders.
|
|
12
|
+
* - "grid": boxed table with visible borders (the default).
|
|
15
13
|
* - "columns": borderless columns optimized for separated block output.
|
|
16
|
-
*
|
|
17
|
-
* Defaults to "columns" in `internalBlockMode: "top-level"`, otherwise "grid".
|
|
18
14
|
*/
|
|
19
15
|
style?: MarkdownTableStyle;
|
|
20
16
|
/**
|
|
@@ -73,19 +69,13 @@ export interface MarkdownOptions extends RenderableOptions<MarkdownRenderable> {
|
|
|
73
69
|
conceal?: boolean;
|
|
74
70
|
/** Controls concealment inside fenced code blocks rendered by CodeRenderable. */
|
|
75
71
|
concealCode?: boolean;
|
|
72
|
+
/** Highlights fenced code blocks. Paragraphs, headings and tables never reach it. */
|
|
76
73
|
treeSitterClient?: TreeSitterClient;
|
|
77
74
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* - Tables render all rows produced by the markdown parser (including trailing rows).
|
|
83
|
-
* - Incomplete table rows are normalized by the parser and rendered with empty cells
|
|
84
|
-
* where data is missing.
|
|
85
|
-
*
|
|
86
|
-
* Expectations:
|
|
87
|
-
* - Keep this true while chunks are still being appended.
|
|
88
|
-
* - Set this to false once streaming is complete to finalize trailing token parsing.
|
|
75
|
+
* Whether more content is still to come. While streaming, the last line shows as far as it is decided: a line
|
|
76
|
+
* that may still become a table row, a fence's end or a heading's underline waits for its end, and an emphasis
|
|
77
|
+
* or code span that has not closed yet draws as if it had. Set it to false once the content is complete; the
|
|
78
|
+
* document then shows as it would from one `content` without streaming.
|
|
89
79
|
*/
|
|
90
80
|
streaming?: boolean;
|
|
91
81
|
/**
|
|
@@ -93,47 +83,100 @@ export interface MarkdownOptions extends RenderableOptions<MarkdownRenderable> {
|
|
|
93
83
|
*/
|
|
94
84
|
tableOptions?: MarkdownTableOptions;
|
|
95
85
|
/**
|
|
96
|
-
* Custom
|
|
97
|
-
* or undefined/null
|
|
86
|
+
* Custom block renderer, called for each top-level block and each code block at any depth when it is built or
|
|
87
|
+
* changes. Return a Renderable to show instead, or undefined/null for the default rendering, which
|
|
88
|
+
* `context.defaultRender()` also returns.
|
|
98
89
|
*/
|
|
99
|
-
|
|
90
|
+
renderBlock?: (block: MarkdownBlock, context: RenderNodeContext) => Renderable | undefined | null;
|
|
100
91
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
92
|
+
* Rewrites the display text of every paragraph, heading and table cell, in lists and quotes too, before it is
|
|
93
|
+
* shown: to show IDs as titled links, for example. Code blocks and `renderBlock` results never reach it. It runs
|
|
94
|
+
* when a block is drawn or changes, and must be synchronous.
|
|
104
95
|
*/
|
|
105
|
-
|
|
96
|
+
inlineHook?: MarkdownInlineHook;
|
|
97
|
+
/** When set, the hook runs only on blocks and cells whose source contains one of these strings. */
|
|
98
|
+
inlineHookFilter?: readonly string[];
|
|
99
|
+
/**
|
|
100
|
+
* Delimiter extensions to parse. `"math"`: `$…$` and `\(…\)` are inline math, and `$$` or `\[` lines open a
|
|
101
|
+
* display math block, a code block of the language `math`.
|
|
102
|
+
*/
|
|
103
|
+
extensions?: readonly "math"[];
|
|
104
|
+
}
|
|
105
|
+
/** One piece of a prose block's display text, as an inline hook sees and returns it. */
|
|
106
|
+
export interface MarkdownInlineSpan {
|
|
107
|
+
text: string;
|
|
108
|
+
fg?: RGBA;
|
|
109
|
+
bg?: RGBA;
|
|
110
|
+
attributes?: number;
|
|
111
|
+
/** A hyperlink Markdown already found (a Markdown link, an autolink or a bare URL). */
|
|
112
|
+
link?: {
|
|
113
|
+
url: string;
|
|
114
|
+
};
|
|
115
|
+
/** Whether the span is a code span. Without conceal its text keeps the backticks. */
|
|
116
|
+
code: boolean;
|
|
117
|
+
/** Inline math: its TeX without delimiters. Set only with `extensions: ["math"]`. */
|
|
118
|
+
math?: string;
|
|
119
|
+
/** What a click on the span means to the app, such as a session ID. Never sent to the terminal. */
|
|
120
|
+
target?: string;
|
|
106
121
|
}
|
|
122
|
+
/** What an inline hook knows about the block or table cell. */
|
|
123
|
+
export interface MarkdownInlineContext {
|
|
124
|
+
/** The block's or cell's Markdown source. */
|
|
125
|
+
source: string;
|
|
126
|
+
conceal: boolean;
|
|
127
|
+
syntaxStyle: SyntaxStyle;
|
|
128
|
+
/** Whether the spans are one table cell's content; false for paragraphs and headings, in lists and quotes too. */
|
|
129
|
+
tableCell: boolean;
|
|
130
|
+
}
|
|
131
|
+
export type MarkdownInlineHook = (spans: MarkdownInlineSpan[], context: MarkdownInlineContext) => MarkdownInlineSpan[];
|
|
107
132
|
export interface RenderNodeContext {
|
|
108
133
|
syntaxStyle: SyntaxStyle;
|
|
109
134
|
conceal: boolean;
|
|
110
135
|
concealCode: boolean;
|
|
111
136
|
treeSitterClient?: TreeSitterClient;
|
|
112
|
-
/** Creates default renderable for this
|
|
137
|
+
/** Creates the default renderable for this block, or returns the one it shows. */
|
|
113
138
|
defaultRender: () => Renderable | null;
|
|
114
139
|
}
|
|
115
|
-
export type
|
|
116
|
-
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
140
|
+
export type MarkdownBlockKind = "paragraph" | "heading" | "code" | "html" | "rule" | "table" | "row" | "cell" | "quote" | "list" | "item";
|
|
141
|
+
/** A block of the document, read when a renderer needs it. */
|
|
142
|
+
export interface MarkdownBlock {
|
|
143
|
+
/** The block's id: its place in document order, counting nested blocks. */
|
|
144
|
+
readonly index: number;
|
|
145
|
+
readonly kind: MarkdownBlockKind;
|
|
146
|
+
/** A heading's level, 1 to 6. */
|
|
147
|
+
readonly level?: number;
|
|
148
|
+
/** Whether a list is numbered, and its first number. */
|
|
149
|
+
readonly ordered?: boolean;
|
|
150
|
+
readonly start?: number;
|
|
151
|
+
/** A task item's box; undefined for other items. */
|
|
152
|
+
readonly checked?: boolean;
|
|
153
|
+
/** A code block's language (the first word of its info string; `math` for display math) and info string. */
|
|
154
|
+
readonly lang?: string;
|
|
155
|
+
readonly info?: string;
|
|
156
|
+
/** Whether a code block's closing delimiter arrived. */
|
|
157
|
+
readonly closed?: boolean;
|
|
158
|
+
/** The block's Markdown source. */
|
|
159
|
+
readonly raw: string;
|
|
160
|
+
/** A code block's code, or a paragraph's, heading's or cell's display text; empty for other blocks. */
|
|
161
|
+
readonly text: string;
|
|
162
|
+
readonly children: readonly MarkdownBlock[];
|
|
121
163
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/** Whether built-in reconciliation can update this renderable without replacing it. */
|
|
130
|
-
canUpdateInPlace: boolean;
|
|
164
|
+
/** A fenced, indented or display math code block. */
|
|
165
|
+
export interface MarkdownCodeBlock extends MarkdownBlock {
|
|
166
|
+
readonly type: "code";
|
|
167
|
+
readonly kind: "code";
|
|
168
|
+
readonly lang: string;
|
|
169
|
+
readonly info: string;
|
|
170
|
+
readonly closed: boolean;
|
|
131
171
|
}
|
|
132
|
-
export type
|
|
172
|
+
export type MarkdownCodeBlockRenderer = (block: MarkdownCodeBlock, context: RenderNodeContext) => Renderable | undefined | null;
|
|
173
|
+
export type MarkdownCodeBlockRendererMap = ReadonlyMap<string, MarkdownCodeBlockRenderer> | Readonly<Record<string, MarkdownCodeBlockRenderer>>;
|
|
174
|
+
export declare function createMarkdownCodeBlockRenderer(renderers: MarkdownCodeBlockRendererMap): MarkdownOptions["renderBlock"];
|
|
133
175
|
export declare class MarkdownRenderable extends Renderable {
|
|
134
176
|
static readonly nativeIntegration: NativeRenderableIntegration;
|
|
135
177
|
private static _capabilitySubscriptions;
|
|
136
|
-
private
|
|
178
|
+
private _doc;
|
|
179
|
+
private _shown;
|
|
137
180
|
private _syntaxStyle;
|
|
138
181
|
private _fg?;
|
|
139
182
|
private _bg?;
|
|
@@ -141,30 +184,31 @@ export declare class MarkdownRenderable extends Renderable {
|
|
|
141
184
|
private _concealCode;
|
|
142
185
|
private _treeSitterClient?;
|
|
143
186
|
private _tableOptions?;
|
|
144
|
-
private
|
|
145
|
-
private _internalBlockMode;
|
|
146
|
-
_parseState: ParseState | null;
|
|
187
|
+
private _renderBlock?;
|
|
147
188
|
private _streaming;
|
|
148
|
-
|
|
149
|
-
|
|
189
|
+
private _inlineHook?;
|
|
190
|
+
private _inlineHookFilter?;
|
|
191
|
+
private _extensions;
|
|
192
|
+
private _styleCopy?;
|
|
193
|
+
private _flags;
|
|
194
|
+
private _before?;
|
|
195
|
+
private _beforeBytes?;
|
|
196
|
+
private _shownInCall?;
|
|
150
197
|
private _styleDirty;
|
|
151
198
|
private readonly applyStyleChanges;
|
|
152
|
-
private _highlightMarkdownLinks;
|
|
153
|
-
private _linkifyMarkdownChunks;
|
|
154
|
-
private _ownedStructuredRenderables;
|
|
155
|
-
private handleCapabilities;
|
|
156
199
|
protected _contentDefaultOptions: {
|
|
157
200
|
content: string;
|
|
158
201
|
conceal: true;
|
|
159
202
|
concealCode: false;
|
|
160
203
|
streaming: false;
|
|
161
|
-
internalBlockMode: "coalesced";
|
|
162
204
|
};
|
|
163
205
|
constructor(ctx: RenderContext, options: MarkdownOptions);
|
|
164
206
|
get content(): string;
|
|
165
207
|
set content(value: string);
|
|
166
208
|
get syntaxStyle(): SyntaxStyle;
|
|
167
209
|
set syntaxStyle(value: SyntaxStyle);
|
|
210
|
+
get treeSitterClient(): TreeSitterClient | undefined;
|
|
211
|
+
set treeSitterClient(value: TreeSitterClient | undefined);
|
|
168
212
|
get fg(): RGBA | undefined;
|
|
169
213
|
set fg(value: ColorInput | undefined);
|
|
170
214
|
get bg(): RGBA | undefined;
|
|
@@ -177,81 +221,121 @@ export declare class MarkdownRenderable extends Renderable {
|
|
|
177
221
|
set streaming(value: boolean);
|
|
178
222
|
get tableOptions(): MarkdownTableOptions | undefined;
|
|
179
223
|
set tableOptions(value: MarkdownTableOptions | undefined);
|
|
180
|
-
get
|
|
181
|
-
set
|
|
182
|
-
get
|
|
183
|
-
set
|
|
224
|
+
get renderBlock(): MarkdownOptions["renderBlock"] | undefined;
|
|
225
|
+
set renderBlock(value: MarkdownOptions["renderBlock"] | undefined);
|
|
226
|
+
get inlineHook(): MarkdownInlineHook | undefined;
|
|
227
|
+
set inlineHook(value: MarkdownInlineHook | undefined);
|
|
228
|
+
get inlineHookFilter(): readonly string[] | undefined;
|
|
229
|
+
set inlineHookFilter(value: readonly string[] | undefined);
|
|
230
|
+
get extensions(): readonly "math"[];
|
|
231
|
+
set extensions(value: readonly "math"[] | null | undefined);
|
|
232
|
+
/** Each block the document holds, in document order (the index is the block's id), with what shows it. */
|
|
233
|
+
get blocks(): readonly {
|
|
234
|
+
kind: MarkdownBlockKind;
|
|
235
|
+
renderable: Renderable | undefined;
|
|
236
|
+
}[];
|
|
237
|
+
/**
|
|
238
|
+
* How many top-level blocks are final: their rows equal those a render of the finished document draws, except
|
|
239
|
+
* that a link definition arriving after a committed block used its label makes that label a link. It counts from
|
|
240
|
+
* the first block and never goes down while the content only grows.
|
|
241
|
+
*/
|
|
242
|
+
get committedBlockCount(): number;
|
|
243
|
+
/**
|
|
244
|
+
* Runs the inline hook again on the paragraphs, headings and table cells it rewrites whose source `select`
|
|
245
|
+
* accepts, for a change only the hook knows about, such as a new title for an ID it links. Nothing is parsed or
|
|
246
|
+
* highlighted again. Does nothing without a hook.
|
|
247
|
+
*/
|
|
248
|
+
rerunInlineHook(select: (source: string) => boolean): void;
|
|
249
|
+
/** The `target` of the inline hook span the latest finished frame drew at screen cell (x, y), if any. */
|
|
250
|
+
targetAt(x: number, y: number): string | undefined;
|
|
251
|
+
clearCache(): void;
|
|
252
|
+
refreshStyles(): void;
|
|
253
|
+
private engineFlags;
|
|
254
|
+
private engineOptions;
|
|
255
|
+
/** The style the doc binds: the style itself, or a copy of its definitions when it lives in another Context. */
|
|
256
|
+
private nativeStyle;
|
|
257
|
+
/** Sends changed engine flags; `force` sends the hook filter too. */
|
|
258
|
+
private changeOptions;
|
|
259
|
+
private change;
|
|
260
|
+
/** Whether a removed block's source (before this call) equals a new block's: the same bytes at its range. */
|
|
261
|
+
private sameSource;
|
|
262
|
+
/** Binds a paragraph's or heading's node, which hands it to the doc. */
|
|
263
|
+
private bind;
|
|
264
|
+
/**
|
|
265
|
+
* After an option change, each paragraph and heading goes to the writer the options now give it: the doc does not
|
|
266
|
+
* list a leaf whose output did not change, so the host hands it over or takes it back here.
|
|
267
|
+
*/
|
|
268
|
+
private syncLeaves;
|
|
269
|
+
/** Whether the host writes a paragraph or heading: the doc writes only concealed, linked, unhooked text. */
|
|
270
|
+
private hostWrites;
|
|
271
|
+
/**
|
|
272
|
+
* Shows a call's changes: builds or updates each listed block, then drops the renderables of removed blocks. A code
|
|
273
|
+
* block or text that takes a removed one's place, index and kind, keeps its renderable and highlight.
|
|
274
|
+
*/
|
|
275
|
+
private apply;
|
|
276
|
+
private refresh;
|
|
277
|
+
private update;
|
|
278
|
+
/** Builds the renderable of block `index` and puts it where `old` was, or last in its parent. */
|
|
279
|
+
private show;
|
|
280
|
+
private showDescendants;
|
|
281
|
+
private subtreeEnd;
|
|
282
|
+
private parentOf;
|
|
283
|
+
/** Whether block `index` lies in a table or a renderer's result without a default, so nothing shows it on its own. */
|
|
284
|
+
private isHidden;
|
|
285
|
+
private rendersCustom;
|
|
286
|
+
/**
|
|
287
|
+
* The renderable of block `index`, a renderer's or the default one, and the default one if it shows (the one shown
|
|
288
|
+
* already, when it is still right).
|
|
289
|
+
*/
|
|
290
|
+
private resolve;
|
|
291
|
+
/** The default renderable of block `index`; `current` is kept when it already shows a block of that kind. */
|
|
292
|
+
private buildDefault;
|
|
293
|
+
private setCode;
|
|
294
|
+
/** What a changed block changes besides its own renderable: text the host writes, the table or list around it. */
|
|
295
|
+
private afterChange;
|
|
296
|
+
/**
|
|
297
|
+
* Writes a paragraph, heading or HTML block the host writes: the parser's output, through the inline hook when
|
|
298
|
+
* the doc marked it, with its click targets. An unchanged output is not written again unless `force`.
|
|
299
|
+
*/
|
|
300
|
+
private writeProse;
|
|
301
|
+
private spans;
|
|
302
|
+
private hook;
|
|
303
|
+
private tableOf;
|
|
304
|
+
/** The blocks that are children of block `index`, in order. */
|
|
305
|
+
private childrenOf;
|
|
306
|
+
/**
|
|
307
|
+
* Fills a table from its rows and cells: a header row in the heading style, then the body, as wide as the header,
|
|
308
|
+
* each column aligned as its delimiter row says.
|
|
309
|
+
*/
|
|
310
|
+
private fillTable;
|
|
311
|
+
/** A cell's content: the parser's output, in the heading style in a header row, through the hook. */
|
|
312
|
+
private readCell;
|
|
313
|
+
/**
|
|
314
|
+
* A list's gaps and its items' markers: numbers align on their right, and the list is loose when items are. With
|
|
315
|
+
* `listed`, only those items changed: they are counted and marked, and the rest is written only when the gap or the
|
|
316
|
+
* marker width changes.
|
|
317
|
+
*/
|
|
318
|
+
private updateList;
|
|
319
|
+
/** Whether an item has a blank line after it or between two of its blocks. */
|
|
320
|
+
private isLoose;
|
|
321
|
+
/** The style of text in block `index` that no part of it styles: the text style, under each quote around it. */
|
|
322
|
+
private baseStyle;
|
|
323
|
+
private styleText;
|
|
184
324
|
private getStyle;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
private
|
|
190
|
-
|
|
191
|
-
private
|
|
192
|
-
|
|
193
|
-
private
|
|
194
|
-
private
|
|
195
|
-
private
|
|
196
|
-
private createBlockquoteRenderable;
|
|
197
|
-
private createListRenderable;
|
|
198
|
-
private getListItemInputs;
|
|
199
|
-
private applyListRenderable;
|
|
200
|
-
private createListItemRenderable;
|
|
201
|
-
private applyListItemRenderable;
|
|
202
|
-
private applyListItemChildren;
|
|
203
|
-
private getRenderableListItemTokens;
|
|
204
|
-
private applyListChildRenderable;
|
|
205
|
-
private destroyListItemChildrenAfter;
|
|
206
|
-
private applyListItemMarker;
|
|
207
|
-
private createListChildRenderable;
|
|
208
|
-
private getHorizontalRuleColor;
|
|
209
|
-
private createHorizontalRuleRenderable;
|
|
210
|
-
private createCodeRenderable;
|
|
211
|
-
private applyMarkdownCodeRenderable;
|
|
212
|
-
private applyBlockquoteRenderable;
|
|
213
|
-
private applyCodeBlockRenderable;
|
|
214
|
-
private shouldRenderSeparately;
|
|
215
|
-
private getInterBlockMargin;
|
|
216
|
-
private applyInterBlockMargin;
|
|
217
|
-
private createMarkdownBlockToken;
|
|
218
|
-
private normalizeMarkdownBlockRaw;
|
|
219
|
-
private normalizeScrollbackMarkdownBlockRaw;
|
|
220
|
-
private isCodeBlockOnlyRenderer;
|
|
221
|
-
private buildRenderableTokens;
|
|
222
|
-
private buildTopLevelRenderBlocks;
|
|
223
|
-
private shouldAddTopLevelMargin;
|
|
224
|
-
private isSeparatedTopLevelBlock;
|
|
225
|
-
private getTableRowsToRender;
|
|
226
|
-
private hashString;
|
|
227
|
-
private hashTableToken;
|
|
228
|
-
private getTableCellKey;
|
|
229
|
-
private createTableDataCellChunks;
|
|
230
|
-
private createTableHeaderCellChunks;
|
|
231
|
-
private buildTableContentCache;
|
|
325
|
+
/**
|
|
326
|
+
* Styles every renderable again for new colors, a new theme or new table options, and asks the renderers again,
|
|
327
|
+
* since they read the style; nothing is parsed again.
|
|
328
|
+
*/
|
|
329
|
+
private restyle;
|
|
330
|
+
/** Builds every block's renderable again (a new renderer), keeping the doc. */
|
|
331
|
+
private rebuild;
|
|
332
|
+
/** A read-only view of block `index` for renderers. */
|
|
333
|
+
private view;
|
|
334
|
+
private leafText;
|
|
335
|
+
private sourceText;
|
|
232
336
|
private resolveTableStyle;
|
|
233
|
-
private usesBorderlessColumnSpacing;
|
|
234
337
|
private resolveTableRenderableOptions;
|
|
235
338
|
private applyTableRenderableOptions;
|
|
236
|
-
private applyTableOptionsToBlocks;
|
|
237
|
-
private createTextTableRenderable;
|
|
238
|
-
private createTableBlock;
|
|
239
|
-
private getStableBlockCount;
|
|
240
|
-
private syncTopLevelBlockState;
|
|
241
|
-
private getTopLevelBlockRaw;
|
|
242
|
-
private createTopLevelDefaultRenderable;
|
|
243
|
-
private createTopLevelRenderable;
|
|
244
|
-
private createDefaultRenderable;
|
|
245
|
-
private createCustomRenderable;
|
|
246
|
-
private createTopLevelCustomRenderable;
|
|
247
|
-
private renderCustomNode;
|
|
248
|
-
private destroyUnusedDefaultRenderable;
|
|
249
|
-
private updateBlockRenderable;
|
|
250
|
-
private updateTopLevelBlocks;
|
|
251
|
-
private updateBlocks;
|
|
252
|
-
private clearBlockStates;
|
|
253
|
-
clearCache(): void;
|
|
254
|
-
refreshStyles(): void;
|
|
255
339
|
private markStyleDirty;
|
|
256
340
|
private rerenderDirtyStyles;
|
|
257
341
|
_needsLifecyclePass(): boolean;
|
|
@@ -36,6 +36,7 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
|
|
|
36
36
|
readonly verticalScrollBar: ScrollBoxBar;
|
|
37
37
|
protected static readonly defaultFocusable = true;
|
|
38
38
|
private readonly selectionListener;
|
|
39
|
+
private autoScrollOwner?;
|
|
39
40
|
private autoScrollMouseX;
|
|
40
41
|
private autoScrollMouseY;
|
|
41
42
|
private readonly autoScrollThresholdVertical;
|
|
@@ -43,7 +44,6 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
|
|
|
43
44
|
private readonly autoScrollSpeedSlow;
|
|
44
45
|
private readonly autoScrollSpeedMedium;
|
|
45
46
|
private readonly autoScrollSpeedFast;
|
|
46
|
-
private isAutoScrolling;
|
|
47
47
|
private cachedAutoScrollSpeed;
|
|
48
48
|
private autoScrollAccumulatorX;
|
|
49
49
|
private autoScrollAccumulatorY;
|
|
@@ -104,7 +104,9 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
|
|
|
104
104
|
private notifyScroll;
|
|
105
105
|
/** Runs `callback` once in the next frame, after its layout and before it paints: layout reads in it are current,
|
|
106
106
|
* and a scroll it makes shows in that frame. Asked during a frame, it runs in the frame after. It waits while the box
|
|
107
|
-
* is hidden; destroying the box drops it.
|
|
107
|
+
* is hidden; destroying the box drops it. A `Code` block that the frame before painted keeps its last highlight's
|
|
108
|
+
* height through the frame that moves it out of view: a growth hold here reads that height, and for a block that ends
|
|
109
|
+
* above the view the rows in view move in the next frame. `anchor` and sticky bottom hold them. */
|
|
108
110
|
afterLayout(callback: () => void): void;
|
|
109
111
|
/** Keeps `node`, a descendant, at its place in the viewport through layout changes, over sticky follow, until the
|
|
110
112
|
* returned function runs or the node leaves the box. A scroll moves the place it keeps; a scroll to the end or a later
|
|
@@ -140,12 +142,15 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
|
|
|
140
142
|
/** Thumb geometry is in half cells along the track, as the native slider's. */
|
|
141
143
|
private thumbPointer;
|
|
142
144
|
private pressTrack;
|
|
145
|
+
/** A pointer at the position the offset already reflects has nothing to apply: recomputing the offset could move
|
|
146
|
+
* it, by a rounding error or by the clamp on a press before the thumb's exact start. */
|
|
143
147
|
private dragThumb;
|
|
144
148
|
private endBarPress;
|
|
145
149
|
handleKeyPress(key: KeyEvent): boolean;
|
|
146
150
|
private resetScrollAccumulators;
|
|
147
151
|
startAutoScroll(mouseX: number, mouseY: number): void;
|
|
148
152
|
updateAutoScroll(mouseX: number, mouseY: number): void;
|
|
153
|
+
private draggingSelection;
|
|
149
154
|
stopAutoScroll(): void;
|
|
150
155
|
private handleAutoScroll;
|
|
151
156
|
private getAutoScrollDirectionX;
|
|
@@ -5,7 +5,6 @@ import type { BaseRenderable, Renderable } from "../Renderable.js";
|
|
|
5
5
|
import type { NativeScene } from "../NativeScene.js";
|
|
6
6
|
import { type NativeSceneRect, type NativeSceneScrollBarOptions, type SceneNodeHandle } from "../zig.js";
|
|
7
7
|
import type { BoxOptions } from "./Box.js";
|
|
8
|
-
import type { VNode } from "./composition/vnode.js";
|
|
9
8
|
import { type ArrowOptions, type ScrollUnit } from "./ScrollBar.js";
|
|
10
9
|
import type { ScrollBoxRenderable } from "./ScrollBox.js";
|
|
11
10
|
export type SceneStyleNode = {
|
|
@@ -85,12 +84,12 @@ export declare class ScrollBoxContent extends ScrollBoxSizedPart {
|
|
|
85
84
|
constructor(box: ScrollBoxRenderable);
|
|
86
85
|
protected rect(): NativeSceneRect;
|
|
87
86
|
private setStyle;
|
|
88
|
-
/** @internal Whether children lay out in a row, by the direction native was given. */
|
|
87
|
+
/** @internal Whether children lay out in a row, by the direction and mode native was given. */
|
|
89
88
|
get _row(): boolean;
|
|
90
89
|
get viewportCulling(): boolean;
|
|
91
90
|
set viewportCulling(value: boolean);
|
|
92
|
-
add(obj: Renderable
|
|
93
|
-
insertBefore(obj: Renderable
|
|
91
|
+
add(obj: Renderable, index?: number): number;
|
|
92
|
+
insertBefore(obj: Renderable, anchor?: Renderable): number;
|
|
94
93
|
remove(child: BaseRenderable): void;
|
|
95
94
|
getChildren(): Renderable[];
|
|
96
95
|
getChildrenCount(): number;
|
|
@@ -156,7 +155,7 @@ export declare class ScrollBoxBar extends ScrollBoxPart {
|
|
|
156
155
|
handleKeyPress(key: KeyEvent): boolean;
|
|
157
156
|
}
|
|
158
157
|
type Edges = "" | "X" | "Y" | "Top" | "Right" | "Bottom" | "Left";
|
|
159
|
-
type ContentLayoutKey = "flexDirection" | "flexWrap" | "alignItems" | "justifyContent" | "alignSelf" | "flexGrow" | "flexShrink" | "flexBasis" | `${"min" | "max"}${"Width" | "Height"}` | `${"padding" | "margin"}${Edges}` | "gap" | "rowGap" | "columnGap";
|
|
158
|
+
type ContentLayoutKey = "flexDirection" | "flexWrap" | "layoutMode" | "alignItems" | "alignContent" | "aspectRatio" | "justifyContent" | "alignSelf" | "flexGrow" | "flexShrink" | "flexBasis" | `${"min" | "max"}${"Width" | "Height"}` | `${"padding" | "margin"}${Edges}` | "gap" | "rowGap" | "columnGap";
|
|
160
159
|
export interface ScrollBoxContent extends ContentLayout {
|
|
161
160
|
}
|
|
162
161
|
type ContentLayout = {
|
package/renderables/Select.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare class SelectRenderable extends Renderable {
|
|
|
84
84
|
constructor(ctx: RenderContext, options: SelectRenderableOptions);
|
|
85
85
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
86
86
|
get options(): SelectOption[];
|
|
87
|
-
set options(options: SelectOption[]);
|
|
87
|
+
set options(options: SelectOption[] | null | undefined);
|
|
88
88
|
getSelectedOption(): SelectOption | null;
|
|
89
89
|
getSelectedIndex(): number;
|
|
90
90
|
moveUp(steps?: number): void;
|
|
@@ -114,7 +114,7 @@ export declare class SelectRenderable extends Renderable {
|
|
|
114
114
|
set font(font: keyof typeof fonts);
|
|
115
115
|
set itemSpacing(spacing: number);
|
|
116
116
|
set fastScrollStep(step: number);
|
|
117
|
-
set keyBindings(bindings: SelectKeyBinding[]);
|
|
117
|
+
set keyBindings(bindings: SelectKeyBinding[] | null | undefined);
|
|
118
118
|
set keyAliasMap(aliases: KeyAliasMap);
|
|
119
119
|
set selectedIndex(value: number);
|
|
120
120
|
}
|
|
@@ -73,7 +73,7 @@ export declare class TabSelectRenderable extends Renderable {
|
|
|
73
73
|
getTabWidth(): number;
|
|
74
74
|
handleKeyPress(key: KeyEvent): boolean;
|
|
75
75
|
get options(): TabSelectOption[];
|
|
76
|
-
set options(options: TabSelectOption[]);
|
|
76
|
+
set options(options: TabSelectOption[] | null | undefined);
|
|
77
77
|
set backgroundColor(color: ColorInput);
|
|
78
78
|
set textColor(color: ColorInput);
|
|
79
79
|
set focusedBackgroundColor(color: ColorInput);
|
|
@@ -91,7 +91,7 @@ export declare class TabSelectRenderable extends Renderable {
|
|
|
91
91
|
set wrapSelection(wrap: boolean);
|
|
92
92
|
get tabWidth(): number;
|
|
93
93
|
set tabWidth(tabWidth: number);
|
|
94
|
-
set keyBindings(bindings: TabSelectKeyBinding[]);
|
|
94
|
+
set keyBindings(bindings: TabSelectKeyBinding[] | null | undefined);
|
|
95
95
|
set keyAliasMap(aliases: KeyAliasMap);
|
|
96
96
|
}
|
|
97
97
|
export {};
|
package/renderables/Text.d.ts
CHANGED
|
@@ -26,8 +26,10 @@ export declare class TextRenderable extends TextBufferRenderable {
|
|
|
26
26
|
_needsLifecyclePass(): boolean;
|
|
27
27
|
requestRender(): void;
|
|
28
28
|
add(obj: TextNodeRenderable | StyledText | string, index?: number): number;
|
|
29
|
+
add(obj: never, index?: number): number;
|
|
29
30
|
remove(child: BaseRenderable): void;
|
|
30
|
-
insertBefore(obj:
|
|
31
|
+
insertBefore(obj: TextNodeRenderable | StyledText | string, anchor?: TextNodeRenderable): number;
|
|
32
|
+
insertBefore(obj: never, anchor?: never): number;
|
|
31
33
|
getTextChildren(): BaseRenderable[];
|
|
32
34
|
clear(): void;
|
|
33
35
|
protected onFgChanged(newColor: RGBA): void;
|
|
@@ -67,6 +67,8 @@ export declare abstract class TextBufferRenderable extends Renderable implements
|
|
|
67
67
|
get scrollHeight(): number;
|
|
68
68
|
get maxScrollY(): number;
|
|
69
69
|
get maxScrollX(): number;
|
|
70
|
+
/** The cells the text fills: native text leaves its padding out once it has a layout; until then, its box. */
|
|
71
|
+
private get textViewport();
|
|
70
72
|
protected updateViewportOffset(scrollX?: number, scrollY?: number): void;
|
|
71
73
|
get plainText(): string;
|
|
72
74
|
get textLength(): number;
|
|
@@ -92,6 +94,8 @@ export declare abstract class TextBufferRenderable extends Renderable implements
|
|
|
92
94
|
set truncate(value: boolean);
|
|
93
95
|
protected onResize(width: number, height: number): void;
|
|
94
96
|
protected refreshLocalSelection(): boolean;
|
|
97
|
+
/** Restyles the accepted selection; replaying its cells would select other text after a width change. */
|
|
98
|
+
private setSelectionColors;
|
|
95
99
|
private updateLocalSelection;
|
|
96
100
|
protected updateTextInfo(): void;
|
|
97
101
|
shouldStartSelection(x: number, y: number): boolean;
|
|
@@ -9,11 +9,14 @@ export type TextTableCellContent = TextChunk[] | null | undefined;
|
|
|
9
9
|
export type TextTableContent = TextTableCellContent[][];
|
|
10
10
|
export type TextTableColumnWidthMode = "content" | "full";
|
|
11
11
|
export type TextTableColumnFitter = "proportional" | "balanced";
|
|
12
|
+
export type TextTableColumnAlignment = "left" | "center" | "right";
|
|
12
13
|
export interface TextTableOptions extends RenderableOptions<TextTableRenderable> {
|
|
13
14
|
content?: TextTableContent;
|
|
14
15
|
wrapMode?: "none" | "char" | "word";
|
|
15
16
|
columnWidthMode?: TextTableColumnWidthMode;
|
|
16
17
|
columnFitter?: TextTableColumnFitter;
|
|
18
|
+
/** Each column's line alignment in its cells, by column; a missing entry is `"left"`. */
|
|
19
|
+
columnAlignments?: TextTableColumnAlignment[];
|
|
17
20
|
cellPadding?: number;
|
|
18
21
|
cellPaddingX?: number;
|
|
19
22
|
cellPaddingY?: number;
|
|
@@ -34,9 +37,20 @@ export interface TextTableOptions extends RenderableOptions<TextTableRenderable>
|
|
|
34
37
|
}
|
|
35
38
|
export declare class TextTableRenderable extends Renderable {
|
|
36
39
|
private _content;
|
|
40
|
+
/** The width method the cells measure with; a terminal reply can change the renderer's. */
|
|
41
|
+
private _cellWidthMethod?;
|
|
42
|
+
/** The cells hold the accepted selection in document offsets; its cells no longer name its text. */
|
|
43
|
+
private _selectionInCells;
|
|
44
|
+
/** The cell a press without a drag pinned, which the gesture's first drag keeps as its anchor. */
|
|
45
|
+
private _pressedCell;
|
|
46
|
+
/** The pressed cell's view still holds the press as its anchor. */
|
|
47
|
+
private _pressPinned;
|
|
48
|
+
private _pressAnchor;
|
|
49
|
+
private _pressMoved;
|
|
37
50
|
private _wrapMode;
|
|
38
51
|
private _columnWidthMode;
|
|
39
52
|
private _columnFitter;
|
|
53
|
+
private _columnAlignments;
|
|
40
54
|
private _cellPaddingX;
|
|
41
55
|
private _cellPaddingY;
|
|
42
56
|
private _columnGap;
|
|
@@ -65,6 +79,8 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
65
79
|
private _cachedMeasureWidth;
|
|
66
80
|
private readonly _defaultOptions;
|
|
67
81
|
constructor(ctx: RenderContext, options?: TextTableOptions);
|
|
82
|
+
/** Cells re-measure in place: their views keep their selections on the same text. */
|
|
83
|
+
private followWidthMethod;
|
|
68
84
|
get content(): TextTableContent;
|
|
69
85
|
set content(value: TextTableContent);
|
|
70
86
|
get wrapMode(): "none" | "char" | "word";
|
|
@@ -73,6 +89,8 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
73
89
|
set columnWidthMode(value: TextTableColumnWidthMode);
|
|
74
90
|
get columnFitter(): TextTableColumnFitter;
|
|
75
91
|
set columnFitter(value: TextTableColumnFitter);
|
|
92
|
+
get columnAlignments(): TextTableColumnAlignment[];
|
|
93
|
+
set columnAlignments(value: TextTableColumnAlignment[] | undefined);
|
|
76
94
|
get cellPadding(): number;
|
|
77
95
|
set cellPadding(value: number);
|
|
78
96
|
get cellPaddingX(): number;
|
|
@@ -132,6 +150,10 @@ export declare class TextTableRenderable extends Renderable {
|
|
|
132
150
|
private ensureLayoutReady;
|
|
133
151
|
private getCellAtLocalPosition;
|
|
134
152
|
private applySelectionToCells;
|
|
153
|
+
/** The table-local cell where the moved press's character lies now. */
|
|
154
|
+
private movedAnchor;
|
|
155
|
+
/** The character offset of the press `view` pins: a drag from it to below the text starts there. */
|
|
156
|
+
private pressOffset;
|
|
135
157
|
private resolveSelectionResolution;
|
|
136
158
|
private getColumnAtLocalX;
|
|
137
159
|
private getFullCellSelectionCoords;
|
|
@@ -59,7 +59,8 @@ export declare class TextareaRenderable extends EditBufferRenderable {
|
|
|
59
59
|
submit(): boolean;
|
|
60
60
|
set onSubmit(handler: ((event: SubmitEvent) => void) | undefined);
|
|
61
61
|
get onSubmit(): ((event: SubmitEvent) => void) | undefined;
|
|
62
|
-
set keyBindings(bindings: KeyBinding[]);
|
|
62
|
+
set keyBindings(bindings: KeyBinding[] | null | undefined);
|
|
63
63
|
set keyAliasMap(aliases: TextareaKeyAliasMap);
|
|
64
|
+
/** Mark endpoints count document display cells, including one per newline. */
|
|
64
65
|
get extmarks(): ExtmarksController;
|
|
65
66
|
}
|