terminal-richjs 0.1.0 → 0.2.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/README.md +241 -89
- package/dist/index.cjs +1156 -369
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +221 -27
- package/dist/index.d.ts +221 -27
- package/dist/index.js +1145 -368
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SpinnerName } from 'cli-spinners';
|
|
2
2
|
import boxes from 'cli-boxes';
|
|
3
3
|
import tinycolor from 'tinycolor2';
|
|
4
4
|
|
|
@@ -23,6 +23,10 @@ interface StyleOptions {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
declare class Style {
|
|
26
|
+
/**
|
|
27
|
+
* Apply this style to text (alias for render).
|
|
28
|
+
*/
|
|
29
|
+
apply(text: string): string;
|
|
26
30
|
readonly color?: Color$1;
|
|
27
31
|
readonly backgroundColor?: Color$1;
|
|
28
32
|
readonly bold?: boolean;
|
|
@@ -175,22 +179,24 @@ interface Renderable {
|
|
|
175
179
|
*/
|
|
176
180
|
declare function isRenderable(obj: unknown): obj is Renderable;
|
|
177
181
|
|
|
182
|
+
interface StatusOptions {
|
|
183
|
+
spinnerName?: string;
|
|
184
|
+
}
|
|
178
185
|
declare class Status {
|
|
179
|
-
private live;
|
|
180
186
|
private spinner;
|
|
181
187
|
private message;
|
|
182
188
|
private interval;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
189
|
+
private started;
|
|
190
|
+
private lastRenderedLines;
|
|
191
|
+
constructor(message: string, options?: StatusOptions);
|
|
187
192
|
start(): void;
|
|
188
193
|
stop(): void;
|
|
189
194
|
update(message: string): void;
|
|
190
|
-
private
|
|
195
|
+
private refresh;
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
declare class Console {
|
|
199
|
+
error(message: any): void;
|
|
194
200
|
private readonly terminal;
|
|
195
201
|
private readonly markupParser;
|
|
196
202
|
private readonly options;
|
|
@@ -210,7 +216,7 @@ declare class Console {
|
|
|
210
216
|
* Displays a status spinner.
|
|
211
217
|
*/
|
|
212
218
|
status(message: string, options?: {
|
|
213
|
-
spinner?: SpinnerName
|
|
219
|
+
spinner?: SpinnerName;
|
|
214
220
|
}): {
|
|
215
221
|
start: () => void;
|
|
216
222
|
stop: () => void;
|
|
@@ -220,7 +226,7 @@ declare class Console {
|
|
|
220
226
|
* Run a task with a status spinner.
|
|
221
227
|
*/
|
|
222
228
|
withStatus<T>(message: string, task: (status: Status) => Promise<T>, options?: {
|
|
223
|
-
spinner?: SpinnerName
|
|
229
|
+
spinner?: SpinnerName;
|
|
224
230
|
}): Promise<T>;
|
|
225
231
|
/**
|
|
226
232
|
* Renders a renderable object to a string.
|
|
@@ -484,6 +490,73 @@ declare class Align implements Renderable {
|
|
|
484
490
|
__rich_console__(console: Console, options: ConsoleOptions): RenderResult;
|
|
485
491
|
}
|
|
486
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Columns layout - display renderables in responsive columns
|
|
495
|
+
*/
|
|
496
|
+
/** biome-ignore-all lint/suspicious/noControlCharactersInRegex: false */
|
|
497
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
498
|
+
|
|
499
|
+
interface ColumnsOptions {
|
|
500
|
+
width?: number;
|
|
501
|
+
padding?: number;
|
|
502
|
+
expand?: boolean;
|
|
503
|
+
equal?: boolean;
|
|
504
|
+
columnFirst?: boolean;
|
|
505
|
+
rightToLeft?: boolean;
|
|
506
|
+
title?: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Display renderables in neat columns that adapt to terminal width.
|
|
510
|
+
*/
|
|
511
|
+
declare class Columns implements Renderable {
|
|
512
|
+
private renderables;
|
|
513
|
+
private options;
|
|
514
|
+
constructor(renderables?: Iterable<string | Renderable>, options?: ColumnsOptions);
|
|
515
|
+
/**
|
|
516
|
+
* Add a renderable to the columns.
|
|
517
|
+
*/
|
|
518
|
+
add(renderable: string | Renderable): this;
|
|
519
|
+
__rich_console__(console: Console, consoleOptions: ConsoleOptions): RenderResult;
|
|
520
|
+
/**
|
|
521
|
+
* Get the display width of a string (accounting for ANSI codes).
|
|
522
|
+
*/
|
|
523
|
+
private getDisplayWidth;
|
|
524
|
+
/**
|
|
525
|
+
* Pad an item to the specified width.
|
|
526
|
+
*/
|
|
527
|
+
private padItem;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* JSON renderable - pretty-printed and syntax-highlighted JSON
|
|
532
|
+
*/
|
|
533
|
+
/** biome-ignore-all lint/suspicious/noShadowRestrictedNames: false */
|
|
534
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
535
|
+
|
|
536
|
+
interface JSONOptions {
|
|
537
|
+
indent?: number | string;
|
|
538
|
+
highlight?: boolean;
|
|
539
|
+
sortKeys?: boolean;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* A renderable which pretty prints JSON with syntax highlighting.
|
|
543
|
+
*/
|
|
544
|
+
declare class JSON implements Renderable {
|
|
545
|
+
private readonly text;
|
|
546
|
+
private readonly highlight;
|
|
547
|
+
constructor(json: string, options?: JSONOptions);
|
|
548
|
+
/**
|
|
549
|
+
* Create JSON from any data object.
|
|
550
|
+
*/
|
|
551
|
+
static fromData(data: unknown, options?: JSONOptions): JSON;
|
|
552
|
+
private sortObject;
|
|
553
|
+
/**
|
|
554
|
+
* Apply JSON syntax highlighting.
|
|
555
|
+
*/
|
|
556
|
+
private highlightJSON;
|
|
557
|
+
__rich_console__(_console: Console, _consoleOptions: ConsoleOptions): RenderResult;
|
|
558
|
+
}
|
|
559
|
+
|
|
487
560
|
interface TracebackOptions {
|
|
488
561
|
showLocals?: boolean;
|
|
489
562
|
extraLines?: number;
|
|
@@ -595,7 +668,7 @@ declare class Markdown implements Renderable {
|
|
|
595
668
|
__rich_console__(_console: Console, _options: ConsoleOptions): RenderResult;
|
|
596
669
|
}
|
|
597
670
|
|
|
598
|
-
/** biome-ignore-all assist/source/organizeImports:
|
|
671
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
599
672
|
|
|
600
673
|
interface ProgressBarOptions {
|
|
601
674
|
width?: number;
|
|
@@ -615,6 +688,7 @@ declare class ProgressBar implements Renderable {
|
|
|
615
688
|
readonly total: number;
|
|
616
689
|
readonly completed: number;
|
|
617
690
|
readonly options: ProgressBarOptions;
|
|
691
|
+
render(_arg0: number): void;
|
|
618
692
|
private pulseOffset;
|
|
619
693
|
private lastPulseTime;
|
|
620
694
|
constructor(total?: number, completed?: number, options?: ProgressBarOptions);
|
|
@@ -649,16 +723,12 @@ declare class TimeRemainingColumn implements Renderable {
|
|
|
649
723
|
__rich_console__(_console: Console, _options: ConsoleOptions): RenderResult;
|
|
650
724
|
}
|
|
651
725
|
|
|
652
|
-
interface ProgressOptions {
|
|
653
|
-
console?: Console;
|
|
654
|
-
autoRefresh?: boolean;
|
|
655
|
-
}
|
|
656
726
|
declare class Progress {
|
|
657
727
|
private tasks;
|
|
658
|
-
private live;
|
|
659
|
-
private console;
|
|
660
728
|
private taskIdCounter;
|
|
661
|
-
|
|
729
|
+
private started;
|
|
730
|
+
private refreshInterval;
|
|
731
|
+
private lastRenderedLines;
|
|
662
732
|
addTask(description: string, options?: {
|
|
663
733
|
total?: number;
|
|
664
734
|
completed?: number;
|
|
@@ -670,6 +740,7 @@ declare class Progress {
|
|
|
670
740
|
start(): void;
|
|
671
741
|
stop(): void;
|
|
672
742
|
private refresh;
|
|
743
|
+
private renderSimpleBar;
|
|
673
744
|
}
|
|
674
745
|
|
|
675
746
|
/**
|
|
@@ -677,17 +748,121 @@ declare class Progress {
|
|
|
677
748
|
*/
|
|
678
749
|
declare function track<T>(sequence: Iterable<T> | T[], description?: string): Generator<T>;
|
|
679
750
|
|
|
680
|
-
|
|
751
|
+
/**
|
|
752
|
+
* Spinner renderable - animated spinners for status display
|
|
753
|
+
*/
|
|
754
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
755
|
+
|
|
756
|
+
interface SpinnerOptions {
|
|
757
|
+
text?: string;
|
|
758
|
+
style?: string;
|
|
759
|
+
speed?: number;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* A spinner animation that can be rendered with Live updates.
|
|
763
|
+
*/
|
|
681
764
|
declare class Spinner implements Renderable {
|
|
682
|
-
readonly name:
|
|
683
|
-
readonly
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
765
|
+
readonly name: string;
|
|
766
|
+
readonly frames: string[];
|
|
767
|
+
readonly interval: number;
|
|
768
|
+
text: string;
|
|
769
|
+
style: string;
|
|
770
|
+
speed: number;
|
|
771
|
+
private startTime;
|
|
772
|
+
private frameNoOffset;
|
|
773
|
+
constructor(name?: string, options?: SpinnerOptions);
|
|
774
|
+
/**
|
|
775
|
+
* Render the spinner for a given time.
|
|
776
|
+
*/
|
|
777
|
+
render(time: number): string;
|
|
778
|
+
/**
|
|
779
|
+
* Get the current frame without time advancement (for static rendering).
|
|
780
|
+
*/
|
|
781
|
+
getCurrentFrame(): string;
|
|
782
|
+
/**
|
|
783
|
+
* Update spinner properties.
|
|
784
|
+
*/
|
|
785
|
+
update(options: Partial<SpinnerOptions>): void;
|
|
786
|
+
__rich_console__(_console: Console, _consoleOptions: ConsoleOptions): RenderResult;
|
|
690
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* List all available spinner names.
|
|
790
|
+
*/
|
|
791
|
+
declare function listSpinners$1(): string[];
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Live display - updates content in place
|
|
795
|
+
*/
|
|
796
|
+
interface LiveOptions {
|
|
797
|
+
refreshPerSecond?: number;
|
|
798
|
+
transient?: boolean;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Renders an auto-updating live display.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* const live = new Live();
|
|
806
|
+
*
|
|
807
|
+
* await live.start(async (update) => {
|
|
808
|
+
* for (let i = 0; i <= 100; i++) {
|
|
809
|
+
* update(`Progress: ${i}%`);
|
|
810
|
+
* await sleep(50);
|
|
811
|
+
* }
|
|
812
|
+
* });
|
|
813
|
+
* ```
|
|
814
|
+
*/
|
|
815
|
+
declare class Live {
|
|
816
|
+
private transient;
|
|
817
|
+
private started;
|
|
818
|
+
private refreshThread;
|
|
819
|
+
private lastRenderedLines;
|
|
820
|
+
private currentContent;
|
|
821
|
+
constructor(options?: LiveOptions);
|
|
822
|
+
/**
|
|
823
|
+
* Check if live display is currently running.
|
|
824
|
+
*/
|
|
825
|
+
get isStarted(): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Update the displayed content.
|
|
828
|
+
*/
|
|
829
|
+
update(content: string): void;
|
|
830
|
+
/**
|
|
831
|
+
* Refresh the display with current content.
|
|
832
|
+
*/
|
|
833
|
+
private refresh;
|
|
834
|
+
/**
|
|
835
|
+
* Start live display with a callback function.
|
|
836
|
+
* The callback receives an update function to change the displayed content.
|
|
837
|
+
*/
|
|
838
|
+
start(callback: (update: (content: string) => void) => Promise<void> | void): Promise<void>;
|
|
839
|
+
/**
|
|
840
|
+
* Stop live display.
|
|
841
|
+
*/
|
|
842
|
+
stop(): void;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Helper function to sleep for a given number of milliseconds.
|
|
846
|
+
*/
|
|
847
|
+
declare function sleep(ms: number): Promise<void>;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Spinner animation definitions
|
|
851
|
+
* Ported from Python Rich / cli-spinners
|
|
852
|
+
*/
|
|
853
|
+
interface SpinnerData {
|
|
854
|
+
interval: number;
|
|
855
|
+
frames: string[] | string;
|
|
856
|
+
}
|
|
857
|
+
declare const SPINNERS: Record<string, SpinnerData>;
|
|
858
|
+
/**
|
|
859
|
+
* Get spinner data by name
|
|
860
|
+
*/
|
|
861
|
+
declare function getSpinner(name: string): SpinnerData | undefined;
|
|
862
|
+
/**
|
|
863
|
+
* List all available spinner names
|
|
864
|
+
*/
|
|
865
|
+
declare function listSpinners(): string[];
|
|
691
866
|
|
|
692
867
|
declare class Color {
|
|
693
868
|
private tc;
|
|
@@ -710,6 +885,25 @@ declare class Color {
|
|
|
710
885
|
getContrastColor(): Color;
|
|
711
886
|
}
|
|
712
887
|
|
|
888
|
+
/**
|
|
889
|
+
* Emoji codes database - common emoji shortcodes
|
|
890
|
+
* Subset of Python Rich's emoji database for practical use
|
|
891
|
+
*/
|
|
892
|
+
declare const EMOJI: Record<string, string>;
|
|
893
|
+
/**
|
|
894
|
+
* Replace emoji shortcodes in text with actual emoji characters.
|
|
895
|
+
* Shortcodes are in the format :emoji_name:
|
|
896
|
+
*/
|
|
897
|
+
declare function replaceEmoji(text: string): string;
|
|
898
|
+
/**
|
|
899
|
+
* Get all available emoji names
|
|
900
|
+
*/
|
|
901
|
+
declare function listEmoji(): string[];
|
|
902
|
+
/**
|
|
903
|
+
* Check if an emoji shortcode exists
|
|
904
|
+
*/
|
|
905
|
+
declare function hasEmoji(name: string): boolean;
|
|
906
|
+
|
|
713
907
|
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
714
908
|
interface LogRecord {
|
|
715
909
|
level: LogLevel;
|
|
@@ -748,4 +942,4 @@ declare function inspect(obj: any, options?: InspectOptions): void;
|
|
|
748
942
|
|
|
749
943
|
declare const print: (...objects: any[]) => void;
|
|
750
944
|
|
|
751
|
-
export { Align, type BoxData, type BoxStyle, Color, type ColorSystem, Confirm, Console, type ConsoleOptions, DEFAULT_THEME, DRACULA, GITHUB_LIGHT, Grid, Layout, Logger, MONOKAI, MONOKAI_THEME, Markdown, MarkupParser, ONE_DARK, Padding, Palette, Panel, PercentageColumn, Progress, ProgressBar, Prompt, type RGB, type RenderResult, type Renderable, RichHandler, Rule, SYNTAX_THEMES, Segment, Spinner, type StandardColor, Status, Style, type StyleOptions, Syntax, type SyntaxTheme, Table, Text, Theme, TimeElapsedColumn, TimeRemainingColumn, Traceback, Tree, getBox, getTheme, inspect, install, installTracebackHandler, isRenderable, listBoxStyles, print, track };
|
|
945
|
+
export { Align, type BoxData, type BoxStyle, Color, type ColorSystem, Columns, Confirm, Console, type ConsoleOptions, DEFAULT_THEME, DRACULA, EMOJI, GITHUB_LIGHT, Grid, JSON, Layout, Live, Logger, MONOKAI, MONOKAI_THEME, Markdown, MarkupParser, ONE_DARK, Padding, Palette, Panel, PercentageColumn, Progress, ProgressBar, Prompt, type RGB, type RenderResult, type Renderable, RichHandler, Rule, SPINNERS, SYNTAX_THEMES, Segment, Spinner, type SpinnerData, type StandardColor, Status, Style, type StyleOptions, Syntax, type SyntaxTheme, Table, Text, Theme, TimeElapsedColumn, TimeRemainingColumn, Traceback, Tree, getBox, getSpinner, listSpinners as getSpinnerNames, getTheme, hasEmoji, inspect, install, installTracebackHandler, isRenderable, listBoxStyles, listEmoji, listSpinners$1 as listSpinners, print, replaceEmoji, sleep, track };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SpinnerName } from 'cli-spinners';
|
|
2
2
|
import boxes from 'cli-boxes';
|
|
3
3
|
import tinycolor from 'tinycolor2';
|
|
4
4
|
|
|
@@ -23,6 +23,10 @@ interface StyleOptions {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
declare class Style {
|
|
26
|
+
/**
|
|
27
|
+
* Apply this style to text (alias for render).
|
|
28
|
+
*/
|
|
29
|
+
apply(text: string): string;
|
|
26
30
|
readonly color?: Color$1;
|
|
27
31
|
readonly backgroundColor?: Color$1;
|
|
28
32
|
readonly bold?: boolean;
|
|
@@ -175,22 +179,24 @@ interface Renderable {
|
|
|
175
179
|
*/
|
|
176
180
|
declare function isRenderable(obj: unknown): obj is Renderable;
|
|
177
181
|
|
|
182
|
+
interface StatusOptions {
|
|
183
|
+
spinnerName?: string;
|
|
184
|
+
}
|
|
178
185
|
declare class Status {
|
|
179
|
-
private live;
|
|
180
186
|
private spinner;
|
|
181
187
|
private message;
|
|
182
188
|
private interval;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
189
|
+
private started;
|
|
190
|
+
private lastRenderedLines;
|
|
191
|
+
constructor(message: string, options?: StatusOptions);
|
|
187
192
|
start(): void;
|
|
188
193
|
stop(): void;
|
|
189
194
|
update(message: string): void;
|
|
190
|
-
private
|
|
195
|
+
private refresh;
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
declare class Console {
|
|
199
|
+
error(message: any): void;
|
|
194
200
|
private readonly terminal;
|
|
195
201
|
private readonly markupParser;
|
|
196
202
|
private readonly options;
|
|
@@ -210,7 +216,7 @@ declare class Console {
|
|
|
210
216
|
* Displays a status spinner.
|
|
211
217
|
*/
|
|
212
218
|
status(message: string, options?: {
|
|
213
|
-
spinner?: SpinnerName
|
|
219
|
+
spinner?: SpinnerName;
|
|
214
220
|
}): {
|
|
215
221
|
start: () => void;
|
|
216
222
|
stop: () => void;
|
|
@@ -220,7 +226,7 @@ declare class Console {
|
|
|
220
226
|
* Run a task with a status spinner.
|
|
221
227
|
*/
|
|
222
228
|
withStatus<T>(message: string, task: (status: Status) => Promise<T>, options?: {
|
|
223
|
-
spinner?: SpinnerName
|
|
229
|
+
spinner?: SpinnerName;
|
|
224
230
|
}): Promise<T>;
|
|
225
231
|
/**
|
|
226
232
|
* Renders a renderable object to a string.
|
|
@@ -484,6 +490,73 @@ declare class Align implements Renderable {
|
|
|
484
490
|
__rich_console__(console: Console, options: ConsoleOptions): RenderResult;
|
|
485
491
|
}
|
|
486
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Columns layout - display renderables in responsive columns
|
|
495
|
+
*/
|
|
496
|
+
/** biome-ignore-all lint/suspicious/noControlCharactersInRegex: false */
|
|
497
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
498
|
+
|
|
499
|
+
interface ColumnsOptions {
|
|
500
|
+
width?: number;
|
|
501
|
+
padding?: number;
|
|
502
|
+
expand?: boolean;
|
|
503
|
+
equal?: boolean;
|
|
504
|
+
columnFirst?: boolean;
|
|
505
|
+
rightToLeft?: boolean;
|
|
506
|
+
title?: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Display renderables in neat columns that adapt to terminal width.
|
|
510
|
+
*/
|
|
511
|
+
declare class Columns implements Renderable {
|
|
512
|
+
private renderables;
|
|
513
|
+
private options;
|
|
514
|
+
constructor(renderables?: Iterable<string | Renderable>, options?: ColumnsOptions);
|
|
515
|
+
/**
|
|
516
|
+
* Add a renderable to the columns.
|
|
517
|
+
*/
|
|
518
|
+
add(renderable: string | Renderable): this;
|
|
519
|
+
__rich_console__(console: Console, consoleOptions: ConsoleOptions): RenderResult;
|
|
520
|
+
/**
|
|
521
|
+
* Get the display width of a string (accounting for ANSI codes).
|
|
522
|
+
*/
|
|
523
|
+
private getDisplayWidth;
|
|
524
|
+
/**
|
|
525
|
+
* Pad an item to the specified width.
|
|
526
|
+
*/
|
|
527
|
+
private padItem;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* JSON renderable - pretty-printed and syntax-highlighted JSON
|
|
532
|
+
*/
|
|
533
|
+
/** biome-ignore-all lint/suspicious/noShadowRestrictedNames: false */
|
|
534
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
535
|
+
|
|
536
|
+
interface JSONOptions {
|
|
537
|
+
indent?: number | string;
|
|
538
|
+
highlight?: boolean;
|
|
539
|
+
sortKeys?: boolean;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* A renderable which pretty prints JSON with syntax highlighting.
|
|
543
|
+
*/
|
|
544
|
+
declare class JSON implements Renderable {
|
|
545
|
+
private readonly text;
|
|
546
|
+
private readonly highlight;
|
|
547
|
+
constructor(json: string, options?: JSONOptions);
|
|
548
|
+
/**
|
|
549
|
+
* Create JSON from any data object.
|
|
550
|
+
*/
|
|
551
|
+
static fromData(data: unknown, options?: JSONOptions): JSON;
|
|
552
|
+
private sortObject;
|
|
553
|
+
/**
|
|
554
|
+
* Apply JSON syntax highlighting.
|
|
555
|
+
*/
|
|
556
|
+
private highlightJSON;
|
|
557
|
+
__rich_console__(_console: Console, _consoleOptions: ConsoleOptions): RenderResult;
|
|
558
|
+
}
|
|
559
|
+
|
|
487
560
|
interface TracebackOptions {
|
|
488
561
|
showLocals?: boolean;
|
|
489
562
|
extraLines?: number;
|
|
@@ -595,7 +668,7 @@ declare class Markdown implements Renderable {
|
|
|
595
668
|
__rich_console__(_console: Console, _options: ConsoleOptions): RenderResult;
|
|
596
669
|
}
|
|
597
670
|
|
|
598
|
-
/** biome-ignore-all assist/source/organizeImports:
|
|
671
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
599
672
|
|
|
600
673
|
interface ProgressBarOptions {
|
|
601
674
|
width?: number;
|
|
@@ -615,6 +688,7 @@ declare class ProgressBar implements Renderable {
|
|
|
615
688
|
readonly total: number;
|
|
616
689
|
readonly completed: number;
|
|
617
690
|
readonly options: ProgressBarOptions;
|
|
691
|
+
render(_arg0: number): void;
|
|
618
692
|
private pulseOffset;
|
|
619
693
|
private lastPulseTime;
|
|
620
694
|
constructor(total?: number, completed?: number, options?: ProgressBarOptions);
|
|
@@ -649,16 +723,12 @@ declare class TimeRemainingColumn implements Renderable {
|
|
|
649
723
|
__rich_console__(_console: Console, _options: ConsoleOptions): RenderResult;
|
|
650
724
|
}
|
|
651
725
|
|
|
652
|
-
interface ProgressOptions {
|
|
653
|
-
console?: Console;
|
|
654
|
-
autoRefresh?: boolean;
|
|
655
|
-
}
|
|
656
726
|
declare class Progress {
|
|
657
727
|
private tasks;
|
|
658
|
-
private live;
|
|
659
|
-
private console;
|
|
660
728
|
private taskIdCounter;
|
|
661
|
-
|
|
729
|
+
private started;
|
|
730
|
+
private refreshInterval;
|
|
731
|
+
private lastRenderedLines;
|
|
662
732
|
addTask(description: string, options?: {
|
|
663
733
|
total?: number;
|
|
664
734
|
completed?: number;
|
|
@@ -670,6 +740,7 @@ declare class Progress {
|
|
|
670
740
|
start(): void;
|
|
671
741
|
stop(): void;
|
|
672
742
|
private refresh;
|
|
743
|
+
private renderSimpleBar;
|
|
673
744
|
}
|
|
674
745
|
|
|
675
746
|
/**
|
|
@@ -677,17 +748,121 @@ declare class Progress {
|
|
|
677
748
|
*/
|
|
678
749
|
declare function track<T>(sequence: Iterable<T> | T[], description?: string): Generator<T>;
|
|
679
750
|
|
|
680
|
-
|
|
751
|
+
/**
|
|
752
|
+
* Spinner renderable - animated spinners for status display
|
|
753
|
+
*/
|
|
754
|
+
/** biome-ignore-all assist/source/organizeImports: false */
|
|
755
|
+
|
|
756
|
+
interface SpinnerOptions {
|
|
757
|
+
text?: string;
|
|
758
|
+
style?: string;
|
|
759
|
+
speed?: number;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* A spinner animation that can be rendered with Live updates.
|
|
763
|
+
*/
|
|
681
764
|
declare class Spinner implements Renderable {
|
|
682
|
-
readonly name:
|
|
683
|
-
readonly
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
765
|
+
readonly name: string;
|
|
766
|
+
readonly frames: string[];
|
|
767
|
+
readonly interval: number;
|
|
768
|
+
text: string;
|
|
769
|
+
style: string;
|
|
770
|
+
speed: number;
|
|
771
|
+
private startTime;
|
|
772
|
+
private frameNoOffset;
|
|
773
|
+
constructor(name?: string, options?: SpinnerOptions);
|
|
774
|
+
/**
|
|
775
|
+
* Render the spinner for a given time.
|
|
776
|
+
*/
|
|
777
|
+
render(time: number): string;
|
|
778
|
+
/**
|
|
779
|
+
* Get the current frame without time advancement (for static rendering).
|
|
780
|
+
*/
|
|
781
|
+
getCurrentFrame(): string;
|
|
782
|
+
/**
|
|
783
|
+
* Update spinner properties.
|
|
784
|
+
*/
|
|
785
|
+
update(options: Partial<SpinnerOptions>): void;
|
|
786
|
+
__rich_console__(_console: Console, _consoleOptions: ConsoleOptions): RenderResult;
|
|
690
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* List all available spinner names.
|
|
790
|
+
*/
|
|
791
|
+
declare function listSpinners$1(): string[];
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Live display - updates content in place
|
|
795
|
+
*/
|
|
796
|
+
interface LiveOptions {
|
|
797
|
+
refreshPerSecond?: number;
|
|
798
|
+
transient?: boolean;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Renders an auto-updating live display.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* const live = new Live();
|
|
806
|
+
*
|
|
807
|
+
* await live.start(async (update) => {
|
|
808
|
+
* for (let i = 0; i <= 100; i++) {
|
|
809
|
+
* update(`Progress: ${i}%`);
|
|
810
|
+
* await sleep(50);
|
|
811
|
+
* }
|
|
812
|
+
* });
|
|
813
|
+
* ```
|
|
814
|
+
*/
|
|
815
|
+
declare class Live {
|
|
816
|
+
private transient;
|
|
817
|
+
private started;
|
|
818
|
+
private refreshThread;
|
|
819
|
+
private lastRenderedLines;
|
|
820
|
+
private currentContent;
|
|
821
|
+
constructor(options?: LiveOptions);
|
|
822
|
+
/**
|
|
823
|
+
* Check if live display is currently running.
|
|
824
|
+
*/
|
|
825
|
+
get isStarted(): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Update the displayed content.
|
|
828
|
+
*/
|
|
829
|
+
update(content: string): void;
|
|
830
|
+
/**
|
|
831
|
+
* Refresh the display with current content.
|
|
832
|
+
*/
|
|
833
|
+
private refresh;
|
|
834
|
+
/**
|
|
835
|
+
* Start live display with a callback function.
|
|
836
|
+
* The callback receives an update function to change the displayed content.
|
|
837
|
+
*/
|
|
838
|
+
start(callback: (update: (content: string) => void) => Promise<void> | void): Promise<void>;
|
|
839
|
+
/**
|
|
840
|
+
* Stop live display.
|
|
841
|
+
*/
|
|
842
|
+
stop(): void;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Helper function to sleep for a given number of milliseconds.
|
|
846
|
+
*/
|
|
847
|
+
declare function sleep(ms: number): Promise<void>;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Spinner animation definitions
|
|
851
|
+
* Ported from Python Rich / cli-spinners
|
|
852
|
+
*/
|
|
853
|
+
interface SpinnerData {
|
|
854
|
+
interval: number;
|
|
855
|
+
frames: string[] | string;
|
|
856
|
+
}
|
|
857
|
+
declare const SPINNERS: Record<string, SpinnerData>;
|
|
858
|
+
/**
|
|
859
|
+
* Get spinner data by name
|
|
860
|
+
*/
|
|
861
|
+
declare function getSpinner(name: string): SpinnerData | undefined;
|
|
862
|
+
/**
|
|
863
|
+
* List all available spinner names
|
|
864
|
+
*/
|
|
865
|
+
declare function listSpinners(): string[];
|
|
691
866
|
|
|
692
867
|
declare class Color {
|
|
693
868
|
private tc;
|
|
@@ -710,6 +885,25 @@ declare class Color {
|
|
|
710
885
|
getContrastColor(): Color;
|
|
711
886
|
}
|
|
712
887
|
|
|
888
|
+
/**
|
|
889
|
+
* Emoji codes database - common emoji shortcodes
|
|
890
|
+
* Subset of Python Rich's emoji database for practical use
|
|
891
|
+
*/
|
|
892
|
+
declare const EMOJI: Record<string, string>;
|
|
893
|
+
/**
|
|
894
|
+
* Replace emoji shortcodes in text with actual emoji characters.
|
|
895
|
+
* Shortcodes are in the format :emoji_name:
|
|
896
|
+
*/
|
|
897
|
+
declare function replaceEmoji(text: string): string;
|
|
898
|
+
/**
|
|
899
|
+
* Get all available emoji names
|
|
900
|
+
*/
|
|
901
|
+
declare function listEmoji(): string[];
|
|
902
|
+
/**
|
|
903
|
+
* Check if an emoji shortcode exists
|
|
904
|
+
*/
|
|
905
|
+
declare function hasEmoji(name: string): boolean;
|
|
906
|
+
|
|
713
907
|
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
714
908
|
interface LogRecord {
|
|
715
909
|
level: LogLevel;
|
|
@@ -748,4 +942,4 @@ declare function inspect(obj: any, options?: InspectOptions): void;
|
|
|
748
942
|
|
|
749
943
|
declare const print: (...objects: any[]) => void;
|
|
750
944
|
|
|
751
|
-
export { Align, type BoxData, type BoxStyle, Color, type ColorSystem, Confirm, Console, type ConsoleOptions, DEFAULT_THEME, DRACULA, GITHUB_LIGHT, Grid, Layout, Logger, MONOKAI, MONOKAI_THEME, Markdown, MarkupParser, ONE_DARK, Padding, Palette, Panel, PercentageColumn, Progress, ProgressBar, Prompt, type RGB, type RenderResult, type Renderable, RichHandler, Rule, SYNTAX_THEMES, Segment, Spinner, type StandardColor, Status, Style, type StyleOptions, Syntax, type SyntaxTheme, Table, Text, Theme, TimeElapsedColumn, TimeRemainingColumn, Traceback, Tree, getBox, getTheme, inspect, install, installTracebackHandler, isRenderable, listBoxStyles, print, track };
|
|
945
|
+
export { Align, type BoxData, type BoxStyle, Color, type ColorSystem, Columns, Confirm, Console, type ConsoleOptions, DEFAULT_THEME, DRACULA, EMOJI, GITHUB_LIGHT, Grid, JSON, Layout, Live, Logger, MONOKAI, MONOKAI_THEME, Markdown, MarkupParser, ONE_DARK, Padding, Palette, Panel, PercentageColumn, Progress, ProgressBar, Prompt, type RGB, type RenderResult, type Renderable, RichHandler, Rule, SPINNERS, SYNTAX_THEMES, Segment, Spinner, type SpinnerData, type StandardColor, Status, Style, type StyleOptions, Syntax, type SyntaxTheme, Table, Text, Theme, TimeElapsedColumn, TimeRemainingColumn, Traceback, Tree, getBox, getSpinner, listSpinners as getSpinnerNames, getTheme, hasEmoji, inspect, install, installTracebackHandler, isRenderable, listBoxStyles, listEmoji, listSpinners$1 as listSpinners, print, replaceEmoji, sleep, track };
|