termark 3.0.0 → 3.0.1

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,54 +0,0 @@
1
- import { ColourLevel } from "./types.mjs";
2
-
3
- //#region src/utilities.d.ts
4
- /**
5
- * Check whether colours are supported in a given terminal environment.
6
- *
7
- * Use {@linkcode hasNoColour} for checking whether terminals that *could* support colour don't do so.
8
- */
9
- declare function areColoursSupported(): boolean;
10
- /**
11
- * Check whether a terminal environment supports at least some level of colours.
12
- *
13
- * @param level A colour level.
14
- */
15
- declare function supports(level: ColourLevel): boolean;
16
- /**
17
- * Check whether a terminal environment supports at most a given colour level.
18
- *
19
- * @param level A colour level.
20
- */
21
- declare function supportsAtMost(level: ColourLevel): boolean;
22
- /**
23
- * Modify the plain text part of a string with ANSI escape sequences.
24
- *
25
- * @example Creating a `toUpperCase` method for ANSI strings
26
- * ```ts
27
- * import { transformPreserveAnsi } from "termark";
28
- *
29
- * const toUpperCase = transformPreserveAnsi((str) => str.toUpperCase());
30
- * ```
31
- *
32
- * @param fn A function that transforms some string.
33
- */
34
- declare function transformPreserveAnsi(fn: (plain: string) => string): (str: string) => string;
35
- /**
36
- * Make some string upper-case while preserving ANSI escape sequences as-is.
37
- *
38
- * @str The string to transform.
39
- */
40
- declare const ansiUpperCase: (str: string) => string;
41
- /**
42
- * Make some string lower-case while preserving ANSI escape sequences as-is.
43
- *
44
- * @param str The string to transform.
45
- */
46
- declare const ansiLowerCase: (str: string) => string;
47
- /**
48
- * Remove ANSI escape sequences from some text.
49
- *
50
- * @param input The input to strip of ANSI escape sequences.
51
- */
52
- declare function stripAnsi(input: string): string;
53
- //#endregion
54
- export { ansiLowerCase, ansiUpperCase, areColoursSupported, stripAnsi, supports, supportsAtMost, transformPreserveAnsi };
@@ -1 +0,0 @@
1
- import{getColourLevel as e}from"./__internal/env.mjs";function t(){return e()!==0}function n(t){return e()>=t}function r(t){return e()<=t}function i(e){return t=>{let n=/(\u{001B}\[[0-9;]*[A-PRZ])|(.+?)/giu,r=``;for(let i of t.matchAll(n)){let t=i[0];r+=t.charCodeAt(0)===27?t:e(t)}return r}}const a=i(e=>e.toUpperCase()),o=i(e=>e.toLowerCase());function s(e){return e.replace(/\u{001B}\[[0-9;]*m/gu,``)}export{o as ansiLowerCase,a as ansiUpperCase,t as areColoursSupported,s as stripAnsi,n as supports,r as supportsAtMost,i as transformPreserveAnsi};