kailogger 1.0.1-dark.red → 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.
- package/README.md +60 -48
- package/dist/core/Logger.d.ts +1 -1
- package/dist/core/Logger.js +36 -39
- package/dist/features/Chart.js +8 -9
- package/dist/features/Diff.js +4 -8
- package/dist/features/Encrypt.js +5 -5
- package/dist/features/Notify.js +40 -1
- package/dist/features/Screenshot.js +0 -3
- package/dist/features/Sound.d.ts +1 -0
- package/dist/features/Sound.js +37 -39
- package/dist/features/Timer.js +3 -7
- package/dist/features/Tree.js +5 -8
- package/dist/icon/logo.png +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -7
- package/dist/sounds/error.wav +0 -0
- package/dist/sounds/notification.wav +0 -0
- package/dist/sounds/success.wav +0 -0
- package/dist/sounds/warning.wav +0 -0
- package/dist/styles/KaiChroma.d.ts +85 -0
- package/dist/styles/KaiChroma.js +407 -0
- package/dist/styles/palettes.d.ts +21 -57
- package/dist/styles/palettes.js +160 -37
- package/dist/transports/ConsoleTransport.js +2 -2
- package/dist/utils/json.js +8 -11
- package/dist/utils/prettyError.js +16 -18
- package/dist/utils/progress.js +5 -7
- package/dist/utils/prompt.js +3 -3
- package/dist/utils/selection.js +14 -24
- package/dist/utils/spinner.d.ts +1 -1
- package/dist/utils/spinner.js +9 -13
- package/dist/utils/stripAnsi.js +2 -1
- package/dist/utils/table.js +4 -7
- package/examples/demo.js +134 -0
- package/package.json +4 -9
- package/scripts/copy-assets.js +37 -0
- package/src/core/Logger.ts +148 -31
- package/src/features/Chart.ts +25 -5
- package/src/features/Diff.ts +2 -2
- package/src/features/Encrypt.ts +13 -5
- package/src/features/Sound.ts +51 -25
- package/src/features/Timer.ts +3 -3
- package/src/features/Tree.ts +6 -5
- package/src/index.ts +1 -1
- package/src/styles/KaiChroma.ts +370 -0
- package/src/styles/palettes.ts +190 -38
- package/src/transports/ConsoleTransport.ts +2 -2
- package/src/utils/json.ts +14 -6
- package/src/utils/prettyError.ts +26 -13
- package/src/utils/progress.ts +19 -5
- package/src/utils/prompt.ts +6 -2
- package/src/utils/selection.ts +40 -17
- package/src/utils/spinner.ts +11 -7
- package/src/utils/stripAnsi.ts +4 -1
- package/src/utils/table.ts +10 -3
- package/src/styles/gradients.ts +0 -22
package/dist/features/Sound.js
CHANGED
|
@@ -34,20 +34,44 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.KaiSound = void 0;
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
37
|
const fs = __importStar(require("fs"));
|
|
39
|
-
|
|
40
|
-
// Windows: PowerShell
|
|
41
|
-
// Mac: afplay
|
|
42
|
-
// Linux: aplay or paplay
|
|
38
|
+
const path = __importStar(require("path"));
|
|
43
39
|
class KaiSound {
|
|
44
40
|
static setSoundsDir(dir) {
|
|
45
41
|
this.soundsDir = dir;
|
|
46
42
|
}
|
|
43
|
+
static getSoundPath(filename) {
|
|
44
|
+
// 1. Explicitly set directory
|
|
45
|
+
if (this.soundsDir) {
|
|
46
|
+
const p = path.join(this.soundsDir, filename);
|
|
47
|
+
if (fs.existsSync(p))
|
|
48
|
+
return p;
|
|
49
|
+
}
|
|
50
|
+
// 2. Local src/sounds (Development)
|
|
51
|
+
const srcPath = path.join(__dirname, '../../src/sounds', filename);
|
|
52
|
+
if (fs.existsSync(srcPath))
|
|
53
|
+
return srcPath;
|
|
54
|
+
// 3. Dist sounds (Production/Installed)
|
|
55
|
+
// __dirname is .../dist/features
|
|
56
|
+
const distPath = path.join(__dirname, '../sounds', filename);
|
|
57
|
+
if (fs.existsSync(distPath))
|
|
58
|
+
return distPath;
|
|
59
|
+
// 4. Node modules fallback (if imported deeply)
|
|
60
|
+
try {
|
|
61
|
+
const pkgPath = require.resolve('kailogger/package.json');
|
|
62
|
+
const pkgDir = path.dirname(pkgPath);
|
|
63
|
+
const enrolledPath = path.join(pkgDir, 'dist/sounds', filename);
|
|
64
|
+
if (fs.existsSync(enrolledPath))
|
|
65
|
+
return enrolledPath;
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
// ignore
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
47
72
|
static async playFile(filename) {
|
|
48
|
-
const filepath = this.
|
|
49
|
-
if (!
|
|
50
|
-
// Fallback to system beep
|
|
73
|
+
const filepath = this.getSoundPath(filename);
|
|
74
|
+
if (!filepath) {
|
|
51
75
|
this.beep();
|
|
52
76
|
return;
|
|
53
77
|
}
|
|
@@ -56,15 +80,12 @@ class KaiSound {
|
|
|
56
80
|
return new Promise((resolve) => {
|
|
57
81
|
let command;
|
|
58
82
|
if (platform === 'win32') {
|
|
59
|
-
// Windows - use PowerShell
|
|
60
83
|
command = `powershell -c "(New-Object Media.SoundPlayer '${filepath}').PlaySync()"`;
|
|
61
84
|
}
|
|
62
85
|
else if (platform === 'darwin') {
|
|
63
|
-
// macOS
|
|
64
86
|
command = `afplay "${filepath}"`;
|
|
65
87
|
}
|
|
66
88
|
else {
|
|
67
|
-
// Linux
|
|
68
89
|
command = `aplay "${filepath}" 2>/dev/null || paplay "${filepath}" 2>/dev/null`;
|
|
69
90
|
}
|
|
70
91
|
exec(command, (error) => {
|
|
@@ -73,46 +94,23 @@ class KaiSound {
|
|
|
73
94
|
});
|
|
74
95
|
}
|
|
75
96
|
static beep() {
|
|
76
|
-
// Universal beep using stdout
|
|
77
97
|
process.stdout.write('\x07');
|
|
78
98
|
}
|
|
79
99
|
static async success() {
|
|
80
|
-
|
|
81
|
-
await this.playFile('success.wav');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.beep();
|
|
85
|
-
}
|
|
100
|
+
await this.playFile('success.wav');
|
|
86
101
|
}
|
|
87
102
|
static async error() {
|
|
88
|
-
|
|
89
|
-
await this.playFile('error.wav');
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
// Double beep for error
|
|
93
|
-
this.beep();
|
|
94
|
-
setTimeout(() => this.beep(), 200);
|
|
95
|
-
}
|
|
103
|
+
await this.playFile('error.wav');
|
|
96
104
|
}
|
|
97
105
|
static async warning() {
|
|
98
|
-
|
|
99
|
-
await this.playFile('warning.wav');
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.beep();
|
|
103
|
-
}
|
|
106
|
+
await this.playFile('warning.wav');
|
|
104
107
|
}
|
|
105
108
|
static async notification() {
|
|
106
|
-
|
|
107
|
-
await this.playFile('notification.wav');
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
this.beep();
|
|
111
|
-
}
|
|
109
|
+
await this.playFile('notification.wav');
|
|
112
110
|
}
|
|
113
111
|
static async play(filename) {
|
|
114
112
|
await this.playFile(filename);
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
exports.KaiSound = KaiSound;
|
|
118
|
-
KaiSound.soundsDir =
|
|
116
|
+
KaiSound.soundsDir = null;
|
package/dist/features/Timer.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.KaiTimer = void 0;
|
|
7
|
-
const
|
|
8
|
-
const gradients_1 = require("../styles/gradients");
|
|
4
|
+
const palettes_1 = require("../styles/palettes");
|
|
9
5
|
class KaiTimer {
|
|
10
6
|
constructor() {
|
|
11
7
|
this.timers = new Map();
|
|
@@ -16,7 +12,7 @@ class KaiTimer {
|
|
|
16
12
|
timeEnd(label, theme) {
|
|
17
13
|
const start = this.timers.get(label);
|
|
18
14
|
if (!start) {
|
|
19
|
-
console.log(
|
|
15
|
+
console.log(palettes_1.paint.apply(`⚠ Timer "${label}" does not exist`, theme.warning));
|
|
20
16
|
return null;
|
|
21
17
|
}
|
|
22
18
|
const duration = performance.now() - start;
|
|
@@ -32,7 +28,7 @@ class KaiTimer {
|
|
|
32
28
|
color = theme.error;
|
|
33
29
|
emoji = '🔥';
|
|
34
30
|
}
|
|
35
|
-
console.log(
|
|
31
|
+
console.log(palettes_1.paint.apply(` ⏱ ${label}: ${ms}ms ${emoji} `, color));
|
|
36
32
|
return duration;
|
|
37
33
|
}
|
|
38
34
|
clear() {
|
package/dist/features/Tree.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.KaiTree = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const KaiChroma_1 = require("../styles/KaiChroma");
|
|
5
|
+
const palettes_1 = require("../styles/palettes");
|
|
9
6
|
class KaiTree {
|
|
10
7
|
static print(obj, theme, prefix = '', isLast = true) {
|
|
11
8
|
const keys = Object.keys(obj);
|
|
@@ -13,12 +10,12 @@ class KaiTree {
|
|
|
13
10
|
const isLastItem = index === keys.length - 1;
|
|
14
11
|
const connector = isLastItem ? '└── ' : '├── ';
|
|
15
12
|
const value = obj[key];
|
|
16
|
-
const line = prefix + connector + key
|
|
13
|
+
const line = prefix + connector; // connector + key part
|
|
17
14
|
if (value === null) {
|
|
18
|
-
console.log(
|
|
15
|
+
console.log(KaiChroma_1.KaiChroma.hex(theme.dim, prefix + connector) + palettes_1.paint.apply(key, theme.info));
|
|
19
16
|
}
|
|
20
17
|
else {
|
|
21
|
-
console.log(
|
|
18
|
+
console.log(KaiChroma_1.KaiChroma.hex(theme.dim, prefix + connector) + palettes_1.paint.apply(key + '/', theme.success));
|
|
22
19
|
const newPrefix = prefix + (isLastItem ? ' ' : '│ ');
|
|
23
20
|
KaiTree.print(value, theme, newPrefix, isLastItem);
|
|
24
21
|
}
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './core/Logger';
|
|
|
2
2
|
export * from './core/Config';
|
|
3
3
|
export * from './core/Scope';
|
|
4
4
|
export * from './styles/palettes';
|
|
5
|
-
export * from './styles/
|
|
5
|
+
export * from './styles/KaiChroma';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export * from './transports';
|
|
8
8
|
export * from './features';
|
package/dist/index.js
CHANGED
|
@@ -15,20 +15,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.PrettyError = exports.KaiSelection = exports.KaiPrompt = exports.KaiJson = exports.KaiTable = exports.KaiProgress = exports.KaiSpinner = void 0;
|
|
18
|
-
// Core
|
|
19
18
|
__exportStar(require("./core/Logger"), exports);
|
|
20
19
|
__exportStar(require("./core/Config"), exports);
|
|
21
20
|
__exportStar(require("./core/Scope"), exports);
|
|
22
|
-
// Styles
|
|
23
21
|
__exportStar(require("./styles/palettes"), exports);
|
|
24
|
-
__exportStar(require("./styles/
|
|
25
|
-
// Types
|
|
22
|
+
__exportStar(require("./styles/KaiChroma"), exports);
|
|
26
23
|
__exportStar(require("./types"), exports);
|
|
27
|
-
// Transports
|
|
28
24
|
__exportStar(require("./transports"), exports);
|
|
29
|
-
// Features
|
|
30
25
|
__exportStar(require("./features"), exports);
|
|
31
|
-
// Utils (selective exports)
|
|
32
26
|
var spinner_1 = require("./utils/spinner");
|
|
33
27
|
Object.defineProperty(exports, "KaiSpinner", { enumerable: true, get: function () { return spinner_1.KaiSpinner; } });
|
|
34
28
|
var progress_1 = require("./utils/progress");
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type Color = [number, number, number];
|
|
2
|
+
export type HexColor = string;
|
|
3
|
+
export type RgbColor = {
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
};
|
|
8
|
+
export type HslColor = {
|
|
9
|
+
h: number;
|
|
10
|
+
s: number;
|
|
11
|
+
l: number;
|
|
12
|
+
};
|
|
13
|
+
export type ColorStop = {
|
|
14
|
+
color: string;
|
|
15
|
+
position: number;
|
|
16
|
+
};
|
|
17
|
+
export type GradientOptions = {
|
|
18
|
+
interpolation?: 'linear' | 'ease' | 'bezier' | 'smooth';
|
|
19
|
+
direction?: 'horizontal' | 'vertical' | 'diagonal';
|
|
20
|
+
stops?: ColorStop[];
|
|
21
|
+
};
|
|
22
|
+
export type StyleOptions = {
|
|
23
|
+
bold?: boolean;
|
|
24
|
+
dim?: boolean;
|
|
25
|
+
italic?: boolean;
|
|
26
|
+
underline?: boolean;
|
|
27
|
+
inverse?: boolean;
|
|
28
|
+
strikethrough?: boolean;
|
|
29
|
+
blink?: boolean;
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare class KaiChroma {
|
|
33
|
+
private static cache;
|
|
34
|
+
private static readonly MAX_CACHE_SIZE;
|
|
35
|
+
private static hexToRgb;
|
|
36
|
+
private static rgbToHex;
|
|
37
|
+
private static rgbToHsl;
|
|
38
|
+
private static hslToRgb;
|
|
39
|
+
private static rgbToAnsi256;
|
|
40
|
+
private static interpolateLinear;
|
|
41
|
+
private static interpolateEase;
|
|
42
|
+
private static interpolateBezier;
|
|
43
|
+
private static interpolateSmooth;
|
|
44
|
+
static hex(hex: string, text: string): string;
|
|
45
|
+
static rgb(r: number, g: number, b: number, text: string): string;
|
|
46
|
+
static hsl(h: number, s: number, l: number, text: string): string;
|
|
47
|
+
static bgHex(hex: string, text: string): string;
|
|
48
|
+
static bgRgb(r: number, g: number, b: number, text: string): string;
|
|
49
|
+
static bold(text: string): string;
|
|
50
|
+
static dim(text: string): string;
|
|
51
|
+
static italic(text: string): string;
|
|
52
|
+
static underline(text: string): string;
|
|
53
|
+
static inverse(text: string): string;
|
|
54
|
+
static hidden(text: string): string;
|
|
55
|
+
static strikethrough(text: string): string;
|
|
56
|
+
static blink(text: string): string;
|
|
57
|
+
static style(text: string, options: StyleOptions): string;
|
|
58
|
+
static gradient(colors: string[], text: string, options?: GradientOptions): string;
|
|
59
|
+
static rainbowGradient(text: string): string;
|
|
60
|
+
static sunsetGradient(text: string): string;
|
|
61
|
+
static oceanGradient(text: string): string;
|
|
62
|
+
static fireGradient(text: string): string;
|
|
63
|
+
static matrixGradient(text: string): string;
|
|
64
|
+
static lighten(hex: string, amount: number): string;
|
|
65
|
+
static darken(hex: string, amount: number): string;
|
|
66
|
+
static saturate(hex: string, amount: number): string;
|
|
67
|
+
static desaturate(hex: string, amount: number): string;
|
|
68
|
+
static rotate(hex: string, degrees: number): string;
|
|
69
|
+
static mix(hex1: string, hex2: string, weight?: number): string;
|
|
70
|
+
static analogous(hex: string, count?: number): string[];
|
|
71
|
+
static complementary(hex: string): string[];
|
|
72
|
+
static triadic(hex: string): string[];
|
|
73
|
+
static tetradic(hex: string): string[];
|
|
74
|
+
static monochromatic(hex: string, count?: number): string[];
|
|
75
|
+
static strip(text: string): string;
|
|
76
|
+
static getSupport(): number;
|
|
77
|
+
static getSupportName(): string;
|
|
78
|
+
static isSupported(): boolean;
|
|
79
|
+
static textLength(text: string): number;
|
|
80
|
+
static box(text: string, color?: string, padding?: number): string;
|
|
81
|
+
static wave(text: string, colors: string[]): string;
|
|
82
|
+
static pulse(text: string, color: string, frames?: number): string[];
|
|
83
|
+
private static clearCacheIfNeeded;
|
|
84
|
+
}
|
|
85
|
+
export default KaiChroma;
|