1ch 0.2.0 → 0.4.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.
- package/README.md +54 -153
- package/dist/index.d.ts +271 -317
- package/dist/index.js +1892 -1866
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { ReactNode, CSSProperties, RefObject } from 'react';
|
|
4
|
-
|
|
5
1
|
type Style = {
|
|
6
2
|
text: string;
|
|
7
3
|
color?: string;
|
|
@@ -125,11 +121,19 @@ type Theme = {
|
|
|
125
121
|
declare function isTableLine(line: Line): boolean;
|
|
126
122
|
declare function preserveTableTag(source: Line, target: Line): void;
|
|
127
123
|
|
|
124
|
+
type ScrollRegionMeta = {
|
|
125
|
+
onScroll: (offset: number) => void;
|
|
126
|
+
totalLines: number;
|
|
127
|
+
maxHeight: number;
|
|
128
|
+
offset: number;
|
|
129
|
+
};
|
|
130
|
+
|
|
128
131
|
declare function pad(s: string, w: number, right?: boolean): string;
|
|
129
132
|
declare function hl(n: number): string;
|
|
130
133
|
declare function bar(val: number, max: number, w: number): string;
|
|
131
134
|
declare function spark(data: number[], w: number): string;
|
|
132
135
|
declare function padLine(line: Line, w: number): Line;
|
|
136
|
+
declare function truncate(text: string, width: number, ellipsis?: string): string;
|
|
133
137
|
|
|
134
138
|
type BoxAction = {
|
|
135
139
|
label: string;
|
|
@@ -147,8 +151,32 @@ declare function hstack(children: LayoutFn[], opts?: {
|
|
|
147
151
|
widths?: number[];
|
|
148
152
|
}): LayoutFn;
|
|
149
153
|
declare function vstack(...children: LayoutFn[]): LayoutFn;
|
|
150
|
-
declare function separator(color?: string): LayoutFn;
|
|
151
|
-
declare function blank(): LayoutFn;
|
|
154
|
+
declare function separator(color?: string, char?: string): LayoutFn;
|
|
155
|
+
declare function blank(count?: number): LayoutFn;
|
|
156
|
+
declare function divider(label: string, opts?: {
|
|
157
|
+
color?: string;
|
|
158
|
+
char?: string;
|
|
159
|
+
labelColor?: string;
|
|
160
|
+
}): LayoutFn;
|
|
161
|
+
declare function grid(cells: LayoutFn[], opts: {
|
|
162
|
+
cols: number;
|
|
163
|
+
gap?: number;
|
|
164
|
+
rowGap?: number;
|
|
165
|
+
}): LayoutFn;
|
|
166
|
+
declare function scroll(content: LayoutFn, opts: {
|
|
167
|
+
maxHeight: number;
|
|
168
|
+
offset?: number;
|
|
169
|
+
scrollbarColor?: string;
|
|
170
|
+
onScroll?: (offset: number) => void;
|
|
171
|
+
}): LayoutFn;
|
|
172
|
+
declare function padding(content: LayoutFn, opts?: {
|
|
173
|
+
x?: number;
|
|
174
|
+
y?: number;
|
|
175
|
+
top?: number;
|
|
176
|
+
bottom?: number;
|
|
177
|
+
left?: number;
|
|
178
|
+
right?: number;
|
|
179
|
+
}): LayoutFn;
|
|
152
180
|
|
|
153
181
|
type Column<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
154
182
|
key: keyof T & string;
|
|
@@ -159,6 +187,7 @@ type Column<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
|
159
187
|
headerBold?: boolean;
|
|
160
188
|
color?: string | ((value: unknown, row: T) => string | undefined);
|
|
161
189
|
dim?: boolean | ((value: unknown, row: T) => boolean);
|
|
190
|
+
onClick?: (value: unknown, row: T) => void;
|
|
162
191
|
};
|
|
163
192
|
declare function table<T extends Record<string, unknown>>(columns: Column<T>[], data: T[], opts?: {
|
|
164
193
|
borderColor?: string;
|
|
@@ -187,6 +216,37 @@ declare function badge(label: string, opts?: {
|
|
|
187
216
|
onClick?: () => void;
|
|
188
217
|
theme?: Theme;
|
|
189
218
|
}): Segment;
|
|
219
|
+
type KVPair = {
|
|
220
|
+
key: string;
|
|
221
|
+
value: string | Segment[];
|
|
222
|
+
keyColor?: string;
|
|
223
|
+
valueColor?: string;
|
|
224
|
+
onClick?: () => void;
|
|
225
|
+
};
|
|
226
|
+
declare function kv(pairs: KVPair[], opts?: {
|
|
227
|
+
separator?: string;
|
|
228
|
+
keyColor?: string;
|
|
229
|
+
valueColor?: string;
|
|
230
|
+
keyWidth?: number;
|
|
231
|
+
}): LayoutFn;
|
|
232
|
+
declare function callout(content: LayoutFn | string, opts?: {
|
|
233
|
+
color?: string;
|
|
234
|
+
accent?: string;
|
|
235
|
+
label?: string;
|
|
236
|
+
}): LayoutFn;
|
|
237
|
+
declare function checkbox(checked: boolean, label: string, opts?: {
|
|
238
|
+
color?: string;
|
|
239
|
+
checkColor?: string;
|
|
240
|
+
onClick?: () => void;
|
|
241
|
+
}): LayoutFn;
|
|
242
|
+
declare function inputField(value: string, opts?: {
|
|
243
|
+
placeholder?: string;
|
|
244
|
+
width?: number;
|
|
245
|
+
focused?: boolean;
|
|
246
|
+
color?: string;
|
|
247
|
+
borderColor?: string;
|
|
248
|
+
onClick?: () => void;
|
|
249
|
+
}): LayoutFn;
|
|
190
250
|
|
|
191
251
|
type JsonNode = {
|
|
192
252
|
type: "vstack";
|
|
@@ -243,6 +303,7 @@ declare function fromJsonNode(node: JsonNode): LayoutFn;
|
|
|
243
303
|
|
|
244
304
|
type TreeNode = {
|
|
245
305
|
label: string;
|
|
306
|
+
onClick?: () => void;
|
|
246
307
|
children?: TreeNode[];
|
|
247
308
|
};
|
|
248
309
|
declare function tree(data: TreeNode[], opts?: {
|
|
@@ -250,7 +311,12 @@ declare function tree(data: TreeNode[], opts?: {
|
|
|
250
311
|
branchColor?: string;
|
|
251
312
|
leafColor?: string;
|
|
252
313
|
}): LayoutFn;
|
|
253
|
-
|
|
314
|
+
type ListItem = string | {
|
|
315
|
+
text: string;
|
|
316
|
+
color?: string;
|
|
317
|
+
onClick?: () => void;
|
|
318
|
+
};
|
|
319
|
+
declare function list(items: ListItem[], opts?: {
|
|
254
320
|
ordered?: boolean;
|
|
255
321
|
bulletColor?: string;
|
|
256
322
|
color?: string;
|
|
@@ -272,11 +338,12 @@ declare function code(source: string, opts?: {
|
|
|
272
338
|
copyable?: boolean;
|
|
273
339
|
action?: BoxAction;
|
|
274
340
|
}): LayoutFn;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
341
|
+
|
|
342
|
+
declare function chart(data: number[], opts?: {
|
|
343
|
+
height?: number;
|
|
344
|
+
color?: string;
|
|
345
|
+
axisColor?: string;
|
|
346
|
+
fill?: boolean;
|
|
280
347
|
}): LayoutFn;
|
|
281
348
|
|
|
282
349
|
type DocumentSource = {
|
|
@@ -291,12 +358,173 @@ type DocumentSource = {
|
|
|
291
358
|
};
|
|
292
359
|
type MarkdownThemeOverrides = Partial<ThemeMarkdown>;
|
|
293
360
|
|
|
294
|
-
|
|
361
|
+
type TermAction = {
|
|
362
|
+
type: "action";
|
|
363
|
+
id?: string;
|
|
364
|
+
text: string;
|
|
365
|
+
tag: string;
|
|
366
|
+
dataset: Record<string, string>;
|
|
367
|
+
sourceElement?: Element;
|
|
368
|
+
} | {
|
|
369
|
+
type: "link";
|
|
370
|
+
href?: string;
|
|
371
|
+
text: string;
|
|
372
|
+
tag: string;
|
|
373
|
+
dataset: Record<string, string>;
|
|
374
|
+
sourceElement?: Element;
|
|
375
|
+
};
|
|
376
|
+
type TermIRNode = {
|
|
377
|
+
kind: "stack";
|
|
378
|
+
gap: number;
|
|
379
|
+
children: TermIRNode[];
|
|
380
|
+
} | {
|
|
381
|
+
kind: "hstack";
|
|
382
|
+
gap: number;
|
|
383
|
+
widths?: number[];
|
|
384
|
+
children: TermIRNode[];
|
|
385
|
+
} | {
|
|
386
|
+
kind: "grid";
|
|
387
|
+
cols: number;
|
|
388
|
+
gap: number;
|
|
389
|
+
rowGap: number;
|
|
390
|
+
children: TermIRNode[];
|
|
391
|
+
} | {
|
|
392
|
+
kind: "box";
|
|
393
|
+
title?: string;
|
|
394
|
+
borderColor?: string;
|
|
395
|
+
gap: number;
|
|
396
|
+
children: TermIRNode[];
|
|
397
|
+
} | {
|
|
398
|
+
kind: "blank";
|
|
399
|
+
lines: number;
|
|
400
|
+
} | {
|
|
401
|
+
kind: "separator";
|
|
402
|
+
color?: string;
|
|
403
|
+
char?: string;
|
|
404
|
+
} | {
|
|
405
|
+
kind: "divider";
|
|
406
|
+
label: string;
|
|
407
|
+
color?: string;
|
|
408
|
+
char?: string;
|
|
409
|
+
labelColor?: string;
|
|
410
|
+
} | {
|
|
411
|
+
kind: "paragraph";
|
|
412
|
+
text: string;
|
|
413
|
+
color?: string;
|
|
414
|
+
} | {
|
|
415
|
+
kind: "heading";
|
|
416
|
+
level: number;
|
|
417
|
+
text: string;
|
|
418
|
+
markerColor?: string;
|
|
419
|
+
} | {
|
|
420
|
+
kind: "list";
|
|
421
|
+
ordered: boolean;
|
|
422
|
+
start: number;
|
|
423
|
+
items: string[];
|
|
424
|
+
} | {
|
|
425
|
+
kind: "blockquote";
|
|
426
|
+
text: string;
|
|
427
|
+
markerColor?: string;
|
|
428
|
+
color?: string;
|
|
429
|
+
} | {
|
|
430
|
+
kind: "pre";
|
|
431
|
+
lines: string[];
|
|
432
|
+
language?: string;
|
|
433
|
+
textColor?: string;
|
|
434
|
+
borderColor?: string;
|
|
435
|
+
emptyColor?: string;
|
|
436
|
+
} | {
|
|
437
|
+
kind: "markdown";
|
|
438
|
+
value: string;
|
|
439
|
+
} | {
|
|
440
|
+
kind: "json";
|
|
441
|
+
value: unknown;
|
|
442
|
+
title?: string;
|
|
443
|
+
} | {
|
|
444
|
+
kind: "chart";
|
|
445
|
+
data: number[];
|
|
446
|
+
height?: number;
|
|
447
|
+
color?: string;
|
|
448
|
+
axisColor?: string;
|
|
449
|
+
fill?: boolean;
|
|
450
|
+
} | {
|
|
451
|
+
kind: "statusbar";
|
|
452
|
+
left: string;
|
|
453
|
+
right: string;
|
|
454
|
+
bg?: string;
|
|
455
|
+
color?: string;
|
|
456
|
+
} | {
|
|
457
|
+
kind: "bar";
|
|
458
|
+
label?: string;
|
|
459
|
+
value: number;
|
|
460
|
+
max: number;
|
|
461
|
+
width?: number;
|
|
462
|
+
color?: string;
|
|
463
|
+
showPercent?: boolean;
|
|
464
|
+
} | {
|
|
465
|
+
kind: "table";
|
|
466
|
+
headers: string[];
|
|
467
|
+
rows: string[][];
|
|
468
|
+
headerColor?: string;
|
|
469
|
+
borderColor?: string;
|
|
470
|
+
} | {
|
|
471
|
+
kind: "button";
|
|
472
|
+
label: string;
|
|
473
|
+
color?: string;
|
|
474
|
+
bg?: string;
|
|
475
|
+
action: TermAction;
|
|
476
|
+
} | {
|
|
477
|
+
kind: "link";
|
|
478
|
+
text: string;
|
|
479
|
+
color?: string;
|
|
480
|
+
action: TermAction;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
type ActionSeed = {
|
|
484
|
+
type: "action";
|
|
485
|
+
id?: string;
|
|
486
|
+
text: string;
|
|
487
|
+
} | {
|
|
488
|
+
type: "link";
|
|
489
|
+
href?: string;
|
|
490
|
+
text: string;
|
|
491
|
+
};
|
|
492
|
+
type HtmlTagCompiler = (el: Element, ctx: HtmlCompileContext) => TermIRNode | null;
|
|
493
|
+
type HtmlCompileContext = {
|
|
494
|
+
theme: Theme;
|
|
495
|
+
overrides?: MarkdownThemeOverrides;
|
|
496
|
+
compileChildren: (el: Element) => TermIRNode[];
|
|
497
|
+
compileNode: (node: ChildNode) => TermIRNode | null;
|
|
498
|
+
actionFromElement: (el: Element, seed: ActionSeed) => TermAction;
|
|
499
|
+
};
|
|
500
|
+
type CompileHtmlToIROptions = {
|
|
501
|
+
theme: Theme;
|
|
502
|
+
overrides?: MarkdownThemeOverrides;
|
|
503
|
+
containerGap?: number;
|
|
504
|
+
};
|
|
505
|
+
declare function registerHtmlTagCompiler(tag: string, compiler: HtmlTagCompiler): void;
|
|
506
|
+
declare function compileHtmlElementToIR(root: Element, options: CompileHtmlToIROptions): TermIRNode;
|
|
507
|
+
declare function compileHtmlToIR(html: string, options: CompileHtmlToIROptions): TermIRNode;
|
|
508
|
+
|
|
509
|
+
type LayoutFromIROptions = {
|
|
510
|
+
theme: Theme;
|
|
511
|
+
overrides?: MarkdownThemeOverrides;
|
|
512
|
+
onAction?: (action: TermAction) => void;
|
|
513
|
+
};
|
|
514
|
+
declare function layoutFromIR(node: TermIRNode, options: LayoutFromIROptions): LayoutFn;
|
|
515
|
+
|
|
516
|
+
type HtmlAction = TermAction;
|
|
517
|
+
type HtmlRenderOptions = {
|
|
295
518
|
theme?: Theme;
|
|
296
519
|
overrides?: MarkdownThemeOverrides;
|
|
297
|
-
|
|
520
|
+
onAction?: (action: HtmlAction) => void;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
declare function registerHtmlCompiler(tag: string, compiler: HtmlTagCompiler): void;
|
|
524
|
+
declare function fromHtmlElement(root: Element, opts?: HtmlRenderOptions): LayoutFn;
|
|
525
|
+
declare function fromHtml(html: string, opts?: HtmlRenderOptions): LayoutFn;
|
|
298
526
|
|
|
299
|
-
declare function
|
|
527
|
+
declare function fromMarkdown(markdown: string, opts?: {
|
|
300
528
|
theme?: Theme;
|
|
301
529
|
overrides?: MarkdownThemeOverrides;
|
|
302
530
|
}): LayoutFn;
|
|
@@ -348,306 +576,32 @@ declare function themeToCssVars(theme: Theme): Record<string, string>;
|
|
|
348
576
|
declare function parseThemeSpec(json: string): ThemeValidationResult;
|
|
349
577
|
declare function validateThemeSpec(value: unknown): ThemeValidationResult;
|
|
350
578
|
|
|
351
|
-
type
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
type TermDocumentProps = {
|
|
379
|
-
source: DocumentSource;
|
|
380
|
-
width?: number;
|
|
381
|
-
theme?: Theme;
|
|
382
|
-
themeSpec?: ThemeSpec;
|
|
383
|
-
mode?: ThemePreference;
|
|
384
|
-
jsonTitle?: string;
|
|
385
|
-
markdownOverrides?: MarkdownThemeOverrides;
|
|
386
|
-
className?: string;
|
|
387
|
-
style?: CSSProperties;
|
|
388
|
-
};
|
|
389
|
-
declare function TermUIBase({ block, children, width, theme, themeSpec, mode, markdownOverrides, className, style, }: TermUIProps): react_jsx_runtime.JSX.Element;
|
|
390
|
-
declare const TermUI: react.MemoExoticComponent<typeof TermUIBase>;
|
|
391
|
-
|
|
392
|
-
declare function TermDocument({ source, width, theme, themeSpec, mode, jsonTitle, markdownOverrides, className, style, }: TermDocumentProps): react_jsx_runtime.JSX.Element;
|
|
393
|
-
|
|
394
|
-
type BaseProps = {
|
|
395
|
-
children?: ReactNode;
|
|
396
|
-
};
|
|
397
|
-
type TVStackProps = BaseProps & {
|
|
398
|
-
gap?: number;
|
|
399
|
-
};
|
|
400
|
-
type THStackProps = BaseProps & {
|
|
401
|
-
gap?: number;
|
|
402
|
-
widths?: number[];
|
|
403
|
-
};
|
|
404
|
-
type TBoxProps = BaseProps & {
|
|
405
|
-
title?: string;
|
|
406
|
-
borderColor?: string;
|
|
407
|
-
gap?: number;
|
|
408
|
-
action?: BoxAction;
|
|
409
|
-
};
|
|
410
|
-
type TSeparatorProps = {
|
|
411
|
-
color?: string;
|
|
412
|
-
};
|
|
413
|
-
type TRawProps = {
|
|
414
|
-
text?: string;
|
|
415
|
-
color?: string;
|
|
416
|
-
bg?: string;
|
|
417
|
-
bold?: boolean;
|
|
418
|
-
dim?: boolean;
|
|
419
|
-
blink?: boolean;
|
|
420
|
-
inverted?: boolean;
|
|
421
|
-
onClick?: () => void;
|
|
422
|
-
children?: ReactNode;
|
|
423
|
-
};
|
|
424
|
-
type TTableProps<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
425
|
-
columns: Column<T>[];
|
|
426
|
-
data: T[];
|
|
427
|
-
borderColor?: string;
|
|
428
|
-
fillWidth?: boolean;
|
|
429
|
-
headerColor?: string;
|
|
430
|
-
cellPadding?: number;
|
|
431
|
-
};
|
|
432
|
-
type TTabProps = {
|
|
433
|
-
name: string;
|
|
434
|
-
children?: ReactNode;
|
|
435
|
-
};
|
|
436
|
-
type TTabsProps = {
|
|
437
|
-
active: number;
|
|
438
|
-
activeColor?: string;
|
|
439
|
-
activeBg?: string;
|
|
440
|
-
inactiveColor?: string;
|
|
441
|
-
separatorColor?: string;
|
|
442
|
-
onSelect?: (index: number) => void;
|
|
443
|
-
children?: ReactNode;
|
|
444
|
-
};
|
|
445
|
-
type TStatusbarProps = {
|
|
446
|
-
left: string | Segment[];
|
|
447
|
-
right: string | Segment[];
|
|
448
|
-
bg?: string;
|
|
449
|
-
color?: string;
|
|
450
|
-
};
|
|
451
|
-
type TMarkdownProps = {
|
|
452
|
-
value: string;
|
|
453
|
-
themeOverrides?: MarkdownThemeOverrides;
|
|
454
|
-
};
|
|
455
|
-
type TJsonProps = {
|
|
456
|
-
value: unknown;
|
|
457
|
-
title?: string;
|
|
458
|
-
};
|
|
459
|
-
type THtmlProps = {
|
|
460
|
-
value: string;
|
|
461
|
-
themeOverrides?: MarkdownThemeOverrides;
|
|
462
|
-
};
|
|
463
|
-
type TLineProps = {
|
|
464
|
-
children?: ReactNode;
|
|
465
|
-
};
|
|
466
|
-
type TSpanProps = {
|
|
467
|
-
text?: string;
|
|
468
|
-
children?: ReactNode;
|
|
469
|
-
color?: string;
|
|
470
|
-
bg?: string;
|
|
471
|
-
bold?: boolean;
|
|
472
|
-
dim?: boolean;
|
|
473
|
-
inverted?: boolean;
|
|
474
|
-
blink?: boolean;
|
|
475
|
-
};
|
|
476
|
-
type TLayoutProps = {
|
|
477
|
-
layout: LayoutFn;
|
|
478
|
-
};
|
|
479
|
-
type TTreeProps = {
|
|
480
|
-
data: TreeNode[];
|
|
481
|
-
color?: string;
|
|
482
|
-
branchColor?: string;
|
|
483
|
-
leafColor?: string;
|
|
484
|
-
};
|
|
485
|
-
type TCodeProps = {
|
|
486
|
-
code: string;
|
|
487
|
-
language?: string;
|
|
488
|
-
title?: string;
|
|
489
|
-
borderColor?: string;
|
|
490
|
-
action?: BoxAction;
|
|
491
|
-
copyable?: boolean;
|
|
492
|
-
};
|
|
493
|
-
type TDiffProps = {
|
|
494
|
-
value: string;
|
|
495
|
-
addColor?: string;
|
|
496
|
-
removeColor?: string;
|
|
497
|
-
metaColor?: string;
|
|
498
|
-
};
|
|
499
|
-
type TBarProps = {
|
|
500
|
-
label: string;
|
|
501
|
-
value: number;
|
|
502
|
-
max?: number;
|
|
503
|
-
color?: string;
|
|
504
|
-
};
|
|
505
|
-
type TSparkProps = {
|
|
506
|
-
data: number[];
|
|
507
|
-
color?: string;
|
|
508
|
-
};
|
|
509
|
-
type TListProps = {
|
|
510
|
-
items: string[];
|
|
511
|
-
ordered?: boolean;
|
|
512
|
-
bulletColor?: string;
|
|
513
|
-
color?: string;
|
|
514
|
-
};
|
|
515
|
-
type TButtonProps = {
|
|
516
|
-
label: string;
|
|
517
|
-
onClick?: () => void;
|
|
518
|
-
color?: string;
|
|
519
|
-
bg?: string;
|
|
520
|
-
};
|
|
521
|
-
type RenderTermOptions = {
|
|
522
|
-
theme?: Theme;
|
|
523
|
-
themeSpec?: ThemeSpec;
|
|
524
|
-
mode?: ThemePreference;
|
|
525
|
-
markdownOverrides?: MarkdownThemeOverrides;
|
|
526
|
-
};
|
|
527
|
-
declare function TVStack({ children, gap }: TVStackProps): react.ReactElement<{
|
|
528
|
-
gap: number | undefined;
|
|
529
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
530
|
-
declare function THStack({ children, gap, widths }: THStackProps): react.ReactElement<{
|
|
531
|
-
gap: number | undefined;
|
|
532
|
-
widths: number[] | undefined;
|
|
533
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
534
|
-
declare function TBox({ children, title, borderColor, gap, action }: TBoxProps): react.ReactElement<{
|
|
535
|
-
title: string | undefined;
|
|
536
|
-
borderColor: string | undefined;
|
|
537
|
-
gap: number | undefined;
|
|
538
|
-
action: BoxAction | undefined;
|
|
539
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
540
|
-
declare function TSeparator({ color }: TSeparatorProps): react.ReactElement<{
|
|
541
|
-
color: string | undefined;
|
|
542
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
543
|
-
declare function TBlank(): react.DOMElement<{}, Element>;
|
|
544
|
-
declare function TRaw({ children, text, color, bg, bold, dim, blink, inverted, onClick }: TRawProps): react.DOMElement<{
|
|
545
|
-
text: string | undefined;
|
|
546
|
-
color: string | undefined;
|
|
547
|
-
bg: string | undefined;
|
|
548
|
-
bold: boolean | undefined;
|
|
549
|
-
dim: boolean | undefined;
|
|
550
|
-
blink: boolean | undefined;
|
|
551
|
-
inverted: boolean | undefined;
|
|
552
|
-
onClick: (() => void) | undefined;
|
|
553
|
-
}, Element>;
|
|
554
|
-
declare function TTable<T extends Record<string, unknown>>({ columns, data, borderColor, fillWidth, headerColor, cellPadding, }: TTableProps<T>): react.ReactElement<{
|
|
555
|
-
columns: Column<T>[];
|
|
556
|
-
data: T[];
|
|
557
|
-
borderColor: string | undefined;
|
|
558
|
-
fillWidth: boolean | undefined;
|
|
559
|
-
headerColor: string | undefined;
|
|
560
|
-
cellPadding: number | undefined;
|
|
561
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
562
|
-
declare function TTab({ name, children }: TTabProps): react.ReactElement<{
|
|
563
|
-
name: string;
|
|
564
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
565
|
-
declare function TTabs({ children, active, activeColor, activeBg, inactiveColor, separatorColor, onSelect, }: TTabsProps): react.ReactElement<{
|
|
566
|
-
active: number;
|
|
567
|
-
activeColor: string | undefined;
|
|
568
|
-
activeBg: string | undefined;
|
|
569
|
-
inactiveColor: string | undefined;
|
|
570
|
-
separatorColor: string | undefined;
|
|
571
|
-
onSelect: ((index: number) => void) | undefined;
|
|
572
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
573
|
-
declare function TStatusbar({ left, right, bg, color }: TStatusbarProps): react.ReactElement<{
|
|
574
|
-
left: string | Segment[];
|
|
575
|
-
right: string | Segment[];
|
|
576
|
-
bg: string | undefined;
|
|
577
|
-
color: string | undefined;
|
|
578
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
579
|
-
declare function TMarkdown({ value, themeOverrides }: TMarkdownProps): react.ReactElement<{
|
|
580
|
-
value: string;
|
|
581
|
-
themeOverrides: Partial<ThemeMarkdown> | undefined;
|
|
582
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
583
|
-
declare function TJson({ value, title }: TJsonProps): react.ReactElement<{
|
|
584
|
-
value: unknown;
|
|
585
|
-
title: string | undefined;
|
|
586
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
587
|
-
declare function THtml({ value, themeOverrides }: THtmlProps): react.ReactElement<{
|
|
588
|
-
value: string;
|
|
589
|
-
themeOverrides: Partial<ThemeMarkdown> | undefined;
|
|
590
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
591
|
-
declare function TLine({ children }: TLineProps): react.DOMElement<{}, Element>;
|
|
592
|
-
declare function TSpan({ children, text, color, bg, bold, dim, inverted, blink }: TSpanProps): react.ReactElement<{
|
|
593
|
-
text: string | undefined;
|
|
594
|
-
color: string | undefined;
|
|
595
|
-
bg: string | undefined;
|
|
596
|
-
bold: boolean | undefined;
|
|
597
|
-
dim: boolean | undefined;
|
|
598
|
-
inverted: boolean | undefined;
|
|
599
|
-
blink: boolean | undefined;
|
|
600
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
601
|
-
declare function TLayout({ layout }: TLayoutProps): react.ReactElement<{
|
|
602
|
-
layout: LayoutFn;
|
|
603
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
604
|
-
declare function TTree({ data, color, branchColor, leafColor }: TTreeProps): react.ReactElement<{
|
|
605
|
-
data: TreeNode[];
|
|
606
|
-
color: string | undefined;
|
|
607
|
-
branchColor: string | undefined;
|
|
608
|
-
leafColor: string | undefined;
|
|
609
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
610
|
-
declare function TCode({ code, language, title, borderColor, action, copyable }: TCodeProps): react.ReactElement<{
|
|
611
|
-
code: string;
|
|
612
|
-
language: string | undefined;
|
|
613
|
-
title: string | undefined;
|
|
614
|
-
borderColor: string | undefined;
|
|
615
|
-
action: BoxAction | undefined;
|
|
616
|
-
copyable: boolean | undefined;
|
|
617
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
618
|
-
declare function TDiff({ value, addColor, removeColor, metaColor }: TDiffProps): react.ReactElement<{
|
|
619
|
-
value: string;
|
|
620
|
-
addColor: string | undefined;
|
|
621
|
-
removeColor: string | undefined;
|
|
622
|
-
metaColor: string | undefined;
|
|
623
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
624
|
-
declare function TBar({ label, value, max, color }: TBarProps): react.ReactElement<{
|
|
625
|
-
label: string;
|
|
626
|
-
value: number;
|
|
627
|
-
max: number | undefined;
|
|
628
|
-
color: string | undefined;
|
|
629
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
630
|
-
declare function TSpark({ data, color }: TSparkProps): react.ReactElement<{
|
|
631
|
-
data: number[];
|
|
632
|
-
color: string | undefined;
|
|
633
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
634
|
-
declare function TList({ items, ordered, bulletColor, color }: TListProps): react.ReactElement<{
|
|
635
|
-
items: string[];
|
|
636
|
-
ordered: boolean | undefined;
|
|
637
|
-
bulletColor: string | undefined;
|
|
638
|
-
color: string | undefined;
|
|
639
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
640
|
-
declare function TButton({ label, onClick, color, bg }: TButtonProps): react.DOMElement<{
|
|
641
|
-
label: string;
|
|
642
|
-
onClick: (() => void) | undefined;
|
|
643
|
-
color: string | undefined;
|
|
644
|
-
bg: string | undefined;
|
|
645
|
-
}, Element>;
|
|
646
|
-
declare function renderTermReact(tree: ReactNode, opts?: RenderTermOptions): LayoutFn;
|
|
647
|
-
|
|
648
|
-
declare function useSpinner(ms?: number): string;
|
|
649
|
-
declare function useTick(ms?: number): number;
|
|
650
|
-
declare function useTermWidth(ref: RefObject<HTMLElement | null>, fallback?: number): number;
|
|
651
|
-
declare function useStreamingText(text: string, lerp?: number): string;
|
|
579
|
+
type TermUIActionEvent = CustomEvent<HtmlAction>;
|
|
580
|
+
declare class TermUIElement extends HTMLElement {
|
|
581
|
+
static observedAttributes: readonly ["width", "mode", "source", "source-format", "json-title"];
|
|
582
|
+
private readonly frame;
|
|
583
|
+
private readonly root;
|
|
584
|
+
private layoutOverride?;
|
|
585
|
+
private resizeObserver?;
|
|
586
|
+
private mutationObserver?;
|
|
587
|
+
private mediaQuery?;
|
|
588
|
+
private mediaQueryListener?;
|
|
589
|
+
private scheduled;
|
|
590
|
+
constructor();
|
|
591
|
+
connectedCallback(): void;
|
|
592
|
+
disconnectedCallback(): void;
|
|
593
|
+
attributeChangedCallback(): void;
|
|
594
|
+
render(): void;
|
|
595
|
+
get layout(): LayoutFn | undefined;
|
|
596
|
+
set layout(next: LayoutFn | null | undefined);
|
|
597
|
+
private queueRender;
|
|
598
|
+
private onAction;
|
|
599
|
+
private measureCharacterWidth;
|
|
600
|
+
private resolveColumns;
|
|
601
|
+
private resolveTheme;
|
|
602
|
+
private renderNow;
|
|
603
|
+
}
|
|
604
|
+
declare const TERM_UI_TAG = "term-ui";
|
|
605
|
+
declare function registerTermUIElement(tagName?: string): void;
|
|
652
606
|
|
|
653
|
-
export { type Block, type BoxAction, type Column, type
|
|
607
|
+
export { type Block, type BoxAction, type Column, type CompileHtmlToIROptions, type DocumentSource, type HtmlAction, type HtmlCompileContext, type HtmlRenderOptions, type HtmlTagCompiler, type JsonNode, type KVPair, type LayoutFn, type LayoutFromIROptions, type Line, type ListItem, type MarkdownThemeOverrides, type ScrollRegionMeta, type Segment, type Style, TERM_UI_TAG, type TermAction, type TermIRNode, type TermUIActionEvent, TermUIElement, type Theme, type ThemeComponents, type ThemeMarkdown, type ThemeMode, type ThemeModeTokens, type ThemePalette, type ThemePreference, type ThemeSemantic, type ThemeSpec, type ThemeSyntax, type ThemeValidationIssue, type ThemeValidationResult, type Token, type TokenType, type TreeNode, badge, bar, blank, box, builtinThemes, callout, chart, checkbox, code, compileHtmlElementToIR, compileHtmlToIR, dark, defaultThemeSpec, divider, fromDocument, fromHtml, fromHtmlElement, fromJson, fromJsonNode, fromMarkdown, grid, hl, hstack, inputField, isTableLine, kv, layoutFromIR, light, lines, list, pad, padLine, padding, parseThemeSpec, preserveTableTag, registerHtmlCompiler, registerHtmlTagCompiler, registerTermUIElement, resolveTheme, resolveThemeMode, scroll, separator, spark, statusbar, table, tabs, themeToCssVars, tokenColor, tokenize, tree, truncate, validateThemeSpec, vstack };
|