@karinjs/plugin-basic 1.3.4 → 1.3.5

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,6 +1,6 @@
1
1
  import {
2
2
  render
3
- } from "../chunk-KMYEMP7Q.js";
3
+ } from "../chunk-4GSJ5FLI.js";
4
4
 
5
5
  // src/apps/logger.ts
6
6
  import fs from "fs";
@@ -47,6 +47,56 @@ var LOG_LEVEL_COLOR_CODE = {
47
47
  MARK: "\x1B[90m"
48
48
  // 灰色
49
49
  };
50
+ var ansi256ToRgb = (idx) => {
51
+ if (idx < 0 || idx > 255 || Number.isNaN(idx)) return null;
52
+ const basicPalette = [
53
+ "#020617",
54
+ // 0: black
55
+ "#ef4444",
56
+ // 1: red
57
+ "#22c55e",
58
+ // 2: green
59
+ "#eab308",
60
+ // 3: yellow
61
+ "#3b82f6",
62
+ // 4: blue
63
+ "#ec4899",
64
+ // 5: magenta
65
+ "#06b6d4",
66
+ // 6: cyan
67
+ "#e5e7eb",
68
+ // 7: white (light gray)
69
+ "#6b7280",
70
+ // 8: bright black (gray)
71
+ "#f97373",
72
+ // 9: bright red
73
+ "#4ade80",
74
+ // 10: bright green
75
+ "#fde047",
76
+ // 11: bright yellow
77
+ "#60a5fa",
78
+ // 12: bright blue
79
+ "#a855f7",
80
+ // 13: bright magenta
81
+ "#38bdf8",
82
+ // 14: bright cyan
83
+ "#f9fafb"
84
+ // 15: bright white
85
+ ];
86
+ if (idx <= 15) {
87
+ return basicPalette[idx];
88
+ }
89
+ if (idx >= 16 && idx <= 231) {
90
+ const n = idx - 16;
91
+ const r = Math.floor(n / 36);
92
+ const g = Math.floor(n % 36 / 6);
93
+ const b = n % 6;
94
+ const conv = (c) => c === 0 ? 0 : 55 + c * 40;
95
+ return `rgb(${conv(r)}, ${conv(g)}, ${conv(b)})`;
96
+ }
97
+ const gray = 8 + (idx - 232) * 10;
98
+ return `rgb(${gray}, ${gray}, ${gray})`;
99
+ };
50
100
  var ansiToHtml = (text) => {
51
101
  if (!text) return "";
52
102
  let result = "";
@@ -73,6 +123,15 @@ var ansiToHtml = (text) => {
73
123
  }
74
124
  return "";
75
125
  }
126
+ if (codes[0] === 38 && codes[1] === 5 && codes.length >= 3) {
127
+ const idx = codes[2];
128
+ const rgb = ansi256ToRgb(idx);
129
+ if (rgb) {
130
+ openSpan = `color: ${rgb}`;
131
+ result += `<span style="${openSpan}">`;
132
+ }
133
+ return "";
134
+ }
76
135
  if (codes.length === 1 && (codes[0] === 0 || codes[0] === 39)) {
77
136
  return "";
78
137
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cfg
3
- } from "../chunk-3EM2TC2Y.js";
4
- import "../chunk-KMYEMP7Q.js";
3
+ } from "../chunk-TUC5A7K4.js";
4
+ import "../chunk-4GSJ5FLI.js";
5
5
 
6
6
  // src/apps/login.ts
7
7
  import karin, { common, contactFriend, logger, segment } from "node-karin";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cfg
3
- } from "../chunk-3EM2TC2Y.js";
4
- import "../chunk-KMYEMP7Q.js";
3
+ } from "../chunk-TUC5A7K4.js";
4
+ import "../chunk-4GSJ5FLI.js";
5
5
 
6
6
  // src/apps/restart.ts
7
7
  import { common, karin, logger, restart } from "node-karin";
@@ -7,8 +7,8 @@ import {
7
7
  } from "../chunk-ODFXVVIE.js";
8
8
  import {
9
9
  cfg
10
- } from "../chunk-3EM2TC2Y.js";
11
- import "../chunk-KMYEMP7Q.js";
10
+ } from "../chunk-TUC5A7K4.js";
11
+ import "../chunk-4GSJ5FLI.js";
12
12
 
13
13
  // src/apps/status.ts
14
14
  import { karin } from "node-karin";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  cfg,
3
3
  sendToFirstAdmin
4
- } from "../chunk-3EM2TC2Y.js";
4
+ } from "../chunk-TUC5A7K4.js";
5
5
  import {
6
6
  render
7
- } from "../chunk-KMYEMP7Q.js";
7
+ } from "../chunk-4GSJ5FLI.js";
8
8
 
9
9
  // src/apps/update.ts
10
10
  import fs from "fs";
@@ -7,7 +7,7 @@ import { karinPathBase } from "node-karin";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@karinjs/plugin-basic",
10
- version: "1.3.4",
10
+ version: "1.3.5",
11
11
  description: "Karin\u7684\u57FA\u7840\u63D2\u4EF6,\u63D0\u4F9B\u6700\u57FA\u7840\u7684\u529F\u80FD",
12
12
  homepage: "https://github.com/KarinJS/karin-plugin-basic",
13
13
  bugs: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  plugin
3
- } from "./chunk-KMYEMP7Q.js";
3
+ } from "./chunk-4GSJ5FLI.js";
4
4
 
5
5
  // src/utils/utils.ts
6
6
  import karin, { config, logger } from "node-karin";
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-ODFXVVIE.js";
10
10
  import {
11
11
  cfg
12
- } from "./chunk-3EM2TC2Y.js";
12
+ } from "./chunk-TUC5A7K4.js";
13
13
  import {
14
14
  plugin
15
- } from "./chunk-KMYEMP7Q.js";
15
+ } from "./chunk-4GSJ5FLI.js";
16
16
 
17
17
  // src/index.ts
18
18
  import { logger, restartDirect } from "node-karin";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  cfg
3
- } from "./chunk-3EM2TC2Y.js";
3
+ } from "./chunk-TUC5A7K4.js";
4
4
  import {
5
5
  plugin
6
- } from "./chunk-KMYEMP7Q.js";
6
+ } from "./chunk-4GSJ5FLI.js";
7
7
 
8
8
  // src/web.config.ts
9
9
  import { components, defineConfig } from "node-karin";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karinjs/plugin-basic",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Karin的基础插件,提供最基础的功能",
5
5
  "homepage": "https://github.com/KarinJS/karin-plugin-basic",
6
6
  "bugs": {