@visulima/colorize 1.4.12 → 1.4.14
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/CHANGELOG.md +39 -0
- package/LICENSE.md +27 -0
- package/README.md +54 -54
- package/dist/gradient.cjs +3 -14
- package/dist/gradient.d.cts +1 -79
- package/dist/gradient.d.mts +34 -0
- package/dist/gradient.d.ts +1 -79
- package/dist/gradient.mjs +3 -0
- package/dist/index.browser.d.mts +65 -0
- package/dist/index.browser.d.ts +3 -66
- package/dist/index.browser.mjs +1 -0
- package/dist/index.server.cjs +2 -13
- package/dist/index.server.d.cts +3 -1
- package/dist/index.server.d.mts +65 -0
- package/dist/index.server.d.ts +3 -66
- package/dist/index.server.mjs +1 -0
- package/dist/packem_shared/Colorize-BG7_2JWK.mjs +2 -0
- package/dist/packem_shared/Colorize-gGSr400y.mjs +1 -0
- package/dist/packem_shared/GradientBuilder-Bn5OODm9.cjs +1 -0
- package/dist/packem_shared/GradientBuilder-CL8ERRQu.mjs +1 -0
- package/dist/packem_shared/colorize.server-BayBPE0C.mjs +2 -0
- package/dist/packem_shared/colorize.server-BdZzymFP.cjs +2 -0
- package/dist/packem_shared/convertHexToRgb-CSiKB7t1.mjs +1 -0
- package/dist/packem_shared/convertHexToRgb-DN4AQa3T.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256-D4IPvnol.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256-YETEPW8R.mjs +1 -0
- package/dist/packem_shared/types-CoLB2PX2.d.mjs +67 -0
- package/dist/packem_shared/types-CoLB2PX2.d.mts +67 -0
- package/dist/packem_shared/types-CuuGv4d0.d.cts +81 -0
- package/dist/packem_shared/types-CuuGv4d0.d.mjs +81 -0
- package/dist/packem_shared/types-CuuGv4d0.d.mts +81 -0
- package/dist/template.cjs +2 -15
- package/dist/template.d.cts +4 -64
- package/dist/template.d.mts +7 -0
- package/dist/template.d.ts +4 -64
- package/dist/template.mjs +2 -0
- package/dist/utils.cjs +1 -10
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.mts +9 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.mjs +1 -0
- package/package.json +42 -65
- package/dist/gradient.cjs.map +0 -1
- package/dist/gradient.js +0 -10
- package/dist/gradient.js.map +0 -1
- package/dist/index.browser.js +0 -5
- package/dist/index.browser.js.map +0 -1
- package/dist/index.server.cjs.map +0 -1
- package/dist/index.server.js +0 -8
- package/dist/index.server.js.map +0 -1
- package/dist/template.cjs.map +0 -1
- package/dist/template.js +0 -9
- package/dist/template.js.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.js +0 -5
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
(string: number | string): string;
|
|
4
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
+
ansi256: (code: number) => this;
|
|
6
|
+
bg: (code: number) => this;
|
|
7
|
+
bgAnsi256: (code: number) => this;
|
|
8
|
+
readonly bgBlack: this;
|
|
9
|
+
readonly bgBlackBright: this;
|
|
10
|
+
readonly bgBlue: this;
|
|
11
|
+
readonly bgBlueBright: this;
|
|
12
|
+
readonly bgCyan: this;
|
|
13
|
+
readonly bgCyanBright: this;
|
|
14
|
+
readonly bgGray: this;
|
|
15
|
+
readonly bgGreen: this;
|
|
16
|
+
readonly bgGreenBright: this;
|
|
17
|
+
readonly bgGrey: this;
|
|
18
|
+
bgHex: (color: ColorValueHex) => this;
|
|
19
|
+
readonly bgMagenta: this;
|
|
20
|
+
readonly bgMagentaBright: this;
|
|
21
|
+
readonly bgRed: this;
|
|
22
|
+
readonly bgRedBright: this;
|
|
23
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
+
readonly bgWhite: this;
|
|
25
|
+
readonly bgWhiteBright: this;
|
|
26
|
+
readonly bgYellow: this;
|
|
27
|
+
readonly bgYellowBright: this;
|
|
28
|
+
readonly black: this;
|
|
29
|
+
readonly blackBright: this;
|
|
30
|
+
readonly blue: this;
|
|
31
|
+
readonly blueBright: this;
|
|
32
|
+
readonly bold: this;
|
|
33
|
+
readonly close: string;
|
|
34
|
+
readonly cyan: this;
|
|
35
|
+
readonly cyanBright: this;
|
|
36
|
+
readonly dim: this;
|
|
37
|
+
fg: (code: number) => this;
|
|
38
|
+
readonly gray: this;
|
|
39
|
+
readonly green: this;
|
|
40
|
+
readonly greenBright: this;
|
|
41
|
+
readonly grey: this;
|
|
42
|
+
hex: (color: ColorValueHex) => this;
|
|
43
|
+
readonly hidden: this;
|
|
44
|
+
readonly inverse: this;
|
|
45
|
+
readonly italic: this;
|
|
46
|
+
readonly magenta: this;
|
|
47
|
+
readonly magentaBright: this;
|
|
48
|
+
readonly open: string;
|
|
49
|
+
readonly overline: this;
|
|
50
|
+
readonly red: this;
|
|
51
|
+
readonly redBright: this;
|
|
52
|
+
readonly reset: this;
|
|
53
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
+
readonly strike: this;
|
|
55
|
+
readonly strikethrough: this;
|
|
56
|
+
strip: (string: string) => string;
|
|
57
|
+
readonly underline: this;
|
|
58
|
+
readonly visible: this;
|
|
59
|
+
readonly white: this;
|
|
60
|
+
readonly whiteBright: this;
|
|
61
|
+
readonly yellow: this;
|
|
62
|
+
readonly yellowBright: this;
|
|
63
|
+
}
|
|
64
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
65
|
+
type StopInput = {
|
|
66
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
67
|
+
colorLess?: boolean;
|
|
68
|
+
position: number;
|
|
69
|
+
};
|
|
70
|
+
type StopOutput = {
|
|
71
|
+
color: [number, number, number] | undefined;
|
|
72
|
+
colorLess?: boolean;
|
|
73
|
+
position: number;
|
|
74
|
+
};
|
|
75
|
+
type RGB = {
|
|
76
|
+
b: number;
|
|
77
|
+
g: number;
|
|
78
|
+
r: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
(string: number | string): string;
|
|
4
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
+
ansi256: (code: number) => this;
|
|
6
|
+
bg: (code: number) => this;
|
|
7
|
+
bgAnsi256: (code: number) => this;
|
|
8
|
+
readonly bgBlack: this;
|
|
9
|
+
readonly bgBlackBright: this;
|
|
10
|
+
readonly bgBlue: this;
|
|
11
|
+
readonly bgBlueBright: this;
|
|
12
|
+
readonly bgCyan: this;
|
|
13
|
+
readonly bgCyanBright: this;
|
|
14
|
+
readonly bgGray: this;
|
|
15
|
+
readonly bgGreen: this;
|
|
16
|
+
readonly bgGreenBright: this;
|
|
17
|
+
readonly bgGrey: this;
|
|
18
|
+
bgHex: (color: ColorValueHex) => this;
|
|
19
|
+
readonly bgMagenta: this;
|
|
20
|
+
readonly bgMagentaBright: this;
|
|
21
|
+
readonly bgRed: this;
|
|
22
|
+
readonly bgRedBright: this;
|
|
23
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
+
readonly bgWhite: this;
|
|
25
|
+
readonly bgWhiteBright: this;
|
|
26
|
+
readonly bgYellow: this;
|
|
27
|
+
readonly bgYellowBright: this;
|
|
28
|
+
readonly black: this;
|
|
29
|
+
readonly blackBright: this;
|
|
30
|
+
readonly blue: this;
|
|
31
|
+
readonly blueBright: this;
|
|
32
|
+
readonly bold: this;
|
|
33
|
+
readonly close: string;
|
|
34
|
+
readonly cyan: this;
|
|
35
|
+
readonly cyanBright: this;
|
|
36
|
+
readonly dim: this;
|
|
37
|
+
fg: (code: number) => this;
|
|
38
|
+
readonly gray: this;
|
|
39
|
+
readonly green: this;
|
|
40
|
+
readonly greenBright: this;
|
|
41
|
+
readonly grey: this;
|
|
42
|
+
hex: (color: ColorValueHex) => this;
|
|
43
|
+
readonly hidden: this;
|
|
44
|
+
readonly inverse: this;
|
|
45
|
+
readonly italic: this;
|
|
46
|
+
readonly magenta: this;
|
|
47
|
+
readonly magentaBright: this;
|
|
48
|
+
readonly open: string;
|
|
49
|
+
readonly overline: this;
|
|
50
|
+
readonly red: this;
|
|
51
|
+
readonly redBright: this;
|
|
52
|
+
readonly reset: this;
|
|
53
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
+
readonly strike: this;
|
|
55
|
+
readonly strikethrough: this;
|
|
56
|
+
strip: (string: string) => string;
|
|
57
|
+
readonly underline: this;
|
|
58
|
+
readonly visible: this;
|
|
59
|
+
readonly white: this;
|
|
60
|
+
readonly whiteBright: this;
|
|
61
|
+
readonly yellow: this;
|
|
62
|
+
readonly yellowBright: this;
|
|
63
|
+
}
|
|
64
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
65
|
+
type StopInput = {
|
|
66
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
67
|
+
colorLess?: boolean;
|
|
68
|
+
position: number;
|
|
69
|
+
};
|
|
70
|
+
type StopOutput = {
|
|
71
|
+
color: [number, number, number] | undefined;
|
|
72
|
+
colorLess?: boolean;
|
|
73
|
+
position: number;
|
|
74
|
+
};
|
|
75
|
+
type RGB = {
|
|
76
|
+
b: number;
|
|
77
|
+
g: number;
|
|
78
|
+
r: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
(string: number | string): string;
|
|
4
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
+
ansi256: (code: number) => this;
|
|
6
|
+
bg: (code: number) => this;
|
|
7
|
+
bgAnsi256: (code: number) => this;
|
|
8
|
+
readonly bgBlack: this;
|
|
9
|
+
readonly bgBlackBright: this;
|
|
10
|
+
readonly bgBlue: this;
|
|
11
|
+
readonly bgBlueBright: this;
|
|
12
|
+
readonly bgCyan: this;
|
|
13
|
+
readonly bgCyanBright: this;
|
|
14
|
+
readonly bgGray: this;
|
|
15
|
+
readonly bgGreen: this;
|
|
16
|
+
readonly bgGreenBright: this;
|
|
17
|
+
readonly bgGrey: this;
|
|
18
|
+
bgHex: (color: ColorValueHex) => this;
|
|
19
|
+
readonly bgMagenta: this;
|
|
20
|
+
readonly bgMagentaBright: this;
|
|
21
|
+
readonly bgRed: this;
|
|
22
|
+
readonly bgRedBright: this;
|
|
23
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
+
readonly bgWhite: this;
|
|
25
|
+
readonly bgWhiteBright: this;
|
|
26
|
+
readonly bgYellow: this;
|
|
27
|
+
readonly bgYellowBright: this;
|
|
28
|
+
readonly black: this;
|
|
29
|
+
readonly blackBright: this;
|
|
30
|
+
readonly blue: this;
|
|
31
|
+
readonly blueBright: this;
|
|
32
|
+
readonly bold: this;
|
|
33
|
+
readonly close: string;
|
|
34
|
+
readonly cyan: this;
|
|
35
|
+
readonly cyanBright: this;
|
|
36
|
+
readonly dim: this;
|
|
37
|
+
fg: (code: number) => this;
|
|
38
|
+
readonly gray: this;
|
|
39
|
+
readonly green: this;
|
|
40
|
+
readonly greenBright: this;
|
|
41
|
+
readonly grey: this;
|
|
42
|
+
hex: (color: ColorValueHex) => this;
|
|
43
|
+
readonly hidden: this;
|
|
44
|
+
readonly inverse: this;
|
|
45
|
+
readonly italic: this;
|
|
46
|
+
readonly magenta: this;
|
|
47
|
+
readonly magentaBright: this;
|
|
48
|
+
readonly open: string;
|
|
49
|
+
readonly overline: this;
|
|
50
|
+
readonly red: this;
|
|
51
|
+
readonly redBright: this;
|
|
52
|
+
readonly reset: this;
|
|
53
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
+
readonly strike: this;
|
|
55
|
+
readonly strikethrough: this;
|
|
56
|
+
strip: (string: string) => string;
|
|
57
|
+
readonly underline: this;
|
|
58
|
+
readonly visible: this;
|
|
59
|
+
readonly white: this;
|
|
60
|
+
readonly whiteBright: this;
|
|
61
|
+
readonly yellow: this;
|
|
62
|
+
readonly yellowBright: this;
|
|
63
|
+
}
|
|
64
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
65
|
+
type StopInput = {
|
|
66
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
67
|
+
colorLess?: boolean;
|
|
68
|
+
position: number;
|
|
69
|
+
};
|
|
70
|
+
type StopOutput = {
|
|
71
|
+
color: [number, number, number] | undefined;
|
|
72
|
+
colorLess?: boolean;
|
|
73
|
+
position: number;
|
|
74
|
+
};
|
|
75
|
+
type RGB = {
|
|
76
|
+
b: number;
|
|
77
|
+
g: number;
|
|
78
|
+
r: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|
package/dist/template.cjs
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var isAnsiColorSupported = require('@visulima/is-ansi-color-supported');
|
|
6
|
-
|
|
7
|
-
function C({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}var u=(e,r,t)=>r>e?r:e>t?t:e;var p=e=>{let[,r]=/([a-f\d]{3,6})/i.exec(e)??[],t=r?r.length:0;if(t===3)r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2];else if(t!==6)return [0,0,0];let s=Number.parseInt(r,16);return [s>>16&255,s>>8&255,s&255]};var x=(e,r,t)=>e===r&&r===t?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/51)+6*Math.round(r/51)+Math.round(t/51),f=e=>{let r,t,s;if(e<8)return 30+e;if(e<16)return 90+(e-8);if(e>=232)r=t=s=((e-232)*10+8)/255;else {e-=16;let g=e%36;r=Math.floor(e/36)/5,t=Math.floor(g/6)/5,s=g%6/5;}let o=Math.max(r,t,s)*2;if(o===0)return 30;let i=30+(Math.round(s)<<2|Math.round(t)<<1|Math.round(r));return o===2?i+60:i},A=(e,r,t)=>f(x(e,r,t));var l=39,a=49,M=10,k=isAnsiColorSupported.isStdoutColorSupported(),L={close:"",open:""},n=k>0?(e,r)=>({close:"\x1B["+r+"m",open:"\x1B["+e+"m"}):()=>L,j=e=>(r,t,s)=>e(x(Number(r),Number(t),Number(s))),H=e=>r=>{let[t,s,o]=p(r);return e(t,s,o)},T=e=>n("38;5;"+e,l),S=e=>n("48;5;"+e,a),y=(e,r,t)=>n("38;2;"+e+";"+r+";"+t,l),d=(e,r,t)=>n("48;2;"+e+";"+r+";"+t,a);k===1?(T=e=>n(f(Number(e)),l),S=e=>n(f(Number(e))+M,a),y=(e,r,t)=>n(A(Number(e),Number(r),Number(t)),l),d=(e,r,t)=>n(A(Number(e),Number(r),Number(t))+M,a)):k===2&&(y=j(T),d=j(S));var w={bold:n(1,22),dim:n(2,22),hidden:n(8,28),inverse:n(7,27),italic:n(3,23),overline:n(53,55),reset:n(0,0),strike:n(9,29),strikethrough:n(9,29),underline:n(4,24),visible:L},R={bgBlack:n(40,a),bgBlackBright:n(100,a),bgBlue:n(44,a),bgBlueBright:n(104,a),bgCyan:n(46,a),bgCyanBright:n(106,a),bgGray:n(100,a),bgGreen:n(42,a),bgGreenBright:n(102,a),bgGrey:n(100,a),bgMagenta:n(45,a),bgMagentaBright:n(105,a),bgRed:n(41,a),bgRedBright:n(101,a),bgWhite:n(47,a),bgWhiteBright:n(107,a),bgYellow:n(43,a),bgYellowBright:n(103,a),black:n(30,l),blackBright:n(90,l),blue:n(34,l),blueBright:n(94,l),cyan:n(36,l),cyanBright:n(96,l),gray:n(90,l),green:n(32,l),greenBright:n(92,l),grey:n(90,l),magenta:n(35,l),magentaBright:n(95,l),red:n(31,l),redBright:n(91,l),white:n(37,l),whiteBright:n(97,l),yellow:n(33,l),yellowBright:n(93,l)},B={bg:e=>S(u(e,0,255)),bgHex:H(d),bgRgb:(e,r,t)=>d(u(e,0,255),u(r,0,255),u(t,0,255)),fg:e=>T(u(e,0,255)),hex:H(y),rgb:(e,r,t)=>y(u(e,0,255),u(r,0,255),u(t,0,255))};var O=(e,r,t)=>{if(r==="")return e;let s=e.indexOf(r);if(s<0)return e;let o=r.length,i=0,g="";for(;~s;)g+=e.slice(i,s)+t,i=s+o,s=e.indexOf(r,i);return g+e.slice(i)};var b={},z=null,W=(e,r,t)=>{if(!e)return "";let s=e.raw==null?e+"":String.raw(e,...r);if(s.includes("\x1B"))for(let o=t;o;o=o.props)s=O(s,o.close,o.open);return s.includes(`
|
|
8
|
-
`)&&(s=s.replace(/(\r*\n)/g,t.closeStack+"$1"+t.openStack)),t.openStack+s+t.closeStack},E=({props:e},{close:r,open:t})=>{let s=(e?.openStack??"")+t,o=r+(e?.closeStack??""),i=(g,...c)=>W(g,c,i.props);return Object.setPrototypeOf(i,z),i.props={close:r,closeStack:o,open:t,openStack:s,props:e},i.open=s,i.close=o,i},X=function(){let e=r=>r+"";e.strip=r=>r.replaceAll(C(),"");for(let r in R)b[r]={get(){let t=E(this,R[r]);return Object.defineProperty(this,r,{value:t}),t}};for(let r in w)b[r]={get(){let t=E(this,w[r]);return Object.defineProperty(this,r,{value:t}),t}};return z=Object.defineProperties({},b),Object.setPrototypeOf(e,z),e};for(let e in B)b[e]={get(){return (...r)=>E(this,B[e](...r))}};b.ansi256=b.fg;b.bgAnsi256=b.bg;var G=X;var v=e=>(r,...t)=>{if(!Array.isArray(r)||!Array.isArray(r.raw))throw new TypeError("A tagged template literal must be provided");let s=[r.raw[0]];for(let o=1;o<r.raw.length;o++)s.push(String(t[o-1]).replaceAll(/[{}\\]/g,"\\$&"),String(r.raw[o]));return e(s.join(""))};var Z=new Map([["\\","\\"],["0","\0"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
|
|
9
|
-
`],["r","\r"],["t"," "],["v","\v"]]),D=e=>{let r=e.startsWith("u"),t=e[1]==="{";return r&&!t&&e.length===5||e.startsWith("x")&&e.length===3?String.fromCodePoint(Number.parseInt(e.slice(1),16)):r&&t?String.fromCodePoint(Number.parseInt(e.slice(2,-1),16)):Z.get(e)??e};var q=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,$=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,F=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Y=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,U=(e,r)=>{let t=[],s=r.trim().split(/\s*,\s*/),o;for(let i of s){let g=Number(i);if(!Number.isNaN(g))t.push(g);else if(o=F.exec(i))t.push(o[2].replace(Y,(c,m,h)=>m?D(m):h));else throw new Error(`Invalid template style argument: ${i} (in style '${e}')`)}return t},J=e=>{$.lastIndex=0;let r=[],t;for(;(t=$.exec(e))!==null;){let s=t[1];t[2]?r.push([s,...U(s,t[2])]):t[3]||t[4]?(t[3]&&r.push(["rgb",...p(t[3])]),t[4]&&r.push(["bgRgb",...p(t[4])])):r.push([s]);}return r},I=(e,r)=>{let t={};for(let o of r)for(let i of o.styles)t[i[0]]=o.inverse?null:i.slice(1);let s=e;for(let[o,i]of Object.entries(t))if(Array.isArray(i)){if(!(o in s))throw new Error(`Unknown style: ${o}`);s=i.length>0?s[o](...i):s[o];}return s},N=e=>r=>{let t=[],s=[],o=[];if(r.replaceAll(q,(i,g,c,m,h,V)=>{if(g)o.push(D(g));else if(m){let P=o.join("");o=[],s.push(t.length===0?P:I(e,t)(P)),t.push({inverse:c,styles:J(m)});}else if(h){if(t.length===0)throw new Error("Found extraneous } in template literal");s.push(I(e,t)(o.join(""))),o=[],t.pop();}else o.push(V);}),s.push(o.join("")),t.length>0)throw new Error(`template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`);return s.join("")};var K=new G,ke=e=>v(N(e)),Q=N(K),Te=v(Q);
|
|
10
|
-
|
|
11
|
-
module.exports = Te;
|
|
12
|
-
exports.makeTaggedTemplate = ke;
|
|
13
|
-
exports.template = Q;
|
|
14
|
-
//# sourceMappingURL=template.cjs.map
|
|
15
|
-
//# sourceMappingURL=template.cjs.map
|
|
1
|
+
"use strict";var T=Object.defineProperty;var i=(e,t)=>T(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("./packem_shared/colorize.server-BdZzymFP.cjs"),g=require("./packem_shared/convertHexToRgb-DN4AQa3T.cjs");var j=Object.defineProperty,A=i((e,t)=>j(e,"name",{value:t,configurable:!0}),"n");const h=A(e=>(t,...r)=>{if(!Array.isArray(t)||!Array.isArray(t.raw))throw new TypeError("A tagged template literal must be provided");const a=[t.raw[0]];for(let n=1;n<t.raw.length;n++)a.push(String(r[n-1]).replaceAll(/[{}\\]/g,"\\$&"),String(t.raw[n]));return e(a.join(""))},"makeColorizeTemplate");var k=Object.defineProperty,$=i((e,t)=>k(e,"name",{value:t,configurable:!0}),"e");const S=new Map([["\\","\\"],["0","\0"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"]]),b=$(e=>{const t=e.startsWith("u"),r=e[1]==="{";return t&&!r&&e.length===5||e.startsWith("x")&&e.length===3?String.fromCodePoint(Number.parseInt(e.slice(1),16)):t&&r?String.fromCodePoint(Number.parseInt(e.slice(2,-1),16)):S.get(e)??e},"unescape");var P=Object.defineProperty,u=i((e,t)=>P(e,"name",{value:t,configurable:!0}),"u");const E=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,m=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,N=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,O=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,C=u((e,t)=>{const r=[],a=t.trim().split(/\s*,\s*/);let n;for(const s of a){const o=Number(s);if(!Number.isNaN(o))r.push(o);else if(n=N.exec(s))r.push(n[2].replace(O,(p,l,c)=>l?b(l):c));else throw new Error(`Invalid template style argument: ${s} (in style '${e}')`)}return r},"parseArguments"),I=u(e=>{m.lastIndex=0;const t=[];let r;for(;(r=m.exec(e))!==null;){const a=r[1];r[2]?t.push([a,...C(a,r[2])]):r[3]||r[4]?(r[3]&&t.push(["rgb",...g.convertHexToRgb(r[3])]),r[4]&&t.push(["bgRgb",...g.convertHexToRgb(r[4])])):t.push([a])}return t},"parseStyle"),d=u((e,t)=>{const r={};for(const n of t)for(const s of n.styles)r[s[0]]=n.inverse?null:s.slice(1);let a=e;for(const[n,s]of Object.entries(r))if(Array.isArray(s)){if(!(n in a))throw new Error(`Unknown style: ${n}`);a=s.length>0?a[n](...s):a[n]}return a},"buildStyle"),v=u(e=>t=>{const r=[],a=[];let n=[];if(t.replaceAll(E,(s,o,p,l,c,y)=>{if(o)n.push(b(o));else if(l){const f=n.join("");n=[],a.push(r.length===0?f:d(e,r)(f)),r.push({inverse:p,styles:I(l)})}else if(c){if(r.length===0)throw new Error("Found extraneous } in template literal");a.push(d(e,r)(n.join(""))),n=[],r.pop()}else n.push(y)}),a.push(n.join("")),r.length>0)throw new Error(`template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`);return a.join("")},"makeTemplate");var R=Object.defineProperty,z=i((e,t)=>R(e,"name",{value:t,configurable:!0}),"o");const H=new x.m,M=z(e=>h(v(e)),"makeTaggedTemplate"),w=v(H),_=h(w);exports.default=_;exports.makeTaggedTemplate=M;exports.template=w;
|
package/dist/template.d.cts
CHANGED
|
@@ -1,69 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
interface ColorizeType {
|
|
3
|
-
(string: number | string): string;
|
|
4
|
-
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
-
ansi256: (code: number) => this;
|
|
6
|
-
bg: (code: number) => this;
|
|
7
|
-
bgAnsi256: (code: number) => this;
|
|
8
|
-
readonly bgBlack: this;
|
|
9
|
-
readonly bgBlackBright: this;
|
|
10
|
-
readonly bgBlue: this;
|
|
11
|
-
readonly bgBlueBright: this;
|
|
12
|
-
readonly bgCyan: this;
|
|
13
|
-
readonly bgCyanBright: this;
|
|
14
|
-
readonly bgGray: this;
|
|
15
|
-
readonly bgGreen: this;
|
|
16
|
-
readonly bgGreenBright: this;
|
|
17
|
-
readonly bgGrey: this;
|
|
18
|
-
bgHex: (color: ColorValueHex) => this;
|
|
19
|
-
readonly bgMagenta: this;
|
|
20
|
-
readonly bgMagentaBright: this;
|
|
21
|
-
readonly bgRed: this;
|
|
22
|
-
readonly bgRedBright: this;
|
|
23
|
-
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
-
readonly bgWhite: this;
|
|
25
|
-
readonly bgWhiteBright: this;
|
|
26
|
-
readonly bgYellow: this;
|
|
27
|
-
readonly bgYellowBright: this;
|
|
28
|
-
readonly black: this;
|
|
29
|
-
readonly blackBright: this;
|
|
30
|
-
readonly blue: this;
|
|
31
|
-
readonly blueBright: this;
|
|
32
|
-
readonly bold: this;
|
|
33
|
-
readonly close: string;
|
|
34
|
-
readonly cyan: this;
|
|
35
|
-
readonly cyanBright: this;
|
|
36
|
-
readonly dim: this;
|
|
37
|
-
fg: (code: number) => this;
|
|
38
|
-
readonly gray: this;
|
|
39
|
-
readonly green: this;
|
|
40
|
-
readonly greenBright: this;
|
|
41
|
-
readonly grey: this;
|
|
42
|
-
hex: (color: ColorValueHex) => this;
|
|
43
|
-
readonly hidden: this;
|
|
44
|
-
readonly inverse: this;
|
|
45
|
-
readonly italic: this;
|
|
46
|
-
readonly magenta: this;
|
|
47
|
-
readonly magentaBright: this;
|
|
48
|
-
readonly open: string;
|
|
49
|
-
readonly overline: this;
|
|
50
|
-
readonly red: this;
|
|
51
|
-
readonly redBright: this;
|
|
52
|
-
readonly reset: this;
|
|
53
|
-
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
-
readonly strike: this;
|
|
55
|
-
readonly strikethrough: this;
|
|
56
|
-
strip: (string: string) => string;
|
|
57
|
-
readonly underline: this;
|
|
58
|
-
readonly visible: this;
|
|
59
|
-
readonly white: this;
|
|
60
|
-
readonly whiteBright: this;
|
|
61
|
-
readonly yellow: this;
|
|
62
|
-
readonly yellowBright: this;
|
|
63
|
-
}
|
|
1
|
+
import { C as ColorizeType } from './packem_shared/types-CuuGv4d0.cjs';
|
|
64
2
|
|
|
65
3
|
declare const makeTaggedTemplate: (instance: ColorizeType) => ((firstString: TemplateStringsArray, ...arguments_: any[]) => string);
|
|
66
4
|
declare const template: (string: string) => string;
|
|
67
5
|
declare const _default: (firstString: TemplateStringsArray, ...arguments_: any[]) => string;
|
|
68
6
|
|
|
69
|
-
export {
|
|
7
|
+
export { makeTaggedTemplate, template };
|
|
8
|
+
|
|
9
|
+
export = _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { C as ColorizeType } from './packem_shared/types-CuuGv4d0.mjs';
|
|
2
|
+
|
|
3
|
+
declare const makeTaggedTemplate: (instance: ColorizeType) => ((firstString: TemplateStringsArray, ...arguments_: any[]) => string);
|
|
4
|
+
declare const template: (string: string) => string;
|
|
5
|
+
declare const _default: (firstString: TemplateStringsArray, ...arguments_: any[]) => string;
|
|
6
|
+
|
|
7
|
+
export { _default as default, makeTaggedTemplate, template };
|
package/dist/template.d.ts
CHANGED
|
@@ -1,69 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
interface ColorizeType {
|
|
3
|
-
(string: number | string): string;
|
|
4
|
-
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
5
|
-
ansi256: (code: number) => this;
|
|
6
|
-
bg: (code: number) => this;
|
|
7
|
-
bgAnsi256: (code: number) => this;
|
|
8
|
-
readonly bgBlack: this;
|
|
9
|
-
readonly bgBlackBright: this;
|
|
10
|
-
readonly bgBlue: this;
|
|
11
|
-
readonly bgBlueBright: this;
|
|
12
|
-
readonly bgCyan: this;
|
|
13
|
-
readonly bgCyanBright: this;
|
|
14
|
-
readonly bgGray: this;
|
|
15
|
-
readonly bgGreen: this;
|
|
16
|
-
readonly bgGreenBright: this;
|
|
17
|
-
readonly bgGrey: this;
|
|
18
|
-
bgHex: (color: ColorValueHex) => this;
|
|
19
|
-
readonly bgMagenta: this;
|
|
20
|
-
readonly bgMagentaBright: this;
|
|
21
|
-
readonly bgRed: this;
|
|
22
|
-
readonly bgRedBright: this;
|
|
23
|
-
bgRgb: (red: number, green: number, blue: number) => this;
|
|
24
|
-
readonly bgWhite: this;
|
|
25
|
-
readonly bgWhiteBright: this;
|
|
26
|
-
readonly bgYellow: this;
|
|
27
|
-
readonly bgYellowBright: this;
|
|
28
|
-
readonly black: this;
|
|
29
|
-
readonly blackBright: this;
|
|
30
|
-
readonly blue: this;
|
|
31
|
-
readonly blueBright: this;
|
|
32
|
-
readonly bold: this;
|
|
33
|
-
readonly close: string;
|
|
34
|
-
readonly cyan: this;
|
|
35
|
-
readonly cyanBright: this;
|
|
36
|
-
readonly dim: this;
|
|
37
|
-
fg: (code: number) => this;
|
|
38
|
-
readonly gray: this;
|
|
39
|
-
readonly green: this;
|
|
40
|
-
readonly greenBright: this;
|
|
41
|
-
readonly grey: this;
|
|
42
|
-
hex: (color: ColorValueHex) => this;
|
|
43
|
-
readonly hidden: this;
|
|
44
|
-
readonly inverse: this;
|
|
45
|
-
readonly italic: this;
|
|
46
|
-
readonly magenta: this;
|
|
47
|
-
readonly magentaBright: this;
|
|
48
|
-
readonly open: string;
|
|
49
|
-
readonly overline: this;
|
|
50
|
-
readonly red: this;
|
|
51
|
-
readonly redBright: this;
|
|
52
|
-
readonly reset: this;
|
|
53
|
-
rgb: (red: number, green: number, blue: number) => this;
|
|
54
|
-
readonly strike: this;
|
|
55
|
-
readonly strikethrough: this;
|
|
56
|
-
strip: (string: string) => string;
|
|
57
|
-
readonly underline: this;
|
|
58
|
-
readonly visible: this;
|
|
59
|
-
readonly white: this;
|
|
60
|
-
readonly whiteBright: this;
|
|
61
|
-
readonly yellow: this;
|
|
62
|
-
readonly yellowBright: this;
|
|
63
|
-
}
|
|
1
|
+
import { C as ColorizeType } from './packem_shared/types-CuuGv4d0.d.mjs';
|
|
64
2
|
|
|
65
3
|
declare const makeTaggedTemplate: (instance: ColorizeType) => ((firstString: TemplateStringsArray, ...arguments_: any[]) => string);
|
|
66
4
|
declare const template: (string: string) => string;
|
|
67
5
|
declare const _default: (firstString: TemplateStringsArray, ...arguments_: any[]) => string;
|
|
68
6
|
|
|
69
|
-
export {
|
|
7
|
+
export { makeTaggedTemplate, template };
|
|
8
|
+
|
|
9
|
+
export = _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var y=Object.defineProperty;var i=(e,t)=>y(e,"name",{value:t,configurable:!0});import{m as x}from"./packem_shared/colorize.server-BayBPE0C.mjs";import{convertHexToRgb as m}from"./packem_shared/convertHexToRgb-CSiKB7t1.mjs";var T=Object.defineProperty,j=i((e,t)=>T(e,"name",{value:t,configurable:!0}),"n");const d=j(e=>(t,...r)=>{if(!Array.isArray(t)||!Array.isArray(t.raw))throw new TypeError("A tagged template literal must be provided");const a=[t.raw[0]];for(let n=1;n<t.raw.length;n++)a.push(String(r[n-1]).replaceAll(/[{}\\]/g,"\\$&"),String(t.raw[n]));return e(a.join(""))},"makeColorizeTemplate");var A=Object.defineProperty,$=i((e,t)=>A(e,"name",{value:t,configurable:!0}),"e");const k=new Map([["\\","\\"],["0","\0"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"]]),b=$(e=>{const t=e.startsWith("u"),r=e[1]==="{";return t&&!r&&e.length===5||e.startsWith("x")&&e.length===3?String.fromCodePoint(Number.parseInt(e.slice(1),16)):t&&r?String.fromCodePoint(Number.parseInt(e.slice(2,-1),16)):k.get(e)??e},"unescape");var E=Object.defineProperty,p=i((e,t)=>E(e,"name",{value:t,configurable:!0}),"u");const N=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,g=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,P=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,S=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,O=p((e,t)=>{const r=[],a=t.trim().split(/\s*,\s*/);let n;for(const s of a){const o=Number(s);if(!Number.isNaN(o))r.push(o);else if(n=P.exec(s))r.push(n[2].replace(S,(f,l,u)=>l?b(l):u));else throw new Error(`Invalid template style argument: ${s} (in style '${e}')`)}return r},"parseArguments"),C=p(e=>{g.lastIndex=0;const t=[];let r;for(;(r=g.exec(e))!==null;){const a=r[1];r[2]?t.push([a,...O(a,r[2])]):r[3]||r[4]?(r[3]&&t.push(["rgb",...m(r[3])]),r[4]&&t.push(["bgRgb",...m(r[4])])):t.push([a])}return t},"parseStyle"),h=p((e,t)=>{const r={};for(const n of t)for(const s of n.styles)r[s[0]]=n.inverse?null:s.slice(1);let a=e;for(const[n,s]of Object.entries(r))if(Array.isArray(s)){if(!(n in a))throw new Error(`Unknown style: ${n}`);a=s.length>0?a[n](...s):a[n]}return a},"buildStyle"),w=p(e=>t=>{const r=[],a=[];let n=[];if(t.replaceAll(N,(s,o,f,l,u,v)=>{if(o)n.push(b(o));else if(l){const c=n.join("");n=[],a.push(r.length===0?c:h(e,r)(c)),r.push({inverse:f,styles:C(l)})}else if(u){if(r.length===0)throw new Error("Found extraneous } in template literal");a.push(h(e,r)(n.join(""))),n=[],r.pop()}else n.push(v)}),a.push(n.join("")),r.length>0)throw new Error(`template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`);return a.join("")},"makeTemplate");var I=Object.defineProperty,z=i((e,t)=>I(e,"name",{value:t,configurable:!0}),"o");const R=new x,M=z(e=>d(w(e)),"makeTaggedTemplate"),W=w(R),U=d(W);export{U as default,M as makeTaggedTemplate,W as template};
|
package/dist/utils.cjs
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var b=n=>{let[,r]=/([a-f\d]{3,6})/i.exec(n)??[],t=r?r.length:0;if(t===3)r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2];else if(t!==6)return [0,0,0];let e=Number.parseInt(r,16);return [e>>16&255,e>>8&255,e&255]};var a=(n,r,t)=>n===r&&r===t?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/51)+6*Math.round(r/51)+Math.round(t/51),i=n=>{let r,t,e;if(n<8)return 30+n;if(n<16)return 90+(n-8);if(n>=232)r=t=e=((n-232)*10+8)/255;else {n-=16;let u=n%36;r=Math.floor(n/36)/5,t=Math.floor(u/6)/5,e=u%6/5;}let s=Math.max(r,t,e)*2;if(s===0)return 30;let o=30+(Math.round(e)<<2|Math.round(t)<<1|Math.round(r));return s===2?o+60:o},g=(n,r,t)=>i(a(n,r,t));
|
|
4
|
-
|
|
5
|
-
exports.ansi256To16 = i;
|
|
6
|
-
exports.convertHexToRgb = b;
|
|
7
|
-
exports.rgbToAnsi16 = g;
|
|
8
|
-
exports.rgbToAnsi256 = a;
|
|
9
|
-
//# sourceMappingURL=utils.cjs.map
|
|
10
|
-
//# sourceMappingURL=utils.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./packem_shared/convertHexToRgb-DN4AQa3T.cjs"),o=require("./packem_shared/rgbToAnsi256-D4IPvnol.cjs");exports.convertHexToRgb=e.convertHexToRgb;exports.ansi256To16=o.ansi256To16;exports.rgbToAnsi16=o.rgbToAnsi16;exports.rgbToAnsi256=o.rgbToAnsi256;
|
package/dist/utils.d.cts
CHANGED
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { a as ColorValueHex } from './packem_shared/types-CuuGv4d0.mjs';
|
|
2
|
+
|
|
3
|
+
declare const convertHexToRgb: (hex: ColorValueHex | string) => [number, number, number];
|
|
4
|
+
|
|
5
|
+
declare const rgbToAnsi256: (r: number, g: number, b: number) => number;
|
|
6
|
+
declare const ansi256To16: (code: number) => number;
|
|
7
|
+
declare const rgbToAnsi16: (r: number, g: number, b: number) => number;
|
|
8
|
+
|
|
9
|
+
export { ansi256To16, convertHexToRgb, rgbToAnsi16, rgbToAnsi256 };
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{convertHexToRgb as e}from"./packem_shared/convertHexToRgb-CSiKB7t1.mjs";import{ansi256To16 as T,rgbToAnsi16 as b,rgbToAnsi256 as g}from"./packem_shared/rgbToAnsi256-YETEPW8R.mjs";export{T as ansi256To16,e as convertHexToRgb,b as rgbToAnsi16,g as rgbToAnsi256};
|