@travetto/terminal 4.1.0 → 5.0.0-rc.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/package.json +2 -2
- package/src/style.ts +2 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/terminal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
4
4
|
"description": "General terminal support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"terminal",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"directory": "module/terminal"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@travetto/base": "^
|
|
27
|
+
"@travetto/base": "^5.0.0-rc.0",
|
|
28
28
|
"chalk": "^4.1.2"
|
|
29
29
|
},
|
|
30
30
|
"travetto": {
|
package/src/style.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
|
|
3
|
-
import { Env, TypedObject
|
|
3
|
+
import { Env, TypedObject } from '@travetto/base';
|
|
4
4
|
|
|
5
|
-
type TemplatePrim =
|
|
5
|
+
type TemplatePrim = number | string | bigint | boolean | RegExp;
|
|
6
6
|
type Color = `#${string}`;
|
|
7
7
|
export type TermStyleInput = Color | { text: Color, background?: Color, inverse?: boolean, bold?: boolean, italic?: boolean, underline?: boolean };
|
|
8
8
|
type TermStylePairInput = TermStyleInput | [dark: TermStyleInput, light: TermStyleInput];
|
|
@@ -10,9 +10,6 @@ export type TermStyleFn = (input: TemplatePrim) => string;
|
|
|
10
10
|
type TermStyledTemplate<T extends string> = (values: TemplateStringsArray, ...keys: (Partial<Record<T, TemplatePrim>> | string)[]) => string;
|
|
11
11
|
export type ColorLevel = 0 | 1 | 2 | 3;
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line no-control-regex
|
|
14
|
-
const ANSI_CODE_REGEX = /(\x1b|\x1B)[\[\]][?]?[0-9;]+[A-Za-z]/g;
|
|
15
|
-
|
|
16
13
|
export class StyleUtil {
|
|
17
14
|
|
|
18
15
|
static #darkAnsi256 = new Set([
|
|
@@ -113,10 +110,4 @@ export class StyleUtil {
|
|
|
113
110
|
};
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
/**
|
|
117
|
-
* Remove style escape sequences
|
|
118
|
-
*/
|
|
119
|
-
static cleanText(text: string): string {
|
|
120
|
-
return text.replace(ANSI_CODE_REGEX, '');
|
|
121
|
-
}
|
|
122
113
|
}
|