tinky-figures 1.0.0 → 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.
@@ -1,4 +1,4 @@
1
- import { FiguresMap } from "../types/figures";
1
+ import { FiguresMap } from "../types/figures.js";
2
2
  /**
3
3
  * Fallback character set for environments that do not support full Unicode.
4
4
  *
@@ -1,2 +1,2 @@
1
- export { unicodeFigures } from "./unicode";
2
- export { asciiFigures } from "./ascii";
1
+ export { unicodeFigures } from "./unicode.js";
2
+ export { asciiFigures } from "./ascii.js";
package/lib/data/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { unicodeFigures } from "./unicode";
2
- export { asciiFigures } from "./ascii";
1
+ export { unicodeFigures } from "./unicode.js";
2
+ export { asciiFigures } from "./ascii.js";
@@ -1,4 +1,4 @@
1
- import { FiguresMap } from "../types/figures";
1
+ import { FiguresMap } from "../types/figures.js";
2
2
  /**
3
3
  * Full Unicode character set.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { FiguresMap } from "../types/figures";
1
+ import { FiguresMap } from "../types/figures.js";
2
2
  /**
3
3
  * Detect if Unicode is supported in the current terminal environment.
4
4
  *
@@ -8,8 +8,8 @@ import { FiguresMap } from "../types/figures";
8
8
  *
9
9
  * Adapted from `sindresorhus/is-unicode-supported`.
10
10
  *
11
- * @param platform - The operating system platform (default: `process.platform`).
12
- * @param env - The environment variables object (default: `process.env`).
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;
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
  import { useApp } from "tinky";
3
- import { unicodeFigures } from "../data/unicode";
4
- import { asciiFigures } from "../data/ascii";
3
+ import { unicodeFigures } from "../data/unicode.js";
4
+ import { asciiFigures } from "../data/ascii.js";
5
5
  /**
6
6
  * Detect if Unicode is supported in the current terminal environment.
7
7
  *
@@ -11,32 +11,33 @@ import { asciiFigures } from "../data/ascii";
11
11
  *
12
12
  * Adapted from `sindresorhus/is-unicode-supported`.
13
13
  *
14
- * @param platform - The operating system platform (default: `process.platform`).
15
- * @param env - The environment variables object (default: `process.env`).
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 = process.platform, env = process.env) {
18
+ export function isUnicodeSupported(platform, env) {
19
19
  // If explicitly set via environment variable, use that
20
- if (env.TINKY_UNICODE === "true") {
20
+ if (env?.TINKY_UNICODE === "true") {
21
21
  return true;
22
22
  }
23
- if (env.TINKY_UNICODE === "false") {
23
+ if (env?.TINKY_UNICODE === "false") {
24
24
  return false;
25
25
  }
26
- const { TERM, TERM_PROGRAM } = env;
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.WT_SESSION) || // Windows Terminal
31
- Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
32
- env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
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.TERMINAL_EMULATOR === "JetBrains-JediTerm");
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.
package/lib/index.d.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export { useFigures, isUnicodeSupported } from "./hooks/useFigures";
10
- export type { FiguresMap } from "./types/figures";
11
- export { unicodeFigures, asciiFigures } from "./data";
9
+ export { useFigures, isUnicodeSupported } from "./hooks/useFigures.js";
10
+ export type { FiguresMap } from "./types/figures.js";
11
+ export { unicodeFigures, asciiFigures } from "./data/index.js";
package/lib/index.js CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export { useFigures, isUnicodeSupported } from "./hooks/useFigures";
10
- export { unicodeFigures, asciiFigures } from "./data";
9
+ export { useFigures, isUnicodeSupported } from "./hooks/useFigures.js";
10
+ export { unicodeFigures, asciiFigures } from "./data/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinky-figures",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Unicode symbols with ASCII fallbacks for tinky applications",
5
5
  "keywords": [
6
6
  "tinky",