tinky-figures 1.0.1 → 1.0.2
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/lib/hooks/useFigures.d.ts +2 -2
- package/lib/hooks/useFigures.js +11 -10
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@ import { FiguresMap } from "../types/figures.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Adapted from `sindresorhus/is-unicode-supported`.
|
|
10
10
|
*
|
|
11
|
-
* @param platform - The operating system platform
|
|
12
|
-
* @param env - The environment variables object
|
|
11
|
+
* @param platform - The operating system platform.
|
|
12
|
+
* @param env - The environment variables object.
|
|
13
13
|
* @returns `true` if Unicode is supported, `false` otherwise.
|
|
14
14
|
*/
|
|
15
15
|
export declare function isUnicodeSupported(platform?: string, env?: Record<string, string | undefined>): boolean;
|
package/lib/hooks/useFigures.js
CHANGED
|
@@ -11,32 +11,33 @@ import { asciiFigures } from "../data/ascii.js";
|
|
|
11
11
|
*
|
|
12
12
|
* Adapted from `sindresorhus/is-unicode-supported`.
|
|
13
13
|
*
|
|
14
|
-
* @param platform - The operating system platform
|
|
15
|
-
* @param env - The environment variables object
|
|
14
|
+
* @param platform - The operating system platform.
|
|
15
|
+
* @param env - The environment variables object.
|
|
16
16
|
* @returns `true` if Unicode is supported, `false` otherwise.
|
|
17
17
|
*/
|
|
18
|
-
export function isUnicodeSupported(platform
|
|
18
|
+
export function isUnicodeSupported(platform, env) {
|
|
19
19
|
// If explicitly set via environment variable, use that
|
|
20
|
-
if (env
|
|
20
|
+
if (env?.TINKY_UNICODE === "true") {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
|
-
if (env
|
|
23
|
+
if (env?.TINKY_UNICODE === "false") {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const TERM = env?.TERM;
|
|
27
|
+
const TERM_PROGRAM = env?.TERM_PROGRAM;
|
|
27
28
|
if (platform !== "win32") {
|
|
28
29
|
return TERM !== "linux"; // Linux console (kernel)
|
|
29
30
|
}
|
|
30
|
-
return (Boolean(env
|
|
31
|
-
Boolean(env
|
|
32
|
-
env
|
|
31
|
+
return (Boolean(env?.WT_SESSION) || // Windows Terminal
|
|
32
|
+
Boolean(env?.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
33
|
+
env?.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
33
34
|
TERM_PROGRAM === "Terminus-Sublime" ||
|
|
34
35
|
TERM_PROGRAM === "vscode" ||
|
|
35
36
|
TERM === "xterm-256color" ||
|
|
36
37
|
TERM === "alacritty" ||
|
|
37
38
|
TERM === "rxvt-unicode" ||
|
|
38
39
|
TERM === "rxvt-unicode-256color" ||
|
|
39
|
-
env
|
|
40
|
+
env?.TERMINAL_EMULATOR === "JetBrains-JediTerm");
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* A React hook that provides a set of figure characters appropriate for the current environment.
|