1ch 0.3.0 → 0.5.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 +199 -489
- package/dist/index.js +1619 -1985
- package/dist/index.js.map +1 -1
- package/package.json +4 -17
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;
|
|
@@ -10,6 +6,7 @@ type Style = {
|
|
|
10
6
|
dim?: boolean;
|
|
11
7
|
inverted?: boolean;
|
|
12
8
|
blink?: boolean;
|
|
9
|
+
interactionId?: string;
|
|
13
10
|
onClick?: () => void;
|
|
14
11
|
noSelect?: boolean;
|
|
15
12
|
cell?: number;
|
|
@@ -212,6 +209,7 @@ declare function tabs(names: string[], active: number, opts?: {
|
|
|
212
209
|
separatorColor?: string;
|
|
213
210
|
onSelect?: (index: number) => void;
|
|
214
211
|
onClicks?: ((() => void) | undefined)[];
|
|
212
|
+
interactionIds?: (string | undefined)[];
|
|
215
213
|
theme?: Theme;
|
|
216
214
|
}): LayoutFn;
|
|
217
215
|
declare function badge(label: string, opts?: {
|
|
@@ -342,19 +340,6 @@ declare function code(source: string, opts?: {
|
|
|
342
340
|
copyable?: boolean;
|
|
343
341
|
action?: BoxAction;
|
|
344
342
|
}): LayoutFn;
|
|
345
|
-
declare function unifiedDiff(value: string, opts?: {
|
|
346
|
-
addColor?: string;
|
|
347
|
-
removeColor?: string;
|
|
348
|
-
metaColor?: string;
|
|
349
|
-
theme?: Theme;
|
|
350
|
-
}): LayoutFn;
|
|
351
|
-
declare function computeDiff(before: string, after: string, opts?: {
|
|
352
|
-
context?: number;
|
|
353
|
-
addColor?: string;
|
|
354
|
-
removeColor?: string;
|
|
355
|
-
metaColor?: string;
|
|
356
|
-
theme?: Theme;
|
|
357
|
-
}): LayoutFn;
|
|
358
343
|
|
|
359
344
|
declare function chart(data: number[], opts?: {
|
|
360
345
|
height?: number;
|
|
@@ -375,12 +360,175 @@ type DocumentSource = {
|
|
|
375
360
|
};
|
|
376
361
|
type MarkdownThemeOverrides = Partial<ThemeMarkdown>;
|
|
377
362
|
|
|
378
|
-
|
|
363
|
+
type TermAction = {
|
|
364
|
+
type: "action";
|
|
365
|
+
key: string;
|
|
366
|
+
id?: string;
|
|
367
|
+
text: string;
|
|
368
|
+
tag: string;
|
|
369
|
+
dataset: Record<string, string>;
|
|
370
|
+
sourceElement?: Element;
|
|
371
|
+
} | {
|
|
372
|
+
type: "link";
|
|
373
|
+
key: string;
|
|
374
|
+
href?: string;
|
|
375
|
+
text: string;
|
|
376
|
+
tag: string;
|
|
377
|
+
dataset: Record<string, string>;
|
|
378
|
+
sourceElement?: Element;
|
|
379
|
+
};
|
|
380
|
+
type TermIRNode = {
|
|
381
|
+
kind: "stack";
|
|
382
|
+
gap: number;
|
|
383
|
+
children: TermIRNode[];
|
|
384
|
+
} | {
|
|
385
|
+
kind: "hstack";
|
|
386
|
+
gap: number;
|
|
387
|
+
widths?: number[];
|
|
388
|
+
children: TermIRNode[];
|
|
389
|
+
} | {
|
|
390
|
+
kind: "grid";
|
|
391
|
+
cols: number;
|
|
392
|
+
gap: number;
|
|
393
|
+
rowGap: number;
|
|
394
|
+
children: TermIRNode[];
|
|
395
|
+
} | {
|
|
396
|
+
kind: "box";
|
|
397
|
+
title?: string;
|
|
398
|
+
borderColor?: string;
|
|
399
|
+
gap: number;
|
|
400
|
+
children: TermIRNode[];
|
|
401
|
+
} | {
|
|
402
|
+
kind: "blank";
|
|
403
|
+
lines: number;
|
|
404
|
+
} | {
|
|
405
|
+
kind: "separator";
|
|
406
|
+
color?: string;
|
|
407
|
+
char?: string;
|
|
408
|
+
} | {
|
|
409
|
+
kind: "divider";
|
|
410
|
+
label: string;
|
|
411
|
+
color?: string;
|
|
412
|
+
char?: string;
|
|
413
|
+
labelColor?: string;
|
|
414
|
+
} | {
|
|
415
|
+
kind: "paragraph";
|
|
416
|
+
text: string;
|
|
417
|
+
color?: string;
|
|
418
|
+
} | {
|
|
419
|
+
kind: "heading";
|
|
420
|
+
level: number;
|
|
421
|
+
text: string;
|
|
422
|
+
markerColor?: string;
|
|
423
|
+
} | {
|
|
424
|
+
kind: "list";
|
|
425
|
+
ordered: boolean;
|
|
426
|
+
start: number;
|
|
427
|
+
items: string[];
|
|
428
|
+
} | {
|
|
429
|
+
kind: "blockquote";
|
|
430
|
+
text: string;
|
|
431
|
+
markerColor?: string;
|
|
432
|
+
color?: string;
|
|
433
|
+
} | {
|
|
434
|
+
kind: "pre";
|
|
435
|
+
lines: string[];
|
|
436
|
+
language?: string;
|
|
437
|
+
textColor?: string;
|
|
438
|
+
borderColor?: string;
|
|
439
|
+
emptyColor?: string;
|
|
440
|
+
} | {
|
|
441
|
+
kind: "markdown";
|
|
442
|
+
value: string;
|
|
443
|
+
} | {
|
|
444
|
+
kind: "json";
|
|
445
|
+
value: unknown;
|
|
446
|
+
title?: string;
|
|
447
|
+
} | {
|
|
448
|
+
kind: "chart";
|
|
449
|
+
data: number[];
|
|
450
|
+
height?: number;
|
|
451
|
+
color?: string;
|
|
452
|
+
axisColor?: string;
|
|
453
|
+
fill?: boolean;
|
|
454
|
+
} | {
|
|
455
|
+
kind: "statusbar";
|
|
456
|
+
left: string;
|
|
457
|
+
right: string;
|
|
458
|
+
bg?: string;
|
|
459
|
+
color?: string;
|
|
460
|
+
} | {
|
|
461
|
+
kind: "bar";
|
|
462
|
+
label?: string;
|
|
463
|
+
value: number;
|
|
464
|
+
max: number;
|
|
465
|
+
width?: number;
|
|
466
|
+
color?: string;
|
|
467
|
+
showPercent?: boolean;
|
|
468
|
+
} | {
|
|
469
|
+
kind: "table";
|
|
470
|
+
headers: string[];
|
|
471
|
+
rows: string[][];
|
|
472
|
+
headerColor?: string;
|
|
473
|
+
borderColor?: string;
|
|
474
|
+
} | {
|
|
475
|
+
kind: "button";
|
|
476
|
+
label: string;
|
|
477
|
+
color?: string;
|
|
478
|
+
bg?: string;
|
|
479
|
+
action: TermAction;
|
|
480
|
+
} | {
|
|
481
|
+
kind: "link";
|
|
482
|
+
text: string;
|
|
483
|
+
color?: string;
|
|
484
|
+
action: TermAction;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
type ActionSeed = {
|
|
488
|
+
type: "action";
|
|
489
|
+
id?: string;
|
|
490
|
+
text: string;
|
|
491
|
+
} | {
|
|
492
|
+
type: "link";
|
|
493
|
+
href?: string;
|
|
494
|
+
text: string;
|
|
495
|
+
};
|
|
496
|
+
type HtmlTagCompiler = (el: Element, ctx: HtmlCompileContext) => TermIRNode | null;
|
|
497
|
+
type HtmlCompileContext = {
|
|
498
|
+
theme: Theme;
|
|
499
|
+
overrides?: MarkdownThemeOverrides;
|
|
500
|
+
compileChildren: (el: Element) => TermIRNode[];
|
|
501
|
+
compileNode: (node: ChildNode) => TermIRNode | null;
|
|
502
|
+
actionFromElement: (el: Element, seed: ActionSeed) => TermAction;
|
|
503
|
+
};
|
|
504
|
+
type CompileHtmlToIROptions = {
|
|
505
|
+
theme: Theme;
|
|
506
|
+
overrides?: MarkdownThemeOverrides;
|
|
507
|
+
containerGap?: number;
|
|
508
|
+
};
|
|
509
|
+
declare function registerHtmlTagCompiler(tag: string, compiler: HtmlTagCompiler): void;
|
|
510
|
+
declare function compileHtmlElementToIR(root: Element, options: CompileHtmlToIROptions): TermIRNode;
|
|
511
|
+
declare function compileHtmlToIR(html: string, options: CompileHtmlToIROptions): TermIRNode;
|
|
512
|
+
|
|
513
|
+
type LayoutFromIROptions = {
|
|
514
|
+
theme: Theme;
|
|
515
|
+
overrides?: MarkdownThemeOverrides;
|
|
516
|
+
onAction?: (action: TermAction) => void;
|
|
517
|
+
};
|
|
518
|
+
declare function layoutFromIR(node: TermIRNode, options: LayoutFromIROptions): LayoutFn;
|
|
519
|
+
|
|
520
|
+
type HtmlAction = TermAction;
|
|
521
|
+
type HtmlRenderOptions = {
|
|
379
522
|
theme?: Theme;
|
|
380
523
|
overrides?: MarkdownThemeOverrides;
|
|
381
|
-
|
|
524
|
+
onAction?: (action: HtmlAction) => void;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
declare function registerHtmlCompiler(tag: string, compiler: HtmlTagCompiler): void;
|
|
528
|
+
declare function fromHtmlElement(root: Element, opts?: HtmlRenderOptions): LayoutFn;
|
|
529
|
+
declare function fromHtml(html: string, opts?: HtmlRenderOptions): LayoutFn;
|
|
382
530
|
|
|
383
|
-
declare function
|
|
531
|
+
declare function fromMarkdown(markdown: string, opts?: {
|
|
384
532
|
theme?: Theme;
|
|
385
533
|
overrides?: MarkdownThemeOverrides;
|
|
386
534
|
}): LayoutFn;
|
|
@@ -432,473 +580,35 @@ declare function themeToCssVars(theme: Theme): Record<string, string>;
|
|
|
432
580
|
declare function parseThemeSpec(json: string): ThemeValidationResult;
|
|
433
581
|
declare function validateThemeSpec(value: unknown): ThemeValidationResult;
|
|
434
582
|
|
|
435
|
-
type
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
theme?: Theme;
|
|
466
|
-
themeSpec?: ThemeSpec;
|
|
467
|
-
mode?: ThemePreference;
|
|
468
|
-
jsonTitle?: string;
|
|
469
|
-
markdownOverrides?: MarkdownThemeOverrides;
|
|
470
|
-
className?: string;
|
|
471
|
-
style?: CSSProperties;
|
|
472
|
-
};
|
|
473
|
-
declare function TermUIBase({ block, children, width, theme, themeSpec, mode, markdownOverrides, className, style, }: TermUIProps): react_jsx_runtime.JSX.Element;
|
|
474
|
-
declare const TermUI: react.MemoExoticComponent<typeof TermUIBase>;
|
|
475
|
-
|
|
476
|
-
declare function TermDocument({ source, width, theme, themeSpec, mode, jsonTitle, markdownOverrides, className, style, }: TermDocumentProps): react_jsx_runtime.JSX.Element;
|
|
477
|
-
|
|
478
|
-
type BaseProps = {
|
|
479
|
-
children?: ReactNode;
|
|
480
|
-
};
|
|
481
|
-
type TVStackProps = BaseProps & {
|
|
482
|
-
gap?: number;
|
|
483
|
-
};
|
|
484
|
-
type THStackProps = BaseProps & {
|
|
485
|
-
gap?: number;
|
|
486
|
-
widths?: number[];
|
|
487
|
-
};
|
|
488
|
-
type TBoxProps = BaseProps & {
|
|
489
|
-
title?: string;
|
|
490
|
-
borderColor?: string;
|
|
491
|
-
gap?: number;
|
|
492
|
-
action?: BoxAction;
|
|
493
|
-
};
|
|
494
|
-
type TSeparatorProps = {
|
|
495
|
-
color?: string;
|
|
496
|
-
char?: string;
|
|
497
|
-
};
|
|
498
|
-
type TRawProps = {
|
|
499
|
-
text?: string;
|
|
500
|
-
color?: string;
|
|
501
|
-
bg?: string;
|
|
502
|
-
bold?: boolean;
|
|
503
|
-
dim?: boolean;
|
|
504
|
-
blink?: boolean;
|
|
505
|
-
inverted?: boolean;
|
|
506
|
-
onClick?: () => void;
|
|
507
|
-
children?: ReactNode;
|
|
508
|
-
};
|
|
509
|
-
type TTableProps<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
510
|
-
columns: Column<T>[];
|
|
511
|
-
data: T[];
|
|
512
|
-
borderColor?: string;
|
|
513
|
-
fillWidth?: boolean;
|
|
514
|
-
headerColor?: string;
|
|
515
|
-
cellPadding?: number;
|
|
516
|
-
};
|
|
517
|
-
type TTabProps = {
|
|
518
|
-
name: string;
|
|
519
|
-
children?: ReactNode;
|
|
520
|
-
};
|
|
521
|
-
type TTabsProps = {
|
|
522
|
-
active: number;
|
|
523
|
-
activeColor?: string;
|
|
524
|
-
activeBg?: string;
|
|
525
|
-
inactiveColor?: string;
|
|
526
|
-
separatorColor?: string;
|
|
527
|
-
onSelect?: (index: number) => void;
|
|
528
|
-
children?: ReactNode;
|
|
529
|
-
};
|
|
530
|
-
type TStatusbarProps = {
|
|
531
|
-
left: string | Segment[];
|
|
532
|
-
right: string | Segment[];
|
|
533
|
-
bg?: string;
|
|
534
|
-
color?: string;
|
|
535
|
-
};
|
|
536
|
-
type TMarkdownProps = {
|
|
537
|
-
value: string;
|
|
538
|
-
themeOverrides?: MarkdownThemeOverrides;
|
|
539
|
-
};
|
|
540
|
-
type TJsonProps = {
|
|
541
|
-
value: unknown;
|
|
542
|
-
title?: string;
|
|
543
|
-
};
|
|
544
|
-
type THtmlProps = {
|
|
545
|
-
value: string;
|
|
546
|
-
themeOverrides?: MarkdownThemeOverrides;
|
|
547
|
-
};
|
|
548
|
-
type TLineProps = {
|
|
549
|
-
children?: ReactNode;
|
|
550
|
-
};
|
|
551
|
-
type TSpanProps = {
|
|
552
|
-
text?: string;
|
|
553
|
-
children?: ReactNode;
|
|
554
|
-
color?: string;
|
|
555
|
-
bg?: string;
|
|
556
|
-
bold?: boolean;
|
|
557
|
-
dim?: boolean;
|
|
558
|
-
inverted?: boolean;
|
|
559
|
-
blink?: boolean;
|
|
560
|
-
onClick?: () => void;
|
|
561
|
-
};
|
|
562
|
-
type TPadProps = BaseProps & {
|
|
563
|
-
x?: number;
|
|
564
|
-
y?: number;
|
|
565
|
-
top?: number;
|
|
566
|
-
bottom?: number;
|
|
567
|
-
left?: number;
|
|
568
|
-
right?: number;
|
|
569
|
-
};
|
|
570
|
-
type TLayoutProps = {
|
|
571
|
-
layout: LayoutFn;
|
|
572
|
-
};
|
|
573
|
-
type TTreeProps = {
|
|
574
|
-
data: TreeNode[];
|
|
575
|
-
color?: string;
|
|
576
|
-
branchColor?: string;
|
|
577
|
-
leafColor?: string;
|
|
578
|
-
};
|
|
579
|
-
type TCodeProps = {
|
|
580
|
-
code: string;
|
|
581
|
-
language?: string;
|
|
582
|
-
title?: string;
|
|
583
|
-
borderColor?: string;
|
|
584
|
-
action?: BoxAction;
|
|
585
|
-
copyable?: boolean;
|
|
586
|
-
};
|
|
587
|
-
type TUnifiedDiffProps = {
|
|
588
|
-
value: string;
|
|
589
|
-
addColor?: string;
|
|
590
|
-
removeColor?: string;
|
|
591
|
-
metaColor?: string;
|
|
592
|
-
};
|
|
593
|
-
type TDiffComputeProps = {
|
|
594
|
-
before: string;
|
|
595
|
-
after: string;
|
|
596
|
-
context?: number;
|
|
597
|
-
addColor?: string;
|
|
598
|
-
removeColor?: string;
|
|
599
|
-
metaColor?: string;
|
|
600
|
-
};
|
|
601
|
-
type TBarProps = {
|
|
602
|
-
label: string;
|
|
603
|
-
value: number;
|
|
604
|
-
max?: number;
|
|
605
|
-
color?: string;
|
|
606
|
-
};
|
|
607
|
-
type TSparkProps = {
|
|
608
|
-
data: number[];
|
|
609
|
-
color?: string;
|
|
610
|
-
};
|
|
611
|
-
type TListProps = {
|
|
612
|
-
items: ListItem[];
|
|
613
|
-
ordered?: boolean;
|
|
614
|
-
bulletColor?: string;
|
|
615
|
-
color?: string;
|
|
616
|
-
};
|
|
617
|
-
type TButtonProps = {
|
|
618
|
-
label: string;
|
|
619
|
-
onClick?: () => void;
|
|
620
|
-
color?: string;
|
|
621
|
-
bg?: string;
|
|
622
|
-
bold?: boolean;
|
|
623
|
-
dim?: boolean;
|
|
624
|
-
};
|
|
625
|
-
type RenderTermOptions = {
|
|
626
|
-
theme?: Theme;
|
|
627
|
-
themeSpec?: ThemeSpec;
|
|
628
|
-
mode?: ThemePreference;
|
|
629
|
-
markdownOverrides?: MarkdownThemeOverrides;
|
|
630
|
-
};
|
|
631
|
-
declare function TVStack({ children, gap }: TVStackProps): react.ReactElement<{
|
|
632
|
-
gap: number | undefined;
|
|
633
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
634
|
-
declare function THStack({ children, gap, widths }: THStackProps): react.ReactElement<{
|
|
635
|
-
gap: number | undefined;
|
|
636
|
-
widths: number[] | undefined;
|
|
637
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
638
|
-
declare function TBox({ children, title, borderColor, gap, action }: TBoxProps): react.ReactElement<{
|
|
639
|
-
title: string | undefined;
|
|
640
|
-
borderColor: string | undefined;
|
|
641
|
-
gap: number | undefined;
|
|
642
|
-
action: BoxAction | undefined;
|
|
643
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
644
|
-
declare function TSeparator({ color, char }: TSeparatorProps): react.ReactElement<{
|
|
645
|
-
color: string | undefined;
|
|
646
|
-
char: string | undefined;
|
|
647
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
648
|
-
type TBlankProps = {
|
|
649
|
-
lines?: number;
|
|
650
|
-
};
|
|
651
|
-
declare function TBlank({ lines }?: TBlankProps): react.ReactElement<{
|
|
652
|
-
lines: number | undefined;
|
|
653
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
654
|
-
type TBadgeProps = {
|
|
655
|
-
label: string;
|
|
656
|
-
color?: string;
|
|
657
|
-
bg?: string;
|
|
658
|
-
onClick?: () => void;
|
|
659
|
-
};
|
|
660
|
-
declare function TBadge({ label, color, bg, onClick }: TBadgeProps): react.DOMElement<{
|
|
661
|
-
label: string;
|
|
662
|
-
color: string | undefined;
|
|
663
|
-
bg: string | undefined;
|
|
664
|
-
onClick: (() => void) | undefined;
|
|
665
|
-
}, Element>;
|
|
666
|
-
declare function TRaw({ children, text, color, bg, bold, dim, blink, inverted, onClick }: TRawProps): react.DOMElement<{
|
|
667
|
-
text: string | undefined;
|
|
668
|
-
color: string | undefined;
|
|
669
|
-
bg: string | undefined;
|
|
670
|
-
bold: boolean | undefined;
|
|
671
|
-
dim: boolean | undefined;
|
|
672
|
-
blink: boolean | undefined;
|
|
673
|
-
inverted: boolean | undefined;
|
|
674
|
-
onClick: (() => void) | undefined;
|
|
675
|
-
}, Element>;
|
|
676
|
-
declare function TTable<T extends Record<string, unknown>>({ columns, data, borderColor, fillWidth, headerColor, cellPadding, }: TTableProps<T>): react.ReactElement<{
|
|
677
|
-
columns: Column<T>[];
|
|
678
|
-
data: T[];
|
|
679
|
-
borderColor: string | undefined;
|
|
680
|
-
fillWidth: boolean | undefined;
|
|
681
|
-
headerColor: string | undefined;
|
|
682
|
-
cellPadding: number | undefined;
|
|
683
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
684
|
-
declare function TTab({ name, children }: TTabProps): react.ReactElement<{
|
|
685
|
-
name: string;
|
|
686
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
687
|
-
declare function TTabs({ children, active, activeColor, activeBg, inactiveColor, separatorColor, onSelect, }: TTabsProps): react.ReactElement<{
|
|
688
|
-
active: number;
|
|
689
|
-
activeColor: string | undefined;
|
|
690
|
-
activeBg: string | undefined;
|
|
691
|
-
inactiveColor: string | undefined;
|
|
692
|
-
separatorColor: string | undefined;
|
|
693
|
-
onSelect: ((index: number) => void) | undefined;
|
|
694
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
695
|
-
declare function TStatusbar({ left, right, bg, color }: TStatusbarProps): react.ReactElement<{
|
|
696
|
-
left: string | Segment[];
|
|
697
|
-
right: string | Segment[];
|
|
698
|
-
bg: string | undefined;
|
|
699
|
-
color: string | undefined;
|
|
700
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
701
|
-
declare function TMarkdown({ value, themeOverrides }: TMarkdownProps): react.ReactElement<{
|
|
702
|
-
value: string;
|
|
703
|
-
themeOverrides: Partial<ThemeMarkdown> | undefined;
|
|
704
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
705
|
-
declare function TJson({ value, title }: TJsonProps): react.ReactElement<{
|
|
706
|
-
value: unknown;
|
|
707
|
-
title: string | undefined;
|
|
708
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
709
|
-
declare function THtml({ value, themeOverrides }: THtmlProps): react.ReactElement<{
|
|
710
|
-
value: string;
|
|
711
|
-
themeOverrides: Partial<ThemeMarkdown> | undefined;
|
|
712
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
713
|
-
declare function TLine({ children }: TLineProps): react.DOMElement<{}, Element>;
|
|
714
|
-
declare function TSpan({ children, text, color, bg, bold, dim, inverted, blink, onClick }: TSpanProps): react.DOMElement<{
|
|
715
|
-
text: string | undefined;
|
|
716
|
-
color: string | undefined;
|
|
717
|
-
bg: string | undefined;
|
|
718
|
-
bold: boolean | undefined;
|
|
719
|
-
dim: boolean | undefined;
|
|
720
|
-
inverted: boolean | undefined;
|
|
721
|
-
blink: boolean | undefined;
|
|
722
|
-
onClick: (() => void) | undefined;
|
|
723
|
-
}, Element>;
|
|
724
|
-
declare function TPad({ children, x, y, top, bottom, left, right }: TPadProps): react.ReactElement<{
|
|
725
|
-
x: number | undefined;
|
|
726
|
-
y: number | undefined;
|
|
727
|
-
top: number | undefined;
|
|
728
|
-
bottom: number | undefined;
|
|
729
|
-
left: number | undefined;
|
|
730
|
-
right: number | undefined;
|
|
731
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
732
|
-
declare function TLayout({ layout }: TLayoutProps): react.ReactElement<{
|
|
733
|
-
layout: LayoutFn;
|
|
734
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
735
|
-
declare function TTree({ data, color, branchColor, leafColor }: TTreeProps): react.ReactElement<{
|
|
736
|
-
data: TreeNode[];
|
|
737
|
-
color: string | undefined;
|
|
738
|
-
branchColor: string | undefined;
|
|
739
|
-
leafColor: string | undefined;
|
|
740
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
741
|
-
declare function TCode({ code, language, title, borderColor, action, copyable }: TCodeProps): react.ReactElement<{
|
|
742
|
-
code: string;
|
|
743
|
-
language: string | undefined;
|
|
744
|
-
title: string | undefined;
|
|
745
|
-
borderColor: string | undefined;
|
|
746
|
-
action: BoxAction | undefined;
|
|
747
|
-
copyable: boolean | undefined;
|
|
748
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
749
|
-
declare function TUnifiedDiff({ value, addColor, removeColor, metaColor }: TUnifiedDiffProps): react.ReactElement<{
|
|
750
|
-
value: string;
|
|
751
|
-
addColor: string | undefined;
|
|
752
|
-
removeColor: string | undefined;
|
|
753
|
-
metaColor: string | undefined;
|
|
754
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
755
|
-
declare function TDiffCompute({ before, after, context, addColor, removeColor, metaColor }: TDiffComputeProps): react.ReactElement<{
|
|
756
|
-
before: string;
|
|
757
|
-
after: string;
|
|
758
|
-
context: number | undefined;
|
|
759
|
-
addColor: string | undefined;
|
|
760
|
-
removeColor: string | undefined;
|
|
761
|
-
metaColor: string | undefined;
|
|
762
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
763
|
-
declare function TBar({ label, value, max, color }: TBarProps): react.ReactElement<{
|
|
764
|
-
label: string;
|
|
765
|
-
value: number;
|
|
766
|
-
max: number | undefined;
|
|
767
|
-
color: string | undefined;
|
|
768
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
769
|
-
declare function TSpark({ data, color }: TSparkProps): react.ReactElement<{
|
|
770
|
-
data: number[];
|
|
771
|
-
color: string | undefined;
|
|
772
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
773
|
-
declare function TList({ items, ordered, bulletColor, color }: TListProps): react.ReactElement<{
|
|
774
|
-
items: ListItem[];
|
|
775
|
-
ordered: boolean | undefined;
|
|
776
|
-
bulletColor: string | undefined;
|
|
777
|
-
color: string | undefined;
|
|
778
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
779
|
-
declare function TButton({ label, onClick, color, bg, bold, dim }: TButtonProps): react.DOMElement<{
|
|
780
|
-
label: string;
|
|
781
|
-
onClick: (() => void) | undefined;
|
|
782
|
-
color: string | undefined;
|
|
783
|
-
bg: string | undefined;
|
|
784
|
-
bold: boolean | undefined;
|
|
785
|
-
dim: boolean | undefined;
|
|
786
|
-
}, Element>;
|
|
787
|
-
type TDividerProps = {
|
|
788
|
-
label: string;
|
|
789
|
-
color?: string;
|
|
790
|
-
char?: string;
|
|
791
|
-
labelColor?: string;
|
|
792
|
-
};
|
|
793
|
-
declare function TDivider({ label, color, char, labelColor }: TDividerProps): react.ReactElement<{
|
|
794
|
-
label: string;
|
|
795
|
-
color: string | undefined;
|
|
796
|
-
char: string | undefined;
|
|
797
|
-
labelColor: string | undefined;
|
|
798
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
799
|
-
type TKVProps = {
|
|
800
|
-
pairs: KVPair[];
|
|
801
|
-
separator?: string;
|
|
802
|
-
keyColor?: string;
|
|
803
|
-
valueColor?: string;
|
|
804
|
-
keyWidth?: number;
|
|
805
|
-
};
|
|
806
|
-
declare function TKV({ pairs, separator, keyColor, valueColor, keyWidth }: TKVProps): react.ReactElement<{
|
|
807
|
-
pairs: KVPair[];
|
|
808
|
-
separator: string | undefined;
|
|
809
|
-
keyColor: string | undefined;
|
|
810
|
-
valueColor: string | undefined;
|
|
811
|
-
keyWidth: number | undefined;
|
|
812
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
813
|
-
type TCalloutProps = BaseProps & {
|
|
814
|
-
text?: string;
|
|
815
|
-
color?: string;
|
|
816
|
-
accent?: string;
|
|
817
|
-
label?: string;
|
|
818
|
-
};
|
|
819
|
-
declare function TCallout({ children, text, color, accent, label }: TCalloutProps): react.ReactElement<{
|
|
820
|
-
text: string | undefined;
|
|
821
|
-
color: string | undefined;
|
|
822
|
-
accent: string | undefined;
|
|
823
|
-
label: string | undefined;
|
|
824
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
825
|
-
type TChartProps = {
|
|
826
|
-
data: number[];
|
|
827
|
-
height?: number;
|
|
828
|
-
color?: string;
|
|
829
|
-
axisColor?: string;
|
|
830
|
-
fill?: boolean;
|
|
831
|
-
};
|
|
832
|
-
declare function TChart({ data, height, color, axisColor, fill }: TChartProps): react.ReactElement<{
|
|
833
|
-
data: number[];
|
|
834
|
-
height: number | undefined;
|
|
835
|
-
color: string | undefined;
|
|
836
|
-
axisColor: string | undefined;
|
|
837
|
-
fill: boolean | undefined;
|
|
838
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
839
|
-
type TScrollProps = BaseProps & {
|
|
840
|
-
maxHeight: number;
|
|
841
|
-
offset?: number;
|
|
842
|
-
onScroll?: (offset: number) => void;
|
|
843
|
-
scrollbarColor?: string;
|
|
844
|
-
};
|
|
845
|
-
declare function TScroll({ children, maxHeight, offset: controlledOffset, onScroll: externalOnScroll, scrollbarColor }: TScrollProps): react.ReactElement<{
|
|
846
|
-
maxHeight: number;
|
|
847
|
-
offset: number;
|
|
848
|
-
scrollbarColor: string | undefined;
|
|
849
|
-
onScroll: (newOffset: number) => void;
|
|
850
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
851
|
-
type TGridProps = BaseProps & {
|
|
852
|
-
cols: number;
|
|
853
|
-
gap?: number;
|
|
854
|
-
rowGap?: number;
|
|
855
|
-
};
|
|
856
|
-
declare function TGrid({ children, cols, gap, rowGap }: TGridProps): react.ReactElement<{
|
|
857
|
-
cols: number;
|
|
858
|
-
gap: number | undefined;
|
|
859
|
-
rowGap: number | undefined;
|
|
860
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
861
|
-
type TCheckboxProps = {
|
|
862
|
-
checked: boolean;
|
|
863
|
-
label: string;
|
|
864
|
-
color?: string;
|
|
865
|
-
checkColor?: string;
|
|
866
|
-
onChange?: (checked: boolean) => void;
|
|
867
|
-
onClick?: () => void;
|
|
868
|
-
};
|
|
869
|
-
declare function TCheckbox({ checked, label, color, checkColor, onChange, onClick }: TCheckboxProps): react.ReactElement<{
|
|
870
|
-
checked: boolean;
|
|
871
|
-
label: string;
|
|
872
|
-
color: string | undefined;
|
|
873
|
-
checkColor: string | undefined;
|
|
874
|
-
onChange: ((checked: boolean) => void) | undefined;
|
|
875
|
-
onClick: (() => void) | undefined;
|
|
876
|
-
}, string | react.JSXElementConstructor<any>>;
|
|
877
|
-
type TInputProps = {
|
|
878
|
-
value: string;
|
|
879
|
-
onChange?: (value: string) => void;
|
|
880
|
-
onSubmit?: (value: string) => void;
|
|
881
|
-
placeholder?: string;
|
|
882
|
-
width?: number;
|
|
883
|
-
focused?: boolean;
|
|
884
|
-
color?: string;
|
|
885
|
-
borderColor?: string;
|
|
886
|
-
onClick?: () => void;
|
|
887
|
-
};
|
|
888
|
-
declare function TInput({ value, onChange, onSubmit, placeholder, width, focused: controlledFocused, color, borderColor, onClick }: TInputProps): react.DOMElement<{
|
|
889
|
-
value: string;
|
|
890
|
-
placeholder: string | undefined;
|
|
891
|
-
width: number | undefined;
|
|
892
|
-
focused: boolean;
|
|
893
|
-
color: string | undefined;
|
|
894
|
-
borderColor: string | undefined;
|
|
895
|
-
onClick: () => void;
|
|
896
|
-
}, Element>;
|
|
897
|
-
declare function renderTermReact(tree: ReactNode, opts?: RenderTermOptions): LayoutFn;
|
|
898
|
-
|
|
899
|
-
declare function useSpinner(ms?: number): string;
|
|
900
|
-
declare function useTick(ms?: number): number;
|
|
901
|
-
declare function useTermWidth(ref: RefObject<HTMLElement | null>, fallback?: number): number;
|
|
902
|
-
declare function useStreamingText(text: string, lerp?: number): string;
|
|
583
|
+
type TermUIActionEvent = CustomEvent<HtmlAction>;
|
|
584
|
+
declare class TermUIElement extends HTMLElement {
|
|
585
|
+
static observedAttributes: readonly ["width", "mode", "source", "source-format", "json-title"];
|
|
586
|
+
private readonly frame;
|
|
587
|
+
private readonly root;
|
|
588
|
+
private layoutOverride?;
|
|
589
|
+
private resizeObserver?;
|
|
590
|
+
private mutationObserver?;
|
|
591
|
+
private observedShadowRoots;
|
|
592
|
+
private mediaQuery?;
|
|
593
|
+
private mediaQueryListener?;
|
|
594
|
+
private renderQueued;
|
|
595
|
+
private renderFrameId;
|
|
596
|
+
constructor();
|
|
597
|
+
connectedCallback(): void;
|
|
598
|
+
disconnectedCallback(): void;
|
|
599
|
+
attributeChangedCallback(): void;
|
|
600
|
+
render(): void;
|
|
601
|
+
get layout(): LayoutFn | undefined;
|
|
602
|
+
set layout(next: LayoutFn | null | undefined);
|
|
603
|
+
private queueRender;
|
|
604
|
+
private observeOpenShadowRoots;
|
|
605
|
+
private onAction;
|
|
606
|
+
private measureCharacterWidth;
|
|
607
|
+
private resolveColumns;
|
|
608
|
+
private resolveTheme;
|
|
609
|
+
private renderNow;
|
|
610
|
+
}
|
|
611
|
+
declare const TERM_UI_TAG = "term-ui";
|
|
612
|
+
declare function registerTermUIElement(tagName?: string): void;
|
|
903
613
|
|
|
904
|
-
export { type Block, type BoxAction, type Column, type
|
|
614
|
+
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 };
|