1ch 0.3.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/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;
@@ -342,19 +338,6 @@ declare function code(source: string, opts?: {
342
338
  copyable?: boolean;
343
339
  action?: BoxAction;
344
340
  }): 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
341
 
359
342
  declare function chart(data: number[], opts?: {
360
343
  height?: number;
@@ -375,12 +358,173 @@ type DocumentSource = {
375
358
  };
376
359
  type MarkdownThemeOverrides = Partial<ThemeMarkdown>;
377
360
 
378
- declare function fromMarkdown(markdown: string, opts?: {
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 = {
379
518
  theme?: Theme;
380
519
  overrides?: MarkdownThemeOverrides;
381
- }): LayoutFn;
520
+ onAction?: (action: HtmlAction) => void;
521
+ };
382
522
 
383
- declare function fromHtml(html: string, opts?: {
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;
526
+
527
+ declare function fromMarkdown(markdown: string, opts?: {
384
528
  theme?: Theme;
385
529
  overrides?: MarkdownThemeOverrides;
386
530
  }): LayoutFn;
@@ -432,473 +576,32 @@ declare function themeToCssVars(theme: Theme): Record<string, string>;
432
576
  declare function parseThemeSpec(json: string): ThemeValidationResult;
433
577
  declare function validateThemeSpec(value: unknown): ThemeValidationResult;
434
578
 
435
- type TermThemeContextValue = {
436
- themeSpec: ThemeSpec;
437
- modePreference: ThemePreference;
438
- systemMode: ThemeMode;
439
- theme: Theme;
440
- setThemeSpec: (next: ThemeSpec) => void;
441
- setModePreference: (next: ThemePreference) => void;
442
- };
443
- type TermThemeProviderProps = {
444
- children: ReactNode;
445
- initialTheme?: ThemeSpec;
446
- initialMode?: ThemePreference;
447
- };
448
- declare function TermThemeProvider({ children, initialTheme, initialMode, }: TermThemeProviderProps): react_jsx_runtime.JSX.Element;
449
- declare function useTermTheme(): TermThemeContextValue;
450
-
451
- type TermUIProps = {
452
- block?: Block;
453
- children?: ReactNode;
454
- width?: number;
455
- theme?: Theme;
456
- themeSpec?: ThemeSpec;
457
- mode?: ThemePreference;
458
- markdownOverrides?: MarkdownThemeOverrides;
459
- className?: string;
460
- style?: CSSProperties;
461
- };
462
- type TermDocumentProps = {
463
- source: DocumentSource;
464
- width?: number;
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;
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;
903
606
 
904
- export { type Block, type BoxAction, type Column, type DocumentSource, type JsonNode, type KVPair, type LayoutFn, type Line, type ListItem, type MarkdownThemeOverrides, type RenderTermOptions, type ScrollRegionMeta, type Segment, type Style, TBadge, type TBadgeProps, TBar, type TBarProps, TBlank, type TBlankProps, TBox, type TBoxProps, TButton, type TButtonProps, TCallout, type TCalloutProps, TChart, type TChartProps, TCheckbox, type TCheckboxProps, TCode, type TCodeProps, TDiffCompute, type TDiffComputeProps, TDivider, type TDividerProps, TGrid, type TGridProps, THStack, type THStackProps, THtml, type THtmlProps, TInput, type TInputProps, TJson, type TJsonProps, TKV, type TKVProps, TLayout, type TLayoutProps, TLine, type TLineProps, TList, type TListProps, TMarkdown, type TMarkdownProps, TPad, type TPadProps, TRaw, type TRawProps, TScroll, type TScrollProps, TSeparator, type TSeparatorProps, TSpan, type TSpanProps, TSpark, type TSparkProps, TStatusbar, type TStatusbarProps, TTab, type TTabProps, TTable, type TTableProps, TTabs, type TTabsProps, TTree, type TTreeProps, TUnifiedDiff, type TUnifiedDiffProps, TVStack, type TVStackProps, TermDocument, type TermDocumentProps, type TermThemeContextValue, TermThemeProvider, type TermThemeProviderProps, TermUI, type TermUIProps, 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, computeDiff, dark, defaultThemeSpec, divider, fromDocument, fromHtml, fromJson, fromJsonNode, fromMarkdown, grid, hl, hstack, inputField, isTableLine, kv, light, lines, list, pad, padLine, padding, parseThemeSpec, preserveTableTag, renderTermReact, resolveTheme, resolveThemeMode, scroll, separator, spark, statusbar, table, tabs, themeToCssVars, tokenColor, tokenize, tree, truncate, unifiedDiff, useSpinner, useStreamingText, useTermTheme, useTermWidth, useTick, validateThemeSpec, vstack };
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 };