UNPKG

@finos/legend-application

Version:
157 lines 5.83 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { GenericLegendApplicationStore } from '../ApplicationStore.js'; export declare enum DISPLAY_ANSI_ESCAPE { RESET = "\u001B[0m",// color off BOLD = "\u001B[1m", DIM = "\u001B[2m", ITALIC = "\u001B[3m", UNDERLINE = "\u001B[4m", BLINKING = "\u001B[5m", STRIKETHROUGH = "\u001B[9m", BLACK = "\u001B[30m", RED = "\u001B[31m", GREEN = "\u001B[32m", YELLOW = "\u001B[33m", BLUE = "\u001B[34m", MAGENTA = "\u001B[35m", CYAN = "\u001B[36m", WHITE = "\u001B[37m", BRIGHT_BLACK = "\u001B[1;30m", BRIGHT_RED = "\u001B[1;31m", BRIGHT_GREEN = "\u001B[1;32m", BRIGHT_YELLOW = "\u001B[1;33m", BRIGHT_BLUE = "\u001B[1;34m", BRIGHT_MAGENTA = "\u001B[1;35m", BRIGHT_CYAN = "\u001B[1;36m", BRIGHT_WHITE = "\u001B[1;37m", DIMMED_BLACK = "\u001B[2;30m", DIMMED_RED = "\u001B[2;31m", DIMMED_GREEN = "\u001B[2;32m", DIMMED_YELLOW = "\u001B[2;33m", DIMMED_BLUE = "\u001B[2;34m", DIMMED_MAGENTA = "\u001B[2;35m", DIMMED_CYAN = "\u001B[2;36m", DIMMED_WHITE = "\u001B[2;37m", BLACK_BG = "\u001B[40m", RED_BG = "\u001B[41m", GREEN_BG = "\u001B[42m", YELLOW_BG = "\u001B[43m", BLUE_BG = "\u001B[44m", MAGENTA_BG = "\u001B[45m", CYAN_BG = "\u001B[46m", WHITE_BG = "\u001B[47m", BRIGHT_BLACK_BG = "\u001B[1;40m", BRIGHT_RED_BG = "\u001B[1;41m", BRIGHT_GREEN_BG = "\u001B[1;42m", BRIGHT_YELLOW_BG = "\u001B[1;43m", BRIGHT_BLUE_BG = "\u001B[1;44m", BRIGHT_MAGENTA_BG = "\u001B[1;45m", BRIGHT_CYAN_BG = "\u001B[1;46m", BRIGHT_WHITE_BG = "\u001B[1;47m", DIMMED_BLACK_BG = "\u001B[2;40m", DIMMED_RED_BG = "\u001B[2;41m", DIMMED_GREEN_BG = "\u001B[2;42m", DIMMED_YELLOW_BG = "\u001B[2;43m", DIMMED_BLUE_BG = "\u001B[2;44m", DIMMED_MAGENTA_BG = "\u001B[2;45m", DIMMED_CYAN_BG = "\u001B[2;46m", DIMMED_WHITE_BG = "\u001B[2;47m" } /** * NOTE: this is the line and the column of the viewport of the terminal; * Also, line and column start from 1 */ export declare const ANSI_moveCursor: (line: number, column: number) => string; export declare const ANSI_moveCursorUp: (val: number, start?: boolean) => string; export declare const ANSI_moveCursorDown: (val: number, start?: boolean) => string; export declare const ANSI_moveCursorRight: (val: number) => string; export declare const ANSI_moveCursorLeft: (val: number) => string; export declare const ANSI_moveCursorToColumn: (val: number) => string; declare class ConsoleSearchConfiguration { private searchInput?; searchText: string; useRegex: boolean; matchWholeWord: boolean; matchCaseSensitive: boolean; resultCount?: number | undefined; currentResultIndex?: number | undefined; constructor(); setSearchInput(el: HTMLInputElement | undefined): void; focus(): void; } export declare abstract class Console { readonly applicationStore: GenericLegendApplicationStore; readonly searchConfig: ConsoleSearchConfiguration; constructor(applicationStore: GenericLegendApplicationStore); setSearchText(val: string): void; setSearchRegex(val: boolean): void; setSearchWholeWord(val: boolean): void; setSearchCaseSensitive(val: boolean): void; setSearchResultCount(val: number | undefined): void; setSearchCurrentResultIndex(val: number | undefined): void; abstract mount(container: HTMLElement): void; abstract dispose(): void; abstract autoResize(): void; abstract clear(): void; } export declare abstract class OutputConsole extends Console { } export interface TerminalWriteOption { systemCommand?: string | undefined; /** * Whether to clear the console prior to writing */ clear?: boolean | undefined; } export interface TerminalWebLinkProviderConfiguration { handler: (event: MouseEvent, text: string) => void; regex: RegExp; } export interface TerminalCommandConfiguration { command: string; description: string; usage: string; aliases?: string[] | undefined; handler: (args: string[], command: string, text: string) => Promise<void>; } export interface TerminalSetupConfiguration { webLinkProvider?: TerminalWebLinkProviderConfiguration | undefined; commands?: TerminalCommandConfiguration[] | undefined; } export declare abstract class Terminal extends Console { preserveLog: boolean; protected commandRegistry: Map<string, TerminalCommandConfiguration>; constructor(applicationStore: GenericLegendApplicationStore); setPreserveLog(val: boolean): void; abstract get isSetup(): boolean; abstract setup(configuration?: TerminalSetupConfiguration | undefined): void; abstract focus(): void; showHelp(): void; showCommonANSIEscapeSequences(): void; abstract abort(): void; abstract fail(error: string, opts?: TerminalWriteOption): void; abstract output(val: string, opts?: TerminalWriteOption): void; abstract isFocused(): boolean; abstract search(val: string): void; abstract clearSearch(): void; abstract findPrevious(): void; abstract findNext(): void; abstract copy(): void; abstract copyAll(): void; } export {}; //# sourceMappingURL=Terminal.d.ts.map