@retrovm/terminal 0.2.0 → 0.2.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.
- package/dist/node.js +8 -0
- package/dist/terminal.js +8 -0
- package/package.json +27 -27
package/dist/node.js
CHANGED
|
@@ -27,6 +27,11 @@ class Color {
|
|
|
27
27
|
this._g = g;
|
|
28
28
|
this._b = b;
|
|
29
29
|
this._a = a;
|
|
30
|
+
} else if (typeof rs === "number" && g === undefined && b === undefined) {
|
|
31
|
+
this._r = (rs & 255) / 255;
|
|
32
|
+
this._g = (rs >> 8 & 255) / 255;
|
|
33
|
+
this._b = (rs >> 16 & 255) / 255;
|
|
34
|
+
this._a = (rs >> 24 & 255) / 255;
|
|
30
35
|
} else if (typeof rs === "string") {
|
|
31
36
|
const match = rs.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i);
|
|
32
37
|
if (match) {
|
|
@@ -126,6 +131,9 @@ class Color {
|
|
|
126
131
|
this._ansiFg = undefined;
|
|
127
132
|
this._ansiBg = undefined;
|
|
128
133
|
}
|
|
134
|
+
toRGBA() {
|
|
135
|
+
return (Math.round(this._a * 255) << 24 | Math.round(this._b * 255) << 16 | Math.round(this._g * 255) << 8 | Math.round(this._r * 255)) >>> 0;
|
|
136
|
+
}
|
|
129
137
|
toString() {
|
|
130
138
|
return `#${Math.round(this._r * 255).toString(16).padStart(2, "0")}${Math.round(this._g * 255).toString(16).padStart(2, "0")}${Math.round(this._b * 255).toString(16).padStart(2, "0")}${Math.round(this._a * 255).toString(16).padStart(2, "0")}`;
|
|
131
139
|
}
|
package/dist/terminal.js
CHANGED
|
@@ -27,6 +27,11 @@ class Color {
|
|
|
27
27
|
this._g = g;
|
|
28
28
|
this._b = b;
|
|
29
29
|
this._a = a;
|
|
30
|
+
} else if (typeof rs === "number" && g === undefined && b === undefined) {
|
|
31
|
+
this._r = (rs & 255) / 255;
|
|
32
|
+
this._g = (rs >> 8 & 255) / 255;
|
|
33
|
+
this._b = (rs >> 16 & 255) / 255;
|
|
34
|
+
this._a = (rs >> 24 & 255) / 255;
|
|
30
35
|
} else if (typeof rs === "string") {
|
|
31
36
|
const match = rs.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i);
|
|
32
37
|
if (match) {
|
|
@@ -126,6 +131,9 @@ class Color {
|
|
|
126
131
|
this._ansiFg = undefined;
|
|
127
132
|
this._ansiBg = undefined;
|
|
128
133
|
}
|
|
134
|
+
toRGBA() {
|
|
135
|
+
return (Math.round(this._a * 255) << 24 | Math.round(this._b * 255) << 16 | Math.round(this._g * 255) << 8 | Math.round(this._r * 255)) >>> 0;
|
|
136
|
+
}
|
|
129
137
|
toString() {
|
|
130
138
|
return `#${Math.round(this._r * 255).toString(16).padStart(2, "0")}${Math.round(this._g * 255).toString(16).padStart(2, "0")}${Math.round(this._b * 255).toString(16).padStart(2, "0")}${Math.round(this._a * 255).toString(16).padStart(2, "0")}`;
|
|
131
139
|
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrovm/terminal",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Fluent ANSI terminal library — 24-bit color, cursor control and screen management for Bun and Node.js",
|
|
3
|
+
"version": "0.2.1",
|
|
5
4
|
"author": "Juan Carlos González Amestoy",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"terminal",
|
|
9
|
-
"ansi",
|
|
10
|
-
"color",
|
|
11
|
-
"cursor",
|
|
12
|
-
"tui",
|
|
13
|
-
"cli",
|
|
14
|
-
"bun",
|
|
15
|
-
"fluent"
|
|
16
|
-
],
|
|
17
5
|
"repository": {
|
|
18
6
|
"type": "git",
|
|
19
7
|
"url": "https://github.com/retrovm/terminal.git"
|
|
20
8
|
},
|
|
21
|
-
"type": "module",
|
|
22
9
|
"module": "src/terminal.ts",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@types/bun": "latest",
|
|
12
|
+
"@types/node": "^25.9.1",
|
|
13
|
+
"typescript": "^5.9.3"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"typescript": "^5"
|
|
26
17
|
},
|
|
27
18
|
"exports": {
|
|
28
19
|
".": {
|
|
@@ -35,22 +26,31 @@
|
|
|
35
26
|
"import": "./dist/terminal.js"
|
|
36
27
|
}
|
|
37
28
|
},
|
|
29
|
+
"description": "Fluent ANSI terminal library — 24-bit color, cursor control and screen management for Bun and Node.js",
|
|
38
30
|
"files": [
|
|
39
31
|
"src",
|
|
40
32
|
"dist"
|
|
41
33
|
],
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
34
|
+
"keywords": [
|
|
35
|
+
"terminal",
|
|
36
|
+
"ansi",
|
|
37
|
+
"color",
|
|
38
|
+
"cursor",
|
|
39
|
+
"tui",
|
|
40
|
+
"cli",
|
|
41
|
+
"bun",
|
|
42
|
+
"fluent"
|
|
43
|
+
],
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
46
47
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "bun build src/terminal.ts src/node.ts --outdir dist --target node && tsc -p tsconfig.build.json",
|
|
50
|
+
"prepublishOnly": "bun run build"
|
|
49
51
|
},
|
|
52
|
+
"type": "module",
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@retrovm/color": "^0.
|
|
52
|
-
},
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
54
|
+
"@retrovm/color": "^0.2.2"
|
|
55
55
|
}
|
|
56
56
|
}
|