@reliverse/relinka 1.3.6 → 1.3.8
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 +115 -76
- package/bin/{relinka-impl → core-impl}/deprecated/components/levels/levels.d.ts +13 -13
- package/bin/{relinka-impl → core-impl}/deprecated/components/modes/basic.d.ts +19 -19
- package/bin/{relinka-impl → core-impl}/deprecated/components/modes/browser.d.ts +19 -19
- package/bin/{relinka-impl → core-impl}/deprecated/components/modes/shared.d.ts +2 -2
- package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/logger.d.ts +5 -5
- package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/mod.d.ts +20 -20
- package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.d.ts +140 -141
- package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.test.d.ts +1 -1
- package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/basic.d.ts +11 -11
- package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/browser.d.ts +10 -10
- package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/fancy.d.ts +10 -10
- package/bin/{relinka-impl → core-impl}/deprecated/utils/box.d.ts +114 -114
- package/bin/{relinka-impl → core-impl}/deprecated/utils/deprecatedColors.d.ts +69 -69
- package/bin/{relinka-impl → core-impl}/deprecated/utils/error.d.ts +6 -6
- package/bin/{relinka-impl → core-impl}/deprecated/utils/format.d.ts +14 -14
- package/bin/{relinka-impl → core-impl}/deprecated/utils/log.d.ts +13 -13
- package/bin/{relinka-impl → core-impl}/deprecated/utils/stream.d.ts +14 -15
- package/bin/{relinka-impl → core-impl}/deprecated/utils/string.d.ts +50 -50
- package/bin/{relinka-impl → core-impl}/deprecated/utils/tree.d.ts +41 -41
- package/bin/core-impl/impl-mod.d.ts +19 -0
- package/bin/core-impl/impl-mod.js +321 -0
- package/bin/{relinka-types.d.ts → core-types.d.ts} +193 -194
- package/bin/main.d.ts +22 -22
- package/bin/main.js +19 -19
- package/package.json +5 -5
- package/bin/relinka-impl/impl-mod.d.ts +0 -20
- package/bin/relinka-impl/impl-mod.js +0 -454
- /package/bin/{relinka-impl → core-impl}/deprecated/components/levels/levels.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/modes/basic.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/modes/browser.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/modes/shared.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/logger.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/mod.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.test.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/basic.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/browser.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/components/reporters/fancy.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/box.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/deprecatedColors.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/error.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/format.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/log.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/stream.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/string.js +0 -0
- /package/bin/{relinka-impl → core-impl}/deprecated/utils/tree.js +0 -0
- /package/bin/{relinka-types.js → core-types.js} +0 -0
package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.d.ts
RENAMED
|
@@ -1,141 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* @
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* @
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export declare function createRelinkaDeprecated(options?: Partial<RelinkaOptionsDeprecated>): RelinkaInstanceDeprecated;
|
|
1
|
+
import type { LogTypeDeprecated } from "../../../../core-types.js";
|
|
2
|
+
import type { InputLogObject, LogObject, RelinkaOptionsDeprecated, RelinkaReporterDeprecated } from "../../../../core-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Relinka class for logging management with support for pause/resume, mocking and customizable reporting.
|
|
5
|
+
* Provides flexible logging capabilities including level-based logging, custom reporters and integration options.
|
|
6
|
+
*
|
|
7
|
+
* @class Relinka
|
|
8
|
+
*/
|
|
9
|
+
export declare class RelinkaInterface {
|
|
10
|
+
options: RelinkaOptionsDeprecated;
|
|
11
|
+
_lastLog: {
|
|
12
|
+
serialized?: string;
|
|
13
|
+
object?: LogObject;
|
|
14
|
+
count?: number;
|
|
15
|
+
time?: Date;
|
|
16
|
+
timeout?: ReturnType<typeof setTimeout>;
|
|
17
|
+
};
|
|
18
|
+
_paused: boolean;
|
|
19
|
+
_queue: any[];
|
|
20
|
+
_mockFn?: RelinkaOptionsDeprecated["mockFn"];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of Relinka with specified options or defaults.
|
|
23
|
+
*
|
|
24
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Configuration options for the Relinka instance.
|
|
25
|
+
*/
|
|
26
|
+
constructor(options?: Partial<RelinkaOptionsDeprecated>);
|
|
27
|
+
/**
|
|
28
|
+
* Gets the current log level of the Relinka instance.
|
|
29
|
+
*
|
|
30
|
+
* @returns {number} The current log level.
|
|
31
|
+
*/
|
|
32
|
+
get level(): any;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the minimum log level that will be output by the instance.
|
|
35
|
+
*
|
|
36
|
+
* @param {number} level - The new log level to set.
|
|
37
|
+
*/
|
|
38
|
+
set level(level: any);
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new instance of Relinka, inheriting options from the current instance, with possible overrides.
|
|
41
|
+
*
|
|
42
|
+
* @param {Partial<RelinkaOptionsDeprecated>} options - Optional overrides for the new instance. See {@link RelinkaOptionsDeprecated}.
|
|
43
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
44
|
+
*/
|
|
45
|
+
create(options: Partial<RelinkaOptionsDeprecated>): RelinkaInstanceDeprecated;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new Relinka instance with the specified default log object properties.
|
|
48
|
+
*
|
|
49
|
+
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
50
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
51
|
+
*/
|
|
52
|
+
withDefaults(defaults: InputLogObject): RelinkaInstanceDeprecated;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new Relinka instance with a specified tag, which will be included in every log.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} tag - The tag to include in each log of the new instance.
|
|
57
|
+
* @returns {RelinkaInstanceDeprecated} A new Relinka instance. See {@link RelinkaInstanceDeprecated}.
|
|
58
|
+
*/
|
|
59
|
+
withTag(tag: string): RelinkaInstanceDeprecated;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a custom reporter to the Relinka instance.
|
|
62
|
+
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
63
|
+
*
|
|
64
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to add. See {@link RelinkaReporterDeprecated}.
|
|
65
|
+
* @returns {Relinka} The current Relinka instance.
|
|
66
|
+
*/
|
|
67
|
+
addReporter(reporter: RelinkaReporterDeprecated): this;
|
|
68
|
+
/**
|
|
69
|
+
* Removes a custom reporter from the Relinka instance.
|
|
70
|
+
* If no reporter is specified, all reporters will be removed.
|
|
71
|
+
*
|
|
72
|
+
* @param {RelinkaReporterDeprecated} reporter - The reporter to remove. See {@link RelinkaReporterDeprecated}.
|
|
73
|
+
* @returns {Relinka} The current Relinka instance.
|
|
74
|
+
*/
|
|
75
|
+
removeReporter(reporter: RelinkaReporterDeprecated): any;
|
|
76
|
+
/**
|
|
77
|
+
* Replaces all reporters of the Relinka instance with the specified array of reporters.
|
|
78
|
+
*
|
|
79
|
+
* @param {RelinkaReporterDeprecated[]} reporters - The new reporters to set. See {@link RelinkaReporterDeprecated}.
|
|
80
|
+
* @returns {Relinka} The current Relinka instance.
|
|
81
|
+
*/
|
|
82
|
+
setReporters(reporters: RelinkaReporterDeprecated[]): this;
|
|
83
|
+
wrapAll(): void;
|
|
84
|
+
restoreAll(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Overrides console methods with Relinka logging methods for consistent logging.
|
|
87
|
+
*/
|
|
88
|
+
wrapConsole(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Restores the original console methods, removing Relinka overrides.
|
|
91
|
+
*/
|
|
92
|
+
restoreConsole(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Overrides standard output and error streams to redirect them through RelinkaInterface.
|
|
95
|
+
*/
|
|
96
|
+
wrapStd(): void;
|
|
97
|
+
_wrapStream(stream: NodeJS.WriteStream | undefined, type: LogTypeDeprecated): void;
|
|
98
|
+
/**
|
|
99
|
+
* Restores the original standard output and error streams, removing the Relinka redirection.
|
|
100
|
+
*/
|
|
101
|
+
restoreStd(): void;
|
|
102
|
+
_restoreStream(stream?: NodeJS.WriteStream): void;
|
|
103
|
+
/**
|
|
104
|
+
* Clears the internal state of the Relinka instance.
|
|
105
|
+
* This will reset any throttling, last log data, clear any queued logs,
|
|
106
|
+
* and optionally clear the actual console.
|
|
107
|
+
*
|
|
108
|
+
* @param {boolean} clearConsole - Whether to clear the actual console. Defaults to false.
|
|
109
|
+
*/
|
|
110
|
+
clear(clearConsole?: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* Pauses logging, queues incoming logs until resumed.
|
|
113
|
+
*/
|
|
114
|
+
pauseLogs(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Resumes logging, processing any queued logs.
|
|
117
|
+
*/
|
|
118
|
+
resumeLogs(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Replaces logging methods with mocks if a mock function is provided.
|
|
121
|
+
*
|
|
122
|
+
* @param {RelinkaOptionsDeprecated["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link RelinkaOptionsDeprecated["mockFn"]}.
|
|
123
|
+
*/
|
|
124
|
+
mockTypes(mockFn?: RelinkaOptionsDeprecated["mockFn"]): void;
|
|
125
|
+
_wrapLogFn(defaults: InputLogObject, isRaw?: boolean): (...args: any[]) => boolean;
|
|
126
|
+
_logFn(defaults: InputLogObject, args: any[], isRaw?: boolean): boolean;
|
|
127
|
+
_log(logObj: LogObject): void;
|
|
128
|
+
}
|
|
129
|
+
export type LogFn = {
|
|
130
|
+
(message: InputLogObject | any, ...args: any[]): void;
|
|
131
|
+
raw: (...args: any[]) => void;
|
|
132
|
+
};
|
|
133
|
+
export type RelinkaInstanceDeprecated = RelinkaInterface & Record<LogTypeDeprecated, LogFn>;
|
|
134
|
+
/**
|
|
135
|
+
* Utility for creating a new Relinka instance with optional configuration.
|
|
136
|
+
*
|
|
137
|
+
* @param {Partial<RelinkaOptionsDeprecated>} [options={}] - Optional configuration options for the new Relinka instance. See {@link RelinkaOptionsDeprecated}.
|
|
138
|
+
* @returns {RelinkaInstanceDeprecated} A new instance of RelinkaInterface. See {@link RelinkaInstanceDeprecated}.
|
|
139
|
+
*/
|
|
140
|
+
export declare function createRelinkaDeprecated(options?: Partial<RelinkaOptionsDeprecated>): RelinkaInstanceDeprecated;
|
package/bin/{relinka-impl → core-impl}/deprecated/components/relinka-deprecated/relinka.test.d.ts
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { LogObject, RelinkaReporterDeprecated, FormatOptions, RelinkaOptionsDeprecated } from "../../../../
|
|
2
|
-
export declare class BasicReporter implements RelinkaReporterDeprecated {
|
|
3
|
-
formatStack(stack: string): string;
|
|
4
|
-
formatArgs(args: any[], opts: FormatOptions): string;
|
|
5
|
-
formatDate(date: Date, opts: FormatOptions): string;
|
|
6
|
-
filterAndJoin(arr: any[]): string;
|
|
7
|
-
formatLogObj(logObj: LogObject, opts: FormatOptions): string;
|
|
8
|
-
log(logObj: LogObject, ctx: {
|
|
9
|
-
options: RelinkaOptionsDeprecated;
|
|
10
|
-
}): any;
|
|
11
|
-
}
|
|
1
|
+
import type { LogObject, RelinkaReporterDeprecated, FormatOptions, RelinkaOptionsDeprecated } from "../../../../core-types.js";
|
|
2
|
+
export declare class BasicReporter implements RelinkaReporterDeprecated {
|
|
3
|
+
formatStack(stack: string): string;
|
|
4
|
+
formatArgs(args: any[], opts: FormatOptions): string;
|
|
5
|
+
formatDate(date: Date, opts: FormatOptions): string;
|
|
6
|
+
filterAndJoin(arr: any[]): string;
|
|
7
|
+
formatLogObj(logObj: LogObject, opts: FormatOptions): string;
|
|
8
|
+
log(logObj: LogObject, ctx: {
|
|
9
|
+
options: RelinkaOptionsDeprecated;
|
|
10
|
+
}): any;
|
|
11
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { LogObject } from "../../../../
|
|
2
|
-
export declare class BrowserReporter {
|
|
3
|
-
options: any;
|
|
4
|
-
defaultColor: string;
|
|
5
|
-
levelColorMap: Record<number, string>;
|
|
6
|
-
typeColorMap: Record<string, string>;
|
|
7
|
-
constructor(options: any);
|
|
8
|
-
_getLogFn(level: number): any;
|
|
9
|
-
log(logObj: LogObject): void;
|
|
10
|
-
}
|
|
1
|
+
import type { LogObject } from "../../../../core-types.js";
|
|
2
|
+
export declare class BrowserReporter {
|
|
3
|
+
options: any;
|
|
4
|
+
defaultColor: string;
|
|
5
|
+
levelColorMap: Record<number, string>;
|
|
6
|
+
typeColorMap: Record<string, string>;
|
|
7
|
+
constructor(options: any);
|
|
8
|
+
_getLogFn(level: number): any;
|
|
9
|
+
log(logObj: LogObject): void;
|
|
10
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { LogLevelDeprecated, LogTypeDeprecated } from "../../../../
|
|
2
|
-
import type { FormatOptions, LogObject } from "../../../../
|
|
3
|
-
import { BasicReporter } from "./basic.js";
|
|
4
|
-
export declare const TYPE_COLOR_MAP: Partial<Record<LogTypeDeprecated, string>>;
|
|
5
|
-
export declare const LEVEL_COLOR_MAP: Partial<Record<LogLevelDeprecated, string>>;
|
|
6
|
-
export declare class FancyReporter extends BasicReporter {
|
|
7
|
-
formatStack(stack: string): string;
|
|
8
|
-
formatType(logObj: LogObject, isBadge: boolean): any;
|
|
9
|
-
formatLogObj(logObj: LogObject, opts: FormatOptions): any;
|
|
10
|
-
}
|
|
1
|
+
import type { LogLevelDeprecated, LogTypeDeprecated } from "../../../../core-types.js";
|
|
2
|
+
import type { FormatOptions, LogObject } from "../../../../core-types.js";
|
|
3
|
+
import { BasicReporter } from "./basic.js";
|
|
4
|
+
export declare const TYPE_COLOR_MAP: Partial<Record<LogTypeDeprecated, string>>;
|
|
5
|
+
export declare const LEVEL_COLOR_MAP: Partial<Record<LogLevelDeprecated, string>>;
|
|
6
|
+
export declare class FancyReporter extends BasicReporter {
|
|
7
|
+
formatStack(stack: string): string;
|
|
8
|
+
formatType(logObj: LogObject, isBadge: boolean): any;
|
|
9
|
+
formatLogObj(logObj: LogObject, opts: FormatOptions): any;
|
|
10
|
+
}
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
export type BoxBorderStyle = {
|
|
2
|
-
/**
|
|
3
|
-
* Top left corner
|
|
4
|
-
* @example `┌`
|
|
5
|
-
* @example `╔`
|
|
6
|
-
* @example `╓`
|
|
7
|
-
*/
|
|
8
|
-
tl: string;
|
|
9
|
-
/**
|
|
10
|
-
* Top right corner
|
|
11
|
-
* @example `┐`
|
|
12
|
-
* @example `╗`
|
|
13
|
-
* @example `╖`
|
|
14
|
-
*/
|
|
15
|
-
tr: string;
|
|
16
|
-
/**
|
|
17
|
-
* Bottom left corner
|
|
18
|
-
* @example `└`
|
|
19
|
-
* @example `╚`
|
|
20
|
-
* @example `╙`
|
|
21
|
-
*/
|
|
22
|
-
bl: string;
|
|
23
|
-
/**
|
|
24
|
-
* Bottom right corner
|
|
25
|
-
* @example `┘`
|
|
26
|
-
* @example `╝`
|
|
27
|
-
* @example `╜`
|
|
28
|
-
*/
|
|
29
|
-
br: string;
|
|
30
|
-
/**
|
|
31
|
-
* Horizontal line
|
|
32
|
-
* @example `─`
|
|
33
|
-
* @example `═`
|
|
34
|
-
* @example `─`
|
|
35
|
-
*/
|
|
36
|
-
h: string;
|
|
37
|
-
/**
|
|
38
|
-
* Vertical line
|
|
39
|
-
* @example `│`
|
|
40
|
-
* @example `║`
|
|
41
|
-
* @example `║`
|
|
42
|
-
*/
|
|
43
|
-
v: string;
|
|
44
|
-
};
|
|
45
|
-
declare const boxStylePresets: Record<string, BoxBorderStyle>;
|
|
46
|
-
export type BoxStyle = {
|
|
47
|
-
/**
|
|
48
|
-
* The border color
|
|
49
|
-
* @default 'white'
|
|
50
|
-
*/
|
|
51
|
-
borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
52
|
-
/**
|
|
53
|
-
* The border style
|
|
54
|
-
* @default 'solid'
|
|
55
|
-
* @example 'single-double-rounded'
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* {
|
|
59
|
-
* tl: '┌',
|
|
60
|
-
* tr: '┐',
|
|
61
|
-
* bl: '└',
|
|
62
|
-
* br: '┘',
|
|
63
|
-
* h: '─',
|
|
64
|
-
* v: '│',
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;
|
|
69
|
-
/**
|
|
70
|
-
* The vertical alignment of the text
|
|
71
|
-
* @default 'center'
|
|
72
|
-
*/
|
|
73
|
-
valign: "top" | "center" | "bottom";
|
|
74
|
-
/**
|
|
75
|
-
* The padding of the box
|
|
76
|
-
* @default 2
|
|
77
|
-
*/
|
|
78
|
-
padding: number;
|
|
79
|
-
/**
|
|
80
|
-
* The left margin of the box
|
|
81
|
-
* @default 1
|
|
82
|
-
*/
|
|
83
|
-
marginLeft: number;
|
|
84
|
-
/**
|
|
85
|
-
* The top margin of the box
|
|
86
|
-
* @default 1
|
|
87
|
-
*/
|
|
88
|
-
marginTop: number;
|
|
89
|
-
/**
|
|
90
|
-
* The top margin of the box
|
|
91
|
-
* @default 1
|
|
92
|
-
*/
|
|
93
|
-
marginBottom: number;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* The border options of the box
|
|
97
|
-
*/
|
|
98
|
-
export type BoxOpts = {
|
|
99
|
-
/**
|
|
100
|
-
* Title that will be displayed on top of the box
|
|
101
|
-
* @example 'Hello World'
|
|
102
|
-
* @example 'Hello {name}'
|
|
103
|
-
*/
|
|
104
|
-
title?: string;
|
|
105
|
-
style?: Partial<BoxStyle>;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Creates a styled box with text content, customizable via options.
|
|
109
|
-
* @param {string} text - The text to display in the box.
|
|
110
|
-
* @param {BoxOpts} [_opts={}] - Optional settings for the appearance and behavior of the box. See {@link BoxOpts}.
|
|
111
|
-
* @returns {string} The formatted box as a string, ready for printing or logging.
|
|
112
|
-
*/
|
|
113
|
-
export declare function box(text: string, _opts?: BoxOpts): string;
|
|
114
|
-
export {};
|
|
1
|
+
export type BoxBorderStyle = {
|
|
2
|
+
/**
|
|
3
|
+
* Top left corner
|
|
4
|
+
* @example `┌`
|
|
5
|
+
* @example `╔`
|
|
6
|
+
* @example `╓`
|
|
7
|
+
*/
|
|
8
|
+
tl: string;
|
|
9
|
+
/**
|
|
10
|
+
* Top right corner
|
|
11
|
+
* @example `┐`
|
|
12
|
+
* @example `╗`
|
|
13
|
+
* @example `╖`
|
|
14
|
+
*/
|
|
15
|
+
tr: string;
|
|
16
|
+
/**
|
|
17
|
+
* Bottom left corner
|
|
18
|
+
* @example `└`
|
|
19
|
+
* @example `╚`
|
|
20
|
+
* @example `╙`
|
|
21
|
+
*/
|
|
22
|
+
bl: string;
|
|
23
|
+
/**
|
|
24
|
+
* Bottom right corner
|
|
25
|
+
* @example `┘`
|
|
26
|
+
* @example `╝`
|
|
27
|
+
* @example `╜`
|
|
28
|
+
*/
|
|
29
|
+
br: string;
|
|
30
|
+
/**
|
|
31
|
+
* Horizontal line
|
|
32
|
+
* @example `─`
|
|
33
|
+
* @example `═`
|
|
34
|
+
* @example `─`
|
|
35
|
+
*/
|
|
36
|
+
h: string;
|
|
37
|
+
/**
|
|
38
|
+
* Vertical line
|
|
39
|
+
* @example `│`
|
|
40
|
+
* @example `║`
|
|
41
|
+
* @example `║`
|
|
42
|
+
*/
|
|
43
|
+
v: string;
|
|
44
|
+
};
|
|
45
|
+
declare const boxStylePresets: Record<string, BoxBorderStyle>;
|
|
46
|
+
export type BoxStyle = {
|
|
47
|
+
/**
|
|
48
|
+
* The border color
|
|
49
|
+
* @default 'white'
|
|
50
|
+
*/
|
|
51
|
+
borderColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
52
|
+
/**
|
|
53
|
+
* The border style
|
|
54
|
+
* @default 'solid'
|
|
55
|
+
* @example 'single-double-rounded'
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* {
|
|
59
|
+
* tl: '┌',
|
|
60
|
+
* tr: '┐',
|
|
61
|
+
* bl: '└',
|
|
62
|
+
* br: '┘',
|
|
63
|
+
* h: '─',
|
|
64
|
+
* v: '│',
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
borderStyle: BoxBorderStyle | keyof typeof boxStylePresets;
|
|
69
|
+
/**
|
|
70
|
+
* The vertical alignment of the text
|
|
71
|
+
* @default 'center'
|
|
72
|
+
*/
|
|
73
|
+
valign: "top" | "center" | "bottom";
|
|
74
|
+
/**
|
|
75
|
+
* The padding of the box
|
|
76
|
+
* @default 2
|
|
77
|
+
*/
|
|
78
|
+
padding: number;
|
|
79
|
+
/**
|
|
80
|
+
* The left margin of the box
|
|
81
|
+
* @default 1
|
|
82
|
+
*/
|
|
83
|
+
marginLeft: number;
|
|
84
|
+
/**
|
|
85
|
+
* The top margin of the box
|
|
86
|
+
* @default 1
|
|
87
|
+
*/
|
|
88
|
+
marginTop: number;
|
|
89
|
+
/**
|
|
90
|
+
* The top margin of the box
|
|
91
|
+
* @default 1
|
|
92
|
+
*/
|
|
93
|
+
marginBottom: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The border options of the box
|
|
97
|
+
*/
|
|
98
|
+
export type BoxOpts = {
|
|
99
|
+
/**
|
|
100
|
+
* Title that will be displayed on top of the box
|
|
101
|
+
* @example 'Hello World'
|
|
102
|
+
* @example 'Hello {name}'
|
|
103
|
+
*/
|
|
104
|
+
title?: string;
|
|
105
|
+
style?: Partial<BoxStyle>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Creates a styled box with text content, customizable via options.
|
|
109
|
+
* @param {string} text - The text to display in the box.
|
|
110
|
+
* @param {BoxOpts} [_opts={}] - Optional settings for the appearance and behavior of the box. See {@link BoxOpts}.
|
|
111
|
+
* @returns {string} The formatted box as a string, ready for printing or logging.
|
|
112
|
+
*/
|
|
113
|
+
export declare function box(text: string, _opts?: BoxOpts): string;
|
|
114
|
+
export {};
|